LLVM  6.0.0svn
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
llvm::MCCodePadder Class Reference

Target-independent base class incharge of all code padding decisions for a target. More...

#include "llvm/MC/MCCodePadder.h"

Collaboration diagram for llvm::MCCodePadder:
Collaboration graph
[legend]

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

MCObjectStreamerOS
 The current streamer, used to stream code padding. More...
 

Detailed Description

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 40 of file MCCodePadder.h.

Constructor & Destructor Documentation

◆ MCCodePadder()

llvm::MCCodePadder::MCCodePadder ( )
inline

Definition at line 86 of file MCCodePadder.h.

References Context.

◆ ~MCCodePadder()

MCCodePadder::~MCCodePadder ( )
virtual

Definition at line 23 of file MCCodePadder.cpp.

Member Function Documentation

◆ addPolicy()

bool MCCodePadder::addPolicy ( MCCodePaddingPolicy Policy)
protected

Definition at line 28 of file MCCodePadder.cpp.

References assert().

◆ basicBlockRequiresInsertionPoint()

virtual bool llvm::MCCodePadder::basicBlockRequiresInsertionPoint ( const MCCodePaddingContext Context)
inlineprotectedvirtual

Definition at line 73 of file MCCodePadder.h.

Referenced by handleBasicBlockStart().

◆ handleBasicBlockEnd()

void MCCodePadder::handleBasicBlockEnd ( const MCCodePaddingContext Context)

Handles all target related code padding when done writing a block to an object file.

Parameters
Contextthe context of the padding, Embeds the basic block's parameters.

Definition at line 69 of file MCCodePadder.cpp.

References assert(), and OS.

◆ handleBasicBlockStart()

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.

Parameters
OSThe streamer used for writing the padding data and function.
Contextthe 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().

◆ handleInstructionBegin()

void MCCodePadder::handleInstructionBegin ( const MCInst Inst)

◆ handleInstructionEnd()

void MCCodePadder::handleInstructionEnd ( const MCInst Inst)

◆ instructionRequiresInsertionPoint()

virtual bool llvm::MCCodePadder::instructionRequiresInsertionPoint ( const MCInst Inst)
inlineprotectedvirtual

Definition at line 77 of file MCCodePadder.h.

Referenced by handleInstructionBegin().

◆ relaxFragment()

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.

Parameters
FragmentThe fragment to relax.
LayoutCode layout information.
Returns
true iff any relaxation occured.

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 llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Size.

◆ usePoliciesForBasicBlock()

virtual bool llvm::MCCodePadder::usePoliciesForBasicBlock ( const MCCodePaddingContext Context)
inlineprotectedvirtual

Definition at line 81 of file MCCodePadder.h.

References llvm::MCCodePaddingContext::IsPaddingActive.

Referenced by handleBasicBlockStart().

Member Data Documentation

◆ OS

MCObjectStreamer* llvm::MCCodePadder::OS
protected

The current streamer, used to stream code padding.

Definition at line 68 of file MCCodePadder.h.

Referenced by handleBasicBlockEnd(), handleBasicBlockStart(), handleInstructionBegin(), and handleInstructionEnd().


The documentation for this class was generated from the following files: