Displaying 20 results from an estimated 56 matches for "getargoperand".
2011 Jan 17
5
[LLVMdev] How to get the name and argument of a function
Hi everyone:
The code I am analyzing is :
int main()
{
int i = 0;
printf("hello world!");
printf( "%d" , i );
}
I want to get each place where printf is called, and the argument used
during that call.
so I write llvm pass code like:
void Myfunction( Function & F){
for( Function::iterator b = F.begin() , be = F.end() ;
2016 Feb 16
2
Intrinsic opt failure
...lvm-3.7
Inside lib/Transforms/InstCombine/InstCombineCompares.cpp there is
attempt to optimize fabs:
if (F->getIntrinsicID() == Intrinsic::fabs ||
...
switch (I.getPredicate()) {
...
case FCmpInst::FCMP_OGT:
return new FCmpInst(FCmpInst::FCMP_ONE, CI->getArgOperand(0), RHSC);
But
CI->getArgOperand(0) returns operand with type (double*) rather then
double, because in our ABI doubles are passed via memory.
Next assertion fires inside FCmpInst ctor:
llvm::FCmpInst::FCmpInst(llvm::CmpInst::Predicate, llvm::Value*,
llvm::Value*, const llvm::Twine&): Ass...
2011 Jan 19
0
[LLVMdev] How to get the name and argument of a function
Thanks a lot!
I finally fix my problem.
My code is like this:
//CallInst* pCall pCall is a printf called in my situation
if( ConstantExpr * pCE = dyn_cast<ConstantExpr>( pCall->getArgOperand(0))){
if( GlobalVariable * pGV = dyn_cast<GlobalVariable>( pCE->getOperand(0))){
if( ConstantArray * pCA = dyn_cast<ConstantArray>(
pGV->getInitializer()
)){
Err << pCA->getAsString() <...
2010 Sep 25
2
[LLVMdev] Strange exception in SelectionDAGBuilder
...un into a weird problem. (Note, this has
nothing to do with the patch I have proposed, this error occurs with regular
old pointer-allocas.)
The exception I am getting occurs in this code here in
SelectionDAGBuilder.cpp:
*case* *Intrinsic*::gcroot:
*if* (GFI) {
*const* Value *Alloca = I.getArgOperand(0);
*const* Constant *TypeMap = cast<Constant>(I.getArgOperand(1));
* FrameIndexSDNode *FI =
cast<FrameIndexSDNode>(getValue(Alloca).getNode());*
GFI->addStackRoot(FI->getIndex(), TypeMap);
}
*return* 0;
Specifically, the cast from SDNode to FrameIndexSDNode fa...
2015 Aug 06
2
[LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event
...backend behaviors is unable to affect
> DWARF generation, right?
why do we need to affect type generation? we just need to know dwarf
type id in the backend, so we can emit it as a constant.
I still think lowering eh_typeid_for differently may work.
Like instead of doing
GV = ExtractTypeInfo(I.getArgOperand(0)) followed by
getMachineFunction().getMMI().getTypeIDFor(GV)
we can get dwarf type id from I.getArgOperand(0) if it's
any pointer to struct type.
I'm not familiar with dwarf handling part of llvm, but feels possible.
2011 Jan 18
0
[LLVMdev] How to get the name and argument of a function
...}
>
> }
> }
>
>
> How could I get the function name and the arguments when I know an
> Instruction is a function call?
There's a worked example at
http://wiki.llvm.org/HowTo:_Find_all_call_sites_of_a_function .
With the CallInst/InvokeInst you can query getArgOperand() to get the
arguments or getCallee() which return a Function -- or it might not. If
the call is an indirect call (ie., function pointer) then you don't know
what it's calling. Ignoring indirect calls, you can call getName() on a
function to get its name.
Personally, I rely heavily on...
2012 Jun 18
0
[LLVMdev] Which pass converts call printf to puts?
...rned one is still the original one
> (CI). So I am very curious about how the call instruction is replaced here.
>
> // printf("%s\n", str) --> puts(str)
> if (FormatStr == "%s\n" && CI->getNumArgOperands() > 1 &&
> CI->getArgOperand(1)->getType()->isPointerTy()) {
> EmitPutS(CI->getArgOperand(1), B, TD);
> return CI;
> }
>
> -Thomson
2010 Sep 26
0
[LLVMdev] Strange exception in SelectionDAGBuilder
...othing to do with the patch I have proposed, this error occurs with regular
> old pointer-allocas.)
>
> The exception I am getting occurs in this code here in
> SelectionDAGBuilder.cpp:
>
> *case* *Intrinsic*::gcroot:
>
> *if* (GFI) {
> *const* Value *Alloca = I.getArgOperand(0);
> *const* Constant *TypeMap = cast<Constant>(I.getArgOperand(1));
> * FrameIndexSDNode *FI = cast<FrameIndexSDNode>(getValue(Alloca).getNode());* GFI->addStackRoot(FI->getIndex(), TypeMap);
> }
> *return* 0;
>
> Specifically, the cast...
2010 Oct 23
2
[LLVMdev] Cast failure in SelectionDAGBuilder
I'm trying to track down the problem with the assertion failure in
SelectionDAGBuilder.cpp. This is the code:
*case* *Intrinsic*::gcroot:
*if* (GFI) {
*const* Value *Alloca = I.getArgOperand(0);
*const* Constant *TypeMap = cast<Constant>(I.getArgOperand(1));
* FrameIndexSDNode *FI =
cast<FrameIndexSDNode>(getValue(Alloca).getNode());*
GFI->addStackRoot(FI->getIndex(), TypeMap);
}
*return* 0
The cast<FrameIndexSDNode> is what's failing. Ap...
2012 Jun 17
5
[LLVMdev] Which pass converts call printf to puts?
I found that LLVM optimized the IR by replacing printf with puts. I
wondered which pass did this optimization? And is it common that puts is
faster (and some other metric) than printf?
--
Thanks
Thomson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120617/08aa6c45/attachment.html>
2010 Jul 15
1
[LLVMdev] Figuring out the parameters of the Call Instruction
...truction iterator on BasicBlock, I get
the RHS of instruction
but not the LHS. How do I get name of nameless LHS registers(%1, %2).
C Code : p_ptr ((unsigned long) &abc);
LLVM IR : call void @p_ptr(i64 ptrtoint (%struct.my_struct* @abc to
i64)) nounwind, !dbg !52
I think by the call CI->getArgOperand(0) you mean CI->getOperand(0).
That doesn't return the ptrtoint constant expression. The CI instruction
has shows two operands. The first operand is the function name. The
second operand
prints NULL.
thank you,
Shankha Banerjee
2014 Nov 05
3
[LLVMdev] How to lower the intrinsic function 'llvm.objectsize'?
...= b.begin(), ie = b.end();
(i != ie) && (block_split == false);) {
IntrinsicInst *ii = dyn_cast<IntrinsicInst>(&*i);
++i;
if(ii) {
switch (ii->getIntrinsicID()) {
case Intrinsic::objectsize: {
IRBuilder<> builder(ii->getParent(), ii);
Value *op1 = ii->getArgOperand(0); //i8*
uint64_t bit_size =
op1->getType()->getPointerElementType()->getPrimitiveSizeInBits();
Value *result = ConstantInt::get(ii->getType(), bit_size);
ii->replaceAllUsesWith(result);
ii->removeFromParent();
delete ii;
break;
}
}
}
I'm new to LLVM and...
2015 Jan 19
2
[LLVMdev] [INCOMPLETE] [GC] Support wrapping vararg functions in statepoint
...;,
&CI, Target);
FunctionType *TargetFuncType = cast<FunctionType>(PT->getElementType());
- Assert1(!TargetFuncType->isVarArg(),
- "gc.statepoint support for var arg functions not implemented", &CI);
const Value *NumCallArgsV = CI.getArgOperand(1);
Assert1(isa<ConstantInt>(NumCallArgsV),
@@ -2650,8 +2648,13 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) {
Assert1(NumCallArgs >= 0,
"gc.statepoint number of arguments to underlying call "
"must be p...
2015 Nov 01
2
Re-numbering address space with a pass
Hi all,
I would like my optimization pass to change an object's address space that is created by llvm.lifetime.start intrinsic. Because I want to be able to identify them later in a codegen pass. I can get a pointer from the intrinsic using CallInst::getArgOperand() function. However, I don't know what to do with it (or if it is the pointer that I want). How can I change its address space? If there is an easier way to "mark" that object, I would like to know that too.
Thanks,Erdem.
-------------- next part --------------
An HTML att...
2014 Sep 01
3
[LLVMdev] understanding DAG: node creation
Hi,
I'm not sure. But in your lowered DAG the chain nodes are the first
operands for you custom nodes, however for the other nodes the chain is
the last operand. I seem to remember that during targetlowering the
chain is the first operand and then it seems to switch over after
ISelDAG, this confused me and may have something to do with the issue
that you are seeing. I really don't
2011 Aug 25
0
[LLVMdev] [RFC] Splitting init.trampoline into init.trampoline and adjust.trampoline
...ted I think
that it is OK.
> --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> @@ -4947,12 +4947,16 @@ SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I, unsigned Intrinsic) {
> Ops[4] = DAG.getSrcValue(I.getArgOperand(0));
> Ops[5] = DAG.getSrcValue(F);
>
> - Res = DAG.getNode(ISD::TRAMPOLINE, dl,
> - DAG.getVTList(TLI.getPointerTy(), MVT::Other),
> - Ops, 6);
> + Res = DAG.getNode(ISD::INIT_TRAMPOLINE, dl, MVT::Other, Ops, 6);
>
> -...
2018 Sep 03
2
Replacing a function from one module into another one
Thank you Ahmad,
I figured out that, although the type of both p(oInst) and p(nInst) were
the same, I had to:
for (unsigned int i = 0; i < callOInst->getNumArgOperands(); i++) {
callOInst->getArgOperand(i)->mutateType(callNInst->getArgOperand(i)->getType());
}
that solves the issue at the calling instruction in the main function, but
now I see that *linkModules* does not work for me (it's a mess to bring all
the other unnecessary functions from the reference module) so what I need
is...
2011 Aug 23
2
[LLVMdev] [RFC] Splitting init.trampoline into init.trampoline and adjust.trampoline
Hi!
Attached set of patches splits llvm.init.trampoline into an "init"
phase and an "adjust" phase, as discussed on the "Go on dragonegg"
thread.
Thanks!
--
Sanjoy Das
http://playingwithpointers.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Split-intrinsics-and-DAG-nodes.patch
Type: text/x-diff
Size: 8808 bytes
Desc:
2013 Nov 04
0
[LLVMdev] Implementing an llvm.setreturnaddress intrinsic
...R(Op, DAG);
This is despite the fact that I can confirm the following line inside
SelectionDAGBuilder::visitIntrinsicCall *is* getting called:
case Intrinsic::setreturnaddress:
setValue(&I, DAG.getNode(ISD::SETRETURNADDR, sdl, TLI->getPointerTy(),
getValue(I.getArgOperand(0)),
getValue(I.getArgOperand(1))));
return 0;
My best guess is that my code is being optimized out -- but I'm not sure
where or why.
Does anyone know why this might be happening?
Thank you!
Mehrdad
-------------- next part --------------
An HTML attachment w...
2016 Feb 16
0
Intrinsic opt failure
On 2/16/2016 8:44 AM, Konstantin Vladimirov via llvm-dev wrote:
>
> CI->getArgOperand(0) returns operand with type (double*) rather then
> double, because in our ABI doubles are passed via memory.
The LLVM intrinsics in the LLVM IR must conform to whatever the IR's
requirements are. That means that even in the case of your backend, the
arguments to the intrinsic must be do...