1 //===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines a wrapper class for the 'Intrinsic' TableGen class.
12 //===----------------------------------------------------------------------===//
14 #ifndef CODEGEN_INTRINSIC_H
15 #define CODEGEN_INTRINSIC_H
19 #include "llvm/CodeGen/ValueTypes.h"
26 struct CodeGenIntrinsic
{
27 Record
*TheDef
; // The actual record defining this intrinsic.
28 std::string Name
; // The name of the LLVM function "llvm.bswap.i32"
29 std::string EnumName
; // The name of the enum "bswap_i32"
30 std::string GCCBuiltinName
;// Name of the corresponding GCC builtin, or "".
31 std::string TargetPrefix
; // Target prefix, e.g. "ppc" for t-s intrinsics.
33 /// IntrinsicSignature - This structure holds the return values and
34 /// parameter values of an intrinsic. If the number of return values is > 1,
35 /// then the intrinsic implicitly returns a first-class aggregate. The
36 /// numbering of the types starts at 0 with the first return value and
37 /// continues from there through the parameter list. This is useful for
39 struct IntrinsicSignature
{
40 /// RetVTs - The MVT::SimpleValueType for each return type. Note that this
41 /// list is only populated when in the context of a target .td file. When
42 /// building Intrinsics.td, this isn't available, because we don't know
43 /// the target pointer size.
44 std::vector
<MVT::SimpleValueType
> RetVTs
;
46 /// RetTypeDefs - The records for each return type.
47 std::vector
<Record
*> RetTypeDefs
;
49 /// ParamVTs - The MVT::SimpleValueType for each parameter type. Note that
50 /// this list is only populated when in the context of a target .td file.
51 /// When building Intrinsics.td, this isn't available, because we don't
52 /// know the target pointer size.
53 std::vector
<MVT::SimpleValueType
> ParamVTs
;
55 /// ParamTypeDefs - The records for each parameter type.
56 std::vector
<Record
*> ParamTypeDefs
;
59 IntrinsicSignature IS
;
61 // Memory mod/ref behavior of this intrinsic.
63 NoMem
, ReadArgMem
, ReadMem
, WriteArgMem
, WriteMem
66 /// This is set to true if the intrinsic is overloaded by its argument
70 /// isCommutative - True if the intrinsic is commutative.
76 std::vector
<std::pair
<unsigned, ArgAttribute
> > ArgumentAttributes
;
78 CodeGenIntrinsic(Record
*R
);
81 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
83 std::vector
<CodeGenIntrinsic
> LoadIntrinsics(const RecordKeeper
&RC
,