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() {} |