10 #ifndef LLVM_MC_MCCODEPADDER_H 11 #define LLVM_MC_MCCODEPADDER_H 21 class MCCodePaddingPolicy;
24 class MCObjectStreamer;
44 bool ArePoliciesActive;
86 : ArePoliciesActive(
false), CurrHandledInstFragment(nullptr),
108 void handleInstructionBegin(
const MCInst &Inst);
113 void handleInstructionEnd(
const MCInst &Inst);
144 bool InstByteIsLastByte)
145 : KindMask(UINT64_C(1) << Kind), WindowSize(WindowSize),
146 InstByteIsLastByte(InstByteIsLastByte) {}
155 static uint64_t getNextFragmentOffset(
const MCFragment *Fragment,
182 double computeFirstWindowPenaltyWeight(
const MCPFRange &Window,
193 virtual double computeWindowPenaltyWeight(
const MCPFRange &Window,
236 double computeRangePenaltyWeight(
const MCPFRange &Range, uint64_t Offset,
242 #endif // LLVM_MC_MCCODEPADDER_H Instances of this class represent a uniqued identifier for a section in the current translation unit...
uint64_t getKindMask() const
Returns the kind mask of this policy - A mask holding the kind of this policy, i.e.
Fragment for adding required padding.
Compute iterated dominance frontiers using a linear time algorithm.
bool isInstByteLastByte() const
Returns true if the last byte of an instruction determines its instruction window, or false if the first of an instruction determines it.
SmallVector< const MCPaddingFragment *, 8 > MCPFRange
Target-independent base class incharge of all code padding decisions for a target.
MCObjectStreamer * OS
The current streamer, used to stream code padding.
uint64_t getWindowSize() const
Returns the instruction window size relevant to this policy.
bool IsBasicBlockReachableViaBranch
Encapsulates the layout of an assembly file at a particular point in time.
const uint64_t KindMask
A mask holding the kind of this policy, i.e.
const uint64_t WindowSize
Instruction window size relevant to this policy.
The base class for all padding policies, i.e.
virtual bool instructionRequiresPaddingFragment(const MCInst &Inst) const
Returns true iff this policy needs padding for a given instruction.
bool IsBasicBlockReachableViaFallthrough
virtual bool instructionRequiresInsertionPoint(const MCInst &Inst)
Streaming object file generation interface.
Instances of this class represent a single low-level machine instruction.
virtual bool basicBlockRequiresInsertionPoint(const MCCodePaddingContext &Context)
virtual ~MCCodePaddingPolicy()
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
const bool InstByteIsLastByte
A boolean indicating which byte of the instruction determies its instruction window.
MCCodePaddingPolicy(uint64_t Kind, uint64_t WindowSize, bool InstByteIsLastByte)
virtual bool basicBlockRequiresPaddingFragment(const MCCodePaddingContext &Context) const
Returns true iff this policy needs padding for a given basic block.
virtual bool usePoliciesForBasicBlock(const MCCodePaddingContext &Context)