Displaying 20 results from an estimated 22 matches for "getnumargoperand".
Did you mean:
getnumargoperands
2011 Oct 17
2
[LLVMdev] Variable name from metadata
...gt;getCalledValue();
const Function *LLVMIFunc= dyn_cast<Function>(LLVMIValue);
if( LLVMIname.compare("llvm.dbg.declare") == 0 )
{
int x = 0;
int numoperands = CI->getNumArgOperands();
for( unsigned i = 0; i != numoperands; ++i)
{
Value *v = CI->getOperand(i);
if( i == 1) //points to metadata for variable name
{
MDNode *mdnode = (MDNode *)CI->getOperand(1);
...
2011 Oct 17
0
[LLVMdev] Variable name from metadata
...read/thread/1a239f0d24db2b5c
http://markmail.org/message/fj5qg44vyjsdde7k#query:+page:1+mid:5zhmyncisenomcga+state:results
I could do following, to get the required information.
const CallInst *CI = dyn_cast<CallInst>(Insn);
int numoperands = CI->getNumArgOperands();
for( unsigned i = 0; i != numoperands; ++i)
{
Value *v = CI->getOperand(i);
MDNode *temp = (MDNode *)CI->getOperand(1) ;
DIVariable DV(temp);//TO CHECK. remove later
StringRef varName =...
2011 Sep 22
2
[LLVMdev] How to const char* Value for function argument
...amp;& !callee->isDeclaration()) continue;
if (callee->getName() != func2.getName()) continue;
SmallVector<Value*, 16> callargs(call->op_begin(), call->op_end());
callargs.insert(callargs.begin(),
ConstantInt::get(Type::getInt32Ty(context),
call->getNumArgOperands()));
callargs.insert(callargs.begin(), callee->getName());
CallInst* newcall = CallInst::Create(launch, callargs, "", call);
newcall->takeName(call);
newcall->setCallingConv(call->getCallingConv());
newcall->setAttributes(call->getAttributes());...
2012 Jun 18
0
[LLVMdev] Which pass converts call printf to puts?
...struction (puts) is
> created in EmitPutS, but the returned 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
2011 Sep 22
0
[LLVMdev] How to const char* Value for function argument
...<Value*, 16> callargs(call->op_begin(), call->op_end());
callargs.insert(callargs.begin(),
ConstantInt::get(Type::getInt32Ty(context),
call->getNumArgOperands()));
callargs.insert(callargs.begin(), callee->getName());
CallInst* newcall = CallInst::Create(launch, callargs, "", call);
newcall->takeName(call);...
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...
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>
2017 Jun 09
2
Get segfault with ModulePass
...; loc->getFilename() << '\n';
}
for (const auto& use : I.uses()) {
if (const CallInst* c = dyn_cast<CallInst>(use.getUser())) {
const Function* f = c->getCalledFunction();
if (f != nullptr) {
for (unsigned i = 0; i < c->getNumArgOperands(); ++i) {
const Use& u = c->getArgOperandUse(i);
if (u.operator->() == &I) {
Function::const_arg_iterator ai = f->arg_begin();
std::advance(ai, i);
for (const auto& use : ai->uses()) {
errs() << "ne...
2012 Feb 15
2
[LLVMdev] Wrong AliasAnalysis::getModRefInfo result
...AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
Instruction *Inst = &*I;
if ( CallInst *ci = dyn_cast<CallInst>(Inst) ){
ci->dump();
for(int i = 0; i < ci->getNumArgOperands(); i++){
Value *v = ci->getArgOperand(i);
if (GetElementPtrInst *vi = dyn_cast<GetElementPtrInst>(v)){
Value *vPtr = vi->getPointerOperand();
vPtr->dump();
if ( AllocaInst *allo = dyn_cast<AllocaInst>(vPtr) ) {...
2018 Sep 04
2
Replacing a function from one module into another one
...at 6:31 PM Daniel Moya via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> 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
>...
2018 Sep 02
2
Replacing a function from one module into another one
...With
>> 2. llvm::CallInst *callNInst =
>> static_cast<llvm::CallInst*>(nCloneInst);
>> 3. llvm::CallInst *callOInst = static_cast<llvm::CallInst*>(oInst);
>> // cast both *oInst* and *nInst*
>> 4. for (unsigned int i = 0; i < callOInst->getNumArgOperands(); i++)
>> { callNInst->setArgOperand(i,callOInst->getArgOperand(i)); } //replace
>> *p(nInst)* with *p(oInst)*
>> 5. The same 5-6 steps as before, drop and erase
>>
>> Error:
>> Call parameter type does not match function signature!
>> %0 =...
2018 Sep 02
2
Replacing a function from one module into another one
...e, from cloning instruction to
replaceAllUsesWith
2. llvm::CallInst *callNInst = static_cast<llvm::CallInst*>(nCloneInst);
3. llvm::CallInst *callOInst = static_cast<llvm::CallInst*>(oInst); //
cast both *oInst* and *nInst*
4. for (unsigned int i = 0; i < callOInst->getNumArgOperands(); i++) {
callNInst->setArgOperand(i,callOInst->getArgOperand(i)); } //replace
*p(nInst)* with *p(oInst)*
5. The same 5-6 steps as before, drop and erase
Error:
Call parameter type does not match function signature!
%0 = load i32, i32* %a, align 4
i32 %2 = call i32 @foo3(i32 %0, i...
2019 May 29
2
Problem of getNumOperands() for CallInst
Hi all,
I got a interesting problem when calling getNumOperands() of CallInst.
For example,
call void @_Z2f2PA100_i([100 x i32]* nonnull %arraydecay)
If I use getNumOperands(), it will return 2.
However, if I use getCalledFunction()->getNumParams(), it will return 1.
According to the IR, I think the number of operands of the call instruction should be 1.
I
2018 Sep 06
2
Replacing a function from one module into another one
...at lists.llvm.org> wrote:
>>>
>>>> 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...
2019 Mar 09
2
Cast a function parameter to GEP
Hi all,
I'm still working on the Interpreter class and I would like to understand
why an operand cannot be cast to GetElementPtrInst.
My code is something like:
void MyInterpreter::visitCallInst(CallInst& I)
{
for(int i = 0; i < I.getNumArgOperands(); i++) {
operand = I.getOperand(i);
if(GetElementPtrInst* CI =
dyn_cast<GetElementPtrInst>(operand)) {
errs() << "GEP\n";
} else {
operand->dump();
}
}
The specific output is:
i8* getelemen...
2012 Jan 06
2
[LLVMdev] How to duplicate a CallInst
Hi,
I have the following piece of code:
%34 = fptosi float %33 to i32
%35 = call i32 @function(i32 %34) nounwind
I would like of know how can I duplicate the statement %35 ? , as follows:
%34 = fptosi float %33 to i32
%35 = call i32 @function(i32 %34) nounwind
*%36 = **call i32 @function(i32 %34) nounwind*
*
*
i.e, two instructions exactly equal.
Using clone, results in badref.
Moreover, how
2012 Jun 18
2
[LLVMdev] Which pass converts call printf to puts?
...created in EmitPutS, but the returned 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
>
-------------- next part --------------
An HTML attachment was scr...
2018 Sep 06
2
Replacing a function from one module into another one
...t;>>>> 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
>>>>>> functio...
2012 Feb 16
0
[LLVMdev] Wrong AliasAnalysis::getModRefInfo result
...getAnalysis<AliasAnalysis>();
> for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
> Instruction *Inst = &*I;
> if ( CallInst *ci = dyn_cast<CallInst>(Inst) ){
> ci->dump();
> for(int i = 0; i < ci->getNumArgOperands(); i++){
> Value *v = ci->getArgOperand(i);
> if (GetElementPtrInst *vi = dyn_cast<GetElementPtrInst>(v)){
> Value *vPtr = vi->getPointerOperand();
> vPtr->dump();
> if ( AllocaInst *allo = dyn_cast<...
2017 Jun 11
2
Get segfault with ModulePass
...const Function* f = c->getCalledFunction();
> > if (f != nullptr) {
> > for (unsigned i = 0; i < c->getNumArgOperands(); ++i) {
> > const Use& u = c->getArgOperandUse(i);
> > if (u.operator->() == &I) {
> >...