[llvm] [CodeGen] Allow negative frame indicies in Register class. (PR #164459)
Mikhail Gudim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 23 07:27:26 PDT 2025
mgudim wrote:
> > I don't understand what a "negative frame index" is supposed to be. The `Register` class can encode references to stack slots which are indices into an array of stack objects in `MachineFrameInfo` and negative indexes make no sense there, no?
>
> From MachineFrameInfo.h
>
> ```
> /// To support this, the class assigns unique integer identifiers to stack
> /// objects requested clients. These identifiers are negative integers for
> /// fixed stack objects (such as arguments passed on the stack) or nonnegative
> /// for objects that may be reordered. Instructions which refer to stack
> /// objects use a special MO_FrameIndex operand to represent these frame
> /// indexes.
> ```
@MatzeB @topperc @arsenm
We expect vast majority of the indices to be positive and a few negative ones. In theory we could "shift" the values so that we use the same 30 bits but only represent say 100 negative values and the rest are positive. I can do this too if people think its necessary.
https://github.com/llvm/llvm-project/pull/164459
More information about the llvm-commits
mailing list