LLVM API Documentation

Classes | Public Member Functions | Static Public Attributes
llvm::JumpInstrTables Class Reference

#include <JumpInstrTables.h>

Inheritance diagram for llvm::JumpInstrTables:
Inheritance graph
[legend]
Collaboration diagram for llvm::JumpInstrTables:
Collaboration graph
[legend]

List of all members.

Classes

struct  TableMeta
 The metadata used while a jump table is being built.

Public Member Functions

 JumpInstrTables ()
 JumpInstrTables (JumpTable::JumpTableType JTT)
virtual ~JumpInstrTables ()
bool runOnModule (Module &M) override
const char * getPassName () const override
void getAnalysisUsage (AnalysisUsage &AU) const override
FunctioninsertEntry (Module &M, Function *Target)
bool hasTable (FunctionType *FunTy)
 Checks to see if there is already a table for the given FunctionType.

Static Public Attributes

static char ID = 0

Detailed Description

A class to manage a set of jump tables indexed on function type. It looks at each function in the module to find all the functions that have the jumptable attribute set. For each such function, it creates a new jump-instruction-table function and stores the mapping in the ImmutablePass JumpInstrTableInfo.

These special functions get lowered in AsmPrinter to assembly of the form:

///   .globl f
///   .type f,@function
///   .align 8,0x90
/// f:
///   jmp f_orig@PLT
/// 

Support for an architecture depends on two functions in TargetInstrInfo: getUnconditionalBranch, and getTrap. AsmPrinter uses these to generate the appropriate instructions for the jump statement (an unconditional branch) and for padding to make the table have a size that is a power of two. This padding uses a trap instruction to ensure that calls to this area halt the program. The default implementations of these functions call llvm_unreachable.

Definition at line 49 of file JumpInstrTables.h.


Constructor & Destructor Documentation

Definition at line 158 of file JumpInstrTables.cpp.


Member Function Documentation

void JumpInstrTables::getAnalysisUsage ( AnalysisUsage ) const [override, virtual]

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.

Reimplemented from llvm::Pass.

Definition at line 160 of file JumpInstrTables.cpp.

References llvm::AnalysisUsage::addRequired().

const char* llvm::JumpInstrTables::getPassName ( ) const [inline, override, virtual]

getPassName - Return a nice clean name for a pass. This usually implemented in terms of the name that is registered by one of the Registration templates, but can be overloaded directly.

Reimplemented from llvm::Pass.

Definition at line 57 of file JumpInstrTables.h.

Checks to see if there is already a table for the given FunctionType.

Definition at line 193 of file JumpInstrTables.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::end(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT >::find().

bool JumpInstrTables::runOnModule ( Module M) [override, virtual]

runOnModule - Virtual method overriden by subclasses to process the module being operated on.

Implements llvm::ModulePass.

Definition at line 253 of file JumpInstrTables.cpp.

References F(), llvm::Function::hasFnAttribute(), llvm::GlobalValue::hasUnnamedAddr(), insertEntry(), and llvm::Attribute::JumpTable.


Member Data Documentation

char JumpInstrTables::ID = 0 [static]

Definition at line 51 of file JumpInstrTables.h.


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