diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2007-10-29 11:42:22 -0400 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2007-10-30 05:15:05 -0400 |
commit | fd908ce234d1f553b59d65afb7e4243ffee24018 (patch) | |
tree | fcddc5e5d93a2c45d90d4bb31172e1a302d1aa94 /src/mesa/pipe/llvm/llvmtgsi.cpp | |
parent | b0f3b5910ebd0737600ab7b1fdc135d74f2617f4 (diff) |
Change the way we handle temporaries in LLVM translation.
TGSI uses TEMP, among others, as a way of passing arguments
from one function to another. Instead of trying to figure out
which temp's a function needs and trying to dynamically adjust its
signature just pass the whole array of temporaries to them.
Diffstat (limited to 'src/mesa/pipe/llvm/llvmtgsi.cpp')
-rw-r--r-- | src/mesa/pipe/llvm/llvmtgsi.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp index ec38c695b9..797843c7c3 100644 --- a/src/mesa/pipe/llvm/llvmtgsi.cpp +++ b/src/mesa/pipe/llvm/llvmtgsi.cpp @@ -146,20 +146,6 @@ translate_declaration(llvm::Module *module, struct tgsi_full_declaration *decl, struct tgsi_full_declaration *fd) { - if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { - switch( decl->Declaration.Declare ) { - case TGSI_DECLARE_RANGE: { - int start = decl->u.DeclarationRange.First; - int end = decl->u.DeclarationRange.Last; - for (int i = start; i <= end; ++i) { - storage->declareTemp(i); - } - } - break; - default: - assert( 0 ); - } - } } @@ -424,7 +410,8 @@ translate_instruction(llvm::Module *module, instr->cal(inst->InstructionExtLabel.Label, storage->outputPtr(), storage->inputPtr(), - storage->constPtr()); + storage->constPtr(), + storage->tempPtr()); return; } break; @@ -641,7 +628,7 @@ translate_instruction(llvm::Module *module, struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { - storage->store(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); + storage->setOutputElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else if (dst->DstRegister.File == TGSI_FILE_TEMPORARY) { storage->setTempElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else if (dst->DstRegister.File == TGSI_FILE_ADDRESS) { @@ -675,6 +662,8 @@ tgsi_to_llvm(struct gallivm_prog *prog, const struct tgsi_token *tokens) ptr_IN->setName("IN"); Value *ptr_CONST = args++; ptr_CONST->setName("CONST"); + Value *ptr_TEMPS = args++; + ptr_TEMPS->setName("TEMPS"); BasicBlock *label_entry = new BasicBlock("entry", shader, 0); @@ -682,7 +671,7 @@ tgsi_to_llvm(struct gallivm_prog *prog, const struct tgsi_token *tokens) fi = tgsi_default_full_instruction(); fd = tgsi_default_full_declaration(); - Storage storage(label_entry, ptr_OUT, ptr_IN, ptr_CONST); + Storage storage(label_entry, ptr_OUT, ptr_IN, ptr_CONST, ptr_TEMPS); Instructions instr(mod, shader, label_entry); while(!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); |