mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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:
@@ -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 *****************************/
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user