search for: arg_end

Displaying 20 results from an estimated 72 matches for "arg_end".

2017 Mar 22
3
arg_iterator missing inc/dec operators
..., it's missing increment/decrement operators (which people typically expect to be defined for iterators). So some external code relying on this is broken. If it's not intentional, would be nice to have it fixed. Specific code that I is broken looks like this: llvm::Function f; foo(--f->arg_end()); // passing the last argument to the function. Dmitry. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170322/ccf96cef/attachment.html>
2004 Oct 12
2
[LLVMdev] GenRegisterInfo.h.inc
...is named GenRegisterInfo.h.inc and not GenRegisterInfo.inc ... Is it for a dependency problem? Back again to compilation problems under win32 with VC llvm\lib\Analysis\DataStructure\Local.cpp(628) : error C2105: '--' needs l-value the line is: Result.mergeWith(getValueDest(**--CS.arg_end())); Can I submit patches for mutate it in something like: llvm::CallSite::arg_iterator ii = CS.arg_end(); --ii; Result.mergeWith(getValueDest(**ii)); There're several of this in Local.cpp, and this is the only file affected. --- Paolo Invernizzi
2017 Mar 22
2
arg_iterator missing inc/dec operators
> The predecrement / decrement operators *do* exist on this iterator: > https://github.com/llvm-mirror/llvm/blob/master/include/ > llvm/ADT/ilist_iterator.h#L153 > > Maybe you meant: > > llvm::Function *f; > foo(&*--f->arg_end()); > > ? > Correct, I mean exactly this. Though &* is not important in this case. This code doesn't work anymore, as arg_iterator is defined differently now: https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Function.h#L57 I get an error when I'm using pre-dec...
2004 Oct 12
0
[LLVMdev] GenRegisterInfo.h.inc
...sterInfo.cpp. Does this make sense? They are both correct. > Back again to compilation problems under win32 with VC > > llvm\lib\Analysis\DataStructure\Local.cpp(628) : error C2105: '--' needs > l-value > > the line is: > > Result.mergeWith(getValueDest(**--CS.arg_end())); > > Can I submit patches for mutate it in something like: > llvm::CallSite::arg_iterator ii = CS.arg_end(); > --ii; > Result.mergeWith(getValueDest(**ii)); > > There're several of this in Local.cpp, and this is the only file affected. Yes, please submit a...
2005 Nov 08
1
TrippLite OMNI1000LCD hiddev
Joel Peshkin wrote: > > I hacked in the following additonal changes... > > Index: newhidups.c > =================================================================== > RCS file: /cvsroot/nut/nut/drivers/newhidups.c,v > retrieving revision 1.1.1.1.8.6.2.21 > diff -u -r1.1.1.1.8.6.2.21 newhidups.c > --- newhidups.c 7 Nov 2005 22:14:20 -0000 1.1.1.1.8.6.2.21 > +++
2011 Sep 16
2
[LLVMdev] How to duplicate a function?
...ate the new function body and insert it into the module... Function *NF = Function::Create(NFTy, Fn->getLinkage()); NF->copyAttributesFrom(Fn); Fn->getParent()->getFunctionList().insert(Fn, NF); NF->takeName(Fn); for (Function::arg_iterator AI=F.arg_begin(), AE=F.arg_end(), NAI=NF->arg_begin(); AI != AE; ++AI, ++NAI) { NAI->takeName(AI); } // Since we have now create the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. NF->getBasicB...
2011 Sep 21
1
[LLVMdev] Segmentation fault while adding an addtional argument
...ks, Shawn // Since we have now created the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. NF->getBasicBlockList().splice(NF->begin(), F.getBasicBlockList()); Value *Globals = NF->arg_end(); Globals->setName("globals"); ========================================================== 150 Globals->setName("globals"); (gdb) Program received signal SIGSEGV, Segmentation fault. 0x08591311 in llvm::StringRef::operator[] (this=0xbfffeca0, Index=0) at /...
2009 Nov 11
4
[LLVMdev] Adding function call in LLVM IR using IRBuilder causes assertion error
...he tutorial. My code is (this function is supposed to add a call to f in bb at pos): void addCallSite(Function *f, BasicBlock *bb, BasicBlock::iterator pos) { std::vector<Value*> args; IRBuilder<> builder(bb,pos); for(Function::arg_iterator argit = f->arg_begin();argit!=f->arg_end();argit++){ AllocaInst* allocInst = builder.CreateAlloca(argit->getType()); args.push_back(allocInst); } builder.CreateCall(f,args.begin(),args.end()); } This seems to work for functions without parameters (eg. int foo()), but once a function has a parameter I get the following...
2009 Apr 16
2
[LLVMdev] Patch: MSIL backend global pointers initialization
...::compareCallSite(CallSite A, CallSite B) { return getCallSiteFType(A)<getCallSiteFType(B); } // Constructs function type from given CallSite FunctionType* MSILWriter::getCallSiteFType(CallSite CS) { std::vector<const Type *> params; CallSite::arg_iterator AI=CS.arg_begin(), AE = CS.arg_end(); for ( ; AI!=AE; ++AI ) params.push_back((*AI)->getType()); return FunctionType::get(CS.getCalledFunction()->getReturnType(), params,CS.getCalledFunction()->isVarArg()); } Thanks! Regards, Artur -------------- next part -------------- An HTML attachment was scrubbed... URL:...
2011 Sep 16
0
[LLVMdev] How to duplicate a function?
...ate the new function body and insert it into the module... Function *NF = Function::Create(NFTy, Fn->getLinkage()); NF->copyAttributesFrom(Fn); Fn->getParent()->getFunctionList().insert(Fn, NF); NF->takeName(Fn); for (Function::arg_iterator AI=F.arg_begin(), AE=F.arg_end(), NAI=NF->arg_begin(); AI != AE; ++AI, ++NAI) { NAI->takeName(AI); } // Since we have now create the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. NF->getBasicB...
2008 Sep 13
3
[LLVMdev] Duplicate Function with duplicated Arguments
I'm now writing a pass and I wanna ask a question about how to duplicate the function and add duplicated arguments in llvm, for example: func(int a, char *b) -> func(int a, char *b, int a1, char *b1) I'm now stuck at using "getOrInsertFunction" and how to handle "getArgumentList", please share your opinion, thanks a lot! James
2009 Nov 18
2
[LLVMdev] Strange error using CallInst constructor
...Twine &NameStr, BasicBlock *InsertAtEnd); My code is: using namespace llvm; void replaceByClone(Function *f, CallInst *I){ Function *clone = CloneFunction(f); BasicBlock::iterator ii(I); ReplaceInstWithInst(I->getParent()->getInstList(),ii,CallInst(clone,clone->arg_begin(),clone->arg_end())); } Compiling generates the following error: error: no matching function for call to ‘llvm::CallInst::CallInst(llvm::Function*&, llvm::ilist_iterator<llvm::Argument>, llvm::ilist_iterator<llvm::Argument>)’ /media/work/cpp-workspace/DivComp/include/llvm/Instructions.h:985: note...
2011 Jul 06
2
[LLVMdev] First steps with LLVM and partial evaluation
...amp; ValueMap) { vector<const Type*> ArgTypes; // The user might be deleting arguments to the function by specifying them in // the ValueMap. If so, we need to not add the arguments to the arg ty vector // for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (ValueMap.count(I) == 0) // Haven't mapped the argument to anything yet? ArgTypes.push_back(I->getType()); // Create a new function type... FunctionType *FTy = FunctionType::get(F->getFunctionType()->getReturnType(),...
2017 Mar 24
2
Problem about API difference between LLVM3.5 and LLVM3.9
...nctionType *new_type = FunctionType::get(new_return_type, arg_types, type->isVarArg( )); 3 func->mutateType(PointerType::get(new_type, address_space)); 4 //Duplicate arguments 5 std::vector<Argument *> arg_list; 6 for each_custom(arg, *func, arg_begin, arg_end) 7 arg_list.push_back(&*arg); 8 for each(arg, arg_list){ 9 Argument *arg_dup = new Argument((*arg)->getType(), makeName(*arg, "_dup")); 10 func->getArgumentList().insertAfter((*arg)->getIterator(), arg_dup); 11 } -------------- nex...
2009 Jun 18
2
[LLVMdev] Referring to an argument in another function
I would like to instrument certain function calls with a function call of my own that takes some of the same arguments. For example, I would like to instrument calls to free with some function foo, so the C code would look like: foo(myarg1, myarg2, ptr); free(ptr); The problem occurs when I grab the arg from the free function and try to pass it to foo... if (isCallToFree(&I)) { Value*
2009 Jun 18
0
[LLVMdev] Referring to an argument in another function
...e arguments of the function being called. So if you're sure it's a call or invoke (not a 'free' instruction), try something like this: #include "llvm/Support/CallSite.h" // ... CallSite CS(&I); CallSite::arg_iterator ait = CS.arg_begin(), aend = CS.arg_end(); > if (ait) { You want if (ait != aend) { here. > P = &(*ait); > } > createCallInst(mem_fcall, &I, 3, getOpcodeValue(I), > getInstrIDValue(), P); > } > } > > createCallInst is my own wrapper. The...
2013 Jul 02
1
[LLVMdev] Problem selecting the correct registers for a calling convention
...re are 2 ways to analyze the arguments of a function: 1) You can get a Function pointer in LowerFormalArguments, and in LowerCall only when Callee can by dyn_casted to a GlobalAddressSDNode. By having this pointer you can then do: for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();I != E; ++I) { unsigned Bytes = TD->getTypeSizeInBits(I->getType()) / 8; // do stuff here } 2) The second case is when the dyn_cast above fails because the Callee SDValue is a ExternalSymbolSDNode. In this case you have to manually analyze the arguments using PartOffset. ---...
2017 Jun 08
4
DICompileUnit duplication in LLVM 4.0.0?
...{ Function *New = Function::Create(NewTy, Old.getLinkage(), "", &M); New->setAttributes(Old.getAttributes()); New->setCallingConv(Old.getCallingConv()); // Map old arguments to the new arguments. ValueToValueMapTy VMap; for (auto OldFI = Old.arg_begin(), OldFE = Old.arg_end(), NewFI = New->arg_begin(); OldFI != OldFE; ++OldFI, ++NewFI) { Argument &OldA = *OldFI; Argument &NewA = *NewFI; NewA.setName(OldA.getName()); VMap[&OldA] = &NewA; } SmallVector<ReturnInst *, 16> Returns; CloneAndPruneFunctionInto...
2009 Nov 17
1
[LLVMdev] LLVM target-independent code generator for reconfigurable logic
...to insert my special DAG building code to the code generator. should i completely replace SelectionDAGISel, or modify SelectionDAGISel when necessary like this: LowerArguments(BasicBlock *LLVMBB) { // code for traditional target ........... for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++Idx) { if (TLI.isStrangeTarget()) { //code for my strange target TLI.HandleArgment(...); continue; } // code for traditional target ....... } // code for traditional target ............. } tha...
2009 Apr 16
0
[LLVMdev] Patch: MSIL backend global pointers initialization
...in general bad for tests, etc. > > // Constructs function type from given CallSite At least - from arguments of the call :) > FunctionType* MSILWriter::getCallSiteFType(CallSite CS) { >   std::vector<const Type *> params; >   CallSite::arg_iterator AI=CS.arg_begin(), AE = CS.arg_end(); Why don't shorten life of AI, AE and not define them in the for() loop header? >   for ( ; AI!=AE; ++AI ) >     params.push_back((*AI)->getType()); -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University