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

Unified Diff: src/IceTargetLowering.h

Issue 1551633002: Subzero. Refactoring. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 5 years 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 | « src/IceCfg.cpp ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.h
diff --git a/src/IceTargetLowering.h b/src/IceTargetLowering.h
index 3d139c0bc0ce73586a11c6d346eee7b5231c85b0..e602f04638e5e8a936ee9874868b34bf422a0b5b 100644
--- a/src/IceTargetLowering.h
+++ b/src/IceTargetLowering.h
@@ -138,19 +138,27 @@ private:
LoweringContext &Context;
};
+/// TargetLowering is the base class for all backends in Subzero. In addition to
+/// implementing the abstract methods in this class, each concrete target must
+/// also implement a named constructor in its own namespace. For instance, for
+/// X8632 we have:
+///
+/// namespace X8632 {
+/// void createTargetLowering(Cfg *Func);
+/// }
class TargetLowering {
TargetLowering() = delete;
TargetLowering(const TargetLowering &) = delete;
TargetLowering &operator=(const TargetLowering &) = delete;
public:
- // TODO(jvoung): return a unique_ptr like the other factory functions.
- static TargetLowering *createLowering(TargetArch Target, Cfg *Func);
static void staticInit(TargetArch Target);
- // Each target must define a public static method:
- // static void staticInit();
- static std::unique_ptr<Assembler> createAssembler(TargetArch Target,
- Cfg *Func);
+
+ static std::unique_ptr<TargetLowering> createLowering(TargetArch Target,
+ Cfg *Func);
+
+ virtual std::unique_ptr<Assembler> createAssembler() const = 0;
+
void translate() {
switch (Ctx->getFlags().getOptLevel()) {
case Opt_m1:
« no previous file with comments | « src/IceCfg.cpp ('k') | src/IceTargetLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698