aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/SparcV9/InstrSelection
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-07 20:49:59 +0000
committerChris Lattner <sabre@nondot.org>2002-04-07 20:49:59 +0000
commit2fbfdcffd3e0cf41422aaa6c526c37cb02b81341 (patch)
treec1991eac5d23807b38e5909f861609b243562f70 /lib/Target/SparcV9/InstrSelection
parentdcc6d4cada290857ee74164816ec3c502c1db7a4 (diff)
downloadexternal_llvm-2fbfdcffd3e0cf41422aaa6c526c37cb02b81341.zip
external_llvm-2fbfdcffd3e0cf41422aaa6c526c37cb02b81341.tar.gz
external_llvm-2fbfdcffd3e0cf41422aaa6c526c37cb02b81341.tar.bz2
Change references to the Method class to be references to the Function
class. The Method class is obsolete (renamed) and all references to it are being converted over to Function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/InstrSelection')
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrSelection.cpp36
-rw-r--r--lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp15
2 files changed, 24 insertions, 27 deletions
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
index 3efc527..1eb507a 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelection.cpp
@@ -23,7 +23,7 @@
#include "llvm/Target/MachineRegInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/iPHINode.h"
#include "Support/CommandLine.h"
#include <iostream>
@@ -60,7 +60,7 @@ static void PostprocessMachineCodeForTree(InstructionNode* instrNode,
short* nts,
TargetMachine &target);
-static void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target);
+static void InsertCode4AllPhisInMeth(Function *F, TargetMachine &target);
@@ -73,25 +73,23 @@ static void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target);
//---------------------------------------------------------------------------
bool
-SelectInstructionsForMethod(Method* method, TargetMachine &target)
+SelectInstructionsForMethod(Function *F, TargetMachine &target)
{
bool failed = false;
//
// Build the instruction trees to be given as inputs to BURG.
//
- InstrForest instrForest(method);
+ InstrForest instrForest(F);
if (SelectDebugLevel >= Select_DebugInstTrees)
{
- cerr << "\n\n*** Input to instruction selection for method "
- << (method->hasName()? method->getName() : "")
- << "\n\n";
- method->dump();
+ cerr << "\n\n*** Input to instruction selection for function "
+ << F->getName() << "\n\n";
+ F->dump();
- cerr << "\n\n*** Instruction trees for method "
- << (method->hasName()? method->getName() : "")
- << "\n\n";
+ cerr << "\n\n*** Instruction trees for function "
+ << F->getName() << "\n\n";
instrForest.dump();
}
@@ -125,7 +123,7 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target)
//
// Record instructions in the vector for each basic block
//
- for (Method::iterator BI = method->begin(); BI != method->end(); ++BI)
+ for (Function::iterator BI = F->begin(), BE = F->end(); BI != BE; ++BI)
{
MachineCodeForBasicBlock& bbMvec = (*BI)->getMachineInstrVec();
for (BasicBlock::iterator II = (*BI)->begin(); II != (*BI)->end(); ++II)
@@ -137,13 +135,13 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target)
}
// Insert phi elimination code -- added by Ruchira
- InsertCode4AllPhisInMeth(method, target);
+ InsertCode4AllPhisInMeth(F, target);
if (SelectDebugLevel >= Select_PrintMachineCode)
{
cerr << "\n*** Machine instructions after INSTRUCTION SELECTION\n";
- MachineCodeForMethod::get(method).dump();
+ MachineCodeForMethod::get(F).dump();
}
return false;
@@ -190,11 +188,11 @@ InsertPhiElimInstructions(BasicBlock *BB, const vector<MachineInstr*>& CpVec)
//-------------------------------------------------------------------------
void
-InsertCode4AllPhisInMeth(Method *method, TargetMachine &target)
+InsertCode4AllPhisInMeth(Function *F, TargetMachine &target)
{
- // for all basic blocks in method
+ // for all basic blocks in function
//
- for (Method::iterator BI = method->begin(); BI != method->end(); ++BI) {
+ for (Function::iterator BI = F->begin(); BI != F->end(); ++BI) {
BasicBlock *BB = *BI;
const BasicBlock::InstListType &InstList = BB->getInstList();
@@ -236,9 +234,7 @@ InsertCode4AllPhisInMeth(Method *method, TargetMachine &target)
else break; // since PHI nodes can only be at the top
} // for each Phi Instr in BB
-
- } // for all BBs in method
-
+ } // for all BBs in function
}
diff --git a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
index ff43f04..24efdf1 100644
--- a/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/Target/SparcV9/InstrSelection/InstrSelectionSupport.cpp
@@ -20,7 +20,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/MachineRegInfo.h"
#include "llvm/ConstantVals.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/Type.h"
#include "llvm/iMemory.h"
@@ -30,7 +30,7 @@ using std::vector;
static TmpInstruction*
-InsertCodeToLoadConstant(Method* method,
+InsertCodeToLoadConstant(Function *F,
Value* opValue,
Instruction* vmInstr,
vector<MachineInstr*>& loadConstVec,
@@ -43,7 +43,7 @@ InsertCodeToLoadConstant(Method* method,
MachineCodeForInstruction &MCFI = MachineCodeForInstruction::get(vmInstr);
MCFI.addTemp(tmpReg);
- target.getInstrInfo().CreateCodeToLoadConst(method, opValue, tmpReg,
+ target.getInstrInfo().CreateCodeToLoadConst(F, opValue, tmpReg,
loadConstVec, tempVec);
// Register the new tmp values created for this m/c instruction sequence
@@ -344,7 +344,7 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
const MachineInstrDescriptor& instrDesc =
target.getInstrInfo().getDescriptor(minstr->getOpCode());
- Method* method = vmInstr->getParent()->getParent();
+ Function *F = vmInstr->getParent()->getParent();
for (unsigned op=0; op < minstr->getNumOperands(); op++)
{
@@ -381,8 +381,9 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
if (constantThatMustBeLoaded || isa<GlobalValue>(opValue))
{ // opValue is a constant that must be explicitly loaded into a reg.
- TmpInstruction* tmpReg = InsertCodeToLoadConstant(method, opValue, vmInstr,
- loadConstVec, target);
+ TmpInstruction* tmpReg = InsertCodeToLoadConstant(F, opValue, vmInstr,
+ loadConstVec,
+ target);
minstr->SetMachineOperandVal(op, MachineOperand::MO_VirtualRegister,
tmpReg);
}
@@ -404,7 +405,7 @@ FixConstantOperandsForInstr(Instruction* vmInstr,
{
Value* oldVal = minstr->getImplicitRef(i);
TmpInstruction* tmpReg =
- InsertCodeToLoadConstant(method, oldVal, vmInstr, loadConstVec, target);
+ InsertCodeToLoadConstant(F, oldVal, vmInstr, loadConstVec, target);
minstr->setImplicitRef(i, tmpReg);
}