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

The SDK directory does not exist (ubuntu 16.04) (react native) -

python - How to clone or copy a list? -

string - Using python and postgres, variables within execute function? -