From c36a504cfe644d53735294f4f45cc3419a1b2b88 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Wed, 10 Oct 2001 20:49:07 +0000 Subject: Moved code generation support routines to InstrSelectionSupport.cpp. llvm-svn: 717 --- llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp | 45 +--------------------- 1 file changed, 1 insertion(+), 44 deletions(-) (limited to 'llvm/lib/CodeGen/InstrSelection') diff --git a/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp b/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp index 339ba6474cc..d52088c0eb6 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -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& 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& 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 *****************************/ -- cgit v1.2.3