aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-18 18:13:37 +0000
committerChris Lattner <sabre@nondot.org>2004-08-18 18:13:37 +0000
commita1e51ff2aa965467632e761774e33ce191f602e7 (patch)
tree53b834292fcab5b3240cb205d99eff6132cf77b3 /lib
parent8bdf87d1d8abde45c40b2698dd9af8407007281c (diff)
downloadexternal_llvm-a1e51ff2aa965467632e761774e33ce191f602e7.zip
external_llvm-a1e51ff2aa965467632e761774e33ce191f602e7.tar.gz
external_llvm-a1e51ff2aa965467632e761774e33ce191f602e7.tar.bz2
Convert to the new MachineFunctionInfo interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/SparcV9/MachineCodeForInstruction.cpp4
-rw-r--r--lib/Target/SparcV9/MachineFunctionInfo.cpp23
-rw-r--r--lib/Target/SparcV9/MachineFunctionInfo.h6
-rw-r--r--lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp12
-rw-r--r--lib/Target/SparcV9/SparcV9BurgISel.cpp14
-rw-r--r--lib/Target/SparcV9/SparcV9FrameInfo.cpp8
-rw-r--r--lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp4
-rw-r--r--lib/Target/SparcV9/SparcV9RegInfo.cpp2
-rw-r--r--lib/Target/SparcV9/SparcV9StackSlots.cpp2
-rw-r--r--lib/Target/SparcV9/SparcV9TargetMachine.cpp2
10 files changed, 34 insertions, 43 deletions
diff --git a/lib/Target/SparcV9/MachineCodeForInstruction.cpp b/lib/Target/SparcV9/MachineCodeForInstruction.cpp
index 96cedba..44cf572 100644
--- a/lib/Target/SparcV9/MachineCodeForInstruction.cpp
+++ b/lib/Target/SparcV9/MachineCodeForInstruction.cpp
@@ -35,11 +35,11 @@ using namespace llvm;
MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){
MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
- return MF.getInfo()->MCFIEntries[I];
+ return MF.getInfo<SparcV9FunctionInfo>()->MCFIEntries[I];
}
void MachineCodeForInstruction::destroy(const Instruction *I) {
MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
- MF.getInfo()->MCFIEntries.erase(I);
+ MF.getInfo<SparcV9FunctionInfo>()->MCFIEntries.erase(I);
}
void
diff --git a/lib/Target/SparcV9/MachineFunctionInfo.cpp b/lib/Target/SparcV9/MachineFunctionInfo.cpp
index eb66aa0..f308bf5 100644
--- a/lib/Target/SparcV9/MachineFunctionInfo.cpp
+++ b/lib/Target/SparcV9/MachineFunctionInfo.cpp
@@ -1,4 +1,4 @@
-//===-- MachineFunctionInfo.cpp -------------------------------------------===//
+//===-- SparcV9FunctionInfo.cpp -------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -20,15 +20,6 @@
#include "llvm/Target/TargetFrameInfo.h"
using namespace llvm;
-MachineFunctionInfo *MachineFunction::getInfo() const {
- if (!MFInfo) {
- MFInfo = new MachineFunctionInfo(*const_cast<MachineFunction*>(this));
- }
- return static_cast<MachineFunctionInfo*>(MFInfo);
-}
-
-
-
static unsigned
ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
unsigned &maxOptionalNumArgs)
@@ -78,7 +69,7 @@ SizeToAlignment(unsigned size, const TargetMachine& target)
}
-void MachineFunctionInfo::CalculateArgSize() {
+void SparcV9FunctionInfo::CalculateArgSize() {
maxOptionalArgsSize = ComputeMaxOptionalArgsSize(MF.getTarget(),
MF.getFunction(),
maxOptionalNumArgs);
@@ -86,7 +77,7 @@ void MachineFunctionInfo::CalculateArgSize() {
}
int
-MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
+SparcV9FunctionInfo::computeOffsetforLocalVar(const Value* val,
unsigned &getPaddedSize,
unsigned sizeToUse)
{
@@ -112,7 +103,7 @@ MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
}
-int MachineFunctionInfo::allocateLocalVar(const Value* val,
+int SparcV9FunctionInfo::allocateLocalVar(const Value* val,
unsigned sizeToUse) {
assert(! automaticVarsAreaFrozen &&
"Size of auto vars area has been used to compute an offset so "
@@ -132,7 +123,7 @@ int MachineFunctionInfo::allocateLocalVar(const Value* val,
}
int
-MachineFunctionInfo::allocateSpilledValue(const Type* type)
+SparcV9FunctionInfo::allocateSpilledValue(const Type* type)
{
assert(! spillsAreaFrozen &&
"Size of reg spills area has been used to compute an offset so "
@@ -156,7 +147,7 @@ MachineFunctionInfo::allocateSpilledValue(const Type* type)
}
int
-MachineFunctionInfo::pushTempValue(unsigned size)
+SparcV9FunctionInfo::pushTempValue(unsigned size)
{
unsigned align = SizeToAlignment(size, MF.getTarget());
@@ -175,6 +166,6 @@ MachineFunctionInfo::pushTempValue(unsigned size)
return aligned;
}
-void MachineFunctionInfo::popAllTempValues() {
+void SparcV9FunctionInfo::popAllTempValues() {
resetTmpAreaSize(); // clear tmp area to reuse
}
diff --git a/lib/Target/SparcV9/MachineFunctionInfo.h b/lib/Target/SparcV9/MachineFunctionInfo.h
index f0c970f..70bbccd 100644
--- a/lib/Target/SparcV9/MachineFunctionInfo.h
+++ b/lib/Target/SparcV9/MachineFunctionInfo.h
@@ -1,4 +1,4 @@
-//===-- MachineFunctionInfo.h -----------------------------------*- C++ -*-===//
+//===-- SparcV9FunctionInfo.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -29,7 +29,7 @@ class MachineFunction;
class Constant;
class Type;
-class MachineFunctionInfo : public MachineFunctionInfoBase {
+class SparcV9FunctionInfo : public MachineFunctionInfo {
hash_set<const Constant*> constantsForConstPool;
hash_map<const Value*, int> offsets;
@@ -48,7 +48,7 @@ class MachineFunctionInfo : public MachineFunctionInfoBase {
public:
hash_map<const Instruction*, MachineCodeForInstruction> MCFIEntries;
- MachineFunctionInfo(MachineFunction &mf) : MF(mf) {
+ SparcV9FunctionInfo(MachineFunction &mf) : MF(mf) {
staticStackSize = automaticVarsSize = regSpillsSize = 0;
maxOptionalArgsSize = maxOptionalNumArgs = currentTmpValuesSize = 0;
maxTmpValuesSize = 0;
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
index 0737249..2fd8e55 100644
--- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
@@ -424,7 +424,7 @@ void PhyRegAlloc::updateInstruction(MachineBasicBlock::iterator& MII,
unsigned Opcode = MInst->getOpcode();
// Reset tmp stack positions so they can be reused for each machine instr.
- MF->getInfo()->popAllTempValues();
+ MF->getInfo<SparcV9FunctionInfo>()->popAllTempValues();
// Mark the operands for which regs have been allocated.
bool instrNeedsSpills = markAllocatedRegs(MII);
@@ -643,7 +643,7 @@ void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR,
}
#endif
- MF->getInfo()->pushTempValue(MRI.getSpilledRegSize(RegType));
+ MF->getInfo<SparcV9FunctionInfo>()->pushTempValue(MRI.getSpilledRegSize(RegType));
std::vector<MachineInstr*> MIBef, MIAft;
std::vector<MachineInstr*> AdIMid;
@@ -796,7 +796,7 @@ PhyRegAlloc::insertCallerSavingCode(std::vector<MachineInstr*> &instrnsBefore,
// and add them to InstrnsBefore and InstrnsAfter of the
// call instruction
int StackOff =
- MF->getInfo()->pushTempValue(MRI.getSpilledRegSize(RegType));
+ MF->getInfo<SparcV9FunctionInfo>()->pushTempValue(MRI.getSpilledRegSize(RegType));
//---- Insert code for pushing the reg on stack ----------
@@ -895,7 +895,7 @@ int PhyRegAlloc::getUsableUniRegAtMI(const int RegType,
// we couldn't find an unused register. Generate code to free up a reg by
// saving it on stack and restoring after the instruction
- int TmpOff = MF->getInfo()->pushTempValue(MRI.getSpilledRegSize(RegType));
+ int TmpOff = MF->getInfo<SparcV9FunctionInfo>()->pushTempValue(MRI.getSpilledRegSize(RegType));
RegU = getUniRegNotUsedByThisInst(RC, RegType, MInst);
@@ -1103,7 +1103,7 @@ void PhyRegAlloc::allocateStackSpace4SpilledLRs() {
if (HMI->first && HMI->second) {
LiveRange *L = HMI->second; // get the LiveRange
if (L->isMarkedForSpill()) { // NOTE: allocating size of long Type **
- int stackOffset = MF->getInfo()->allocateSpilledValue(Type::LongTy);
+ int stackOffset = MF->getInfo<SparcV9FunctionInfo>()->allocateSpilledValue(Type::LongTy);
L->setSpillOffFromFP(stackOffset);
if (DEBUG_RA)
std::cerr << " LR# " << L->getUserIGNode()->getIndex()
@@ -1323,7 +1323,7 @@ bool PhyRegAlloc::runOnFunction (Function &F) {
// Reset the temp. area on the stack before use by the first instruction.
// This will also happen after updating each instruction.
- MF->getInfo()->popAllTempValues();
+ MF->getInfo<SparcV9FunctionInfo>()->popAllTempValues();
// color incoming args - if the correct color was not received
// insert code to copy to the correct register
diff --git a/lib/Target/SparcV9/SparcV9BurgISel.cpp b/lib/Target/SparcV9/SparcV9BurgISel.cpp
index 895b73b..0b4685c 100644
--- a/lib/Target/SparcV9/SparcV9BurgISel.cpp
+++ b/lib/Target/SparcV9/SparcV9BurgISel.cpp
@@ -1149,7 +1149,7 @@ void CreateCodeToCopyFloatToInt(const TargetMachine& target, Function* F,
// FIXME: For now, we allocate permanent space because the stack frame
// manager does not allow locals to be allocated (e.g., for alloca) after
// a temp is allocated!
- int offset = MachineFunction::get(F).getInfo()->allocateLocalVar(val);
+ int offset = MachineFunction::get(F).getInfo<SparcV9FunctionInfo>()->allocateLocalVar(val);
unsigned FPReg = target.getRegInfo()->getFramePointer();
@@ -1248,7 +1248,7 @@ void CreateCodeToCopyIntToFloat(const TargetMachine& target,
&& "Dest type must be float/double");
// Get a stack slot to use for the copy
- int offset = MachineFunction::get(F).getInfo()->allocateLocalVar(val);
+ int offset = MachineFunction::get(F).getInfo<SparcV9FunctionInfo>()->allocateLocalVar(val);
// Get the size of the source value being copied.
size_t srcSize = target.getTargetData().getTypeSize(val->getType());
@@ -2568,7 +2568,7 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
// You've gotta love having only 13 bits for constant offset values :-|.
//
unsigned paddedSize;
- int offsetFromFP = mcInfo.getInfo()->computeOffsetforLocalVar(result,
+ int offsetFromFP = mcInfo.getInfo<SparcV9FunctionInfo>()->computeOffsetforLocalVar(result,
paddedSize,
tsize * numElements);
@@ -2581,7 +2581,7 @@ CreateCodeForFixedSizeAlloca(const TargetMachine& target,
}
// else offset fits in immediate field so go ahead and allocate it.
- offsetFromFP = mcInfo.getInfo()->allocateLocalVar(result, tsize *numElements);
+ offsetFromFP = mcInfo.getInfo<SparcV9FunctionInfo>()->allocateLocalVar(result, tsize *numElements);
// Create a temporary Value to hold the constant offset.
// This is needed because it may not fit in the immediate field.
@@ -3924,8 +3924,8 @@ void GetInstructionsByRule(InstructionNode* subtreeRoot, int ruleForNode,
// allocated (e.g., for alloca) after a temp is
// allocated!
//
- // int tmpOffset = MF.getInfo()->pushTempValue(argSize);
- int tmpOffset = MF.getInfo()->allocateLocalVar(argVReg);
+ // int tmpOffset = MF.getInfo<SparcV9FunctionInfo>()->pushTempValue(argSize);
+ int tmpOffset = MF.getInfo<SparcV9FunctionInfo>()->allocateLocalVar(argVReg);
// Generate the store from FP reg to stack
unsigned StoreOpcode = ChooseStoreInstruction(argType);
@@ -4083,7 +4083,7 @@ void GetInstructionsByRule(InstructionNode* subtreeRoot, int ruleForNode,
if (isa<Function>(callee))
callMI->addImplicitRef(retAddrReg, /*isDef*/ true);
- MF.getInfo()->popAllTempValues(); // free temps used for this inst
+ MF.getInfo<SparcV9FunctionInfo>()->popAllTempValues(); // free temps used for this inst
}
break;
diff --git a/lib/Target/SparcV9/SparcV9FrameInfo.cpp b/lib/Target/SparcV9/SparcV9FrameInfo.cpp
index 59e8113..bdddad6 100644
--- a/lib/Target/SparcV9/SparcV9FrameInfo.cpp
+++ b/lib/Target/SparcV9/SparcV9FrameInfo.cpp
@@ -22,15 +22,15 @@ int
SparcV9FrameInfo::getRegSpillAreaOffset(MachineFunction& mcInfo, bool& pos) const
{
// ensure no more auto vars are added
- mcInfo.getInfo()->freezeAutomaticVarsArea();
+ mcInfo.getInfo<SparcV9FunctionInfo>()->freezeAutomaticVarsArea();
pos = false; // static stack area grows downwards
- unsigned autoVarsSize = mcInfo.getInfo()->getAutomaticVarsSize();
+ unsigned autoVarsSize = mcInfo.getInfo<SparcV9FunctionInfo>()->getAutomaticVarsSize();
return StaticAreaOffsetFromFP - autoVarsSize;
}
int SparcV9FrameInfo::getTmpAreaOffset(MachineFunction& mcInfo, bool& pos) const {
- MachineFunctionInfo *MFI = mcInfo.getInfo();
+ SparcV9FunctionInfo *MFI = mcInfo.getInfo<SparcV9FunctionInfo>();
MFI->freezeAutomaticVarsArea(); // ensure no more auto vars are added
MFI->freezeSpillsArea(); // ensure no more spill slots are added
@@ -48,7 +48,7 @@ SparcV9FrameInfo::getDynamicAreaOffset(MachineFunction& mcInfo, bool& pos) const
// during calls and traps, so they are shifted downwards on each
// dynamic-size alloca.
pos = false;
- unsigned optArgsSize = mcInfo.getInfo()->getMaxOptionalArgsSize();
+ unsigned optArgsSize = mcInfo.getInfo<SparcV9FunctionInfo>()->getMaxOptionalArgsSize();
if (int extra = optArgsSize % 16)
optArgsSize += (16 - extra);
int offset = optArgsSize + FirstOptionalOutgoingArgOffsetFromSP;
diff --git a/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp b/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp
index 419b110..47cab90 100644
--- a/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp
+++ b/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp
@@ -36,7 +36,7 @@ namespace {
const char *getPassName() const { return "SparcV9 Prolog/Epilog Inserter"; }
bool runOnMachineFunction(MachineFunction &F) {
- if (!F.getInfo()->isCompiledAsLeafMethod()) {
+ if (!F.getInfo<SparcV9FunctionInfo>()->isCompiledAsLeafMethod()) {
InsertPrologCode(F);
InsertEpilogCode(F);
}
@@ -51,7 +51,7 @@ namespace {
static unsigned getStaticStackSize (MachineFunction &MF) {
const TargetFrameInfo& frameInfo = *MF.getTarget().getFrameInfo();
- unsigned staticStackSize = MF.getInfo()->getStaticStackSize();
+ unsigned staticStackSize = MF.getInfo<SparcV9FunctionInfo>()->getStaticStackSize();
if (staticStackSize < (unsigned)SparcV9FrameInfo::MinStackFrameSize)
staticStackSize = SparcV9FrameInfo::MinStackFrameSize;
if (unsigned padsz = staticStackSize %
diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp
index 7e62819..e5f4073 100644
--- a/lib/Target/SparcV9/SparcV9RegInfo.cpp
+++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp
@@ -466,7 +466,7 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
regClassIDOfArgReg == IntRegClassID &&
"This should only be an Int register for an FP argument");
- int TmpOff = MachineFunction::get(Meth).getInfo()->pushTempValue(
+ int TmpOff = MachineFunction::get(Meth).getInfo<SparcV9FunctionInfo>()->pushTempValue(
getSpilledRegSize(regType));
cpReg2MemMI(InstrnsBefore,
UniArgReg, getFramePointer(), TmpOff, IntRegType);
diff --git a/lib/Target/SparcV9/SparcV9StackSlots.cpp b/lib/Target/SparcV9/SparcV9StackSlots.cpp
index 693d29e..90aca0d 100644
--- a/lib/Target/SparcV9/SparcV9StackSlots.cpp
+++ b/lib/Target/SparcV9/SparcV9StackSlots.cpp
@@ -40,7 +40,7 @@ namespace {
unsigned Size = Target.getTargetData().getTypeSize(PtrInt);
Value *V = Constant::getNullValue(Type::IntTy);
- MF.getInfo()->allocateLocalVar(V, 2*Size);
+ MF.getInfo<SparcV9FunctionInfo>()->allocateLocalVar(V, 2*Size);
return true;
}
};
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index bca50ab..29a208c 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -98,7 +98,7 @@ namespace {
}
bool runOnFunction(Function &F) {
- MachineFunction::construct(&F, Target).getInfo()->CalculateArgSize();
+ MachineFunction::construct(&F, Target).getInfo<SparcV9FunctionInfo>()->CalculateArgSize();
return false;
}
};