[llvm-dev] Accessing constant contents

James Courtier-Dutton via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 1 13:25:03 PDT 2020


Hi,

I have a global variable in LLVM IR:

@mem8 = private unnamed_addr constant [9 x i8] c"Hello12\0A\00", align 1

I have loaded the module, so now have:
llvm::Value *value1;
...
value1->print(llvm::outs());
That will output:
@mem8 = private unnamed_addr constant [9 x i8] c"Hello12\0A\00", align 1

What method should I use to access the contents of the constant.
I.e. I want the "Hello12" bytes contained in @mem8 to be put in a
std::vector<int8_t>

I can access the Type hierarchy, but cannot find how to access the
value contents.

Kind Regards

James


More information about the llvm-dev mailing list