[LLVMdev] Adding custom operation intrinsic for ASIP architectures.

Chris Lattner sabre at nondot.org
Mon Aug 6 12:25:29 PDT 2007


On Thu, 2 Aug 2007, [ISO-8859-1] Mikael Lepistö wrote:
>> Sure, that can be done.  What sort of operations require variable
>> arguments?  It might be better implemented with pattern matching in the
>> code generator than as an intrinsic.
>>
> Need for variable arguments is that we don't know beforehand
> which custom operations we support. So practically we just
> give operation name and 1 or more parameters depending
> how many parameters custom operation has.
>
> e.g. __custom_operation("addsub", a, b, c)
>
> In lowering of intrinsic function we check from the processor,
> which type of parameters our current processor has for operation
> named "addsub" and write corresponding native code.

The standard way of handling this is to add a bunch of separate 
intrinsics, on for each thing a processor supports.  For example, take a 
look at llvm/include/llvm/IntrinsicsX86.td, which has almost 200 
intrinsics.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/


More information about the llvm-dev mailing list