[PATCH] D62995: [IntrinsicEmitter] Extend argument overloading with forward references.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 01:08:46 PDT 2019


sdesmalen created this revision.
sdesmalen added reviewers: RKSimon, arsenm, rnk, greened.
Herald added a subscriber: wdng.

Extend the mechanism to overload intrinsic arguments by using either 
backward or forward references to the overloadable arguments.

In for example:

  def int_something : Intrinsic<[LLVMPointerToElt<0>],
                                [llvm_anyvector_ty], []>;

LLVMPointerToElt<0> is a forward reference to the overloadable operand
of type 'llvm_anyvector_ty' and would allow intrinsics such as:

  declare i32* @llvm.something.v4i32(<4 x i32>);
  declare i64* @llvm.something.v2i64(<2 x i64>);

where the result pointer type is deduced from the element type of the 
first argument.

If the returned pointer is not a pointer to the element type, LLVM will
give an error:

  Intrinsic has incorrect return type!
  i64* (<4 x i32>)* @llvm.something.v4i32


https://reviews.llvm.org/D62995

Files:
  include/llvm/IR/Intrinsics.h
  include/llvm/IR/Intrinsics.td
  lib/IR/Function.cpp
  lib/IR/Verifier.cpp
  lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
  test/Verifier/intrinsic-arg-overloading-struct-ret.ll
  test/Verifier/intrinsic-arg-overloading.ll
  utils/TableGen/CodeGenTarget.cpp
  utils/TableGen/IntrinsicEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62995.203502.patch
Type: text/x-patch
Size: 24909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190607/c2294efe/attachment.bin>


More information about the llvm-commits mailing list