similar to: [LLVMdev] How to define a global variable?

Displaying 20 results from an estimated 4000 matches similar to: "[LLVMdev] How to define a global variable?"

2011 Jan 13
0
[LLVMdev] How to define a global variable?
On 12 January 2011 23:38, Rob Nikander <rob.nikander at gmail.com> wrote: > I have to pass something from the LinkageTypes enum to the > constructor.  I tried others, like GlobalVariable::InternalLinkage, > which dumps as "internal global" but the error was the same. To be honest, your IR is a bit odd. I'm not a JIT expert, but here are a few things that will help you
2011 Jan 12
2
[LLVMdev] How to define a global variable?
On Wed, Jan 12, 2011 at 6:08 PM, Renato Golin <rengolin at systemcall.org> wrote: > On 12 January 2011 22:28, Rob Nikander <rob.nikander at gmail.com> wrote: >> @x = external global %0* > > Hi Rob, > > Try removing the 'extern', as it implies the variable storage is > elsewhere (ie. another object file). > I have to pass something from the
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
I don't think it's the same problem as you described. By printing I meant calling printf function and passing my global variable as one of the arguments. My code: Instruction* InstructionVisitor::incrementGlobalKey(Instruction* I) { IRBuilder<> Builder(I->getContext()); Builder.SetInsertPoint(I->getNextNode()); GlobalVariable* key =
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
Hi Everyone, I'm quite new to LLVM and I want to update value of global variable in LLVM IR. I created new global variable in ModulePass: bool runOnModule(llvm::Module &M) { IRBuilder<> Builder(M.getContext()); Instruction *I = &*inst_begin(M.getFunction("main")); Builder.SetInsertPoint(I); M.getOrInsertGlobal("globalKey",
2011 Jan 12
0
[LLVMdev] How to define a global variable?
On 12 January 2011 22:28, Rob Nikander <rob.nikander at gmail.com> wrote: > @x = external global %0* Hi Rob, Try removing the 'extern', as it implies the variable storage is elsewhere (ie. another object file). cheers, --renato
2013 Apr 07
1
[LLVMdev] How to get the Instruction where one function use the global variable.
Hi, all I try to get the Instructions where one function use the global variable. for (llvm::Module::global_iterator gvar_iter = M.global_begin(); gvar_iter != M.global_end(); gvar_iter++) { llvm::GlobalVariable *gvar = &*gvar_iter; llvm::errs() << "const global var: " << gvar->getName() << "\n"; for (
2011 Jan 13
0
[LLVMdev] How to define a global variable?
On Wed, Jan 12, 2011 at 11:28 PM, Rob Nikander <rob.nikander at gmail.com> wrote: > I'm trying to define a mutable variable, outside functions.  The code > below is trying to evaluate an expression much like "x = 1" at the > module level in Python.  It appears that when it tries to JIT the > function there is an error because there is no storage allocated for >
2013 Mar 05
4
[LLVMdev] Convert C variable to LLVM IR Variable
Hi everyone, I am doing some work with LLVM IR, I need to use LLVM IR to do operation on C variables. Code emission is done by LLVM JIT. That variable is C thread local , for example __thread int* gvar; I think some methods to convert that variable to LLVM IR, (1) use external function I know LLVM IR is able to call an external function, so I can write codes that look like: int* load()
2012 Jan 17
0
[LLVMdev] ValueMapper question: no type mapping for GlobalValue?
So it looks like the verifier doesn't catch this condition - I think it should. The attached program reproduces the problem - verification succeeds, but the linker fails with a type assertion. BTW, if no one has the bandwidth to work on this I'm willing to attempt a fix, assuming that you agree that the verifier should discover this condition. Michael Muller wrote: > >
2010 May 13
1
[LLVMdev] How to create Global Variables using LLVM API?
I am using llvm-2.6. In the online documentation, the signature is GlobalVariable::GlobalVariable ( const Type * Ty, bool isConstant, LinkageTypes Linkage, Constant * Initializer = 0, const Twine & Name = "", bool ThreadLocal = false, unsigned AddressSpace = 0 ) the link to the documenation is
2010 May 12
2
[LLVMdev] How to create Global Variables using LLVM API?
Thanks. It works. Actually, the signature of the constructor given in the online documentation is different from the actual source code. Nick Lewycky wrote: > > subramanyam wrote: >> >> I am new to LLVM API. and I am experimenting with it. >> I want to create Global Variables in a module. >> I am able to create local variables using IRBuilder class. I tried using
2019 Feb 05
2
IRBuilder constraints
Hi, I need to control IRBuilder(or manage IR building with other means) very strictly. The problem is in the realm of ConstInt/GlobalVariable handling, more precisely: LLVM converts llvm::ConstantInt values to GlobalVariable addresses ad-hoc if I store a constant in a GlobalVariable, and it appears to me, that I can do nothing about it. Consider the following, shortened code: ... 0x18: r2 =
2004 Oct 26
2
[LLVMdev] Getting started with GC
I'm in a group tasked with improving the GC of LLVM for a 421 project. We are having trouble getting started with the given SemiSpace collector. We found the string llvm_gc_initialize called from a single source file ./test/Regression/CodeGen/Generic/GC/alloc_loop.ll which we tried with the following... (showing LLVM checked out from cvs a few days ago, similar output with release 1.3) $
2004 Oct 27
0
[LLVMdev] Getting started with GC
On Tue, 26 Oct 2004, Tom Brown wrote: > I'm in a group tasked with improving the GC of LLVM for a 421 project. > We are having trouble getting started with the given SemiSpace > collector. > > We found the string llvm_gc_initialize called from a single source file > ./test/Regression/CodeGen/Generic/GC/alloc_loop.ll > which we tried with the following... (showing LLVM
2010 Feb 16
3
[LLVMdev] Creating a global variable in JIT context
I'm trying to create a global variable initialized to zero, and return its value from a newly created function, in JIT context. I'm keeping all types as i32 for the moment, and I only have the one module object. This is the code I have for creating the global variable: const Type *type = Type::getInt32Ty(getGlobalContext()); // Constant *zerov = Constant::getNullValue(type); Constant
2004 Oct 27
2
[LLVMdev] Getting started with GC
On Tue, Oct 26, 2004 at 11:17:00PM -0500, Chris Lattner wrote: > On Tue, 26 Oct 2004, Tom Brown wrote: > > $ llvm-as alloc_loop.ll > > $ lli alloc_loop.bc > > lli: Globals.cpp:81: llvm::GlobalVariable::GlobalVariable(const llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, const std::string&, llvm::Module*): Assertion `Initializer->getType() == Ty
2010 Jun 04
5
[LLVMdev] Speculative phi elimination at the top of a loop?
I am working on heavily optimising unusually static C++ code, and have encountered a situation where I basically want an optimiser that would speculatively unroll a loop to see if the first round of the loop could be optimised further. (I happen to know that it is possible.) The previous optimisations that produce the loop in the first place already do a magical job (relying heavily on constant
2014 Feb 21
12
[LLVMdev] asan coverage
> > > > We may need some additional info. What kind of additional info? > I haven't put a ton of thought into > this, but I'm hoping we can either (a) use debug info as is or add some > extra (valid) debug info to support this, or (b) add an extra > debug-info-like section to instrumented binaries with the information we > need. > I'd try this data
2012 Nov 09
2
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Dmitry, > I'm attaching a patch that should fix the issue mentioned above. It > simply makes the same check seen in the same file for global > variables: > > emitPTXAddressSpace(PTy->getAddressSpace(), O); > if (GVar->getAlignment() == 0) > O << " .align " << (int) TD->getPrefTypeAlignment(ETy); > else > O
2020 Oct 01
3
Creating a global variable for a struct array
>The type you pass to GlobalVariable's constructor for that variable should be "[10 x %struct.dlist]" because that's what you want storage for. Then the GlobalVariable itself will be a Constant of type "[10 x %struct.dlist]*". Yes, I verified that this is the case. I enabled assertions and the error seems to occur while creating GlobalVariable for both struct dhash