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

Unified Diff: src/IceTranslator.h

Issue 361733002: Update Subzero to start parsing PNaCl bitcode files. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reformat IceConverter.cpp Created 6 years, 5 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
Index: src/IceTranslator.h
diff --git a/src/IceTranslator.h b/src/IceTranslator.h
new file mode 100644
index 0000000000000000000000000000000000000000..0450f0932035de4cf110f4fcbc8136faab9a1bd3
--- /dev/null
+++ b/src/IceTranslator.h
@@ -0,0 +1,67 @@
+//===- subzero/src/IceTranslator.h - ICE to machine code --------*- C++ -*-===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the general driver class for translating ICE to
+// machine code.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SUBZERO_SRC_ICETRANSLATOR_H
+#define SUBZERO_SRC_ICETRANSLATOR_H
+
+#include "llvm/ADT/OwningPtr.h"
+
+namespace Ice {
+
+class ClFlags;
+class Cfg;
+class GlobalContext;
+
+// Base class for translating ICE to machine code.
+// Derived classes convert other intermediate representations down to ICE,
+// and then call the appropriate (inherited) methods to convert ICE into
+// machine instructions.
+class Translator {
+public:
+ Translator(GlobalContext *Ctx, ClFlags &Flags)
+ : Ctx(Ctx), Flags(Flags), ExitStatus(0) {}
+
+ ~Translator();
+ int getExitStatus() const { return ExitStatus; }
+
+protected:
+ GlobalContext *Ctx;
+ ClFlags &Flags;
+ // The exit status of the translation. 0 is successful. Nonzero
+ // otherwise.
+ bool ExitStatus;
+ // Ideally, Func would be inside the methods that converts IR to
+ // functions. However, emitting the constant pool requires a valid
+ // Cfg object, so we need to defer deleting the last non-empty Cfg
+ // object to emit the constant pool (via emitConstants). TODO:
+ // Since all constants are globally pooled in the GlobalContext
+ // object, change all Constant related functions to use
+ // GlobalContext instead of Cfg, and then make emitConstantPool use
+ // that.
+ llvm::OwningPtr<Cfg> Func;
+
+ /// Translates the constructed ICE function Fcn to machine code.
+ /// Note: As a side effect, Field Func is set to Fcn.
+ void translateFcn(Cfg *Fcn);
+
+ /// Emits the constant pool.
+ void emitConstants();
+
+private:
+ Translator(const Translator &) LLVM_DELETED_FUNCTION;
+ Translator &operator=(const Translator &) LLVM_DELETED_FUNCTION;
+};
+}
+
+#endif // SUBZERO_SRC_ICETRANSLATOR_H
« no previous file with comments | « src/IceConverter.cpp ('k') | src/IceTranslator.cpp » ('j') | src/PNaClTranslator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698