Problem with variable argument intrinsics

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with variable argument intrinsics

aditya vishnubhotla
Hi,
I tried creating variable argument  intrinsics which
are to be placeholders for some instructions which
should not be executed by the backend.

Kindly help me with the errors in my "migrate_begin"
intrinsic creation

//Additions made to Intrinsics.td file:

def llvm_migrate_begin : LLVMType<iAny>;
def int_migrate_begin :
Intrinsic<[llvm_migrate_begin,llvm_vararg_ty],[IntrWriteMem],"llvm.migrate_begin">;

//A section of the code which deals with the
//"migrate_begin" intrinsic creation is as follows:

const Type **Tys=(const
Type**)calloc(extTys.size(),sizeof(Type*));     /*
extTys
vector contains data types(pointers) of formal
parameters  of the
function "f" */
int i=0;
for(vector<const Type*>::iterator
it=extTys.begin(),e=extTys.end();it!=e;it++)
        {Tys[i++]=*it;}
extTys.clear();
Module *M = bbp->getParent()->getParent();
Function *f =
Intrinsic::getDeclaration(M,Intrinsic::migrate_begin,Tys,i);
/*
migrate_begin intrinsic creation */
CallInst* CI = new CallInst(f,"migrate_begin",bbp);  
 /*bbp is pointer to basic block where
intrinsic is to be inserted*/


//Errors:

Overloaded intrinsic has incorrect suffix: '.i32.i32'.
It should be '.i32'
i32 (...)* @llvm.migrate_begin.i32.i32

Overloaded intrinsic has incorrect suffix:
'.i32.i32.i32'. It should be '.i32'
i32 (...)* @llvm.migrate_begin.i32.i32.i32

Broken module found, compilation aborted!


      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with variable argument intrinsics

Dan Gohman-2

On Feb 19, 2008, at 1:11 AM, aditya vishnubhotla wrote:

> Hi,
> I tried creating variable argument  intrinsics which
> are to be placeholders for some instructions which
> should not be executed by the backend.
>
> Kindly help me with the errors in my "migrate_begin"
> intrinsic creation
>
> //Additions made to Intrinsics.td file:
>
> def llvm_migrate_begin : LLVMType<iAny>;
> def int_migrate_begin :
> Intrinsic<[llvm_migrate_begin,llvm_vararg_ty],
> [IntrWriteMem],"llvm.migrate_begin">;

This says that the return type is overloaded (because it's iAny). But  
that's
the only overloaded part here; using variadic argument lists is  
different
from overloading.

>
>
> Overloaded intrinsic has incorrect suffix: '.i32.i32'.
> It should be '.i32'
> i32 (...)* @llvm.migrate_begin.i32.i32
>
> Overloaded intrinsic has incorrect suffix:
> '.i32.i32.i32'. It should be '.i32'
> i32 (...)* @llvm.migrate_begin.i32.i32.i32

The suffix has a part for each overloaded type in the function type.  
Since only
the return type is overloaded, the verifier is expecting only one type  
to be passed
into getDeclaration.

Dan

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Invalid intrinsic name error

aditya vishnubhotla
 Hi,
Thank You for the advice and we were able to solve
that  problem by the following modifications to the
Instrinsics.td file.
 But I now have an "Invalid Intrinsic name" error    

This error occurs presumably because the created
intrinsic is named:
llvm.migrate_begin.i32
Intrinsics.gen checks for a string length of 18
(i.e. the length without the .i32).
Kindly help me through it.

 //Additions made to Intrinsics.td file:

 def int_migrate_begin :
Intrinsic<[llvm_i32_ty,llvm_vararg_ty],
 [IntrWriteMem],"llvm.migrate_begin">;

 //A section of the code which deals with the
 //"migrate_begin" intrinsic creation is as follows:

 const Type **Tys=(const
Type**)calloc(extTys.size(),sizeof(Type*));
 /*extTys vector contains function type  of the
function "f" */
 int i=0;
 for(vector<const Type*>::iterator
 it=extTys.begin(),e=extTys.end();it!=e;it++)
{Tys[i++]=*it;}
 extTys.clear();
 Module *M = bbp->getParent()->getParent();
 Function *f =

Intrinsic::getDeclaration(M,Intrinsic::migrate_begin,Tys,i);
 /* migrate_begin intrinsic creation */
 CallInst* CI = new CallInst(f,"migrate_begin");

 //Error:

 NAME:llvm.migrate_begin.i32
 opt: Function.cpp:293: unsigned int
llvm::Function::getIntrinsicID(bool)
 const: Assertion `noAssert && "Invalid LLVM intrinsic
name"' failed.

 P.S:

> --- Dan Gohman <[hidden email]> wrote:
 > On Feb 19, 2008, at 1:11 AM, aditya vishnubhotla
 >
 > wrote:
 > > Hi,
 > > I tried creating variable argument  intrinsics
 >
 > which
 >
 > > are to be placeholders for some instructions
which
 > > should not be executed by the backend.
 > >
 > > Kindly help me with the errors in my
 >
 > "migrate_begin"
 >
 > > intrinsic creation
 > >
 > > //Additions made to Intrinsics.td file:
 > >
 > > def llvm_migrate_begin : LLVMType<iAny>;
 > > def int_migrate_begin :
 > > Intrinsic<[llvm_migrate_begin,llvm_vararg_ty],
 > > [IntrWriteMem],"llvm.migrate_begin">;
 >
 > This says that the return type is overloaded
 > (because it's iAny). But
 > that's
 > the only overloaded part here; using variadic
> > argument lists is
 > different
 > from overloading.
 >
 > > Overloaded intrinsic has incorrect suffix:
 >
 > '.i32.i32'.
 >
 > > It should be '.i32'
 > > i32 (...)* @llvm.migrate_begin.i32.i32
 > >
 > > Overloaded intrinsic has incorrect suffix:
 > > '.i32.i32.i32'. It should be '.i32'
 > > i32 (...)* @llvm.migrate_begin.i32.i32.i32
 >
 > The suffix has a part for each overloaded type in
 > the function type.
 > Since only
 > the return type is overloaded, the verifier is
 > expecting only one type
 > to be passed
 > into getDeclaration.
 >
> Dan


      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Invalid intrinsic name error

Dan Gohman-2

On Feb 20, 2008, at 6:20 AM, aditya vishnubhotla wrote:
>
> def int_migrate_begin :
> Intrinsic<[llvm_i32_ty,llvm_vararg_ty],
> [IntrWriteMem],"llvm.migrate_begin">;

This is now an intrinsic with no overloaded types. It will have
an empty-string suffix.

>
>
> Intrinsic::getDeclaration(M,Intrinsic::migrate_begin,Tys,i);
> /* migrate_begin intrinsic creation */
> CallInst* CI = new CallInst(f,"migrate_begin");
>
> //Error:
>
> NAME:llvm.migrate_begin.i32
> opt: Function.cpp:293: unsigned int
> llvm::Function::getIntrinsicID(bool)
> const: Assertion `noAssert && "Invalid LLVM intrinsic
> name"' failed.

Without overloading, there should be no types passed to
Intrinsic::getDeclaration.

Dan
_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev