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 LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
15 #define LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
17 #include "llvm/CodeGen/MachineValueType.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 MSBuiltinName; // Name of the corresponding MS builtin, or "".
32 std::string TargetPrefix; // Target prefix, e.g. "ppc" for t-s intrinsics.
34 /// IntrinsicSignature - This structure holds the return values and
35 /// parameter values of an intrinsic. If the number of return values is > 1,
36 /// then the intrinsic implicitly returns a first-class aggregate. The
37 /// numbering of the types starts at 0 with the first return value and
38 /// continues from there through the parameter list. This is useful for
40 struct IntrinsicSignature {
41 /// RetVTs - The MVT::SimpleValueType for each return type. Note that this
42 /// list is only populated when in the context of a target .td file. When
43 /// building Intrinsics.td, this isn't available, because we don't know
44 /// the target pointer size.
45 std::vector<MVT::SimpleValueType> RetVTs;
47 /// RetTypeDefs - The records for each return type.
48 std::vector<Record*> RetTypeDefs;
50 /// ParamVTs - The MVT::SimpleValueType for each parameter type. Note that
51 /// this list is only populated when in the context of a target .td file.
52 /// When building Intrinsics.td, this isn't available, because we don't
53 /// know the target pointer size.
54 std::vector<MVT::SimpleValueType> ParamVTs;
56 /// ParamTypeDefs - The records for each parameter type.
57 std::vector<Record*> ParamTypeDefs;
60 IntrinsicSignature IS;
62 // Memory mod/ref behavior of this intrinsic.
64 NoMem, ReadArgMem, ReadMem, ReadWriteArgMem, ReadWriteMem
67 /// This is set to true if the intrinsic is overloaded by its argument
71 /// isCommutative - True if the intrinsic is commutative.
74 /// canThrow - True if the intrinsic can throw.
77 /// isNoDuplicate - True if the intrinsic is marked as noduplicate.
80 /// isNoReturn - True if the intrinsic is no-return.
88 std::vector<std::pair<unsigned, ArgAttribute> > ArgumentAttributes;
90 CodeGenIntrinsic(Record *R);
93 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
95 std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC,