Reputation: 1324
I"m a beginner in LLVM.
I'm trying to add metadata to instructions. I tried to work around with the following code from LLVM-Source Level Debugging:
if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction
DILocation Loc(N); // DILocation is in DebugInfo.h
unsigned Line = Loc.getLineNumber();
StringRef File = Loc.getFilename();
StringRef Dir = Loc.getDirectory();
}
What is the data type of I
in I->getMetadata("dbg")
? How should I define I
?
Thank you :)
Upvotes: 0
Views: 2229
Reputation: 26878
I
is an Instruction
. In general, throughout the LLVM codebase, documentation and code samples,
I
is an Instruction
F
is a Function
M
is a Module
For more information about the high-level structure of LLVM modules and how to get access to instructions, see
Upvotes: 3