On Jan 9, 2008, at 6:18 PM, Evan Cheng wrote: > Author: evancheng > Date: Wed Jan 9 20:18:37 2008 > New Revision: 45812 > > URL: http://llvm.org/viewvc/llvm-project?rev=45812&view=rev > Log: > Add a isImmutable bit to StackObject. Fixed stack objects are > immutable (in the function) unless specified otherwise.
Hi Evan, please describe what "immutable" means more clearly. The definition you have is "If true, the value of the stack object does not change in this function". Please say something like "If true, the value is set before the function is entered, and we know the function never modifies the stack slot." or something like this. Thanks! I'll make the x86 backend check this predicate. -Chris > > Modified: > llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h > > Modified: llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h?rev=45812&r1=45811&r2=45812&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineFrameInfo.h Wed Jan 9 > 20:18:37 2008 > @@ -86,8 +86,13 @@ > // the function. This field has no meaning for a variable sized > element. > int64_t SPOffset; > > - StackObject(uint64_t Sz, unsigned Al, int64_t SP) > - : Size(Sz), Alignment(Al), SPOffset(SP) {} > + // isImmutable - If true, the value of the stack object does > not change > + // in this function. By default, fixed objects are immutable > unless marked > + // otherwise. > + bool isImmutable; > + > + StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM = > false) > + : Size(Sz), Alignment(Al), SPOffset(SP), isImmutable(IM) {} > }; > > /// Objects - The list of stack objects allocated... > @@ -255,11 +260,13 @@ > > /// 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. This returns an index with a negative value. > + /// efficiency. By default, fixed objects are immutable. This > returns an > + /// index with a negative value. > /// > - int CreateFixedObject(uint64_t Size, int64_t SPOffset) { > + 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)); > + Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, > Immutable)); > return -++NumFixedObjects; > } > > @@ -269,6 +276,12 @@ > return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects); > } > > + /// isImmutableObjectIndex - Returns true if the specified index > corresponds > + /// to an immutable object. > + bool isImmutableObjectIndex(int ObjectIdx) const { > + return Objects[ObjectIdx+NumFixedObjects].isImmutable; > + } > + > /// CreateStackObject - Create a new statically sized stack > object, returning > /// a postive identifier to represent it. > /// > > > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits