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

Side by Side 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: Fix more nits. 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 unified diff | Download patch
OLDNEW
(Empty)
1 //===- subzero/src/IceTranslator.h - Translate IR to ICE --------*- C++ -*-===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the general driver class for translating IR to ICE.
jvoung (off chromium) 2014/07/01 17:32:52 Clarify what IR to ICE? I guess it has to be seria
Karl 2014/07/01 21:31:06 Rewrote this to try and be more clear.
jvoung (off chromium) 2014/07/02 17:00:15 For this one-line summary, it feels like this clas
Karl 2014/07/02 18:09:54 Good point. Fixing.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef SUBZERO_SRC_ICETRANSLATOR_H
15 #define SUBZERO_SRC_ICETRANSLATOR_H
16
17 #include "IceCfg.h"
18 #include "IceClFlags.h"
19 #include "IceGlobalContext.h"
jvoung (off chromium) 2014/07/01 17:32:52 Could probably fwd declare the IceGlobalContext cl
Karl 2014/07/01 21:31:06 Removing unnecessary includes.
20 #include "llvm/ADT/OwningPtr.h"
21
22 namespace Ice {
23
24 // Base class for translating IR to ICE. The input IR is handled by
25 // derived classes. This code assumes that derived classes define one
26 // (or more) methods to translate the input IR. Whenever a function is
27 // converted to ICE, these methods call translateFcn to finish the
28 // translation.
29 class Translator {
30 public:
31 Translator(Ice::GlobalContext *Ctx, Ice::ClFlags &Flags)
32 : Ctx(Ctx),
33 Flags(Flags),
34 ExitStatus(0) {}
35
36 ~Translator();
37
38 protected:
39 Ice::GlobalContext *Ctx;
40 Ice::ClFlags &Flags;
41 // The exit status of the translation. 0 is successful. Nonzero
42 // otherwise.
43 int ExitStatus;
44 // Ideally, Func would be inside the methods that converts IR to
45 // functions. However, emitting the constant pool requires a valid
46 // Cfg object, so we need to defer deleting the last non-empty Cfg
47 // object to emit the constant pool (via emitConstants). TODO:
48 // Since all constants are globally pooled in the Ice::GlobalContext
49 // object, change all Ice::Constant related functions to use
50 // GlobalContext instead of Cfg, and then make emitConstantPool use
51 // that.
52 llvm::OwningPtr<Ice::Cfg> Func;
53
54 /// Translates the constructed ICE function Fcn to machine code.
55 /// Note: As a side effect, Field Func is set to Fcn.
56 void translateFcn(Ice::Cfg *Fcn);
57
58 /// Emits the constant pool.
59 void emitConstants();
60 };
61
62 }
63
64 #endif // SUBZERO_SRC_ICETRANSLATOR_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698