OpenASIP
2.0
|
#include <PreOptimizer.hh>
Private Member Functions | |
ControlFlowGraph::NodeSet | inverseGuardsOfHeads (DataDependenceGraph &ddg, DataDependenceGraph::EdgeSet &oEdges) |
bool | checkGuardReversalAllowed (DataDependenceGraph &ddg, DataDependenceGraph::EdgeSet &oEdges) |
bool | tryToOptimizeAddressReg (DataDependenceGraph &ddg, ProgramOperation &po) |
ControlFlowGraph::NodeSet | tryToRemoveXor (DataDependenceGraph &ddg, ProgramOperation &po, TTAProgram::InstructionReferenceManager *irm, ControlFlowGraph &cfg) |
ControlFlowGraph::NodeSet | tryToRemoveEq (DataDependenceGraph &ddg, ProgramOperation &po, TTAProgram::InstructionReferenceManager *irm, ControlFlowGraph &cfg) |
ControlFlowGraph::NodeSet | tryToRemoveGuardInversingOp (DataDependenceGraph &ddg, ProgramOperation &po, TTAProgram::InstructionReferenceManager *irm, ControlFlowGraph &cfg) |
bool | cfgAllowsJumpReversal (TTAProgram::Instruction &ins, ControlFlowGraph &cfg) |
void | tryToPrecalcConstantAdd (DataDependenceGraph &ddg, ProgramOperation &po) |
Additional Inherited Members | |
Static Public Member Functions inherited from ProcedurePass | |
static void | copyCfgToProcedure (TTAProgram::Procedure &procedure, ControlFlowGraph &cfg) |
static void | executeControlFlowGraphPass (TTAProgram::Procedure &procedure, const TTAMachine::Machine &targetmachine, ControlFlowGraphPass &cfgp) |
Static Public Member Functions inherited from ProgramPass | |
static void | executeProcedurePass (TTAProgram::Program &program, const TTAMachine::Machine &targetMachine, ProcedurePass &procedurePass) |
Definition at line 66 of file PreOptimizer.hh.
PreOptimizer::PreOptimizer | ( | InterPassData & | data | ) |
Constructor. Initializes interpassData.
data | InterPassData to store. |
Definition at line 69 of file PreOptimizer.cc.
|
private |
Check that we can revert the out edges of the cfg when reverting a jump guard
Definition at line 562 of file PreOptimizer.cc.
References BasicBlockNode::basicBlock(), ControlFlowEdge::isFalseEdge(), ControlFlowEdge::isTrueEdge(), BoostGraph< GraphNode, GraphEdge >::node(), BoostGraph< GraphNode, GraphEdge >::nodeCount(), BoostGraph< GraphNode, GraphEdge >::outDegree(), BoostGraph< GraphNode, GraphEdge >::outEdge(), and TTAProgram::Instruction::parent().
Referenced by tryToRemoveGuardInversingOp().
|
private |
Definition at line 326 of file PreOptimizer.cc.
References DataDependenceEdge::DEP_RAW, DataDependenceEdge::dependenceType(), MoveNode::destinationOperation(), DataDependenceEdge::guardUse(), BoostGraph< GraphNode, GraphEdge >::headNode(), BoostGraph< GraphNode, GraphEdge >::inEdges(), MoveNode::isDestinationOperation(), Operation::name(), and ProgramOperation::operation().
Referenced by tryToRemoveGuardInversingOp().
void PreOptimizer::handleCFGDDG | ( | ControlFlowGraph & | cfg, |
DataDependenceGraph & | ddg | ||
) |
Definition at line 511 of file PreOptimizer.cc.
References Operation::name(), ProgramOperation::operation(), program, ControlFlowGraph::program(), DataDependenceGraph::programOperation(), DataDependenceGraph::programOperationCount(), Operation::readsMemory(), ControlFlowGraph::reverseGuardOnOutEdges(), tryToOptimizeAddressReg(), tryToPrecalcConstantAdd(), tryToRemoveEq(), and tryToRemoveXor().
Referenced by llvm::LLVMTCEIRBuilder::compileOptimized(), and handleControlFlowGraph().
|
virtual |
Handles a single control flow graph.
The pass should work with any kind of control flow graph, it should not assume the CFG represents a whole procedure, for example.
cfg | The control flow graph to handle. |
machine | The target machine if any. (NullMachine::instance() if target machine is irrelevant). |
In | case handling is unsuccesful for any reason (cfg might still get modified). |
Reimplemented from ControlFlowGraphPass.
Definition at line 546 of file PreOptimizer.cc.
References DataDependenceGraphBuilder::build(), handleCFGDDG(), SchedulerPass::interPassData(), and DataDependenceGraph::NO_ANTIDEPS.
Referenced by handleProcedure().
|
virtual |
Handles a procedure.
procedure | the procedure. |
targetMachine | targetmachine. Not used at all. |
Reimplemented from ProcedurePass.
Definition at line 484 of file PreOptimizer.cc.
References Application::cmdLineOptions(), ControlFlowGraph::copyToProcedure(), DEFAULT_LOWMEM_MODE_THRESHOLD, handleControlFlowGraph(), TTAProgram::CodeSnippet::instructionCount(), SchedulerCmdLineOptions::lowMemModeThreshold(), and ControlFlowGraph::updateReferencesFromProcToCfg().
|
virtual |
Handles a program.
program | the program. |
targetMachine | targetmachine. Not used at all. |
Reimplemented from ProgramPass.
Definition at line 81 of file PreOptimizer.cc.
References ProgramPass::executeProcedurePass(), and program.
|
private |
Definition at line 380 of file PreOptimizer.cc.
References assert, TTAProgram::CodeGenerator::createInverseGuard(), DataDependenceEdge::DEP_RAW, DataDependenceEdge::dependenceType(), MoveNode::destinationOperation(), DataDependenceGraph::getBasicBlockNode(), TTAProgram::Move::guard(), DataDependenceEdge::guardUse(), BoostGraph< GraphNode, GraphEdge >::headNode(), TTAProgram::Move::isJump(), TTAProgram::Move::isUnconditional(), MoveNode::move(), TTAProgram::Move::setGuard(), and ProgramOperation::switchInputs().
Referenced by tryToRemoveGuardInversingOp().
|
inlinevirtual |
A short description of the pass, usually the optimization name, such as "basic block scheduler".
Implements SchedulerPass.
Definition at line 86 of file PreOptimizer.hh.
|
private |
Definition at line 87 of file PreOptimizer.cc.
References TTAProgram::Terminal::copy(), DataDependenceEdge::DEP_RAW, DataDependenceEdge::dependenceType(), TTAProgram::Move::destination(), DataDependenceEdge::EDGE_REGISTER, DataDependenceEdge::edgeReason(), DataDependenceGraph::getBasicBlockNode(), DataDependenceEdge::guardUse(), BoostGraph< GraphNode, GraphEdge >::headNode(), BoostGraph< GraphNode, GraphEdge >::inEdges(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), DataDependenceEdge::isBackEdge(), TTAProgram::Terminal::isGPR(), MoveNode::move(), TTAMachine::Component::name(), GraphNode::nodeID(), BoostGraph< GraphNode, GraphEdge >::outEdges(), ProgramOperation::outputMove(), ProgramOperation::outputMoveCount(), TTAProgram::Terminal::registerFile(), DisassemblyRegister::registerName(), DataDependenceGraph::renamedSimpleLiveRange(), TTAProgram::Move::setDestination(), TTAProgram::Move::setSource(), TTAProgram::Move::source(), BoostGraph< GraphNode, GraphEdge >::tailNode(), and TTAMachine::BaseRegisterFile::width().
Referenced by handleCFGDDG().
|
private |
Remove additions that can be removed staticly. LLVM leaves these when another ide of the addition is an address of a global variable.
Definition at line 412 of file PreOptimizer.cc.
References assert, DataDependenceGraph::deleteNode(), ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), MoveNode::isSourceConstant(), MoveNode::isSourceVariable(), MoveNode::move(), TTAProgram::Instruction::moveCount(), Operation::name(), DataDependenceGraph::onlyRegisterRawSource(), ProgramOperation::operation(), ProgramOperation::outputMove(), TTAProgram::Move::parent(), TTAProgram::Instruction::parent(), TTAProgram::CodeSnippet::remove(), ProgramOperation::removeOutputNode(), TTAProgram::Move::setSource(), TTAProgram::Move::source(), and MoveNode::unsetSourceOperation().
Referenced by handleCFGDDG().
|
private |
Definition at line 215 of file PreOptimizer.cc.
References Operand::BOOL, ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), SimValue::intValue(), TTAProgram::Terminal::isImmediate(), MoveNode::isSourceOperation(), MoveNode::move(), DataDependenceGraph::onlyRegisterRawSource(), Operation::operand(), ProgramOperation::operation(), TTAProgram::Terminal::operationIndex(), ProgramOperation::outputMoveCount(), TTAProgram::Move::source(), MoveNode::sourceOperation(), tryToRemoveGuardInversingOp(), Operand::type(), and TTAProgram::Terminal::value().
Referenced by handleCFGDDG().
|
private |
Definition at line 244 of file PreOptimizer.cc.
References TTAProgram::Instruction::addMove(), DataDependenceGraph::addNode(), assert, TTAProgram::Move::bus(), cfgAllowsJumpReversal(), checkGuardReversalAllowed(), DataDependenceGraph::combineNodes(), TTAProgram::Terminal::copy(), DataDependenceGraph::copyDepsOver(), DataDependenceGraph::deleteNode(), TTAProgram::Move::destination(), TTAProgram::Terminal::equals(), TTAProgram::InstructionReferenceManager::hasReference(), ProgramOperation::inputMove(), TTAProgram::CodeSnippet::insertAfter(), inverseGuardsOfHeads(), MoveNode::move(), TTAProgram::Instruction::moveCount(), BoostGraph< GraphNode, GraphEdge >::outEdges(), ProgramOperation::outputMove(), TTAProgram::Move::parent(), TTAProgram::Instruction::parent(), TTAProgram::CodeSnippet::remove(), and TTAProgram::Move::source().
Referenced by tryToRemoveEq(), and tryToRemoveXor().
|
private |
Tries to remove an unnecessary guard value xor before a conditional jump.
Tries to remove xor operation which is used for converting false boolean value into true boolean value which is then used for jump. The xor operation is removed and the jump predicate reversed.
ddg | The datadependence graph of the whole function |
po | ProgramOperation which is a xor operation |
irm | instructionreferencemanager of the program. |
Definition at line 195 of file PreOptimizer.cc.
References ProgramOperation::inputMove(), ProgramOperation::inputMoveCount(), SimValue::intValue(), TTAProgram::Terminal::isImmediate(), MoveNode::move(), ProgramOperation::outputMoveCount(), TTAProgram::Move::source(), tryToRemoveGuardInversingOp(), and TTAProgram::Terminal::value().
Referenced by handleCFGDDG().