From fd908ce234d1f553b59d65afb7e4243ffee24018 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 29 Oct 2007 11:42:22 -0400 Subject: 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. --- src/mesa/pipe/llvm/llvmtgsi.cpp | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/mesa/pipe/llvm/llvmtgsi.cpp') 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); -- cgit v1.2.3