ConsistentProgrammer
ConsistentProgrammer

Reputation: 1324

Using GetMetadata in LLVM

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

Answers (1)

Oak
Oak

Reputation: 26878

I is an Instruction. In general, throughout the LLVM codebase, documentation and code samples,

For more information about the high-level structure of LLVM modules and how to get access to instructions, see

Upvotes: 3

Related Questions