add a stub of a lowering pass
authorZack Rusin <zack@tungstengraphics.com>
Fri, 25 Jan 2008 11:36:35 +0000 (06:36 -0500)
committerZack Rusin <zack@tungstengraphics.com>
Mon, 11 Feb 2008 04:07:17 +0000 (23:07 -0500)
src/mesa/pipe/llvm/Makefile
src/mesa/pipe/llvm/gallivm.cpp
src/mesa/pipe/llvm/loweringpass.cpp [new file with mode: 0644]
src/mesa/pipe/llvm/loweringpass.h [new file with mode: 0644]

index f655fb8340ae1e22f14b01b053b4bdb123c99989..1e3ae988df31415ecfdc220ec1910a373c1a9d1f 100644 (file)
@@ -8,6 +8,7 @@ LIBNAME = gallivm
 GALLIVM_SOURCES = \
         gallivm.cpp  \
         instructions.cpp  \
+        loweringpass.cpp \
         storage.cpp
 
 INC_SOURCES = gallivm_builtins.cpp llvm_base_shader.cpp
index afa14468902e17b7355d097ccbe7689925bf6071..46e11c185a9838c815f7c83983df779094060a36 100644 (file)
@@ -34,6 +34,7 @@
 #include "gallivm.h"
 
 #include "instructions.h"
+#include "loweringpass.h"
 #include "storage.h"
 
 #include "pipe/p_context.h"
@@ -95,6 +96,7 @@ using namespace llvm;
 static int GLOBAL_ID = 0;
 
 static inline void AddStandardCompilePasses(PassManager &PM) {
+   PM.add(new LoweringPass());
    PM.add(createVerifierPass());                  // Verify that input is correct
 
    PM.add(createLowerSetJmpPass());          // Lower llvm.setjmp/.longjmp
diff --git a/src/mesa/pipe/llvm/loweringpass.cpp b/src/mesa/pipe/llvm/loweringpass.cpp
new file mode 100644 (file)
index 0000000..556dbec
--- /dev/null
@@ -0,0 +1,17 @@
+#include "loweringpass.h"
+
+using namespace llvm;
+
+char LoweringPass::ID = 0;
+RegisterPass<LoweringPass> X("lowering", "Lowering Pass");
+
+LoweringPass::LoweringPass()
+   :  ModulePass((intptr_t)&ID)
+{
+}
+
+bool LoweringPass::runOnModule(Module &m)
+{
+   llvm::cerr << "Hello: " << m.getModuleIdentifier() << "\n";
+   return false;
+}
diff --git a/src/mesa/pipe/llvm/loweringpass.h b/src/mesa/pipe/llvm/loweringpass.h
new file mode 100644 (file)
index 0000000..f62dcf6
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef LOWERINGPASS_H
+#define LOWERINGPASS_H
+
+#include "llvm/Pass.h"
+#include "llvm/Module.h"
+
+struct LoweringPass : public llvm::ModulePass
+{
+   static char ID;
+   LoweringPass();
+
+   virtual bool runOnModule(llvm::Module &m);
+};
+
+#endif