If I have this example:
int a=0, b=0;
a and b are local variables and make any modifications in their values, such as:
I need to get the value in this line code during running MCJIT.
I mean by value not
Value class, but the actual integer or any type value.
What are you actually trying to do?
This is not something that can be done trivially. Obviously for this particular code-sequence:
int a = 0;
the compiler may well optimize it to
printf("a=%d\n", 1) - and you could get the value from the constant integer that is in the IR after optimisations.
If we ignore such trivial cases, and look at REAL code, that actually does things:
a = rand() % 11;
if (a < 5)
This can’t be understood by the compiler, and it’s impossible to get the value of
a, other than by storing the value with a store instruction [you need a defined place to store it, however, which makes life a bit difficult].
If you have a specific use-case that you want this for, perhaps there is something “better”, so perhaps if you can explain what you are actually trying to do, maybe someone can give you a better suggestion - no promises tho’. (For example, debuggers are able to figure out, through information stored in the debug info, how to get to a particular variable’s value - not 100% of cases, even after optimizations - but some opts some do crazy things like invert loop counts to save an instruction, which will make this break tho’)