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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 /// Models a type signature for a function. | 124 /// Models a type signature for a function. |
125 class FuncSigType { | 125 class FuncSigType { |
126 FuncSigType &operator=(const FuncSigType &Ty) = delete; | 126 FuncSigType &operator=(const FuncSigType &Ty) = delete; |
127 | 127 |
128 public: | 128 public: |
129 typedef std::vector<Type> ArgListType; | 129 typedef std::vector<Type> ArgListType; |
130 | 130 |
131 // Creates a function signature type with the given return type. | 131 // Creates a function signature type with the given return type. |
132 // Parameter types should be added using calls to appendArgType. | 132 // Parameter types should be added using calls to appendArgType. |
133 FuncSigType() : ReturnType(IceType_void) {} | 133 FuncSigType() = default; |
134 FuncSigType(const FuncSigType &Ty) = default; | 134 FuncSigType(const FuncSigType &Ty) = default; |
135 | 135 |
136 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } | 136 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } |
137 | 137 |
138 Type getReturnType() const { return ReturnType; } | 138 Type getReturnType() const { return ReturnType; } |
139 void setReturnType(Type NewType) { ReturnType = NewType; } | 139 void setReturnType(Type NewType) { ReturnType = NewType; } |
140 SizeT getNumArgs() const { return ArgList.size(); } | 140 SizeT getNumArgs() const { return ArgList.size(); } |
141 Type getArgType(SizeT Index) const { | 141 Type getArgType(SizeT Index) const { |
142 assert(Index < ArgList.size()); | 142 assert(Index < ArgList.size()); |
143 return ArgList[Index]; | 143 return ArgList[Index]; |
144 } | 144 } |
145 const ArgListType &getArgList() const { return ArgList; } | 145 const ArgListType &getArgList() const { return ArgList; } |
146 void dump(Ostream &Stream) const; | 146 void dump(Ostream &Stream) const; |
147 | 147 |
148 private: | 148 private: |
149 // The return type. | 149 // The return type. |
150 Type ReturnType; | 150 Type ReturnType = IceType_void; |
151 // The list of parameters. | 151 // The list of parameters. |
152 ArgListType ArgList; | 152 ArgListType ArgList; |
153 }; | 153 }; |
154 | 154 |
155 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { | 155 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { |
156 Sig.dump(Stream); | 156 Sig.dump(Stream); |
157 return Stream; | 157 return Stream; |
158 } | 158 } |
159 | 159 |
160 } // end of namespace Ice | 160 } // end of namespace Ice |
161 | 161 |
162 #endif // SUBZERO_SRC_ICETYPES_H | 162 #endif // SUBZERO_SRC_ICETYPES_H |
OLD | NEW |