LLVM
8.0.1
|
The base class for all padding policies, i.e. More...
#include "llvm/MC/MCCodePadder.h"
Public Member Functions | |
virtual | ~MCCodePaddingPolicy () |
uint64_t | getKindMask () const |
Returns the kind mask of this policy - A mask holding the kind of this policy, i.e. More... | |
uint64_t | getWindowSize () const |
Returns the instruction window size relevant to this policy. More... | |
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. More... | |
virtual bool | basicBlockRequiresPaddingFragment (const MCCodePaddingContext &Context) const |
Returns true iff this policy needs padding for a given basic block. More... | |
virtual bool | instructionRequiresPaddingFragment (const MCInst &Inst) const |
Returns true iff this policy needs padding for a given instruction. More... | |
double | computeRangePenaltyWeight (const MCPFRange &Range, uint64_t Offset, MCAsmLayout &Layout) const |
Computes and returns the penalty caused by a range of instruction windows. More... | |
Protected Member Functions | |
MCCodePaddingPolicy (uint64_t Kind, uint64_t WindowSize, bool InstByteIsLastByte) | |
uint64_t | getFragmentInstByte (const MCPaddingFragment *Fragment, MCAsmLayout &Layout) const |
Returns the instruction byte of an instruction pointed by a given MCPaddingFragment. More... | |
uint64_t | computeWindowEndAddress (const MCPaddingFragment *Fragment, uint64_t Offset, MCAsmLayout &Layout) const |
double | computeFirstWindowPenaltyWeight (const MCPFRange &Window, uint64_t Offset, MCAsmLayout &Layout) const |
Computes and returns the penalty weight of a first instruction window in a range. More... | |
virtual double | computeWindowPenaltyWeight (const MCPFRange &Window, uint64_t Offset, MCAsmLayout &Layout) const =0 |
Computes and returns the penalty caused by an instruction window. More... | |
Static Protected Member Functions | |
static uint64_t | getNextFragmentOffset (const MCFragment *Fragment, const MCAsmLayout &Layout) |
Computes and returns the offset of the consecutive fragment of a given fragment. More... | |
Protected Attributes | |
const uint64_t | KindMask |
A mask holding the kind of this policy, i.e. More... | |
const uint64_t | WindowSize |
Instruction window size relevant to this policy. More... | |
const bool | InstByteIsLastByte |
A boolean indicating which byte of the instruction determies its instruction window. More... | |
The base class for all padding policies, i.e.
a rule or set of rules to pad the generated code.
Definition at line 127 of file MCCodePadder.h.
|
inlineprotected |
Definition at line 143 of file MCCodePadder.h.
|
inlinevirtual |
Definition at line 198 of file MCCodePadder.h.
|
inlinevirtual |
Returns true iff this policy needs padding for a given basic block.
Context | the context of the padding, Embeds the basic block's parameters. |
Definition at line 216 of file MCCodePadder.h.
|
protected |
Computes and returns the penalty weight of a first instruction window in a range.
This requires a special function since the first window does not contain all the padding fragments in that window. It only contains all the padding fragments starting from the relevant insertion point.
Window | The first window. |
Offset | The offset of the parent section relative to the beginning of the file, mod the window size. |
Layout | Code layout information. |
Window
. Definition at line 330 of file MCCodePadder.cpp.
References llvm::SmallVectorImpl< T >::append(), assert(), llvm::SmallVectorTemplateCommon< T, typename >::begin(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T, typename >::end(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getPrevNode(), llvm::MCPaddingFragment::hasPaddingPolicy(), and llvm::reverse().
double MCCodePaddingPolicy::computeRangePenaltyWeight | ( | const MCPFRange & | Range, |
uint64_t | Offset, | ||
MCAsmLayout & | Layout | ||
) | const |
Computes and returns the penalty caused by a range of instruction windows.
The weight is computed for each window separelty and then accumulated.
Range | The range. |
Offset | The offset of the parent section relative to the beginning of the file, mod the window size. |
Layout | Code layout information. |
Range
. Definition at line 294 of file MCCodePadder.cpp.
References llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::MCPaddingFragment::hasPaddingPolicy(), I, and llvm::SmallVectorTemplateBase< T >::push_back().
|
protected |
Definition at line 287 of file MCCodePadder.cpp.
References llvm::alignTo().
|
protectedpure virtual |
Computes and returns the penalty caused by an instruction window.
Window | The instruction window. |
Offset | The offset of the parent section relative to the beginning of the file, mod the window size. |
Layout | Code layout information. |
Window
.
|
protected |
Returns the instruction byte of an instruction pointed by a given MCPaddingFragment.
An instruction byte is the address of the byte of an instruction which determines its instruction window.
Fragment | The fragment pointing to the instruction. |
Layout | Code layout information. |
Fragment
. Definition at line 278 of file MCCodePadder.cpp.
References llvm::MCPaddingFragment::getInstSize().
|
inline |
Returns the kind mask of this policy - A mask holding the kind of this policy, i.e.
only the i'th bit will be set where i is the kind number.
Definition at line 202 of file MCCodePadder.h.
|
staticprotected |
Computes and returns the offset of the consecutive fragment of a given fragment.
Fragment | The fragment whose consecutive offset will be computed. |
Layout | Code layout information. |
Fragment
. Definition at line 268 of file MCCodePadder.cpp.
References assert(), llvm::MCAsmLayout::getFragmentOffset(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::MCFragment::getParent(), and llvm::MCAsmLayout::getSectionAddressSize().
|
inline |
Returns the instruction window size relevant to this policy.
Definition at line 204 of file MCCodePadder.h.
|
inlinevirtual |
Returns true iff this policy needs padding for a given instruction.
Inst | The given instruction. |
Inst
. Definition at line 224 of file MCCodePadder.h.
|
inline |
Returns true if the last byte of an instruction determines its instruction window, or false if the first of an instruction determines it.
Definition at line 207 of file MCCodePadder.h.
A boolean indicating which byte of the instruction determies its instruction window.
If true - the last byte of the instructions, o.w. - the first byte of the instruction.
Definition at line 141 of file MCCodePadder.h.
|
protected |
A mask holding the kind of this policy, i.e.
only the i'th bit will be set where i is the kind number.
Definition at line 135 of file MCCodePadder.h.
|
protected |
Instruction window size relevant to this policy.
Definition at line 137 of file MCCodePadder.h.