summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/Sparc')
-rw-r--r--llvm/lib/Target/Sparc/EmitAssembly.cpp69
-rw-r--r--llvm/lib/Target/Sparc/Sparc.cpp76
-rw-r--r--llvm/lib/Target/Sparc/SparcInstrInfo.cpp30
-rw-r--r--llvm/lib/Target/Sparc/SparcInstrSelection.cpp43
4 files changed, 110 insertions, 108 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp
index 91570444830..de4cb82b5dc 100644
--- a/llvm/lib/Target/Sparc/EmitAssembly.cpp
+++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp
@@ -20,7 +20,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Annotation.h"
#include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/Module.h"
#include "Support/StringExtras.h"
#include "Support/HashExtras.h"
@@ -74,7 +74,7 @@ public:
AsmPrinter(std::ostream &os, const TargetMachine &T)
: idTable(0), toAsm(os), Target(T), CurSection(Unknown) {}
- // (start|end)(Module|Method) - Callback methods to be invoked by subclasses
+ // (start|end)(Module|Function) - Callback methods to be invoked by subclasses
void startModule(Module *M) {
// Create the global id table if it does not already exist
idTable = (GlobalIdTable*) M->getAnnotation(GlobalIdTable::AnnotId);
@@ -83,12 +83,12 @@ public:
M->addAnnotation(idTable);
}
}
- void startMethod(Method *M) {
+ void startFunction(Function *F) {
// Make sure the slot table has information about this method...
- idTable->Table->incorporateMethod(M);
+ idTable->Table->incorporateMethod(F);
}
- void endMethod(Method *M) {
- idTable->Table->purgeMethod(); // Forget all about M.
+ void endFunction(Function *F) {
+ idTable->Table->purgeMethod(); // Forget all about F
}
void endModule() {
}
@@ -97,9 +97,8 @@ public:
// Only functions can currently be external. "main" is the only name
// that is visible externally.
bool isExternal(const Value* V) {
- const Method* meth = dyn_cast<Method>(V);
- return bool(meth != NULL
- && (meth->isExternal() || meth->getName() == "main"));
+ const Function *F = dyn_cast<Function>(V);
+ return F && (F->isExternal() || F->getName() == "main");
}
// enterSection - Use this method to enter a different section of the output
@@ -177,8 +176,8 @@ public:
string getID(const Module *M) {
return getID(M, "LLVMModule_");
}
- string getID(const Method *M) {
- return getID(M, "LLVMMethod_");
+ string getID(const Function *F) {
+ return getID(F, "LLVMFunction_");
}
string getID(const BasicBlock *BB) {
return getID(BB, "LL", (".L_"+getID(BB->getParent())+"_").c_str());
@@ -194,11 +193,11 @@ public:
//===----------------------------------------------------------------------===//
-// SparcMethodAsmPrinter Code
+// SparcFunctionAsmPrinter Code
//===----------------------------------------------------------------------===//
-struct SparcMethodAsmPrinter : public MethodPass, public AsmPrinter {
- inline SparcMethodAsmPrinter(std::ostream &os, const TargetMachine &t)
+struct SparcFunctionAsmPrinter : public MethodPass, public AsmPrinter {
+ inline SparcFunctionAsmPrinter(std::ostream &os, const TargetMachine &t)
: AsmPrinter(os, t) {}
virtual bool doInitialization(Module *M) {
@@ -206,10 +205,10 @@ struct SparcMethodAsmPrinter : public MethodPass, public AsmPrinter {
return false;
}
- virtual bool runOnMethod(Method *M) {
- startMethod(M);
- emitMethod(M);
- endMethod(M);
+ virtual bool runOnMethod(Function *F) {
+ startFunction(F);
+ emitFunction(F);
+ endFunction(F);
return false;
}
@@ -218,7 +217,7 @@ struct SparcMethodAsmPrinter : public MethodPass, public AsmPrinter {
return false;
}
- void emitMethod(const Method *M);
+ void emitFunction(const Function *F);
private :
void emitBasicBlock(const BasicBlock *BB);
void emitMachineInst(const MachineInstr *MI);
@@ -239,8 +238,8 @@ private :
};
inline bool
-SparcMethodAsmPrinter::OpIsBranchTargetLabel(const MachineInstr *MI,
- unsigned int opNum) {
+SparcFunctionAsmPrinter::OpIsBranchTargetLabel(const MachineInstr *MI,
+ unsigned int opNum) {
switch (MI->getOpCode()) {
case JMPLCALL:
case JMPLRET: return (opNum == 0);
@@ -250,8 +249,8 @@ SparcMethodAsmPrinter::OpIsBranchTargetLabel(const MachineInstr *MI,
inline bool
-SparcMethodAsmPrinter::OpIsMemoryAddressBase(const MachineInstr *MI,
- unsigned int opNum) {
+SparcFunctionAsmPrinter::OpIsMemoryAddressBase(const MachineInstr *MI,
+ unsigned int opNum) {
if (Target.getInstrInfo().isLoad(MI->getOpCode()))
return (opNum == 0);
else if (Target.getInstrInfo().isStore(MI->getOpCode()))
@@ -267,7 +266,7 @@ SparcMethodAsmPrinter::OpIsMemoryAddressBase(const MachineInstr *MI,
printOneOperand(Op2);
unsigned int
-SparcMethodAsmPrinter::printOperands(const MachineInstr *MI,
+SparcFunctionAsmPrinter::printOperands(const MachineInstr *MI,
unsigned int opNum)
{
const MachineOperand& Op = MI->getOperand(opNum);
@@ -293,7 +292,7 @@ SparcMethodAsmPrinter::printOperands(const MachineInstr *MI,
void
-SparcMethodAsmPrinter::printOneOperand(const MachineOperand &op)
+SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &op)
{
switch (op.getOperandType())
{
@@ -319,7 +318,7 @@ SparcMethodAsmPrinter::printOneOperand(const MachineOperand &op)
toAsm << "\t<*NULL Value*>";
else if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val))
toAsm << getID(BB);
- else if (const Method *M = dyn_cast<const Method>(Val))
+ else if (const Function *M = dyn_cast<const Function>(Val))
toAsm << getID(M);
else if (const GlobalVariable *GV=dyn_cast<const GlobalVariable>(Val))
toAsm << getID(GV);
@@ -343,7 +342,7 @@ SparcMethodAsmPrinter::printOneOperand(const MachineOperand &op)
void
-SparcMethodAsmPrinter::emitMachineInst(const MachineInstr *MI)
+SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI)
{
unsigned Opcode = MI->getOpCode();
@@ -369,7 +368,7 @@ SparcMethodAsmPrinter::emitMachineInst(const MachineInstr *MI)
}
void
-SparcMethodAsmPrinter::emitBasicBlock(const BasicBlock *BB)
+SparcFunctionAsmPrinter::emitBasicBlock(const BasicBlock *BB)
{
// Emit a label for the basic block
toAsm << getID(BB) << ":\n";
@@ -385,18 +384,18 @@ SparcMethodAsmPrinter::emitBasicBlock(const BasicBlock *BB)
}
void
-SparcMethodAsmPrinter::emitMethod(const Method *M)
+SparcFunctionAsmPrinter::emitFunction(const Function *M)
{
string methName = getID(M);
- toAsm << "!****** Outputing Method: " << methName << " ******\n";
+ toAsm << "!****** Outputing Function: " << methName << " ******\n";
enterSection(AsmPrinter::Text);
toAsm << "\t.align\t4\n\t.global\t" << methName << "\n";
//toAsm << "\t.type\t" << methName << ",#function\n";
toAsm << "\t.type\t" << methName << ", 2\n";
toAsm << methName << ":\n";
- // Output code for all of the basic blocks in the method...
- for (Method::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
+ // Output code for all of the basic blocks in the function...
+ for (Function::const_iterator I = M->begin(), E = M->end(); I != E; ++I)
emitBasicBlock(*I);
// Output a .size directive so the debugger knows the extents of the function
@@ -404,14 +403,14 @@ SparcMethodAsmPrinter::emitMethod(const Method *M)
<< methName << ", .EndOf_"
<< methName << "-" << methName << "\n";
- // Put some spaces between the methods
+ // Put some spaces between the functions
toAsm << "\n\n";
}
} // End anonymous namespace
Pass *UltraSparc::getMethodAsmPrinterPass(PassManager &PM, std::ostream &Out) {
- return new SparcMethodAsmPrinter(Out, *this);
+ return new SparcFunctionAsmPrinter(Out, *this);
}
@@ -419,7 +418,7 @@ Pass *UltraSparc::getMethodAsmPrinterPass(PassManager &PM, std::ostream &Out) {
//===----------------------------------------------------------------------===//
-// SparcMethodAsmPrinter Code
+// SparcFunctionAsmPrinter Code
//===----------------------------------------------------------------------===//
namespace {
diff --git a/llvm/lib/Target/Sparc/Sparc.cpp b/llvm/lib/Target/Sparc/Sparc.cpp
index 3eac9c0d2a2..09b44f5f2e5 100644
--- a/llvm/lib/Target/Sparc/Sparc.cpp
+++ b/llvm/lib/Target/Sparc/Sparc.cpp
@@ -18,7 +18,7 @@
#include "llvm/CodeGen/MachineCodeForMethod.h"
#include "llvm/CodeGen/RegisterAllocation.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/PassManager.h"
#include <iostream>
@@ -45,12 +45,12 @@ TargetMachine *allocateSparcTargetMachine() { return new UltraSparc(); }
//---------------------------------------------------------------------------
// class InsertPrologEpilogCode
//
-// Insert SAVE/RESTORE instructions for the method
+// Insert SAVE/RESTORE instructions for the function
//
-// Insert prolog code at the unique method entry point.
-// Insert epilog code at each method exit point.
-// InsertPrologEpilog invokes these only if the method is not compiled
-// with the leaf method optimization.
+// Insert prolog code at the unique function entry point.
+// Insert epilog code at each function exit point.
+// InsertPrologEpilog invokes these only if the function is not compiled
+// with the leaf function optimization.
//
//---------------------------------------------------------------------------
static MachineInstr* minstrVec[MAX_INSTR_PER_VMINSTR];
@@ -59,22 +59,22 @@ class InsertPrologEpilogCode : public MethodPass {
TargetMachine &Target;
public:
inline InsertPrologEpilogCode(TargetMachine &T) : Target(T) {}
- bool runOnMethod(Method *M) {
- MachineCodeForMethod &mcodeInfo = MachineCodeForMethod::get(M);
+ bool runOnMethod(Function *F) {
+ MachineCodeForMethod &mcodeInfo = MachineCodeForMethod::get(F);
if (!mcodeInfo.isCompiledAsLeafMethod()) {
- InsertPrologCode(M);
- InsertEpilogCode(M);
+ InsertPrologCode(F);
+ InsertEpilogCode(F);
}
return false;
}
- void InsertPrologCode(Method *M);
- void InsertEpilogCode(Method *M);
+ void InsertPrologCode(Function *F);
+ void InsertEpilogCode(Function *F);
};
-void InsertPrologEpilogCode::InsertPrologCode(Method* method)
+void InsertPrologEpilogCode::InsertPrologCode(Function *F)
{
- BasicBlock* entryBB = method->getEntryNode();
+ BasicBlock *entryBB = F->getEntryNode();
unsigned N = GetInstructionsForProlog(entryBB, Target, minstrVec);
assert(N <= MAX_INSTR_PER_VMINSTR);
MachineCodeForBasicBlock& bbMvec = entryBB->getMachineInstrVec();
@@ -82,9 +82,9 @@ void InsertPrologEpilogCode::InsertPrologCode(Method* method)
}
-void InsertPrologEpilogCode::InsertEpilogCode(Method* method)
+void InsertPrologEpilogCode::InsertEpilogCode(Function *F)
{
- for (Method::iterator I=method->begin(), E=method->end(); I != E; ++I) {
+ for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
Instruction *TermInst = (Instruction*)(*I)->getTerminator();
if (TermInst->getOpcode() == Instruction::Ret)
{
@@ -209,12 +209,12 @@ UltraSparc::UltraSparc()
// Native code generation for a specified target.
//===---------------------------------------------------------------------===//
-class ConstructMachineCodeForMethod : public MethodPass {
+class ConstructMachineCodeForFunction : public MethodPass {
TargetMachine &Target;
public:
- inline ConstructMachineCodeForMethod(TargetMachine &T) : Target(T) {}
- bool runOnMethod(Method *M) {
- MachineCodeForMethod::construct(M, Target);
+ inline ConstructMachineCodeForFunction(TargetMachine &T) : Target(T) {}
+ bool runOnMethod(Function *F) {
+ MachineCodeForMethod::construct(F, Target);
return false;
}
};
@@ -223,26 +223,28 @@ class InstructionSelection : public MethodPass {
TargetMachine &Target;
public:
inline InstructionSelection(TargetMachine &T) : Target(T) {}
- bool runOnMethod(Method *M) {
- if (SelectInstructionsForMethod(M, Target))
- cerr << "Instr selection failed for method " << M->getName() << "\n";
+ bool runOnMethod(Function *F) {
+ if (SelectInstructionsForMethod(F, Target)) {
+ cerr << "Instr selection failed for function " << F->getName() << "\n";
+ abort();
+ }
return false;
}
};
-struct FreeMachineCodeForMethod : public MethodPass {
+struct FreeMachineCodeForFunction : public MethodPass {
static void freeMachineCode(Instruction *I) {
MachineCodeForInstruction::destroy(I);
}
- bool runOnMethod(Method *M) {
- for (Method::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI)
- for (BasicBlock::iterator I = (*MI)->begin(), E = (*MI)->end();
+ bool runOnMethod(Function *F) {
+ for (Function::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
+ for (BasicBlock::iterator I = (*FI)->begin(), E = (*FI)->end();
I != E; ++I)
MachineCodeForInstruction::get(*I).dropAllReferences();
- for (Method::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI)
- for (BasicBlock::iterator I = (*MI)->begin(), E = (*MI)->end();
+ for (Method::iterator FI = F->begin(), FE = F->end(); FI != FE; ++FI)
+ for (BasicBlock::iterator I = (*FI)->begin(), E = (*FI)->end();
I != E; ++I)
freeMachineCode(*I);
@@ -256,8 +258,8 @@ struct FreeMachineCodeForMethod : public MethodPass {
// process for the ultra sparc.
//
void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) {
- // Construct and initialize the MachineCodeForMethod object for this method.
- PM.add(new ConstructMachineCodeForMethod(*this));
+ // Construct and initialize the MachineCodeForMethod object for this fn.
+ PM.add(new ConstructMachineCodeForFunction(*this));
PM.add(new InstructionSelection(*this));
@@ -273,15 +275,15 @@ void UltraSparc::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out) {
PM.add(new InsertPrologEpilogCode(*this));
// Output assembly language to the .s file. Assembly emission is split into
- // two parts: Method output and Global value output. This is because method
- // output is pipelined with all of the rest of code generation stuff,
- // allowing machine code representations for methods to be free'd after the
- // method has been emitted.
+ // two parts: Function output and Global value output. This is because
+ // function output is pipelined with all of the rest of code generation stuff,
+ // allowing machine code representations for functions to be free'd after the
+ // function has been emitted.
//
PM.add(getMethodAsmPrinterPass(PM, Out));
- PM.add(new FreeMachineCodeForMethod()); // Free stuff no longer needed
+ PM.add(new FreeMachineCodeForFunction()); // Free stuff no longer needed
- // Emit Module level assembly after all of the methods have been processed.
+ // Emit Module level assembly after all of the functions have been processed.
PM.add(getModuleAsmPrinterPass(PM, Out));
// Emit bytecode to the sparc assembly file into its special section next
diff --git a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp
index a44dc7fbaf5..aa618c9259a 100644
--- a/llvm/lib/Target/Sparc/SparcInstrInfo.cpp
+++ b/llvm/lib/Target/Sparc/SparcInstrInfo.cpp
@@ -17,7 +17,7 @@
#include "llvm/CodeGen/InstrSelectionSupport.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/ConstantVals.h"
#include "llvm/DerivedTypes.h"
@@ -136,11 +136,10 @@ UltraSparcInstrInfo::UltraSparcInstrInfo(const TargetMachine& tgt)
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
//
void
-UltraSparcInstrInfo::CreateCodeToLoadConst(Method* method,
- Value* val,
+UltraSparcInstrInfo::CreateCodeToLoadConst(Function *F, Value* val,
Instruction* dest,
- std::vector<MachineInstr*>& minstrVec,
- std::vector<TmpInstruction*>& tempVec) const
+ std::vector<MachineInstr*>&minstrVec,
+ std::vector<TmpInstruction*>& tempVec) const
{
MachineInstr* minstr;
@@ -197,22 +196,23 @@ UltraSparcInstrInfo::CreateCodeToLoadConst(Method* method,
minstr = new MachineInstr(SETX);
minstr->SetMachineOperandVal(0, MachineOperand::MO_PCRelativeDisp, val);
- minstr->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister, tmpReg,
+ minstr->SetMachineOperandVal(1, MachineOperand::MO_VirtualRegister,tmpReg,
/*isdef*/ true);
- minstr->SetMachineOperandVal(2, MachineOperand::MO_VirtualRegister,addrVal);
+ minstr->SetMachineOperandVal(2, MachineOperand::MO_VirtualRegister,
+ addrVal);
minstrVec.push_back(minstr);
if (isa<Constant>(val))
{
// Make sure constant is emitted to constant pool in assembly code.
- MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(method);
+ MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
mcinfo.addToConstantPool(cast<Constant>(val));
// Generate the load instruction
minstr = new MachineInstr(ChooseLoadInstruction(val->getType()));
minstr->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister,
addrVal);
- minstr->SetMachineOperandConst(1, MachineOperand::MO_SignExtendedImmed,
+ minstr->SetMachineOperandConst(1,MachineOperand::MO_SignExtendedImmed,
zeroOffset);
minstr->SetMachineOperandVal(2, MachineOperand::MO_VirtualRegister,
dest);
@@ -229,7 +229,7 @@ UltraSparcInstrInfo::CreateCodeToLoadConst(Method* method,
// Any temp. registers (TmpInstruction) created are returned in `tempVec'.
//
void
-UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(Method* method,
+UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(Function *F,
Value* val,
Instruction* dest,
std::vector<MachineInstr*>& minstrVec,
@@ -238,10 +238,10 @@ UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(Method* method,
{
assert((val->getType()->isIntegral() || val->getType()->isPointerType())
&& "Source type must be integral");
- assert((dest->getType() ==Type::FloatTy || dest->getType() ==Type::DoubleTy)
+ assert((dest->getType() == Type::FloatTy || dest->getType() == Type::DoubleTy)
&& "Dest type must be float/double");
- MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(method);
+ MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
int offset = mcinfo.allocateLocalVar(target, val);
// Store instruction stores `val' to [%fp+offset].
@@ -255,7 +255,7 @@ UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(Method* method,
MachineInstr* store = new MachineInstr(ChooseStoreInstruction(tmpType));
store->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister, val);
store->SetMachineOperandReg(1, target.getRegInfo().getFramePointer());
- store->SetMachineOperandConst(2, MachineOperand::MO_SignExtendedImmed, offset);
+ store->SetMachineOperandConst(2,MachineOperand::MO_SignExtendedImmed, offset);
minstrVec.push_back(store);
// Load instruction loads [%fp+offset] to `dest'.
@@ -273,7 +273,7 @@ UltraSparcInstrInfo::CreateCodeToCopyIntToFloat(Method* method,
// See the previous function for information about return values.
//
void
-UltraSparcInstrInfo::CreateCodeToCopyFloatToInt(Method* method,
+UltraSparcInstrInfo::CreateCodeToCopyFloatToInt(Function *F,
Value* val,
Instruction* dest,
std::vector<MachineInstr*>& minstrVec,
@@ -285,7 +285,7 @@ UltraSparcInstrInfo::CreateCodeToCopyFloatToInt(Method* method,
assert((dest->getType()->isIntegral() || dest->getType()->isPointerType())
&& "Dest type must be integral");
- MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(method);
+ MachineCodeForMethod& mcinfo = MachineCodeForMethod::get(F);
int offset = mcinfo.allocateLocalVar(target, val);
// Store instruction stores `val' to [%fp+offset].
diff --git a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
index 7b6e597e4dc..2094f6ec41c 100644
--- a/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
+++ b/llvm/lib/Target/Sparc/SparcInstrSelection.cpp
@@ -24,7 +24,7 @@
#include "llvm/iMemory.h"
#include "llvm/iOther.h"
#include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
#include "llvm/ConstantVals.h"
#include "Support/MathExtras.h"
#include <math.h>
@@ -141,20 +141,20 @@ ChooseBFpccInstruction(const InstructionNode* instrNode,
// Eventually the entire BURG instruction selection should be put
// into a separate class that can hold such information.
// The static cache is not too bad because the memory for these
-// TmpInstructions will be freed along with the rest of the Method anyway.
+// TmpInstructions will be freed along with the rest of the Function anyway.
//
static TmpInstruction*
-GetTmpForCC(Value* boolVal, const Method* method, const Type* ccType)
+GetTmpForCC(Value* boolVal, const Function *F, const Type* ccType)
{
typedef std::hash_map<const Value*, TmpInstruction*> BoolTmpCache;
static BoolTmpCache boolToTmpCache; // Map boolVal -> TmpInstruction*
- static const Method* lastMethod = NULL; // Use to flush cache between methods
+ static const Function *lastFunction = 0;// Use to flush cache between funcs
assert(boolVal->getType() == Type::BoolTy && "Weird but ok! Delete assert");
- if (lastMethod != method)
+ if (lastFunction != F)
{
- lastMethod = method;
+ lastFunction = F;
boolToTmpCache.clear();
}
@@ -809,9 +809,9 @@ CreateCodeForVariableSizeAlloca(const TargetMachine& target,
// Get the constant offset from SP for dynamically allocated storage
// and create a temporary Value to hold it.
- assert(result && result->getParent() && "Result value is not part of a method?");
- Method* method = result->getParent()->getParent();
- MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(method);
+ assert(result && result->getParent() && "Result value is not part of a fn?");
+ Function *F = result->getParent()->getParent();
+ MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(F);
bool growUp;
ConstantSInt* dynamicAreaOffset =
ConstantSInt::get(Type::IntTy,
@@ -853,13 +853,14 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
vector<MachineInstr*>& getMvec)
{
assert(result && result->getParent() &&
- "Result value is not part of a method?");
- Method* method = result->getParent()->getParent();
- MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(method);
-
- // Check if the offset would small enough to use as an immediate in load/stores
- // (check LDX because all load/stores have the same-size immediate field).
- // If not, put the variable in the dynamically sized area of the frame.
+ "Result value is not part of a function?");
+ Function *F = result->getParent()->getParent();
+ MachineCodeForMethod &mcInfo = MachineCodeForMethod::get(F);
+
+ // Check if the offset would small enough to use as an immediate in
+ // load/stores (check LDX because all load/stores have the same-size immediate
+ // field). If not, put the variable in the dynamically sized area of the
+ // frame.
unsigned int paddedSizeIgnored;
int offsetFromFP = mcInfo.computeOffsetforLocalVar(target, result,
paddedSizeIgnored,
@@ -1148,7 +1149,7 @@ ForwardOperand(InstructionNode* treeNode,
void UltraSparcInstrInfo::
CreateCopyInstructionsByType(const TargetMachine& target,
- Method* method,
+ Function *F,
Value* src,
Instruction* dest,
vector<MachineInstr*>& minstrVec) const
@@ -1186,8 +1187,8 @@ CreateCopyInstructionsByType(const TargetMachine& target,
{ // `src' is constant and cannot fit in immed field for the ADD
// Insert instructions to "load" the constant into a register
vector<TmpInstruction*> tempVec;
- target.getInstrInfo().CreateCodeToLoadConst(method, src, dest,
- minstrVec,tempVec);
+ target.getInstrInfo().CreateCodeToLoadConst(F, src, dest,
+ minstrVec, tempVec);
for (unsigned i=0; i < tempVec.size(); i++)
MachineCodeForInstruction::get(dest).addTemp(tempVec[i]);
}
@@ -1235,8 +1236,8 @@ GetInstructionsForProlog(BasicBlock* entryBB,
// We will assume that local register `l0' is unused since the SAVE
// instruction must be the first instruction in each procedure.
//
- Method* method = entryBB->getParent();
- MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(method);
+ Function *F = entryBB->getParent();
+ MachineCodeForMethod& mcInfo = MachineCodeForMethod::get(F);
unsigned int staticStackSize = mcInfo.getStaticStackSize();
if (staticStackSize < (unsigned) frameInfo.getMinStackFrameSize())
OpenPOWER on IntegriCloud