]> git.proxmox.com Git - rustc.git/blob - src/llvm/utils/TableGen/CodeGenIntrinsics.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / utils / TableGen / CodeGenIntrinsics.h
1 //===- CodeGenIntrinsic.h - Intrinsic Class Wrapper ------------*- C++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines a wrapper class for the 'Intrinsic' TableGen class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
15 #define LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
16
17 #include "llvm/CodeGen/MachineValueType.h"
18 #include <string>
19 #include <vector>
20
21 namespace llvm {
22 class Record;
23 class RecordKeeper;
24 class CodeGenTarget;
25
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.
33
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
39 /// "matching" types.
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;
46
47 /// RetTypeDefs - The records for each return type.
48 std::vector<Record*> RetTypeDefs;
49
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;
55
56 /// ParamTypeDefs - The records for each parameter type.
57 std::vector<Record*> ParamTypeDefs;
58 };
59
60 IntrinsicSignature IS;
61
62 // Memory mod/ref behavior of this intrinsic.
63 enum {
64 NoMem, ReadArgMem, ReadMem, ReadWriteArgMem, ReadWriteMem
65 } ModRef;
66
67 /// This is set to true if the intrinsic is overloaded by its argument
68 /// types.
69 bool isOverloaded;
70
71 /// isCommutative - True if the intrinsic is commutative.
72 bool isCommutative;
73
74 /// canThrow - True if the intrinsic can throw.
75 bool canThrow;
76
77 /// isNoDuplicate - True if the intrinsic is marked as noduplicate.
78 bool isNoDuplicate;
79
80 /// isNoReturn - True if the intrinsic is no-return.
81 bool isNoReturn;
82
83 enum ArgAttribute {
84 NoCapture,
85 ReadOnly,
86 ReadNone
87 };
88 std::vector<std::pair<unsigned, ArgAttribute> > ArgumentAttributes;
89
90 CodeGenIntrinsic(Record *R);
91 };
92
93 /// LoadIntrinsics - Read all of the intrinsics defined in the specified
94 /// .td file.
95 std::vector<CodeGenIntrinsic> LoadIntrinsics(const RecordKeeper &RC,
96 bool TargetOnly);
97 }
98
99 #endif