LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CodeExtractor Class Reference

Collaboration diagram for CodeExtractor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CodeExtractor (DominatorTree *dt=0, bool AggArgs=false)
FunctionExtractCodeRegion (const std::vector< BasicBlock * > &code)
bool isEligible (const std::vector< BasicBlock * > &code)

Constructor & Destructor Documentation

CodeExtractor::CodeExtractor DominatorTree dt = 0,
bool  AggArgs = false
[inline]
 

Definition at line 52 of file CodeExtractor.cpp.

References AggregateArgsOpt.


Member Function Documentation

Function * CodeExtractor::ExtractCodeRegion const std::vector< BasicBlock * > &  code  ) 
 

ExtractRegion - Removes a loop from a function, replaces it with a call to new function. Returns pointer to the new function.

algorithm:

find inputs and outputs for the region

for inputs: add to function as args, map input instr* to arg# for outputs: add allocas for scalars, add to func as args, map output instr* to arg#

rewrite func to use argument #s instead of instr*

for each scalar output in the function: at every exit, store intermediate computed result back into memory.

Definition at line 608 of file CodeExtractor.cpp.

References DEBUG, llvm::PHINode::getIncomingBlock(), llvm::BasicBlock::getInstList(), llvm::PHINode::getNumIncomingValues(), llvm::GlobalValue::getParent(), llvm::BasicBlock::getParent(), isEligible(), llvm::pred_begin(), llvm::pred_end(), llvm::pred_iterator, llvm::PHINode::removeIncomingValue(), llvm::PHINode::setIncomingBlock(), llvm::succ_begin(), llvm::succ_end(), and llvm::verifyFunction().

bool CodeExtractor::isEligible const std::vector< BasicBlock * > &  code  ) 
 

Definition at line 705 of file CodeExtractor.cpp.

References llvm::CallInst::getCalledFunction(), and llvm::Function::getIntrinsicID().

Referenced by ExtractCodeRegion().


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


This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.