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);
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());
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);
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();