When using LLVM Interpreter(Aka lli
), an Instruction
object is run in Interpreter::run()
function like as in the code.
void Interpreter::run() {
while (!ECStack.empty()) {
// Interpret a single instruction & increment the "PC".
ExecutionContext &SF = ECStack.back(); // Current stack frame
Instruction &I = *SF.CurInst++; // Increment before execute
// Track the number of dynamic instructions executed.
++NumDynamicInsts;
DEBUG(dbgs() << "About to interpret: " << I << "\n");
visit(I); // Dispatch to one of the visit* methods...
}
}
A line with DEBUG
preprocessor will print the instruction that was written in .ll file like this.
About to interpret: %retval = alloca i32, align 4
How can I get the LLVM IR variable's name?
In this situation it will be %retval
.