similar to: [LLVMdev] how to get and modify a global variable inside a module

Displaying 20 results from an estimated 2000 matches similar to: "[LLVMdev] how to get and modify a global variable inside a module"

2012 Dec 05
0
[LLVMdev] how to get and modify a global variable inside a module
On 05/12/12 12:07, Dong Chen wrote: > recently, i use LLVM API to write a program to read *.ll and excute it > automatically. > Further more, i want to change some global variables inside a module. > i tried some functions provided by Module.h and ExecutionEngine.h but none > were seemed to match my need. > did someone have the experience or some advices? > thank you ;) You
2012 Dec 05
3
[LLVMdev] how to get and modify a global variable inside a module
hi Duncan Sands, i have tried the functions: GlobalValue * getNamedValue (StringRef Name) const GlobalVariable * getGlobalVariable (StringRef Name, bool AllowInternal=false) const GlobalVariable * getNamedGlobal (StringRef Name) const but i think these functions just return the ID or something else (not the Global Variable's main memory address, i am not sure) here is the thing. i
2012 Dec 05
0
[LLVMdev] how to get and modify a global variable inside a module
Hi Dong Chen, You can write a ModulePass class and implement a runOnModule method. Inside this method you can access Module::global_iterator and get a reference to all global variables of a module. With this reference, you can change this variable. But be careful, you may need to change also the references to those variables. Have a look to the method GlobalVariable::use_begin and use_end. They
2012 Dec 05
2
[LLVMdev] how to get and modify a global variable inside a module
hi Eduardo, thanks for your attention, i checked the iterator, but i didn't see any fucntion can return or modify the main memory address of a global variable inside the module. can you provide some reference code or program can achieve this? thank you very much -- View this message in context:
2012 Dec 10
2
[LLVMdev] how to get and modify a local variable's value through executionEngine?
hello guys, recently, i successfully get and modify global variable by execution engine. the functions i used are listed here: int m=1; EE->updateGlobalMapping(p->M->getGlobalVariable("x",true),&m); EE->recompileAndRelinkFunction(EntryFn); x is the global variable in the module. but how to modify the local variable in the module? -- View this message in context:
2012 Dec 10
2
[LLVMdev] how to get and modify a local variable's value through executionEngine?
hello Óscar Fuentes, thanks for your reply, if i use the API provided by parser.h and the program *.ll i parsed contains local variable, i can get a module have local variable without defines it first. i think that module is a structure like AST(i am not sure whether i was right), this must be a traversal method. am i right or do i misunderstand something? -- View this message in context:
2012 Dec 10
2
[LLVMdev] how to get and modify a local variable's value through executionEngine?
hi Óscar Fuentes, i am new to llvm, so i still have several questions. thanks for you help. (1)what is SSA form(static single assignment)? (2)how to traverse the basic blocks? if the module is gained by parser, what will the basic blocks contain? i will be on the line, thank you very much -- View this message in context:
2012 Dec 10
2
[LLVMdev] how to get and modify a local variable's value through executionEngine?
hi Óscar Fuentes , thanks for your reply, but there are still a lot of concepts i don't understand. there seems to be some document to guide you but hard to understand. can you show me some basic and easy to learn document or websites? thank you -- View this message in context:
2013 Apr 09
3
[LLVMdev] get the identifies of the unnamed temporaries from the instruction of LLVM IR
hi, Duncan, thank you for your reply; instruction "i->getOperand(0)->dump()" may print the %4 in the screen, but how can i store it in a variable like char * oprand="%4" ? -- View this message in context: http://llvm.1065342.n5.nabble.com/get-the-identifies-of-the-unnamed-temporaries-from-the-instruction-of-LLVM-IR-tp56572p56588.html Sent from the LLVM - Dev mailing
2013 Apr 14
8
[LLVMdev] llvm 'select' instruction
hello guys: i am thinking about what kind of C instructions can turn into llvm IR 'select' instruction. i tried "d=a?b:c" and compiled it using clang, i still didn't get 'select' is there anybody who knows this? thank you -- View this message in context: http://llvm.1065342.n5.nabble.com/llvm-select-instruction-tp56719.html Sent from the LLVM - Dev mailing list
2012 Dec 05
0
[LLVMdev] how to get and modify a global variable inside a module
On 12/5/12 2:49 PM, Dong Chen wrote: > here is the thing. i want to know the exact main memory address of the > Global Varibale's address when ExecutionEngine execut the *.ll code. further > more, i want to change the address, is it possible? I assume you want to adjust the value at that address, right? Then you might want to check the ExecutionEngine::getPointerToGlobal method. You
2007 Sep 22
4
[LLVMdev] RFC: Patch
Hi all, I have a patch that would potentially help Objective-C 2. In the "make_decl_llvm()" in llvm-backend.cpp, there is code to search through the already generated global variables. Objective-C goes through this code twice with the same identifier. The first time, is to create meta-data for a "property". The second time is to add a reference to that property into the
2013 Apr 14
1
[LLVMdev] llvm 'select' instruction
hi Sam: thank you for your reply. but i have another question about this 'select' instruction. i think that in LLVM IR, i can use a branch and two seperate assignments to replace 'select' instruction(am i right?). so is there any compiling option to aviod generate 'select' instruction? -- View this message in context:
2007 Sep 22
0
[LLVMdev] RFC: Patch
Hi Bill, why not just add "true" to the getGlobalVariable call? GlobalVariable *getGlobalVariable(const std::string &Name, bool AllowInternal = false) const; Ciao, Duncan.
2012 Dec 05
0
[LLVMdev] how to get and modify a global variable inside a module
Hi Dong Chen, I realized you are actually executing the IR, right? I am not sure if the things I mentioned apply in that case. Actually, I wrote a optimization pass that modify the IR. It modifies global variables and the final IR is intended to be compiled. A snippet of what I do looks like this: class TestClass : public llvm::ModulePass { public: TestClass() : llvm::ModulePass(TestClass::ID)
2015 Jul 27
2
[LLVMdev] a question about pooalloc
Hello, today I download poolalloc from " https://github.com/llvm-mirror/poolalloc". and I compiled it with LLVM3.3. Then when I excute "make",I get the error: AddressTakenAnalysis.cpp:18:30:fatal error:llvm/IR/CallSite.h: No such file or directory. ​I correct the path of callsite.h to "llvm/Support/Callsite.h". there is another error: AddressTakenAnalysis.cpp:In
2020 Sep 30
2
Creating a global variable for a struct array
Let me clarify my question. I have a struct array h1 as follows: dhash h1[10]; I want to get a Constant* to variable h1. It looks like I can use ConstantStruct::get(StructType*, ArrayRef<Constant *>) to do this. My question is how to get the second argument of type ArrayRef<Constant *> from the above variable h1. Thanks, Chaitra ________________________________ From: Tim Northover
2005 Nov 02
1
[LLVMdev] Statically Initialized Arrays
On Nov 2, 2005, at 16:39, Chris Lattner wrote: > 4. Replace the old GV with the new GV using code that looks like this: > > OldGV->replaceAllUsesWith(ConstantExpr::getCast(NewGV, > OldGV->getType()); > OldGV->eraseFromParent(); > > At the end of this, any instructions or other globals that referenced > the temporary global will now reference the new one.
2018 Sep 22
3
Quick question: How to BuildMI mov64mi32 arbitrary MMB address to memory
Dear Mr. Northover, Thank you for the quick reply. You are correct about the address-mode operands :) . I guess an important detail left out was that the basic block (call it A) that wants to calculate the address of the target stationary trampoline basic block (call it B) will be moved around in memory during run-time. Our earlier solution, before the feature was implemented to move around (A)
2004 Aug 20
1
[LLVMdev] Re:About the address of Basic Block
I really appreciated for you guys' help and thanks all you guys, Misha Brukman, Vikram S. Adve, Michael McCracken, Chris Lattner and Brian R. Gaeke . I hope I can make it clear :-). I am trying ... There is application i.e decoder.c . I compile it using llvm and get excutable file/object file ( named decoder.out/decoder.o ) and decoder.s. And I wrote another code loader.c which is trying to