| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return result; | 105 return result; |
| 106 } | 106 } |
| 107 | 107 |
| 108 template <typename StreamType> | 108 template <typename StreamType> |
| 109 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { | 109 inline StreamType &operator<<(StreamType &Str, const Type &Ty) { |
| 110 Str << typeString(Ty); | 110 Str << typeString(Ty); |
| 111 return Str; | 111 return Str; |
| 112 } | 112 } |
| 113 | 113 |
| 114 /// Models a type signature for a function. | 114 /// Models a type signature for a function. |
| 115 /// TODO(kschimpf): Consider using arena memory allocation for | |
| 116 /// the contents of type signatures. | |
| 117 class FuncSigType { | 115 class FuncSigType { |
| 118 // FuncSigType(const FuncSigType &Ty) = delete; | |
| 119 FuncSigType &operator=(const FuncSigType &Ty) = delete; | 116 FuncSigType &operator=(const FuncSigType &Ty) = delete; |
| 120 public: | 117 public: |
| 121 typedef std::vector<Type> ArgListType; | 118 typedef std::vector<Type> ArgListType; |
| 122 | 119 |
| 123 // Creates a function signature type with the given return type. | 120 // Creates a function signature type with the given return type. |
| 124 // Parameter types should be added using calls to appendArgType. | 121 // Parameter types should be added using calls to appendArgType. |
| 125 FuncSigType() : ReturnType(IceType_void) {} | 122 FuncSigType() : ReturnType(IceType_void) {} |
| 123 FuncSigType(const FuncSigType &Ty) = default; |
| 126 | 124 |
| 127 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } | 125 void appendArgType(Type ArgType) { ArgList.push_back(ArgType); } |
| 128 | 126 |
| 129 Type getReturnType() const { return ReturnType; } | 127 Type getReturnType() const { return ReturnType; } |
| 130 void setReturnType(Type NewType) { ReturnType = NewType; } | 128 void setReturnType(Type NewType) { ReturnType = NewType; } |
| 131 SizeT getNumArgs() const { return ArgList.size(); } | 129 SizeT getNumArgs() const { return ArgList.size(); } |
| 132 Type getArgType(SizeT Index) const { | 130 Type getArgType(SizeT Index) const { |
| 133 assert(Index < ArgList.size()); | 131 assert(Index < ArgList.size()); |
| 134 return ArgList[Index]; | 132 return ArgList[Index]; |
| 135 } | 133 } |
| 136 const ArgListType &getArgList() const { return ArgList; } | 134 const ArgListType &getArgList() const { return ArgList; } |
| 137 void dump(Ostream &Stream) const; | 135 void dump(Ostream &Stream) const; |
| 138 | 136 |
| 139 private: | 137 private: |
| 140 // The return type. | 138 // The return type. |
| 141 Type ReturnType; | 139 Type ReturnType; |
| 142 // The list of parameters. | 140 // The list of parameters. |
| 143 ArgListType ArgList; | 141 ArgListType ArgList; |
| 144 }; | 142 }; |
| 145 | 143 |
| 146 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { | 144 inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) { |
| 147 Sig.dump(Stream); | 145 Sig.dump(Stream); |
| 148 return Stream; | 146 return Stream; |
| 149 } | 147 } |
| 150 | 148 |
| 151 } // end of namespace Ice | 149 } // end of namespace Ice |
| 152 | 150 |
| 153 #endif // SUBZERO_SRC_ICETYPES_H | 151 #endif // SUBZERO_SRC_ICETYPES_H |
| OLD | NEW |