LLVM
8.0.1
|
Target-independent base class incharge of all code padding decisions for a target. More...
#include "llvm/MC/MCCodePadder.h"
Public Member Functions | |
MCCodePadder () | |
virtual | ~MCCodePadder () |
void | handleBasicBlockStart (MCObjectStreamer *OS, const MCCodePaddingContext &Context) |
Handles all target related code padding when starting to write a new basic block to an object file. More... | |
void | handleBasicBlockEnd (const MCCodePaddingContext &Context) |
Handles all target related code padding when done writing a block to an object file. More... | |
void | handleInstructionBegin (const MCInst &Inst) |
Handles all target related code padding before writing a new instruction to an object file. More... | |
void | handleInstructionEnd (const MCInst &Inst) |
Handles all target related code padding after writing an instruction to an object file. More... | |
bool | relaxFragment (MCPaddingFragment *Fragment, MCAsmLayout &Layout) |
Relaxes a fragment (changes the size of the padding) according to target requirements. More... | |
Protected Member Functions | |
bool | addPolicy (MCCodePaddingPolicy *Policy) |
virtual bool | basicBlockRequiresInsertionPoint (const MCCodePaddingContext &Context) |
virtual bool | instructionRequiresInsertionPoint (const MCInst &Inst) |
virtual bool | usePoliciesForBasicBlock (const MCCodePaddingContext &Context) |
Protected Attributes | |
MCObjectStreamer * | OS |
The current streamer, used to stream code padding. More... | |
Target-independent base class incharge of all code padding decisions for a target.
During encoding it determines if and where MCPaddingFragments will be located, as later on, when layout information is available, it determines their sizes.
Definition at line 39 of file MCCodePadder.h.
|
inline |
Definition at line 85 of file MCCodePadder.h.
References Context.
|
virtual |
Definition at line 23 of file MCCodePadder.cpp.
|
protected |
Definition at line 28 of file MCCodePadder.cpp.
References assert().
|
inlineprotectedvirtual |
Definition at line 72 of file MCCodePadder.h.
Referenced by handleBasicBlockStart().
void MCCodePadder::handleBasicBlockEnd | ( | const MCCodePaddingContext & | Context | ) |
Handles all target related code padding when done writing a block to an object file.
Context | the context of the padding, Embeds the basic block's parameters. |
Definition at line 69 of file MCCodePadder.cpp.
void MCCodePadder::handleBasicBlockStart | ( | MCObjectStreamer * | OS, |
const MCCodePaddingContext & | Context | ||
) |
Handles all target related code padding when starting to write a new basic block to an object file.
OS | The streamer used for writing the padding data and function. |
Context | the context of the padding, Embeds the basic block's parameters. |
Definition at line 33 of file MCCodePadder.cpp.
References assert(), basicBlockRequiresInsertionPoint(), Context, llvm::MCFragment::FT_Align, llvm::MCObjectStreamer::getCurrentFragment(), llvm::MCFragment::getKind(), llvm::MCObjectStreamer::getOrCreatePaddingFragment(), llvm::MCPaddingFragment::getPaddingPoliciesMask(), llvm::BitmaskEnumDetail::Mask(), OS, llvm::MCPaddingFragment::PFK_None, llvm::MCPaddingFragment::setAsInsertionPoint(), llvm::MCPaddingFragment::setPaddingPoliciesMask(), and usePoliciesForBasicBlock().
Handles all target related code padding before writing a new instruction to an object file.
Inst | the instruction. |
Definition at line 74 of file MCCodePadder.cpp.
References assert(), llvm::MCFragment::FT_Align, llvm::MCFragment::FT_Padding, llvm::MCObjectStreamer::getCurrentFragment(), llvm::MCFragment::getKind(), llvm::MCObjectStreamer::getOrCreatePaddingFragment(), llvm::MCPaddingFragment::getPaddingPoliciesMask(), instructionRequiresInsertionPoint(), llvm::BitmaskEnumDetail::Mask(), OS, llvm::MCPaddingFragment::PFK_None, llvm::MCPaddingFragment::setAsInsertionPoint(), and llvm::MCPaddingFragment::setPaddingPoliciesMask().
Handles all target related code padding after writing an instruction to an object file.
Inst | the instruction. |
Definition at line 118 of file MCCodePadder.cpp.
References assert(), llvm::dyn_cast(), for(), llvm::MCObjectStreamer::getCurrentFragment(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::MCPaddingFragment::hasPaddingPolicy(), llvm::MCPaddingFragment::isInsertionPoint(), llvm_unreachable, llvm::max(), OS, llvm::MCPaddingFragment::PFK_None, llvm::MCPaddingFragment::setInstAndInstFragment(), llvm::MCPaddingFragment::setInstAndInstSize(), and llvm::MCInst::size().
|
inlineprotectedvirtual |
Definition at line 76 of file MCCodePadder.h.
Referenced by handleInstructionBegin().
bool MCCodePadder::relaxFragment | ( | MCPaddingFragment * | Fragment, |
MCAsmLayout & | Layout | ||
) |
Relaxes a fragment (changes the size of the padding) according to target requirements.
The new size computation is done w.r.t a layout.
Fragment | The fragment to relax. |
Layout | Code layout information. |
Definition at line 208 of file MCCodePadder.cpp.
References assert(), llvm::MCSection::getAlignment(), llvm::MCFragment::getParent(), llvm::MCPaddingFragment::getSize(), llvm::MCAsmLayout::invalidateFragmentsFrom(), llvm::MCPaddingFragment::isInsertionPoint(), llvm::isPowerOf2_64(), llvm::max(), llvm::MCPaddingFragment::setSize(), and Size.
|
inlineprotectedvirtual |
Definition at line 80 of file MCCodePadder.h.
References llvm::MCCodePaddingContext::IsPaddingActive.
Referenced by handleBasicBlockStart().
|
protected |
The current streamer, used to stream code padding.
Definition at line 67 of file MCCodePadder.h.
Referenced by handleBasicBlockEnd(), handleBasicBlockStart(), handleInstructionBegin(), and handleInstructionEnd().