t-bltg
t-bltg

Reputation: 904

Analyzing LLVM IR instruction

I'm trying to analyze the following llvm-ir instruction:

    %0 = call nonnull {}* inttoptr (i64 140019712366044 to {}* ({}*, i64)*)({}* inttoptr (i64 140019153768096 to {}*), i64 0)

I couldn't find any information on what is {}* in the docs. Is it a pointer to an empty struct ?

What does this instruction do ?

Upvotes: 0

Views: 110

Answers (1)

Nick Lewycky
Nick Lewycky

Reputation: 1342

Is it a pointer to an empty struct ?

Yup. Somewhat like a void pointer. void* is not a valid type in LLVM IR, most frontends use i8* for this purpose.

What does this instruction do ?

It's an indirect call. That first {}* is the return type of the callee (and guaranteed to be a nonnull pointer at that!), the callee is the value i64 140019712366044 casted to pointer to function that returns {}* and takes two parameters, {}* and i64. Then for the first parameter, it passes this function i64 140019153768096 casted to {}* and 0 as the second parameter.

Those constant numbers suggest that this is a JIT and those are pointers to things outside this LLVM IR module.

Upvotes: 1

Related Questions