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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/IceTargetLowering.h ('k') | src/IceTargetLoweringARM32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 4902a3d64a8637a75decad7d1012ee626cd608a9..0ee0afa2301929fa5e2596a709f0db2bd03e3886 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -105,6 +105,24 @@ TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
return nullptr;
}
+void TargetLowering::staticInit(TargetArch Target) {
+ // Call the specified target's static initializer.
+ switch (Target) {
+ default:
+ llvm::report_fatal_error("Unsupported target");
+ break;
+#define SUBZERO_TARGET(X) \
+ case Target_##X: { \
+ static bool InitGuard##X = false; \
+ if (InitGuard##X) \
+ return; \
+ InitGuard##X = true; \
+ Target##X::staticInit(); \
+ } break;
+#include "llvm/Config/SZTargets.def"
+ }
+}
+
TargetLowering::TargetLowering(Cfg *Func)
: Func(Func), Ctx(Func->getContext()), Context() {}
« 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