[llvm-dev] Problem in interpreting LLVM Stack Map

Kavindu Gimhan Zoysa via llvm-dev llvm-dev at lists.llvm.org
Fri May 14 06:36:24 PDT 2021


Hi all,

Let's say I have placed statepoints as follows.

>
> define @foo() {
>    %1 = call malloc(4)
>    ...
> }
> define @bar() {
>    %1 = call malloc(4)
>    %token = call @llvm..statepoint.p0f_isVoidf(....foo(), ... i8* %2)
>    %afterRelo = call @llvm.gc.relocate(token %token, i32 7, i32 7)
>    ...
> }
> define @main() {
>    %1 = call malloc(4)
>    %token = call @llvm..statepoint.p0f_isVoidf(....bar(), ... i8* %2)
> }


If I check the LLVM StackMap, for the *bar *function, locations look like
this,

 Kind : 4
> Flags : 0
> Location Size : 8
> Reg Num : 0
> Reserved : 0
> Offset : 0
>


> Kind : 4
> Flags : 0
> Location Size : 8
> Reg Num : 0
> Reserved : 0
> Offset : 0
>


> Kind : 4
> Flags : 0
> Location Size : 8
> Reg Num : 0
> Reserved : 0
> Offset : 0
>


> Kind : 3
> Flags : 0
> Location Size : 8
> Reg Num : 7
> Reserved : 0
> Offset : 0
>


> Kind : 3
> Flags : 0
> Location Size : 8
> Reg Num : 7
> Reserved : 0
> Offset : 0


After reading document [1], I figured out that if the kind is 3, the
location of heap reference can be found at BP + Offset. But here the offset
is 0. Could you please explain me how to interpret this stack frame, and
how do we find the location of a given heap reference in the stack map for
a given heap reference?

[1]: https://llvm.org/docs/StackMaps.html#stack-map-format

Thank you in advance,
Kavindu

Kavindu Gimhan Zoysa,
BSc(Hons) | ENTC | UoM,
SSE | WSO2

GitHub <https://github.com/KavinduZoysa> LinkedIn
<https://www.linkedin.com/in/kavindu-gimhan-zoysa-85939a122/> Medium
<https://medium.com/@kavindugimhanzoysa>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210514/edf4a122/attachment.html>


More information about the llvm-dev mailing list