how to get string literal from LLVM IR instruction -


i want string literal llvm ir.

c source code looked like:

char *test = "string"; 

llvm ir looked like:

@.str = private unnamed_addr constant [9 x i8] c"string\00", align 1 @test = global i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), align 8 

i got how in argvalue variable. --> second line of ir.. code looked : , stuck after getting constant*

getelementptrinst *gep = dyn_cast<getelementptrinst>(argvalue); value *valop = gep->getpointeroperand(); instruction *inst = dyn_cast<instruction>(valop); constant *cda = dyn_cast<constant>(inst->getoperand(0)); 

now after last statement, how constant "string" stuck at. constant *cda not null.. third line success not work if try type cast other object. please help...


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -