Kangkook Jee
2013-Jun-22 02:16 UTC
[LLVMdev] Outputting constant char array from llvm pass
Hi, all I want to know how a llvm pass output constant char array defined from the input source. Here's an example that I want to do. == test input source = char* msg = "hello, world\n"; void msg_out(char * in) { printf("msg: %s \n", in); } main () { ... msg_out(msg); ... } == llvm pass snippet =... const CallInst* ci = dyn_cast<CallInst>(val); const Function* func = ci->getCalledFunction(); if (func->getName() == "msg_out") { errs() << ci->getOperand(0); } ... With the source, the above llvm pass would print the following output. == output == i8* getelementptr inbounds ([8 x i8]* @10, i32 0, i32 0) However, what I want to implement instead is i) identify the 1st argument is a constant character array ii) if so, print out "hello, world\n" Can anyone let me know how to implement this? Thanks a lot for your help in advance! /Kangkook
Maybe Matching Threads
- [LLVMdev] How to explain this weird phenomenon????????
- [LLVMdev] How to explain this weird phenomenon????????
- [LLVMdev] How to insert a self-written function to a piece of programme
- [LLVMdev] How to const char* Value for function argument
- [LLVMdev] How to const char* Value for function argument