diff options
Diffstat (limited to 'src/mesa/pipe/llvm')
-rw-r--r-- | src/mesa/pipe/llvm/llvmtgsi.cpp | 5 | ||||
-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.h | 57 |
3 files changed, 70 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 |