#include "bolt/Passes/Aligner.h"
#include "bolt/Core/ParallelUtilities.h"
#define DEBUG_TYPE …
usingnamespacellvm;
namespace opts {
extern cl::OptionCategory BoltOptCategory;
extern cl::opt<bool> AlignBlocks;
extern cl::opt<bool> PreserveBlocksAlignment;
extern cl::opt<unsigned> AlignFunctions;
cl::opt<unsigned>
AlignBlocksMinSize("align-blocks-min-size",
cl::desc("minimal size of the basic block that should be aligned"),
cl::init(0),
cl::ZeroOrMore,
cl::Hidden,
cl::cat(BoltOptCategory));
cl::opt<unsigned> AlignBlocksThreshold(
"align-blocks-threshold",
cl::desc(
"align only blocks with frequency larger than containing function "
"execution frequency specified in percent. E.g. 1000 means aligning "
"blocks that are 10 times more frequently executed than the "
"containing function."),
cl::init(800), cl::Hidden, cl::cat(BoltOptCategory));
cl::opt<unsigned> AlignFunctionsMaxBytes(
"align-functions-max-bytes",
cl::desc("maximum number of bytes to use to align functions"), cl::init(32),
cl::cat(BoltOptCategory));
cl::opt<unsigned>
BlockAlignment("block-alignment",
cl::desc("boundary to use for alignment of basic blocks"),
cl::init(16),
cl::ZeroOrMore,
cl::cat(BoltOptCategory));
cl::opt<bool>
UseCompactAligner("use-compact-aligner",
cl::desc("Use compact approach for aligning functions"),
cl::init(true), cl::cat(BoltOptCategory));
}
namespace llvm {
namespace bolt {
static void alignMaxBytes(BinaryFunction &Function) { … }
static void alignCompact(BinaryFunction &Function,
const MCCodeEmitter *Emitter) { … }
void AlignerPass::alignBlocks(BinaryFunction &Function,
const MCCodeEmitter *Emitter) { … }
Error AlignerPass::runOnFunctions(BinaryContext &BC) { … }
}
}