summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-10-24 19:26:09 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-10-24 19:26:09 -0400
commit5022ee43fc7916f16bdce8b076bad78fca262a62 (patch)
tree9668d9910f2699a9eb8fd49374e6aeacac4f992c /src
parent1c5fec714d30c02d6d00d95215c2e302c4c65cc3 (diff)
Make branching work :) Simply allow output variables as valid
operand inputs when they've been assigned already.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.cpp4
-rw-r--r--src/mesa/pipe/llvm/storage.cpp28
-rw-r--r--src/mesa/pipe/llvm/storage.h1
3 files changed, 31 insertions, 2 deletions
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp
index ec284a624a..93dd2ea46a 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.cpp
+++ b/src/mesa/pipe/llvm/llvmtgsi.cpp
@@ -195,8 +195,8 @@ translate_instruction(llvm::Module *module,
val = storage->inputElement(src->SrcRegister.Index, indIdx);
} else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) {
val = storage->tempElement(src->SrcRegister.Index);
- } else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) {
- fprintf(stderr, "FIXME: do somethign with immediates?\n");
+ } else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) {
+ val = storage->outputElement(src->SrcRegister.Index, indIdx);
} else {
fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File);
return;
diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp
index 6721f387c8..603053c0e8 100644
--- a/src/mesa/pipe/llvm/storage.cpp
+++ b/src/mesa/pipe/llvm/storage.cpp
@@ -310,3 +310,31 @@ void Storage::declareTemp(int idx)
{
m_temps[idx] = new AllocaInst(m_floatVecType, name("temp"), m_block);
}
+
+llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx )
+{
+ GetElementPtrInst *getElem = 0;
+
+ if (indIdx) {
+ getElem = new GetElementPtrInst(m_IN,
+ BinaryOperator::create(Instruction::Add,
+ indIdx,
+ constantInt(idx),
+ name("add"),
+ m_block),
+ name("output_ptr"),
+ m_block);
+ } else {
+ getElem = new GetElementPtrInst(m_IN,
+ constantInt(idx),
+ name("output_ptr"),
+ m_block);
+ }
+
+ LoadInst *load = new LoadInst(getElem, name("output"),
+ false, m_block);
+ load->setAlignment(8);
+ m_inputs[idx] = load;
+
+ return load;
+}
diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h
index 26b2579b07..dd5de35073 100644
--- a/src/mesa/pipe/llvm/storage.h
+++ b/src/mesa/pipe/llvm/storage.h
@@ -59,6 +59,7 @@ public:
llvm::Constant *shuffleMask(int vec);
llvm::Value *inputElement(int idx, llvm::Value *indIdx =0);
llvm::Value *constElement(int idx, llvm::Value *indIdx =0);
+ llvm::Value *outputElement(int idx, llvm::Value *indIdx =0);
llvm::Value *tempElement(int idx);
void setTempElement(int idx, llvm::Value *val, int mask);