Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: src/IceTypes.h

Issue 625243002: Convert Subzero's bitcode reader to generate ICE types. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues in patch set 3. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceTypes.cpp » ('j') | src/PNaClTranslator.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTypes.h
diff --git a/src/IceTypes.h b/src/IceTypes.h
index 6480c2c57bdb8b52326013f5d53559de20c47ff4..83b0ecce3f3b1839551d68b35fc04c8aa43eb7cb 100644
--- a/src/IceTypes.h
+++ b/src/IceTypes.h
@@ -103,6 +103,54 @@ inline StreamType &operator<<(StreamType &Str, const Type &Ty) {
return Str;
}
+/// Models a type signature for a function.
+/// TODO(kschimpf): Consider using arena memory allocation for
+/// the contents of type signatures.
+class FuncSigType {
+public:
+ typedef std::vector<Type> ArgListType;
+
+ // Creates a function signature type with the given return type.
+ // Parameter types should be added using calls to appendArgType.
+ explicit FuncSigType() : ReturnType(IceType_void) {}
+
+ FuncSigType(const FuncSigType &Ty)
+ : ReturnType(Ty.ReturnType), ArgList(Ty.ArgList) {}
+
+ FuncSigType &operator=(const FuncSigType &Ty) {
+ ReturnType = Ty.ReturnType;
+ ArgList = Ty.ArgList;
+ return *this;
+ }
+
+ void appendArgType(Type ArgType) { ArgList.push_back(ArgType); }
+
+ Type getReturnType() const { return ReturnType; }
+ void setReturnType(Type NewType) { ReturnType = NewType; }
+ SizeT getNumArgs() const { return ArgList.size(); }
+ Type getArgType(SizeT Index) const {
+ assert(Index < ArgList.size());
+ return ArgList[Index];
+ }
+ const ArgListType &getArgList() const { return ArgList; }
+ void Dump(Ostream &Stream) const;
Jim Stichnoth 2014/10/06 22:48:51 lowercase dump
Karl 2014/10/07 20:15:58 Done.
+ void reset() {
+ ArgList.clear();
+ ArgList.push_back(IceType_void);
+ }
+
+private:
+ // The return type.
+ Type ReturnType;
+ // The list of parameters.
+ ArgListType ArgList;
+};
+
+inline Ostream &operator<<(Ostream &Stream, const FuncSigType &Sig) {
+ Sig.Dump(Stream);
+ return Stream;
+}
+
} // end of namespace Ice
#endif // SUBZERO_SRC_ICETYPES_H
« no previous file with comments | « no previous file | src/IceTypes.cpp » ('j') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698