Moved code generation support routines to InstrSelectionSupport.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve
2001-10-10 20:49:07 +00:00
parent 25e288fd92
commit 9aba1d3307
3 changed files with 2 additions and 303 deletions

View File

@@ -6,7 +6,7 @@
// Purpose:
// Machine-independent driver file for instruction selection.
// This file constructs a forest of BURG instruction trees and then
// use the BURG-generated tree grammar (BURM) to find the optimal
// uses the BURG-generated tree grammar (BURM) to find the optimal
// instruction sequences for a given machine.
//
// History:
@@ -17,8 +17,6 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Type.h"
#include "llvm/iMemory.h"
#include "llvm/Instruction.h"
#include "llvm/BasicBlock.h"
#include "llvm/Method.h"
@@ -119,47 +117,6 @@ SelectInstructionsForMethod(Method* method, TargetMachine &Target)
}
//---------------------------------------------------------------------------
// Function: FoldGetElemChain
//
// Purpose:
// Fold a chain of GetElementPtr instructions into an equivalent
// (Pointer, IndexVector) pair. Returns the pointer Value, and
// stores the resulting IndexVector in argument chainIdxVec.
//---------------------------------------------------------------------------
Value*
FoldGetElemChain(const InstructionNode* getElemInstrNode,
vector<ConstPoolVal*>& chainIdxVec)
{
MemAccessInst* getElemInst = (MemAccessInst*)
getElemInstrNode->getInstruction();
// Initialize return values from the incoming instruction
Value* ptrVal = getElemInst->getPtrOperand();
chainIdxVec = getElemInst->getIndexVec(); // copies index vector values
// Now chase the chain of getElementInstr instructions, if any
InstrTreeNode* ptrChild = getElemInstrNode->leftChild();
while (ptrChild->getOpLabel() == Instruction::GetElementPtr ||
ptrChild->getOpLabel() == GetElemPtrIdx)
{
// Child is a GetElemPtr instruction
getElemInst = (MemAccessInst*)
((InstructionNode*) ptrChild)->getInstruction();
const vector<ConstPoolVal*>& idxVec = getElemInst->getIndexVec();
// Get the pointer value out of ptrChild and *prepend* its index vector
ptrVal = getElemInst->getPtrOperand();
chainIdxVec.insert(chainIdxVec.begin(), idxVec.begin(), idxVec.end());
ptrChild = ptrChild->leftChild();
}
return ptrVal;
}
//*********************** Private Functions *****************************/