fix fetching input elements and generate a ret on end
authorZack Rusin <zack@tungstengraphics.com>
Wed, 13 Feb 2008 05:36:31 +0000 (00:36 -0500)
committerZack Rusin <zack@tungstengraphics.com>
Wed, 13 Feb 2008 05:36:31 +0000 (00:36 -0500)
src/mesa/pipe/llvm/instructionssoa.cpp
src/mesa/pipe/llvm/instructionssoa.h
src/mesa/pipe/llvm/storagesoa.cpp

index 9ac4d8fbc73babbea511dd57a82ff825be837863..0e501ab08d0fc250a06adc09439b419befd8e627 100644 (file)
@@ -2,6 +2,7 @@
 
 InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func,
                                  llvm::BasicBlock *block, StorageSoa *storage)
+   : m_builder(block)
 {
 }
 
@@ -23,4 +24,5 @@ std::vector<llvm::Value*> InstructionsSoa::mul(const std::vector<llvm::Value*> i
 
 void InstructionsSoa::end()
 {
+   m_builder.CreateRetVoid();
 }
index 0b6b41cf056b6b8df65b475c40ee44ce5a29f97f..233d363b90629329b131a8356692865af607980a 100644 (file)
@@ -28,6 +28,8 @@
 #ifndef INSTRUCTIONSSOA_H
 #define INSTRUCTIONSSOA_H
 
+#include <llvm/Support/LLVMBuilder.h>
+
 #include <vector>
 
 namespace llvm {
@@ -49,6 +51,8 @@ public:
    std::vector<llvm::Value*> mul(const std::vector<llvm::Value*> in1,
                                  const std::vector<llvm::Value*> in2);
    void         end();
+private:
+   llvm::LLVMFoldingBuilder  m_builder;
 };
 
 
index 8f82989cc5da68bb13d02eeefe4ec72a09820cb4..786511204a3ff2775d912582fad507995bdaf28d 100644 (file)
@@ -150,10 +150,7 @@ llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index,
 {
    std::vector<Value*> indices;
    indices.push_back(constantInt(index));
-   indices.push_back(constantInt(0));//first element in the struct
    indices.push_back(constantInt(channel));
-   indices.push_back(constantInt(0));//f channel
-   indices.push_back(constantInt(0));//first ptr in the f channel
 
    GetElementPtrInst *getElem = new GetElementPtrInst(ptr,
                                                       indices.begin(),