variable arguement intrinsics

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

variable arguement intrinsics

aditya vishnubhotla
hi

I want to use two intrinsic functions which should be
placeholders
for some instructions which should not be executed by
the backend.

So these two intrinsics should just keep the data
dependencies while i
 try to
separate set of instructions(with more of data flow)
to be executed on
hardware.

One intrinsic which takes care of the data
dependencies  required for
 proper
execution of the hardware set and the second intrinsic
which takes care
 of
the data dependencies of other instructions on this
hardware set.

My question is can we create intrinsics with variable
number of
 arguments? if
so, how?

My other question is can we use the data type "void"
to represent the
 datatype
of the arguments instead of creating multiple
intrinsic for each
 possible
type of the dependencies?

thank you
aditya

P.S:


>
> On Jan 9, 2008, at 2:12 AM, aditya vishnubhotla
> wrote:
>
> >
> > Hi,
> >
> > I am writing a pass which identifies the
> parts(basic
> > blocks/functions) of
> > the input algorithm with more of data flow or
> control
> > flow. These parts are to
> > be separated executed by different backends.
> > My idea is to insert replacement basic blocks with
> > intrinsic instructions
> > within the basic block. These instructions should
> > satisfy the data
> > dependencies within the LLVM data structure and
> should
> > do the parameter
> > marshalling for switching to the other
> architecture to
> > and fro.
> >
> > Dependencies of the different passes:
> >
> >  analysis part
> >          |
> >        filter
> >      /      \
> > ppc          custom backend
>
> Ok.
>
> >
> > Switching between the ppc and custom backend would
> be
> > by using different
> > filter passes in two compiler runs.
> >
> > I have a couple of questions regarding the problem
> > outlined above:
> > Is the approach using intrinsic instructions
> > worthwile?
>
> Probably. If what you are trying to represent is
> truly target  
> specific then using intrinsics is good solution.
>
> > What has to be done to the existing backends to
> make
> > these new instrinsic
> > instructions known?
>
> You need to add Intrinsics??.td file to include/llvm
> as well as  
> instruction selection patterns / code to translate
> them to target  
> specific instructions.
>
> > Is there an way to eliminate two compiler runs,
> one
> > for each backend?
>
> Right now, the only way I see that can be possible
> is if you have a  
> single target capable of handling codegen for both
> parts. So for  
> example, if you can make the target into a variant
> of ppc, then you  
> can potentially dynamically switch between the two
> for different  
> BB's. But I would suggest you put the idea away for
> now. It would  
> seem to me the problem you described present plenty
> of challenges for  
> now. :-)
>
> Evan
>
> >
> > Best regards
> > Aditya
> >
> >
> >        
> >
>



      ____________________________________________________________________________________
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: variable arguement intrinsics

Dan Gohman
On Fri, Jan 25, 2008 at 07:48:50AM -0800, aditya vishnubhotla wrote:

> hi
>
> I want to use two intrinsic functions which should be
> placeholders
> for some instructions which should not be executed by
> the backend.
>
> So these two intrinsics should just keep the data
> dependencies while i
>  try to
> separate set of instructions(with more of data flow)
> to be executed on
> hardware.
>
> One intrinsic which takes care of the data
> dependencies  required for
>  proper
> execution of the hardware set and the second intrinsic
> which takes care
>  of
> the data dependencies of other instructions on this
> hardware set.
>
> My question is can we create intrinsics with variable
> number of
>  arguments? if
> so, how?

Yes, you can use llvm_vararg_ty to do this; see llvm/include/Intrinsics.td
for an example.

>
> My other question is can we use the data type "void"
> to represent the
>  datatype
> of the arguments instead of creating multiple
> intrinsic for each
>  possible
> type of the dependencies?

No, the "void" type in LLVM is only used for the return type of
a function with no return value. A variadic intrinsic with
llvm_vararg_ty may be useful though.

Depending on what you want, llvm_anyint_ty and llvm_anyfloat_ty may
alternatively be useful. These allow you to create overloaded
intrinsics.

Dan

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