OpenASIP
2.0
|
#include <LLVMTCEIRBuilder.hh>
Public Member Functions | |
LLVMTCEIRBuilder (const TargetMachine &tm, TTAMachine::Machine *mach, InterPassData &ipd, AliasAnalysis *AA, bool functionAtATime=false, bool modifyMF=false) | |
bool | writeMachineFunction (MachineFunction &mf) |
virtual | ~LLVMTCEIRBuilder () |
virtual bool | doInitialization (Module &m) |
virtual bool | doFinalization (Module &m) |
virtual void | emitSPInitialization () |
void | getAnalysisUsage (AnalysisUsage &AU) const |
virtual StringRef | getPassName () const |
void | setInnerLoopFinder (InnerLoopFinder *loopFinder) |
Public Member Functions inherited from llvm::LLVMTCEBuilder | |
LLVMTCEBuilder (char &ID) | |
LLVMTCEBuilder (const TargetMachine &tm, TTAMachine::Machine *mach, char &ID, bool functionAtATime=false) | |
virtual | ~LLVMTCEBuilder () |
TTAProgram::Program * | result () |
TTAProgram::Instruction * | firstInstructionOfBasicBlock (const llvm::BasicBlock *bb) |
bool | isProgramUsingRestrictedPointers () const |
virtual bool | isTTATarget () const |
void | deleteDeadProcedures () |
void | setInitialStackPointerValue (unsigned value) |
Static Public Attributes | |
static char | ID = -1 |
Static Public Attributes inherited from llvm::LLVMTCEBuilder | |
static char | ID = 0 |
Protected Member Functions | |
virtual unsigned | spDRegNum () const |
virtual unsigned | raPortDRegNum () const |
virtual TCEString | registerFileName (unsigned llvmRegNum) const |
virtual int | registerIndex (unsigned llvmRegNum) const |
virtual TCEString | operationName (const MachineInstr &mi) const |
virtual TTAProgram::Terminal * | createFUTerminal (const MachineOperand &) const |
virtual TTAProgram::Terminal * | createMBBReference (const MachineOperand &mo) |
virtual TTAProgram::Terminal * | createSymbolReference (const TCEString &symbolName) |
virtual void | createMoveNode (ProgramOperationPtr &po, std::shared_ptr< TTAProgram::Move > m, bool isDestination) override |
Protected Member Functions inherited from llvm::LLVMTCEBuilder | |
bool | doInitialization (Module &M) |
bool | runOnMachineFunction (MachineFunction &MF) |
bool | doFinalization (Module &M) |
bool | hasAmbiguousASpaceRefs (const TTAProgram::Instruction &instr) const |
void | initDataSections () |
std::shared_ptr< TTAProgram::Move > | createMove (const MachineOperand &src, const MachineOperand &dst, TTAProgram::MoveGuard *guard) |
const TargetMachine & | targetMachine () const |
TCEString | registerName (unsigned llvmRegNum) const |
std::string | mbbName (const MachineBasicBlock &mbb) |
const TTAMachine::HWOperation & | getHWOperation (std::string opName) |
TTAProgram::TerminalRegister * | createTerminalRegister (const std::string &rfName, int index) |
TTAProgram::Terminal * | createTerminal (const MachineOperand &mo, int bitLimit=0) |
std::shared_ptr< TTAProgram::Move > | createMove (TTAProgram::Terminal *src, TTAProgram::Terminal *dst, const TTAMachine::Bus &bus, TTAProgram::MoveGuard *guard=NULL) |
void | emitConstantPool (const llvm::MachineConstantPool &cp) |
virtual TTAProgram::Terminal * | createSymbolReference (const MachineOperand &mo) |
virtual TTAProgram::Terminal * | createProgramOperationReference (const MachineOperand &mo) |
TTAProgram::Instruction * | emitInstruction (const MachineInstr *mi, TTAProgram::CodeSnippet *proc) |
virtual TTAProgram::Instruction * | emitMove (const MachineInstr *mi, TTAProgram::CodeSnippet *proc, bool conditional=false, bool trueGuard=true) |
TTAProgram::Instruction * | emitInlineAsm (const MachineFunction &mf, const MachineInstr *mi, TTAProgram::BasicBlock *bb, TTAProgram::InstructionReferenceManager &irm) |
void | fixProgramOperationReferences () |
void | addLabelForProgramOperation (TCEString label, ProgramOperationPtr po) |
void | emitSPInitialization (TTAProgram::CodeSnippet &target) |
void | clearFunctionBookkeeping () |
Private Member Functions | |
bool | isHotFunction (llvm::MachineFunction &mf) const |
bool | isRealInstruction (const MachineInstr &instr) const |
bool | hasRealInstructions (MachineBasicBlock::const_iterator i, const MachineBasicBlock &mbb) |
void | convertProcedureToMachineFunction (const TTAProgram::Procedure &proc, llvm::MachineFunction &mf) |
void | compileFast (ControlFlowGraph &cfg) |
void | compileOptimized (ControlFlowGraph &cfg, llvm::AliasAnalysis *llvmAA) |
bool | isExplicitReturn (const llvm::MachineInstr &mi) const |
CopyingDelaySlotFiller & | delaySlotFiller () |
BBSchedulerController & | scheduler () |
ControlFlowGraph * | buildTCECFG (llvm::MachineFunction &mf) |
void | markJumpTableDestinations (llvm::MachineFunction &mf, ControlFlowGraph &cfg) |
void | fixJumpTableDestinations (llvm::MachineFunction &mf, ControlFlowGraph &cfg) |
Private Attributes | |
InterPassData * | ipData_ |
std::set< TCEString > | allParamRegs_ |
DataDependenceGraphBuilder | ddgBuilder_ |
std::map< const MachineBasicBlock *, BasicBlockNode * > | bbMapping_ |
std::vector< std::vector< BasicBlockNode * > > | jumpTableRecord_ |
AliasAnalysis * | AA_ |
bool | modifyMF_ |
std::map< const MachineBasicBlock *, BasicBlockNode * > | skippedBBs_ |
bool | delaySlotFilling_ |
BBSchedulerController * | scheduler_ |
CopyingDelaySlotFiller * | dsf_ |
CycleLookBackSoftwareBypasser * | bypasser_ |
InnerLoopFinder * | loopFinder_ |
Additional Inherited Members | |
Static Protected Member Functions inherited from llvm::LLVMTCEBuilder | |
static bool | isInlineAsm (const MachineInstr &instr) |
Protected Attributes inherited from llvm::LLVMTCEBuilder | |
std::map< std::string, TTAProgram::Instruction * > | codeLabels_ |
Code labels. More... | |
TTAMachine::Machine * | mach_ |
Machine for building the program. More... | |
const llvm::TargetMachine * | tm_ |
Target machine description. More... | |
llvm::Mangler * | mang_ |
Mangler for mangling label strings. More... | |
TTAProgram::Program * | prog_ |
Current program being built. More... | |
std::set< std::string > | opset_ |
The operations supported by the current target machine. More... | |
bool | functionAtATime_ |
PRegionMarkerAnalyzer * | pregions_ |
int | spillMoveCount_ |
unsigned | initialStackPointerValue_ |
MachineFrameInfo * | curFrameInfo_ |
LLVMTCECmdLineOptions * | options_ = nullptr |
The compiler options. More... | |
Definition at line 60 of file LLVMTCEIRBuilder.hh.
llvm::LLVMTCEIRBuilder::LLVMTCEIRBuilder | ( | const TargetMachine & | tm, |
TTAMachine::Machine * | mach, | ||
InterPassData & | ipd, | ||
AliasAnalysis * | AA, | ||
bool | functionAtATime = false , |
||
bool | modifyMF = false |
||
) |
Definition at line 103 of file LLVMTCEIRBuilder.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), delaySlotFilling_, LLVMTCECmdLineOptions::disableDelaySlotFiller(), RegisterCopyAdder::findTempRegisters(), llvm::LLVMTCEBuilder::functionAtATime_, TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::HWOperation::name(), TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), llvm::LLVMTCEBuilder::opset_, llvm::LLVMTCEBuilder::options_, and StringTools::stringToLower().
|
virtual |
Definition at line 1285 of file LLVMTCEIRBuilder.cc.
References bypasser_, Application::cmdLineOptions(), dsf_, CmdLineOptions::isVerboseSwitchDefined(), options, and scheduler_.
|
private |
Definition at line 273 of file LLVMTCEIRBuilder.cc.
References __func__, abortWithError, ControlFlowGraph::addExit(), llvm::LLVMTCEBuilder::addLabelForProgramOperation(), BoostGraph< GraphNode, GraphEdge >::addNode(), assert, BasicBlockNode::basicBlock(), bbMapping_, ControlFlowEdge::CFLOW_EDGE_CALL, ControlFlowEdge::CFLOW_EDGE_FALLTHROUGH, ControlFlowEdge::CFLOW_EDGE_FALSE, ControlFlowEdge::CFLOW_EDGE_JUMP, ControlFlowEdge::CFLOW_EDGE_NORMAL, ControlFlowEdge::CFLOW_EDGE_TRUE, BoostGraph< GraphNode, GraphEdge >::connectNodes(), MapTools::containsKey(), AssocTools::containsKey(), TTAProgram::Move::destination(), ControlFlowGraph::detectBackEdges(), llvm::LLVMTCEBuilder::emitInlineAsm(), llvm::LLVMTCEBuilder::emitInstruction(), llvm::LLVMTCEBuilder::emitSPInitialization(), llvm::LLVMTCEBuilder::fixProgramOperationReferences(), llvm::LLVMTCEBuilder::functionAtATime_, TTAProgram::Instruction::hasControlFlowMove(), hasRealInstructions(), InnerLoopFinder::innerLoopInfo(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Program::instructionReferenceManager(), isExplicitReturn(), llvm::LLVMTCEBuilder::isInlineAsm(), isRealInstruction(), InnerLoopFinder::InnerLoopInfo::isTripCountKnown(), llvm::LLVMTCEBuilder::isTTATarget(), Application::logStream(), loopFinder_, llvm::LLVMTCEBuilder::mang_, llvm::LLVMTCEBuilder::mbbName(), TTAProgram::Instruction::move(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), operationName(), llvm::LLVMTCEBuilder::pregions_, TTAProgram::Program::procedureCount(), llvm::LLVMTCEBuilder::prog_, TTAProgram::TerminalFUPort::programOperation(), BasicBlockNode::setBBOwnership(), BasicBlockNode::setHWLoop(), TTAProgram::BasicBlock::setInInnerLoop(), ControlFlowGraph::setInstructionReferenceManager(), BasicBlockNode::setScheduled(), TTAProgram::BasicBlock::setTripCount(), skippedBBs_, ControlFlowGraph::splitBasicBlocksWithCallsAndRefs(), and InnerLoopFinder::InnerLoopInfo::tripCount().
Referenced by writeMachineFunction().
|
private |
Definition at line 883 of file LLVMTCEIRBuilder.cc.
References ControlFlowGraphPass::handleControlFlowGraph(), ipData_, and llvm::LLVMTCEBuilder::mach_.
Referenced by writeMachineFunction().
|
private |
Definition at line 911 of file LLVMTCEIRBuilder.cc.
References DataDependenceGraphBuilder::build(), Application::cmdLineOptions(), ControlFlowGraph::convertBBRefsToInstRefs(), ddgBuilder_, delaySlotFiller(), delaySlotFilling_, CopyingDelaySlotFiller::fillDelaySlots(), llvm::LLVMTCEBuilder::functionAtATime_, PreOptimizer::handleCFGDDG(), BBSchedulerController::handleCFGDDG(), Peel2BBLoops::handleControlFlowGraph(), SimpleIfConverter::handleControlFlowGraph(), ControlFlowGraphPass::handleControlFlowGraph(), CopyingDelaySlotFiller::initialize(), ControlFlowGraph::instructionReferenceManager(), DataDependenceGraph::INTRA_BB_ANTIDEPS, ipData_, llvm::LLVMTCEBuilder::mach_, modifyMF_, BoostGraph< GraphNode, GraphEdge >::name(), ControlFlowGraph::optimizeBBOrdering(), options, scheduler(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
Referenced by writeMachineFunction().
|
private |
|
inlineprotectedvirtual |
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 114 of file LLVMTCEIRBuilder.hh.
|
protectedvirtual |
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 994 of file LLVMTCEIRBuilder.cc.
References assert, bbMapping_, Application::logStream(), skippedBBs_, and TTAProgram::CodeSnippet::toString().
|
overrideprotectedvirtual |
Create MoveNode and attach it to TerminalFUs. The MoveNode will be owned by DDG.
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 1264 of file LLVMTCEIRBuilder.cc.
References MoveNode::addDestinationOperationPtr(), TTAProgram::Move::destination(), TTAProgram::TerminalFUPort::setProgramOperation(), MoveNode::setSourceOperationPtr(), and TTAProgram::Move::source().
|
protectedvirtual |
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 1066 of file LLVMTCEIRBuilder.cc.
|
private |
Definition at line 904 of file LLVMTCEIRBuilder.cc.
References dsf_.
Referenced by compileOptimized(), and scheduler().
|
virtual |
Definition at line 1124 of file LLVMTCEIRBuilder.cc.
References TTAProgram::Program::convertSymbolRefsToInsRefs(), llvm::LLVMTCEBuilder::doFinalization(), EXIT_IF_THROWS, BBSchedulerController::handleProcedure(), llvm::LLVMTCEBuilder::mach_, TTAProgram::Procedure::name(), TTAProgram::Program::procedure(), TTAProgram::Program::procedureCount(), llvm::LLVMTCEBuilder::prog_, and scheduler().
|
virtual |
Definition at line 1118 of file LLVMTCEIRBuilder.cc.
References llvm::LLVMTCEBuilder::doInitialization().
Referenced by llvm::LLVMTCEScheduler::runOnMachineFunction().
|
inlinevirtual |
Emit stack pointer initialization move to the begining of the program.
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 76 of file LLVMTCEIRBuilder.hh.
|
private |
Definition at line 1234 of file LLVMTCEIRBuilder.cc.
References BasicBlockNode::basicBlock(), ControlFlowGraph::getMBB(), and jumpTableRecord_.
Referenced by writeMachineFunction().
|
virtual |
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 131 of file LLVMTCEIRBuilder.cc.
References llvm::LLVMTCEBuilder::getAnalysisUsage().
|
inlinevirtual |
Definition at line 80 of file LLVMTCEIRBuilder.hh.
|
private |
Definition at line 1106 of file LLVMTCEIRBuilder.cc.
References isRealInstruction().
Referenced by buildTCECFG().
|
private |
Returns true in case the given MI is an explict return instruction generated from the pseudo assembly string ".return_to".
Definition at line 855 of file LLVMTCEIRBuilder.cc.
References TCEString::startsWith().
Referenced by buildTCECFG().
|
private |
Returns false in case the given function should be compiled with fast settings without optimizations.
This looks into the tcecc –primary-functions function list if it's set. If not set, assumes all functions are "hot".
Definition at line 257 of file LLVMTCEIRBuilder.cc.
References AssocTools::containsKey(), llvm::LLVMTCEBuilder::mang_, llvm::LLVMTCEBuilder::options_, and LLVMTCECmdLineOptions::primaryFunctions().
Referenced by writeMachineFunction().
|
private |
Definition at line 1071 of file LLVMTCEIRBuilder.cc.
References operationName().
Referenced by buildTCECFG(), and hasRealInstructions().
|
private |
Definition at line 1203 of file LLVMTCEIRBuilder.cc.
References assert, bbMapping_, and jumpTableRecord_.
Referenced by writeMachineFunction().
|
protectedvirtual |
Implements llvm::LLVMTCEBuilder.
Definition at line 1147 of file LLVMTCEIRBuilder.cc.
References llvm::LLVMTCEBuilder::targetMachine().
Referenced by buildTCECFG(), and isRealInstruction().
|
inlineprotectedvirtual |
Implements llvm::LLVMTCEBuilder.
Definition at line 96 of file LLVMTCEIRBuilder.hh.
References abortWithError, llvm::LLVMTCEBuilder::isTTATarget(), and llvm::LLVMTCEBuilder::targetMachine().
|
protectedvirtual |
Implements llvm::LLVMTCEBuilder.
Definition at line 1161 of file LLVMTCEIRBuilder.cc.
References abortWithError, TTAMachine::Machine::Navigator< ComponentType >::count(), llvm::LLVMTCEBuilder::isTTATarget(), TTAMachine::Machine::Navigator< ComponentType >::item(), llvm::LLVMTCEBuilder::mach_, TTAMachine::Component::name(), TTAMachine::Machine::registerFileNavigator(), llvm::LLVMTCEBuilder::targetMachine(), and TTAMachine::BaseRegisterFile::width().
|
protectedvirtual |
Implements llvm::LLVMTCEBuilder.
Definition at line 1186 of file LLVMTCEIRBuilder.cc.
References llvm::LLVMTCEBuilder::isTTATarget(), and llvm::LLVMTCEBuilder::targetMachine().
|
private |
Definition at line 889 of file LLVMTCEIRBuilder.cc.
References bypasser_, delaySlotFiller(), delaySlotFilling_, ipData_, llvm::LLVMTCEBuilder::mach_, modifyMF_, and scheduler_.
Referenced by compileOptimized(), and doFinalization().
|
inline |
Definition at line 84 of file LLVMTCEIRBuilder.hh.
References loopFinder_.
Referenced by LLVMBackend::compile().
|
inlineprotectedvirtual |
Implements llvm::LLVMTCEBuilder.
Definition at line 90 of file LLVMTCEIRBuilder.hh.
References llvm::LLVMTCEBuilder::targetMachine().
|
virtual |
Writes machine function to POM.
Actually does things to MachineFunction which was supposed to be done in runOnMachineFunction, but which cannot be done during that, because MachineDCE is not ready yet at that time...
Reimplemented from llvm::LLVMTCEBuilder.
Definition at line 136 of file LLVMTCEIRBuilder.cc.
References AA_, TTAProgram::Program::addProcedure(), TTAMachine::FunctionUnit::addressSpace(), assert, buildTCECFG(), llvm::LLVMTCEBuilder::clearFunctionBookkeeping(), llvm::LLVMTCEBuilder::codeLabels_, compileFast(), compileOptimized(), TTAMachine::Machine::controlUnit(), ControlFlowGraph::convertBBRefsToInstRefs(), ControlFlowGraph::copyToLLVMMachineFunction(), ControlFlowGraph::copyToProcedure(), llvm::LLVMTCEBuilder::curFrameInfo_, llvm::LLVMTCEBuilder::emitConstantPool(), EXIT_IF_THROWS, TTAProgram::CodeSnippet::firstInstruction(), fixJumpTableDestinations(), llvm::LLVMTCEBuilder::functionAtATime_, CallsToJumps::handleControlFlowGraph(), AbsoluteToRelativeJumps::handleProcedure(), TTAMachine::FunctionUnit::hasOperation(), llvm::LLVMTCEBuilder::initDataSections(), TTAProgram::CodeSnippet::instructionCount(), TTAProgram::Program::instructionReferenceManager(), ipData_, isHotFunction(), Application::logStream(), llvm::LLVMTCEBuilder::mach_, llvm::LLVMTCEBuilder::mang_, markJumpTableDestinations(), modifyMF_, llvm::LLVMTCEBuilder::options_, LLVMTCECmdLineOptions::optLevel(), llvm::LLVMTCEBuilder::prog_, ControlFlowGraph::setInstructionReferenceManager(), llvm::LLVMTCEBuilder::spillMoveCount_, llvm::LLVMTCEBuilder::tm_, Application::verboseLevel(), verboseLog, and GraphBase< GraphNode, GraphEdge >::writeToDotFile().
Referenced by llvm::LLVMTCEScheduler::runOnMachineFunction().
|
private |
Definition at line 172 of file LLVMTCEIRBuilder.hh.
Referenced by writeMachineFunction().
|
private |
Definition at line 163 of file LLVMTCEIRBuilder.hh.
|
private |
Definition at line 168 of file LLVMTCEIRBuilder.hh.
Referenced by buildTCECFG(), createMBBReference(), and markJumpTableDestinations().
|
private |
Definition at line 183 of file LLVMTCEIRBuilder.hh.
Referenced by scheduler(), and ~LLVMTCEIRBuilder().
|
private |
Definition at line 166 of file LLVMTCEIRBuilder.hh.
Referenced by compileOptimized().
|
private |
Definition at line 179 of file LLVMTCEIRBuilder.hh.
Referenced by compileOptimized(), LLVMTCEIRBuilder(), and scheduler().
|
private |
Definition at line 182 of file LLVMTCEIRBuilder.hh.
Referenced by delaySlotFiller(), and ~LLVMTCEIRBuilder().
|
static |
Definition at line 62 of file LLVMTCEIRBuilder.hh.
|
private |
Definition at line 161 of file LLVMTCEIRBuilder.hh.
Referenced by compileFast(), compileOptimized(), scheduler(), and writeMachineFunction().
|
private |
Definition at line 170 of file LLVMTCEIRBuilder.hh.
Referenced by fixJumpTableDestinations(), and markJumpTableDestinations().
|
private |
Definition at line 185 of file LLVMTCEIRBuilder.hh.
Referenced by buildTCECFG(), and setInnerLoopFinder().
|
private |
Definition at line 175 of file LLVMTCEIRBuilder.hh.
Referenced by compileOptimized(), scheduler(), and writeMachineFunction().
|
private |
Definition at line 181 of file LLVMTCEIRBuilder.hh.
Referenced by scheduler(), and ~LLVMTCEIRBuilder().
|
private |
Definition at line 177 of file LLVMTCEIRBuilder.hh.
Referenced by buildTCECFG(), and createMBBReference().