Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement StackMap v2 #73

Open
swaroop-sridhar opened this issue Aug 5, 2015 · 2 comments
Open

Implement StackMap v2 #73

swaroop-sridhar opened this issue Aug 5, 2015 · 2 comments
Assignees

Comments

@swaroop-sridhar
Copy link
Contributor

Implement the StackMap v2 proposed on LLVM list:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-July/087867.html

Header v2 {
  uint8  : Stack Map Version (2)
  uint8  : Reserved [3] (0)
  uint32 : Constants Offset (bytes)
  uint32 : Frame Records Offset (bytes)
  uint32 : Frame Registers Offset (bytes)
  uint32 : StackMap Records Offset (bytes)
  uint32 : Locations Offset (bytes)
  uint32 : LiveOuts Offset (bytes)
}

align to 8 bytes
Constants[] {
  uint64 : LargeConstant
}

align to 8 bytes
FrameRecord[] {
  uint64 : Function Address
  uint32 : Function Size
  uint32 : Stack Size
  uint16 : Flags {
    bool : HasFrame
    bool : HasVariableSizeAlloca
    bool : HasStackRealignment
    bool : HasLiveOutInfo
    bool : Reserved [12]
  }
  uint16 : Frame Base Register Dwarf RegNum
  uint16 : Num Frame Registers
  uint16 : Frame Register Index
  uint16 : Num StackMap Records
  uint16 : StackMap Record Index
}

align to 4 bytes
FrameRegister[] {
  uint16 : Dwarf RegNum
  int16  : Offset
  uint8  : Size in Bytes
  uint8  : Flags {
    bool : IsSpilled
    bool : Reserved [7]
  }
}

align to 8 bytes
StackMapRecord[] {
  uint64 : PatchPoint ID
  uint32 : Instruction Offset
  uint8  : Call size (bytes)
  uint8  : Flags {
    bool : HasLiveOutInfo
    bool : Reserved [7]
  }
  uint16 : Num Locations
  uint16 : Location Index
  uint16 : Num LiveOuts
  uint16 : LiveOut Index
}

align to 4 bytes
Location[] {
  uint8  : Register | Direct | Indirect | Constant | ConstantIndex
  uint8  : Reserved (location flags)
  uint16 : Dwarf RegNum
  int32  : Offset or SmallConstant
}

align to 2 bytes
LiveOuts[] {
  uint16 : Dwarf RegNum
  uint8  : Reserved
  uint8  : Size in Bytes
}
@swaroop-sridhar
Copy link
Contributor Author

@kyulee1 you can get the context from all the messages in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-July/087857.html

@kyulee1
Copy link

kyulee1 commented Aug 28, 2015

@swaroop-sridhar @AndyAyersMS as pointed in http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-July/088274.html , I don't understand what FrameRegister[] is for and how to get this.

align to 4 bytes
FrameRegister[] {
uint16 : Dwarf RegNum
int16 : Offset
uint8 : Size in Bytes
uint8 : Flags {
bool : IsSpilled
bool : Reserved [7]
}
}
This seems tied specifically to the assumption that registers are
spilled on entry. Given the recent work towards shrink wrapping, is
that something we want to do?

p.s. What's with the IsSpilled bit? Why would you have a record for
an unspilled register?

This was done before shrink wrapping and pristine register support.
The original problem was that the live-out set didn’t contain pristine
registers and we have to add all callee-saved register to the live-out
set too to make sure we didn’t miss anything. We could do better by
recording which callee-save registers actually got spilled and which not.
Makes sense, but isn't this still per call site information, not per
function? The format seems to imply per-function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants