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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 1418853005: Subzero: Refactor some common TargetLowering initializations. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 5 years, 1 month 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
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===//
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 /// \file 10 /// \file
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { 98 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
99 #define SUBZERO_TARGET(X) \ 99 #define SUBZERO_TARGET(X) \
100 if (Target == Target_##X) \ 100 if (Target == Target_##X) \
101 return Target##X::create(Func); 101 return Target##X::create(Func);
102 #include "llvm/Config/SZTargets.def" 102 #include "llvm/Config/SZTargets.def"
103 103
104 Func->setError("Unsupported target"); 104 Func->setError("Unsupported target");
105 return nullptr; 105 return nullptr;
106 } 106 }
107 107
108 void TargetLowering::staticInit(TargetArch Target) {
109 // Call the specified target's static initializer.
110 switch (Target) {
111 default:
112 llvm::report_fatal_error("Unsupported target");
113 break;
114 #define SUBZERO_TARGET(X) \
115 case Target_##X: { \
116 static bool InitGuard##X = false; \
117 if (InitGuard##X) \
118 return; \
119 InitGuard##X = true; \
120 Target##X::staticInit(); \
121 } break;
122 #include "llvm/Config/SZTargets.def"
123 }
124 }
125
108 TargetLowering::TargetLowering(Cfg *Func) 126 TargetLowering::TargetLowering(Cfg *Func)
109 : Func(Func), Ctx(Func->getContext()), Context() {} 127 : Func(Func), Ctx(Func->getContext()), Context() {}
110 128
111 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, 129 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target,
112 Cfg *Func) { 130 Cfg *Func) {
113 #define SUBZERO_TARGET(X) \ 131 #define SUBZERO_TARGET(X) \
114 if (Target == Target_##X) \ 132 if (Target == Target_##X) \
115 return std::unique_ptr<Assembler>(new X::Assembler##X()); 133 return std::unique_ptr<Assembler>(new X::Assembler##X());
116 #include "llvm/Config/SZTargets.def" 134 #include "llvm/Config/SZTargets.def"
117 135
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 if (Target == Target_##X) \ 643 if (Target == Target_##X) \
626 return TargetHeader##X::create(Ctx); 644 return TargetHeader##X::create(Ctx);
627 #include "llvm/Config/SZTargets.def" 645 #include "llvm/Config/SZTargets.def"
628 646
629 llvm::report_fatal_error("Unsupported target header lowering"); 647 llvm::report_fatal_error("Unsupported target header lowering");
630 } 648 }
631 649
632 TargetHeaderLowering::~TargetHeaderLowering() = default; 650 TargetHeaderLowering::~TargetHeaderLowering() = default;
633 651
634 } // end of namespace Ice 652 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698