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

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: Move static field definitions into .cpp files 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
Index: src/IceTargetLowering.cpp
diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp
index 4902a3d64a8637a75decad7d1012ee626cd608a9..b4270f92832dbc691b58abee7d94a1fb7eb701fc 100644
--- a/src/IceTargetLowering.cpp
+++ b/src/IceTargetLowering.cpp
@@ -105,6 +105,25 @@ TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
return nullptr;
}
+void TargetLowering::staticInit(TargetArch Target) {
+ static bool InitGuard = false;
John 2015/11/04 21:35:23 Not that this matter, but if in the future we allo
Jim Stichnoth 2015/11/04 23:51:39 I did something like that originally, by duplicati
+ if (InitGuard)
+ return;
+ InitGuard = true;
+
+ // Call the specified target's static initializer.
+ switch (Target) {
+ default:
+ llvm::report_fatal_error("Unsupported target");
+ break;
+#define SUBZERO_TARGET(X) \
+ case Target_##X: \
+ Target##X::staticInit(); \
+ break;
+#include "llvm/Config/SZTargets.def"
+ }
+}
+
TargetLowering::TargetLowering(Cfg *Func)
: Func(Func), Ctx(Func->getContext()), Context() {}

Powered by Google App Engine
This is Rietveld 408576698