diff options
Diffstat (limited to 'src/mesa/pipe/llvm/storage.cpp')
-rw-r--r-- | src/mesa/pipe/llvm/storage.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
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; +} |