[llvm-commits] CVS: llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp MachineFunctionInfo.cpp MachineFunctionInfo.h SparcV9BurgISel.cpp SparcV9FrameInfo.cpp SparcV9PrologEpilogInserter.cpp SparcV9RegInfo.cpp SparcV9StackSlots.cpp SparcV9TargetMachine.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Aug 18 11:13:47 PDT 2004
Changes in directory llvm/lib/Target/SparcV9:
MachineCodeForInstruction.cpp updated: 1.1 -> 1.2
MachineFunctionInfo.cpp updated: 1.1 -> 1.2
MachineFunctionInfo.h updated: 1.7 -> 1.8
SparcV9BurgISel.cpp updated: 1.7 -> 1.8
SparcV9FrameInfo.cpp updated: 1.6 -> 1.7
SparcV9PrologEpilogInserter.cpp updated: 1.46 -> 1.47
SparcV9RegInfo.cpp updated: 1.136 -> 1.137
SparcV9StackSlots.cpp updated: 1.12 -> 1.13
SparcV9TargetMachine.cpp updated: 1.120 -> 1.121
---
Log message:
Convert to the new MachineFunctionInfo interface
---
Diffs of the changes: (+28 -37)
Index: llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp
diff -u llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp:1.1 llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp:1.2
--- llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp:1.1 Mon Aug 16 17:38:02 2004
+++ llvm/lib/Target/SparcV9/MachineCodeForInstruction.cpp Wed Aug 18 13:13:34 2004
@@ -35,11 +35,11 @@
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
Index: llvm/lib/Target/SparcV9/MachineFunctionInfo.cpp
diff -u llvm/lib/Target/SparcV9/MachineFunctionInfo.cpp:1.1 llvm/lib/Target/SparcV9/MachineFunctionInfo.cpp:1.2
--- llvm/lib/Target/SparcV9/MachineFunctionInfo.cpp:1.1 Mon Aug 16 17:36:54 2004
+++ llvm/lib/Target/SparcV9/MachineFunctionInfo.cpp Wed Aug 18 13:13:34 2004
@@ -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 @@
}
-void MachineFunctionInfo::CalculateArgSize() {
+void SparcV9FunctionInfo::CalculateArgSize() {
maxOptionalArgsSize = ComputeMaxOptionalArgsSize(MF.getTarget(),
MF.getFunction(),
maxOptionalNumArgs);
@@ -86,7 +77,7 @@
}
int
-MachineFunctionInfo::computeOffsetforLocalVar(const Value* val,
+SparcV9FunctionInfo::computeOffsetforLocalVar(const Value* val,
unsigned &getPaddedSize,
unsigned sizeToUse)
{
@@ -112,7 +103,7 @@
}
-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::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 @@
}
int
-MachineFunctionInfo::pushTempValue(unsigned size)
+SparcV9FunctionInfo::pushTempValue(unsigned size)
{
unsigned align = SizeToAlignment(size, MF.getTarget());
@@ -175,6 +166,6 @@
return aligned;
}
-void MachineFunctionInfo::popAllTempValues() {
+void SparcV9FunctionInfo::popAllTempValues() {
resetTmpAreaSize(); // clear tmp area to reuse
}
Index: llvm/lib/Target/SparcV9/MachineFunctionInfo.h
diff -u llvm/lib/Target/SparcV9/MachineFunctionInfo.h:1.7 llvm/lib/Target/SparcV9/MachineFunctionInfo.h:1.8
--- llvm/lib/Target/SparcV9/MachineFunctionInfo.h:1.7 Mon Aug 16 17:37:18 2004
+++ llvm/lib/Target/SparcV9/MachineFunctionInfo.h Wed Aug 18 13:13:34 2004
@@ -1,4 +1,4 @@
-//===-- MachineFunctionInfo.h -----------------------------------*- C++ -*-===//
+//===-- SparcV9FunctionInfo.h -----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -29,7 +29,7 @@
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 @@
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;
Index: llvm/lib/Target/SparcV9/SparcV9BurgISel.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9BurgISel.cpp:1.7 llvm/lib/Target/SparcV9/SparcV9BurgISel.cpp:1.8
--- llvm/lib/Target/SparcV9/SparcV9BurgISel.cpp:1.7 Wed Aug 18 12:44:15 2004
+++ llvm/lib/Target/SparcV9/SparcV9BurgISel.cpp Wed Aug 18 13:13:34 2004
@@ -1149,7 +1149,7 @@
// 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 @@
&& "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 @@
// 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 @@
}
// 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 @@
// 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 @@
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;
Index: llvm/lib/Target/SparcV9/SparcV9FrameInfo.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9FrameInfo.cpp:1.6 llvm/lib/Target/SparcV9/SparcV9FrameInfo.cpp:1.7
--- llvm/lib/Target/SparcV9/SparcV9FrameInfo.cpp:1.6 Mon Aug 16 16:54:30 2004
+++ llvm/lib/Target/SparcV9/SparcV9FrameInfo.cpp Wed Aug 18 13:13:34 2004
@@ -22,15 +22,15 @@
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 @@
// 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;
Index: llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp:1.46 llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp:1.47
--- llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp:1.46 Mon Aug 16 16:54:30 2004
+++ llvm/lib/Target/SparcV9/SparcV9PrologEpilogInserter.cpp Wed Aug 18 13:13:34 2004
@@ -36,7 +36,7 @@
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 @@
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 %
Index: llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.136 llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.137
--- llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp:1.136 Wed Aug 18 12:44:14 2004
+++ llvm/lib/Target/SparcV9/SparcV9RegInfo.cpp Wed Aug 18 13:13:34 2004
@@ -466,7 +466,7 @@
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);
Index: llvm/lib/Target/SparcV9/SparcV9StackSlots.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9StackSlots.cpp:1.12 llvm/lib/Target/SparcV9/SparcV9StackSlots.cpp:1.13
--- llvm/lib/Target/SparcV9/SparcV9StackSlots.cpp:1.12 Mon Aug 16 16:54:30 2004
+++ llvm/lib/Target/SparcV9/SparcV9StackSlots.cpp Wed Aug 18 13:13:34 2004
@@ -40,7 +40,7 @@
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;
}
};
Index: llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp
diff -u llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.120 llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.121
--- llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp:1.120 Mon Aug 16 16:54:30 2004
+++ llvm/lib/Target/SparcV9/SparcV9TargetMachine.cpp Wed Aug 18 13:13:34 2004
@@ -98,7 +98,7 @@
}
bool runOnFunction(Function &F) {
- MachineFunction::construct(&F, Target).getInfo()->CalculateArgSize();
+ MachineFunction::construct(&F, Target).getInfo<SparcV9FunctionInfo>()->CalculateArgSize();
return false;
}
};
More information about the llvm-commits
mailing list