summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-10-25 07:18:01 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-10-25 09:04:41 -0400
commit7073ef96824242669735a8681519e1a0cee14309 (patch)
tree3c80ec3fceb62102d8a92ee0d8850028d7a194d6 /src/mesa/pipe
parent731352f03ee998050331104d90abb47ee1377b3f (diff)
Implement else ops.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/llvm/instructions.cpp13
-rw-r--r--src/mesa/pipe/llvm/instructions.h1
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.cpp6
3 files changed, 18 insertions, 2 deletions
diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/mesa/pipe/llvm/instructions.cpp
index 622d420f64..a0645c5804 100644
--- a/src/mesa/pipe/llvm/instructions.cpp
+++ b/src/mesa/pipe/llvm/instructions.cpp
@@ -956,7 +956,7 @@ Function* makeLitFunction(Module *mod) {
void Instructions::ifop(llvm::Value *in)
{
BasicBlock *ifthen = new BasicBlock(name("ifthen"), m_func,0);
- BasicBlock *ifend = new BasicBlock(name("ifend"), m_func,0);
+ BasicBlock *ifend = new BasicBlock(name("ifthenend"), m_func,0);
//BasicBlock *yblock = new BasicBlock(name("yblock"), m_func,0);
//BasicBlock *zblock = new BasicBlock(name("zblock"), m_func,0);
@@ -981,6 +981,17 @@ llvm::BasicBlock * Instructions::currentBlock() const
return m_block;
}
+void Instructions::elseop()
+{
+ assert(!m_ifStack.empty());
+ BasicBlock *ifend = new BasicBlock(name("ifend"), m_func,0);
+ new BranchInst(ifend, m_block);
+ m_block = m_ifStack.top();
+ m_block->setName(name("ifelse"));
+ m_ifStack.pop();
+ m_ifStack.push(ifend);
+}
+
void Instructions::endif()
{
assert(!m_ifStack.empty());
diff --git a/src/mesa/pipe/llvm/instructions.h b/src/mesa/pipe/llvm/instructions.h
index 8b47accd15..b0608e1da6 100644
--- a/src/mesa/pipe/llvm/instructions.h
+++ b/src/mesa/pipe/llvm/instructions.h
@@ -60,6 +60,7 @@ public:
llvm::Value *dph(llvm::Value *in1, llvm::Value *in2);
llvm::Value *dst(llvm::Value *in1, llvm::Value *in2);
void endif();
+ void elseop();
llvm::Value *ex2(llvm::Value *in);
llvm::Value *floor(llvm::Value *in);
llvm::Value *frc(llvm::Value *in);
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp
index 93dd2ea46a..6ff4bc2270 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.cpp
+++ b/src/mesa/pipe/llvm/llvmtgsi.cpp
@@ -459,7 +459,11 @@ translate_instruction(llvm::Module *module,
break;
case TGSI_OPCODE_REP:
break;
- case TGSI_OPCODE_ELSE:
+ case TGSI_OPCODE_ELSE: {
+ instr->elseop();
+ storage->setCurrentBlock(instr->currentBlock());
+ return; //only state update
+ }
break;
case TGSI_OPCODE_ENDIF: {
instr->endif();