[LLVMdev] variable arguement intrinsics

Dan Gohman djg at cray.com
Mon Jan 28 11:14:33 PST 2008


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.



More information about the llvm-dev mailing list