summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2007-10-17 11:28:26 -0400
committerZack Rusin <[email protected]>2007-10-24 11:21:03 -0400
commitb0f80693434cb203f63d8fbab56c1522000ed88f (patch)
treefedc98fa842c487cb5d1c5ae59b3a609d98b8f17 /src
parent3975f34fd36f8b04d499bb6b3d48eaeef5cab24e (diff)
Refactor the tgsi->llvm storage translator
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.cpp5
-rw-r--r--src/mesa/pipe/llvm/storage.cpp (renamed from src/mesa/pipe/llvm/tgsillvmbuilder.cpp)50
-rw-r--r--src/mesa/pipe/llvm/storage.h57
-rw-r--r--src/mesa/sources1
4 files changed, 71 insertions, 42 deletions
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp
index 5cbd0ae89ff..c6cf2de4fc2 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.cpp
+++ b/src/mesa/pipe/llvm/llvmtgsi.cpp
@@ -1,5 +1,8 @@
#include "llvmtgsi.h"
+#include "instructions.h"
+#include "storage.h"
+
#include "pipe/p_context.h"
#include "pipe/tgsi/exec/tgsi_exec.h"
#include "pipe/tgsi/exec/tgsi_token.h"
@@ -30,10 +33,8 @@
#include <llvm/Bitcode/ReaderWriter.h>
#include <iostream>
-#include "instructions.h"
using namespace llvm;
#include "llvm_base_shader.cpp"
-#include "tgsillvmbuilder.cpp"
static inline void addPass(PassManager &PM, Pass *P) {
diff --git a/src/mesa/pipe/llvm/tgsillvmbuilder.cpp b/src/mesa/pipe/llvm/storage.cpp
index ca70a46648c..c6e86ea4b43 100644
--- a/src/mesa/pipe/llvm/tgsillvmbuilder.cpp
+++ b/src/mesa/pipe/llvm/storage.cpp
@@ -1,46 +1,16 @@
+#include "storage.h"
-#include <map>
+#include <llvm/BasicBlock.h>
+#include <llvm/Module.h>
+#include <llvm/Value.h>
-class Storage
-{
- typedef std::map<int, llvm::LoadInst*> LoadMap;
-public:
- Storage(llvm::BasicBlock *block,
- llvm::Value *out,
- llvm::Value *in, llvm::Value *consts);
-
- llvm::ConstantInt *constantInt(int);
- llvm::Constant *shuffleMask(int vec);
- llvm::Value *inputElement(int idx);
- llvm::Value *constElement(int idx);
-
- llvm::Value *tempElement(int idx) const;
- void setTempElement(int idx, llvm::Value *val);
-
- llvm::Value *shuffleVector(llvm::Value *vec, int shuffle);
-
-
- void store(int dstIdx, llvm::Value *val);
-private:
- llvm::BasicBlock *m_block;
- llvm::Value *m_OUT;
- llvm::Value *m_IN;
- llvm::Value *m_CONST;
-
- std::map<int, llvm::ConstantInt*> m_constInts;
- std::map<int, llvm::Constant*> m_intVecs;
- std::vector<llvm::Value*> m_temps;
- LoadMap m_inputs;
- LoadMap m_consts;
-
- llvm::VectorType *m_floatVecType;
- llvm::VectorType *m_intVecType;
-
- llvm::Value *m_undefFloatVec;
- llvm::Value *m_undefIntVec;
+#include <llvm/CallingConv.h>
+#include <llvm/Constants.h>
+#include <llvm/DerivedTypes.h>
+#include <llvm/InstrTypes.h>
+#include <llvm/Instructions.h>
- int m_shuffleId;
-};
+using namespace llvm;
Storage::Storage(llvm::BasicBlock *block, llvm::Value *out,
llvm::Value *in, llvm::Value *consts)
diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h
new file mode 100644
index 00000000000..b69c8d614e9
--- /dev/null
+++ b/src/mesa/pipe/llvm/storage.h
@@ -0,0 +1,57 @@
+#ifndef STORAGE_H
+#define STORAGE_H
+
+#include <map>
+#include <vector>
+
+namespace llvm {
+ class BasicBlock;
+ class Constant;
+ class ConstantInt;
+ class LoadInst;
+ class Value;
+ class VectorType;
+}
+
+class Storage
+{
+ typedef std::map<int, llvm::LoadInst*> LoadMap;
+public:
+ Storage(llvm::BasicBlock *block,
+ llvm::Value *out,
+ llvm::Value *in, llvm::Value *consts);
+
+ llvm::ConstantInt *constantInt(int);
+ llvm::Constant *shuffleMask(int vec);
+ llvm::Value *inputElement(int idx);
+ llvm::Value *constElement(int idx);
+
+ llvm::Value *tempElement(int idx) const;
+ void setTempElement(int idx, llvm::Value *val);
+
+ llvm::Value *shuffleVector(llvm::Value *vec, int shuffle);
+
+
+ void store(int dstIdx, llvm::Value *val);
+private:
+ llvm::BasicBlock *m_block;
+ llvm::Value *m_OUT;
+ llvm::Value *m_IN;
+ llvm::Value *m_CONST;
+
+ std::map<int, llvm::ConstantInt*> m_constInts;
+ std::map<int, llvm::Constant*> m_intVecs;
+ std::vector<llvm::Value*> m_temps;
+ LoadMap m_inputs;
+ LoadMap m_consts;
+
+ llvm::VectorType *m_floatVecType;
+ llvm::VectorType *m_intVecType;
+
+ llvm::Value *m_undefFloatVec;
+ llvm::Value *m_undefIntVec;
+
+ int m_shuffleId;
+};
+
+#endif
diff --git a/src/mesa/sources b/src/mesa/sources
index 7e1d909e286..1bc45c98132 100644
--- a/src/mesa/sources
+++ b/src/mesa/sources
@@ -192,6 +192,7 @@ TGSIMESA_SOURCES = \
ifeq ($(MESA_NO_LLVM),0)
LLVMTGSI_SOURCES = \
pipe/llvm/llvmtgsi.cpp \
+ pipe/llvm/storage.cpp \
pipe/llvm/instructions.cpp
endif