Re-implement clspv-opt as a standalone driver (#346)
* Fix #307 and #322.
This re-implements clspv-opt as a standalone driver. The initial
implementation used the plugin facility for LLVM opt, but this is
difficult to implement in Windows (#307).
The driver only supports LLVM scalar transformations and all of clspv
transformations. To do this, passes must be declared using LLVM's
INITIALIZE_PASS macro. Additionally, the function
initializeClspvPasses() must include a call to the initialize*()
function generated by INITIALIZE_PASS.
This change also adds tests for all the existing passes in clspv. It
does not check for specific transformations. It checks that the flags
are accepted by clspv-opt.
Finally, this change reduces the build time for LLVM by building no
target backends by default.
diff --git a/lib/SplatSelectCondition.cpp b/lib/SplatSelectCondition.cpp
index bbda9e9..ce75eb8 100644
--- a/lib/SplatSelectCondition.cpp
+++ b/lib/SplatSelectCondition.cpp
@@ -18,6 +18,8 @@
#include "llvm/Pass.h"
#include "llvm/Support/raw_ostream.h"
+#include "Passes.h"
+
using namespace llvm;
#define DEBUG_TYPE "splatselectcond"
@@ -32,8 +34,8 @@
} // namespace
char SplatSelectConditionPass::ID = 0;
-static RegisterPass<SplatSelectConditionPass> X("SplatSelectCond",
- "Splat Select Condition Pass");
+INITIALIZE_PASS(SplatSelectConditionPass, "SplatSelectCond",
+ "Splat Select Condition Pass", false, false)
namespace clspv {
llvm::ModulePass *createSplatSelectConditionPass() {