[BOLT] Support passing fragments to code emission
authorFabian Parzefall <parzefall@fb.com>
Fri, 19 Aug 2022 04:26:18 +0000 (21:26 -0700)
committerFabian Parzefall <parzefall@fb.com>
Fri, 19 Aug 2022 04:55:06 +0000 (21:55 -0700)
commit275e075cbe051198fecdfd2f3ef2bc58fd9508f0
treebd4c71e15527aafedcda8d44dc17027ae14bca73
parent89d7db9d8128830975e1318d954db4ed4e484d13
[BOLT] Support passing fragments to code emission

This changes code emission such that it can emit specific function
fragments instead of scanning all basic blocks of a function and just
emitting those that are hot or cold.

To implement this, `FunctionLayout` explicitly distinguishes the "main"
fragment (i.e. the one that contains the entry block and is associated
with the original symbol) from "split" fragments. Additionally,
`BinaryFunction` receives support for multiple cold symbols - one for
each split fragment.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D130052
bolt/include/bolt/Core/BinaryEmitter.h
bolt/include/bolt/Core/BinaryFunction.h
bolt/include/bolt/Core/FunctionLayout.h
bolt/lib/Core/BinaryContext.cpp
bolt/lib/Core/BinaryEmitter.cpp
bolt/lib/Core/BinaryFunction.cpp
bolt/lib/Rewrite/RewriteInstance.cpp