search for: createstore

Displaying 20 results from an estimated 49 matches for "createstore".

2017 Jun 05
2
[newbie] trouble with global variables and CreateLoad/Store in JIT
Since the getelementptrs were implicitly generated by the CreateStore/Load I'm not sure how to get access to them. So I hacked the assignment to be done thrice: once using a manual decomposition into two GEPs and stores, once using the "big" CreateStore, once via the setGlobal function, printing addresses and memory contents at each point to the degree...
2017 Jun 04
2
[newbie] trouble with global variables and CreateLoad/Store in JIT
...type { i8*, i32 } define dllexport void @setGlobal(%Any* %ptr, %Any %value) { store %Any %value, %Any* %ptr ret void } define dllexport %Any @getGlobal(%Any* %ptr) { %val = load %Any, %Any* %ptr ret %Any %val } Trying to replace the setGlobal call with what should be equivalent builder.CreateStore(value, ptr) results in what should end up in the second (i32) slot being stored in the first (i8*). I've added ::dump() calls where the CreateStore is, and this is what I get: { i8*, i32 } { i8* @FixnumClass, i32 32 } ; for value @foo = external global { i8*, i32 } ; for ptr Even more bizar...
2014 Oct 28
2
[LLVMdev] Storing values in global variables
...use of the different contexts. And this is where I could need help. The special case I am stuck at is about storing a value in a global variable. Here is some code: IRBuilder<> builder(pi); Value *elem = builder.CreateCall(...); Value *elem_ptr = builder.CreateGEP(global_array, idx); builder.CreateStore(get_crypted_funcptr(func, builder), elem_ptr); I get a IRBuilder before some instruction (pi) in main. The element I want to store (elem) is created by some call instruction which I create via the builder. To store elem in global_array, I need a pointer, which I get via a GEP instruction which is...
2017 Jun 06
2
[newbie] trouble with global variables and CreateLoad/Store in JIT
...p = 02F80000 > class: 028D3E98 > datum: 0000007B > > Cheers, > > -- nikodemus > > > On Mon, Jun 5, 2017 at 10:57 PM, Nikodemus Siivola < > nikodemus at random-state.net> wrote: > >> Since the getelementptrs were implicitly generated by the >> CreateStore/Load I'm not sure how to get access to them. >> >> So I hacked the assignment to be done thrice: once using a manual >> decomposition into two GEPs and stores, once using the "big" CreateStore, >> once via the setGlobal function, printing addresses and memory c...
2015 Jun 30
4
[LLVMdev] Crashes on Windows 8 with >4k stack frames
...s Visual Studio 2010. Both debug and release builds are affected. The variables are created en-block at the beginning of the function with code looking like for (i=0; i<513; ++i) { AllocaInst *variable = mBuilder.CreateAlloca(Type::getInt64Ty(mContext),0,""); mBuilder.CreateStore(GetConstI("INT4_8",0),variable); } We have not yet looked at the compiled machine code (same on Win 7 and 8, or differs?). But the 4k limit made us suspicious, as there were some bug reports - some still open - regarding this limit with LLVM [1,2]. So the question is - before digging...
2012 Oct 18
1
[LLVMdev] Incrementing a pointer to array element?
...ant to create an array via an Alloca instruction like: Value *a = ir_builder.CreateAlloca( my_type, my_size ); and then I want to initialize each element of the array with values computed elsewhere like: for ( vector<Value*>::const_iterator i = v.begin(); i != v.end(); ++i ) { builder.CreateStore( *i, a ); // How do I increment 'a' to point to the next element? } how do I increment 'a' to point to the next element (taking the size of my_type into account) so that each store instruction stores in successive elements? - Paul
2019 Jul 03
2
optimisation issue in an llvm IR pass
...fore both variants // CODE FOR VARIANT #1 auto cf = IRB.CreateICmpEQ(Incr, ConstantInt::get(Int8Ty, 0)); Incr = IRB.CreateAdd(Incr, cf); // CODE FOR VARIANT #2 auto cf = IRB.CreateICmpULT(Incr, ConstantInt::get(Int8Ty, 1)); Incr = IRB.CreateAdd(Incr, cf); // vvv same code after both variants IRB.CreateStore(Incr, MapPtrIdx)->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None)); StoreInst *Store = IRB.CreateStore(ConstantInt::get(Int32Ty, cur_loc >> 1), AFLPrevLoc); Store->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, None)); // ^^^ same code after bo...
2017 Jun 06
2
[newbie] trouble with global variables and CreateLoad/Store in JIT
...eers, >>> >>> -- nikodemus >>> >>> >>> On Mon, Jun 5, 2017 at 10:57 PM, Nikodemus Siivola < >>> nikodemus at random-state.net> wrote: >>> >>>> Since the getelementptrs were implicitly generated by the >>>> CreateStore/Load I'm not sure how to get access to them. >>>> >>>> So I hacked the assignment to be done thrice: once using a manual >>>> decomposition into two GEPs and stores, once using the "big" CreateStore, >>>> once via the setGlobal function,...
2017 Jun 07
2
[newbie] trouble with global variables and CreateLoad/Store in JIT
...t;>> >>>>> >>>>> On Mon, Jun 5, 2017 at 10:57 PM, Nikodemus Siivola < >>>>> nikodemus at random-state.net> wrote: >>>>> >>>>>> Since the getelementptrs were implicitly generated by the >>>>>> CreateStore/Load I'm not sure how to get access to them. >>>>>> >>>>>> So I hacked the assignment to be done thrice: once using a manual >>>>>> decomposition into two GEPs and stores, once using the "big" CreateStore, >>>>>>...
2019 Jul 03
3
optimisation issue in an llvm IR pass
...CmpEQ(Incr, ConstantInt::get(Int8Ty, 0)); > Incr = IRB.CreateAdd(Incr, cf); > > // CODE FOR VARIANT #2 > auto cf = IRB.CreateICmpULT(Incr, ConstantInt::get(Int8Ty, 1)); > Incr = IRB.CreateAdd(Incr, cf); > > // vvv same code after both variants > IRB.CreateStore(Incr, > MapPtrIdx)->setMetadata(M.getMDKindID("nosanitize"), MDNode::get(C, > None)); > StoreInst *Store = IRB.CreateStore(ConstantInt::get(Int32Ty, cur_loc >> > 1), AFLPrevLoc); > Store->setMetadata(M.getMDKindID("nosanitize"), MDN...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...; Builder(I->getContext()); Builder.SetInsertPoint(I->getNextNode()); GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey"); if (key) { LoadInst* load = Builder.CreateLoad(key); Value* inc = Builder.CreateAdd(load, Builder.getInt64(1)); StoreInst* store = Builder.CreateStore(inc, key); return store; } return I; } Instruction* InstructionVisitor::print(Instruction* I, const char* text, Value* arg1, Value* arg2, Value* arg3, Value* arg4) { Function* printfFn = I->getModule()->getFunction("printf"); if (printfFn) { IRBuilder<> Builder(I->getConte...
2018 Mar 13
2
How to optimize store of constant arrays
Hi all, I have this problem: I'm using LLVM's C++ API, mostly `IRBuilder<>` to generate code. Some of the generated code is just storing constant data to a location provided as a function argument. Something like `ir_builder.CreateStore(get_default_data(), ptrValue)` where `get_default_data()` may return a `ConstantArray` of `i8` and `ptrValue` is a function argument. Looking at the generated assembly, it seems inefficient, it generates a separate instruction for storing each byte relative to the pointer. Each instruction take...
2009 Aug 05
2
[LLVMdev] Dominator error inserting instructions into BasicBlock
...alueSymbolTable* vst = first_block->getValueSymbolTable(); IRBuilder <> builder(first_block); for (ValueSymbolTable::iterator vst_it = vst->begin(); vst_it != vst->end(); vst_it++) { AllocaInst* store_var = builder.CreateAlloca(type, 0,my_name.c_str()); builder.CreateStore(symbol, store_var, true); } //Put a terminator on the block builder.CreateRetVoid(); This builds fine, but I get dominator issues when I try to test it with opt. I'm sure that I just don't understand all of the constraints on the IR, but I would appreciate it if anyone can point...
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
...(I->getContext());Builder.SetInsertPoint(I->getNextNode()); GlobalVariable* key = I->getModule()->getNamedGlobal("globalKey"); if (key) { LoadInst* load = Builder.CreateLoad(key); Value* inc = Builder.CreateAdd(load, Builder.getInt64(1)); StoreInst* store = Builder.CreateStore(inc, key);} I print that global variable during execution of instrumented code. I access it's value by key->getOperand(0), but it's unchanged. I'm using ORC JIT based on this tutorial: https://llvm.org/docs/tutorial/BuildingAJIT2.html and I run ModulePass from optimizeModule functio...
2015 Jun 30
2
[LLVMdev] Crashes on Windows 8 with >4k stack frames
...>> >> The variables are created en-block at the beginning of the function >> with code looking like >> >> for (i=0; i<513; ++i) { >> AllocaInst *variable = >> mBuilder.CreateAlloca(Type::getInt64Ty(mContext),0,""); >> mBuilder.CreateStore(GetConstI("INT4_8",0),variable); >> } >> >> We have not yet looked at the compiled machine code (same on Win 7 and >> 8, or differs?). But the 4k limit made us suspicious, as there were >> some bug reports - some still open - regarding this limit with LLVM &g...
2010 Aug 16
1
[LLVMdev] Create the Value object for StoreInst
Hello all, I would like to create a new StoreInst into a basic block. I found that I could use methods like ConstantInt::get() to provide the Value* for the first argument of the constructor of the StoreInst, but I don't know how to provide the second one. For example, if I would to do x = 1, I would like to create the "Value" object of "x" for the second argument. I
2012 Apr 09
0
[LLVMdev] Catching C++ exceptions, cleaning up, rethrowing
...): > llvm::LandingPadInst *caughtResult = > builder.CreateLandingPad(ourCaughtResultType, > personality, > numExceptionsToCatch, > "landingPad"); > // ... > > builder.CreateStore(caughtResult, caughtResultStorage); Then on line 1255: > builder.CreateResume(builder.CreateLoad(caughtResultStorage)); Are you saying that code is wrong too? - Paul
2013 Dec 02
1
[LLVMdev] must store instructions really have the exact same type pointer?
I'm getting frustrated by assertions whenever I create a store inst (via builder CreateStore). I get the error "Ptr must be a pointer to Val type!" My destination is a pointer to an equivalent to the source type. The problem is that the types were created via different generation paths and the underlying structure is a distinct object (with the exact same fields). I seem to reca...
2008 May 20
0
[LLVMdev] Making use of SSE intrinsics
...tr_y, false, basicBlock); Using an IRBuilder, something like the following (uncompiled, but it's at least approximately right): Value* x = Builder.CreateLoad(ptr_x); Function* rcpps = Intrinsic::getDeclaration(Module, Intrinsic::x86_sse_rcp_ps); Value* y = Builder.CreateCall(rcpps, x); Builder.CreateStore(y, ptr_y); > Somewhat related to this, I'd also like to know how to 'reinterpret_cast' > values. It can be quite useful to sometimes interpret a vector of > floating-point values as a vector of integers (for instance to extract the > sign, exponent and/or mantissa bits). An...
2009 Aug 23
1
[LLVMdev] Having JIT resolve extern "C" functions declared in executible
...@print(double) ; ================== END The function call is, then: // Number 10 Value* value = ConstantFP::get(getGlobalContext(), APFloat(10.0)); // Variable var is double Value* var = builder.CreateAlloca(Type::getDoubleTy(getGlobalContext()), 0, "var"); // Assign it value 10 builder.CreateStore(value, var); // Create a call to the function, passing a double var builder.CreateCall(printFunction, var, "print"); If var is DoubleTy and the arg is expecting DoubleTy, why is the assert failing? I've tried creating a vector with the var inside and create the function as below,...