[llvm-commits] [llvm] r46348 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h lib/CodeGen/MachineFunction.cpp
Chris Lattner
sabre at nondot.org
Thu Jan 24 23:19:06 PST 2008
Author: lattner
Date: Fri Jan 25 01:19:06 2008
New Revision: 46348
URL: http://llvm.org/viewvc/llvm-project?rev=46348&view=rev
Log:
move MachineFrameInfo::CreateFixedObject out of line, give MachineFrameInfo
a reference to TargetFrameInfo. Rearrange order of fields in StackObject to
save a word.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
llvm/trunk/lib/CodeGen/MachineFunction.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=46348&r1=46347&r2=46348&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Fri Jan 25 01:19:06 2008
@@ -19,6 +19,7 @@
class Type;
class MachineModuleInfo;
class MachineFunction;
+class TargetFrameInfo;
/// The CalleeSavedInfo class tracks the information need to locate where a
/// callee saved register in the current frame.
@@ -82,17 +83,17 @@
// Alignment - The required alignment of this stack slot.
unsigned Alignment;
- // SPOffset - The offset of this object from the stack pointer on entry to
- // the function. This field has no meaning for a variable sized element.
- int64_t SPOffset;
-
// isImmutable - If true, the value of the stack object is set before
// entering the function and is not modified inside the function. By
// default, fixed objects are immutable unless marked otherwise.
bool isImmutable;
+
+ // SPOffset - The offset of this object from the stack pointer on entry to
+ // the function. This field has no meaning for a variable sized element.
+ int64_t SPOffset;
StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = false)
- : Size(Sz), Alignment(Al), SPOffset(SP), isImmutable(IM) {}
+ : Size(Sz), Alignment(Al), isImmutable(IM), SPOffset(SP) {}
};
/// Objects - The list of stack objects allocated...
@@ -159,8 +160,11 @@
/// of frame layouts.
MachineModuleInfo *MMI;
+ /// TargetFrameInfo - Target information about frame layout.
+ ///
+ const TargetFrameInfo &TFI;
public:
- MachineFrameInfo() {
+ MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
HasVarSizedObjects = false;
HasCalls = false;
@@ -264,12 +268,9 @@
/// index with a negative value.
///
int CreateFixedObject(uint64_t Size, int64_t SPOffset,
- bool Immutable = true) {
- assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
- Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable));
- return -++NumFixedObjects;
- }
-
+ bool Immutable = true);
+
+
/// isFixedObjectIndex - Returns true if the specified index corresponds to a
/// fixed stack object.
bool isFixedObjectIndex(int ObjectIdx) const {
Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=46348&r1=46347&r2=46348&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Fri Jan 25 01:19:06 2008
@@ -126,7 +126,7 @@
: Annotation(MF_AID), Fn(F), Target(TM) {
RegInfo = new MachineRegisterInfo(*TM.getRegisterInfo());
MFInfo = 0;
- FrameInfo = new MachineFrameInfo();
+ FrameInfo = new MachineFrameInfo(*TM.getFrameInfo());
ConstantPool = new MachineConstantPool(TM.getTargetData());
// Set up jump table.
@@ -331,6 +331,19 @@
// MachineFrameInfo implementation
//===----------------------------------------------------------------------===//
+/// CreateFixedObject - Create a new object at a fixed location on the stack.
+/// All fixed objects should be created before other objects are created for
+/// efficiency. By default, fixed objects are immutable. This returns an
+/// index with a negative value.
+///
+int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
+ bool Immutable) {
+ assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
+ Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable));
+ return -++NumFixedObjects;
+}
+
+
void MachineFrameInfo::print(const MachineFunction &MF, std::ostream &OS) const{
int ValOffset = MF.getTarget().getFrameInfo()->getOffsetOfLocalArea();
More information about the llvm-commits
mailing list