search for: getnamedvalu

Displaying 13 results from an estimated 13 matches for "getnamedvalu".

Did you mean: getnamedvalue
2012 Dec 05
0
[LLVMdev] how to get and modify a global variable inside a module
...e 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 can get hold of the global variable by passing it's name to Module::getNamedValue. For modification it depends on what kind of modification you have in mind, so please clarify. Ciao, Duncan.
2012 Dec 05
4
[LLVMdev] how to get and modify a global variable inside a module
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 ;) -- View this message in context:
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
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)
2012 Jun 17
1
[LLVMdev] Adding code after compilation
Hi, I want to be able add a function to a module after it is (partly) compiled in JIT. Let's say we have these functions: Foo() { Stuff; } Bar() { Foo(); MoreStuff; } I want to have a module with Foo optimized and have a callable pointer to Foo. Later, I want to generate Bar, optimize it (so Foo is inlined) and than get a callable pointer to Bar. Is this possible? If so, is there a way to
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 su...
2010 Feb 27
2
[LLVMdev] 2nd attempt for a working patch for bug 2606
...is what you are referring to? Ah, I was confused. You're right, getLazyFunctionStub is the badly-named function you want. You currently have nearly the same loop in getOrEmitGlobalVariable() and getPointerToFunction(). Can you unify those, perhaps by making them searches for GlobalValues with getNamedValue()? GetLinkageResult() in lib/Linker/LinkModules.cpp has a lot of logic about choosing a function based on its linkage. You should read that to figure out how to filter GVs with various linkages in your search. Please add some tests for cross-module JITting. You'll find some of the functions...
2010 Mar 01
0
[LLVMdev] 2nd attempt for a working patch for bug 2606
...r. If there is such a doc, could you give me a link? On Feb 26, 2010, at 21:17, Jeffrey Yasskin wrote: > > You currently have nearly the same loop in getOrEmitGlobalVariable() > and getPointerToFunction(). Can you unify those, perhaps by making > them searches for GlobalValues with getNamedValue()? > > GetLinkageResult() in lib/Linker/LinkModules.cpp has a lot of logic > about choosing a function based on its linkage. You should read that > to figure out how to filter GVs with various linkages in your search. When I'm able to write a unit test, I'll re-submit a patch...
2020 Oct 01
2
Creating a global variable for a struct array
...NameInit->getType(), true, GlobalValue::PrivateLinkage, FileNameInit, ".str"); FileName = ConstantExpr::getBitCast(FileName, Int8PtrTy); // Look up the previously created static_list variable (code to produce it omitted for brevity). GlobalVariable *StaticList = Module->getNamedValue("static_list"); // Create the ConstantStruct that will initialize the first element of the array. Constant *FirstInitArr[] = { FileName, StaticList }; ConstantStruct *FirstInit = ConstantStruct::get(DHashTy, FirstInitArr); // Create an all-zero struct for the rest of th...
2010 Feb 26
0
[LLVMdev] 2nd attempt for a working patch for bug 2606
Hi Jeffrey, On Feb 26, 2010, at 16:02, Jeffrey Yasskin wrote: > [sidenote: Please try to avoid extraneous whitespace and line wrapping changes in your patches. It makes it harder to see what you're actually changing] Sorry just saw some preexisting code was not in 80 columns. > > On Fri, Feb 26, 2010 at 4:57 AM, Garrison Venn <gvenn.cfe.dev at gmail.com> wrote: > Hi
2010 Feb 26
1
[LLVMdev] 2nd attempt for a working patch for bug 2606
[sidenote: Please try to avoid extraneous whitespace and line wrapping changes in your patches. It makes it harder to see what you're actually changing] On Fri, Feb 26, 2010 at 4:57 AM, Garrison Venn <gvenn.cfe.dev at gmail.com>wrote: > Hi Olivier, > > On Feb 25, 2010, at 14:10, Olivier Meurant wrote: > > Hi Garrison, > > I finally come back from holidays and take
2013 Feb 27
3
[LLVMdev] llvm get annotations
...integrate the following part of code into runOnFunction(): std::string name = gv->getName().str(); // assumption: the zeroth operand of a Value::GlobalVariableVal is the actual Value //Module* module = ; //can I use Module& llvm::CallGraph::getModule() ? Value *v = module->getNamedValue(name)->getOperand(0); if(v->getValueID() == Value::ConstantArrayVal) { ConstantArray *ca = (ConstantArray *)v; std::cout << " argument " << a->getType()->getDescription() << " "<<a->getName().str() &l...
2014 Nov 03
8
[LLVMdev] [PATCH] Protection against stack-based memory corruption errors using SafeStack
...PointerType::get(Int8Ty->getPointerTo(), AddressSpace)); + } else { + // The unsafe stack pointer is stored in a global variable with a magic name + // FIXME: make the name start with "llvm." + UnsafeStackPtr = dyn_cast_or_null<GlobalVariable>( + M.getNamedValue("__llvm__unsafe_stack_ptr")); + + if (!UnsafeStackPtr) { + // The global variable is not defined yet, define it ourselves + UnsafeStackPtr = new GlobalVariable( + /*Module=*/ M, /*Type=*/ Int8Ty->getPointerTo(), + /*isConstant=*/ false, /*Linka...