OLD | NEW |
---|---|
1 //===- subzero/src/IceTypes.h - Primitive ICE types -------------*- C++ -*-===// | 1 //===- subzero/src/IceTypes.h - Primitive ICE types -------------*- C++ -*-===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file declares a few properties of the primitive types allowed | 10 // This file declares a few properties of the primitive types allowed |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 assert(result || Ty == IceType_f64); | 96 assert(result || Ty == IceType_f64); |
97 return result; | 97 return result; |
98 } | 98 } |
99 | 99 |
100 template <typename StreamType> | 100 template <typename StreamType> |
101 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { | 101 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { |
102 Str << typeString(Ty); | 102 Str << typeString(Ty); |
103 return Str; | 103 return Str; |
104 } | 104 } |
105 | 105 |
106 /// Models a type signature for a function. | |
Jim Stichnoth
2014/10/05 15:35:47
IceIntrinsics uses something similar to this for i
Karl
2014/10/06 21:15:54
After looking at this some more, it appears that w
| |
107 class FcnSigType { | |
Jim Stichnoth
2014/10/05 15:35:47
A little bikeshedding here... Most of the code bas
Karl
2014/10/06 21:15:54
Renamed to FuncSigType.
| |
108 FcnSigType(const FcnSigType&) = delete; | |
109 FcnSigType &operator=(const FcnSigType&) = delete; | |
110 public: | |
111 typedef std::vector<Type> ArgListType; | |
112 | |
113 // Creates a function signature type with the given return type. | |
114 // Parameter types should be added using calls to appendArgType. | |
115 explicit FcnSigType(Ice::Type ReturnType) : ReturnType(ReturnType) {} | |
Jim Stichnoth
2014/10/05 15:35:47
drop the Ice::
Karl
2014/10/06 21:15:54
Done.
| |
116 | |
117 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } | |
118 | |
119 Type getReturnType() const { return ReturnType; } | |
120 SizeT getNumArgs() const { return ArgList.size(); } | |
121 Type getArgType(SizeT Index) const { | |
122 assert(Index < ArgList.size()); | |
123 return ArgList[Index]; | |
124 } | |
125 const ArgListType &getArgList() const { return ArgList; } | |
126 void Print(Ostream &Stream) const; | |
Jim Stichnoth
2014/10/05 15:35:47
For consistency with the other dump routines:
v
Karl
2014/10/06 21:15:54
Done.
| |
127 | |
128 private: | |
129 // The return type. | |
130 Type ReturnType; | |
131 // The list of parameters. | |
132 ArgListType ArgList; | |
133 }; | |
134 | |
135 inline Ostream &operator<<(Ostream &Stream, const FcnSigType &Sig) { | |
136 Sig.Print(Stream); | |
137 return Stream; | |
138 } | |
139 | |
106 } // end of namespace Ice | 140 } // end of namespace Ice |
107 | 141 |
108 #endif // SUBZERO_SRC_ICETYPES_H | 142 #endif // SUBZERO_SRC_ICETYPES_H |
OLD | NEW |