search for: allocainst

Displaying 20 results from an estimated 275 matches for "allocainst".

2013 Jul 25
2
[LLVMdev] Error for AllocaInst and Instruction
Hi, For the following code const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb); Bb->getInstList().push_back(newInst); It gives me the error " error: no matching constructor for initialization of 'llvm::AllocaInst' AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag&qu...
2015 Jan 15
2
[LLVMdev] AllocaInst for FunctionType?
...tramform manual information to code. The manual states alloca is defined for <type>. FunstionType is a type, so alloca for functionType should be possible? Not? If we have a valid Module *m we can get an allocate instruction allocating space for a non-argumented function as follows: AllocaInst* pa2 = new AllocaInst( FunctionType::get( Type::getVoidTy(m->getContext()), false ) , 1, "myName"); but how about nonvar-argumented functions? E.g. I32,I16 std::vector<Type*>FuncTy_args; FuncTy_args.push_back(IntegerType::get(mod->getContext(), 32)); FuncTy...
2013 Jul 31
1
[LLVMdev] Instruction insertion By Module Pass
Thank you for your help I tried Instruction* p=&( Bb->front()); Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type,"flag", p); that works well but I need to store the value of the variable too. What's the method that could be used to store specific value?? On 30 July 2013 16:01, John Criswell <criswell at illinois.edu> wrote: > On 7/30/13 7:44 AM,...
2013 Jul 30
2
[LLVMdev] Instruction insertion By Module Pass
Hi, I need to insert new instruction into every basic block like x=1 or while loop I tried this code, but it doesn't work Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); AllocaInst* newInst = new AllocaInst(Int32Type,"flag", Bb); Bb->getInstList().push_back(newInst); the error: void llvm::SymbolTableListTraits<llvm::Instruction, llvm::BasicBlock>::addNodeToList(ValueSubClass *) [ValueSubClass = llvm::Instruction, ItemParentClass = llvm::BasicBlock]: Asser...
2018 Sep 20
2
Added AllocaInsts are relocated in stack
...have "data, metadata, data, metadata", however, I was seeing "data, data, metadata, metadata" in the actual stack. Investigating into this problem, I realized that when printing the instruction instance (errs() << AI << "\n"), there is a numbering for each AllocaInst. However, the newly-added AllocaInsts, during instrumentation, are having a way higher number than the original AllocaInsts', and I guess that is why all the original local variables are first located in the stack, and then the metadata that I added are inserted into the stack. I am wondering...
2013 Jul 30
0
[LLVMdev] Instruction insertion By Module Pass
On 7/30/13 7:44 AM, Rasha Omar wrote: > Hi, > I need to insert new instruction into every basic block like x=1 > or while loop > I tried this code, but it doesn't work > > Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext()); > AllocaInst* newInst = new AllocaInst(Int32Type,"flag", Bb); > Bb->getInstList().push_back(newInst); The problem is that you've inserted the AllocaInst into the basic block via the AllocaInst constructor (note the Bb at the end of the line with new AllocaInst). You then attempt to inse...
2010 May 28
2
[LLVMdev] Retrieving Underlying Type from AllocaInst
Is there a recommended way to retrieve the original type from an AllocaInst object? For example, I am creating alloca instructions using the IRBuilder interface like: alloca = builder.CreateAlloca( Type::getDoubleTy( context ), 0, variableName.c_str() ); and I place the alloca into a symbol table. Later when I am generating instructions for an assignment operation, I w...
2010 May 28
2
[LLVMdev] Retrieving Underlying Type from AllocaInst
...y looking for, I suppose, was a Value class virtual member function something like getLoadStoreType or perhaps getReferencedType which returned the type as it would be used in a load or store. It appears that both load and store do handle the pointer dereferencing automatically for both types, i.e. AllocaInst and GlobalVariable both dereference the pointers automatically. I can cast the value I get from the symbol table to a AllocaInst, of course, in the case where it is one, but this requires a test for one and is just as messy as first getting the type and then testing it for being a PointerType and...
2007 Mar 06
6
[LLVMdev] alloca & store generation
...eb = M.getMainFunction()->getEntryBlock(); Function::arg_iterator argc_it = mainfun->arg_begin(); Function::arg_iterator argv_it = argc_it; ++argv_it; Argument* argc = &*argc_it; Argument* argv = &*argv_it; Instruction* insertNewInstsBefore = &eb->front(); AllocaInst* argc_alloca = new AllocaInst(argc->getType(), "", insertNewInstsBefore); AllocaInst* argv_alloca = new AllocaInst(argv->getType(), "", insertNewInstsBefore); new StoreInst(argc, argc_alloca, false, insertNewInstsBefore); new StoreInst(argv, argv_a...
2010 May 28
0
[LLVMdev] Retrieving Underlying Type from AllocaInst
Curtis Faith wrote: > Is there a recommended way to retrieve the original type from an > AllocaInst object? > > For example, I am creating alloca instructions using the IRBuilder > interface like: > > alloca = builder.CreateAlloca( Type::getDoubleTy( context ), 0, > variableName.c_str() ); > > and I place the alloca into a symbol table. > > Later when I am generating...
2010 May 28
0
[LLVMdev] Retrieving Underlying Type from AllocaInst
...was > a Value class virtual member function something like getLoadStoreType or > perhaps getReferencedType which returned the type as it would be used in a > load or store. It appears that both load and store do handle the pointer > dereferencing automatically for both types, > i.e. AllocaInst and GlobalVariable both dereference the pointers > automatically. > I can cast the value I get from the symbol table to a AllocaInst, of course, > in the case where it is one, but this requires a test for one and is just as > messy as first getting the type and then testing it for being...
2019 Jul 28
2
Efficient way to identify an instruction
...at 10:09, Alberto Barbaro via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > Having the reference I to the instruction in bold.Can i efficiently know > that the variable %11 was "created" by the %3 = alloca [40 x i8], align 16. > > Yes, I.getOperand(0) *is* the AllocaInst in this case. So for example > isa<AllocaInst>(I.getOperand(0)) will return true. And if you care > about more details you can dyn_cast<AllocaInst> it and check any other > properties you want. > > I would like to use the approach you described considering I to be a refer...
2007 Mar 06
0
[LLVMdev] alloca & store generation
> Why isn't llvm giving a name to the value returned by the allocas and > using it in the store instructions? Because you pass in an empty string for the name in the new AllocaInst calls below. Replace the empty strings with "argc_addr" or whatever you want. > AllocaInst* argc_alloca = new AllocaInst(argc->getType(), "", > insertNewInstsBefore); > AllocaInst* argv_alloca = new AllocaInst(argv-&g...
2014 Jul 07
4
[LLVMdev] Splitting basic block results in unknown instruction type assertion
...PrintStackTrace(__sFILE*) + 46 1 opt 0x0000000103bcca8b PrintStackTraceSignalHandler(void*) + 27 2 opt 0x0000000103bccd99 SignalHandler(int) + 297 3 libsystem_c.dylib 0x00007fff9455990a _sigtramp + 26 4 opt 0x000000010367bbc5 llvm::AllocaInst** std::__uninitialized_copy_aux<llvm::AllocaInst* const*, llvm::AllocaInst**>(llvm::AllocaInst* const*, llvm::AllocaInst* const*, llvm::AllocaInst**, std::__true_type) + 37 5 opt 0x0000000103bccabb raise + 27 6 opt 0x0000000103bccb72 abort + 18...
2012 Sep 21
0
[LLVMdev] How To Get The Name of the type the popinter is pointing to
i am using llvm , i did this if ( AllocaInst *allocInst = dyn_cast<AllocaInst>(&*bbit)){ PointerType *p = allocInst->getType(); if ( p->getElementType()->isPointerTy()){ StringRef name = allocInst->getName();...
2010 Apr 18
4
[LLVMdev] create two Twine object
...; std::string *varname = new std::string(ss.str()); return varname->c_str(); } const char *VarNum = getVarNum(); Twine *x1 = new Twine(StringRef("status"), VarNum); // 1 Twine *x2 = new Twine(StringRef("request"), VarNum); // 2 Instruction *sstatusInst = new AllocaInst(StatusTy, *x1, entry_inst); // 3 Instruction *sreqInst = new AllocaInst(ReqTy, *x2, entry_inst); // 4 with only 1&3, my code works well, I can have status1, status2, status3, ...... with 1&2&3&4 exists at the same time, it compiles without problem, but segmentatio...
2013 Dec 12
2
[LLVMdev] LLVM Type Int32Ty Problems & LLVMContextImpl.h Problems
Hello! I'm newer to LLVM development . I'm trying to use AllocaInst class to construct an instruction , I wrote like this: AllocaInst *alloc = new AllocaInst(llvm::Int32Ty, 0, "indexLoc",i); but it return the error: error: use of undeclared identifier 'llvm::Int32Ty' AllocaInst *alloc = new AllocaInst(Int32Ty, 0, "i...
2010 Apr 18
0
[LLVMdev] create two Twine object
According to documentation Twines should be used only for temporary values and not stored, so allocating the in heap sounds wrong. I think all you need here is static int varNum; ++varNum; Instruction *sstatusInst = new AllocaInst(StatusTy, Twine("status") + Twine(varNum), entry_inst); Instruction *sreqInst = new AllocaInst(ReqTy, Twine("request") + Twine(varNum), entry_inst); btw, your getVarNum() leaks. Eugene On Sun, Apr 18, 2010 at 5:55 AM, Yuanfang Chen <tabloid.adroit at gmail.com> wrote:...
2013 Jan 11
2
[LLVMdev] Make a comparation with IR builder
Hi Justin, my class is a visitor pattern and I use accept method to go recursive in suboject in my AST. In locals I store AllocaInst pointer. void *visit(var1_init_decl_c *symbol) { llvm::Type *lType; varNames.clear(); varType = ""; symbol->var1_list->accept(*this); /* get a vector contains variable names */ symbol->spec_init->accept(*this); /* Store in varType variable list */ lType = t...
2011 Mar 04
0
[LLVMdev] AllocaInst remapped as NULL in llvm::MapValue
Hello all When using llvm-ld to link several bitcode files produced by LLVM-GCC, I ran into the problem that the resulting linked file had missing dbg entries for AllocaInst values. After some digging I found that llvm::MapValue returns NULL when it encounters an AllocaInst. The attached trivial patch fixes the problem. Is this behaviour intended? Regards, Jacob -- Jacob Zimmermann Oracle Labs, Brisbane, Queensland, Australia jacob.zimmermann at oracle.com ------...