summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/llvm/llvmtgsi.cpp
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2007-10-24 19:20:19 -0400
committerZack Rusin <[email protected]>2007-10-24 19:20:32 -0400
commit1c5fec714d30c02d6d00d95215c2e302c4c65cc3 (patch)
tree084ff82f7b39e25c17447ba211295f963fcf6b17 /src/mesa/pipe/llvm/llvmtgsi.cpp
parent7636aac54bb357ce907ae6cc2c41f32957faecf3 (diff)
Simplify branch handling. Prepare for proper decleration extraction.
Diffstat (limited to 'src/mesa/pipe/llvm/llvmtgsi.cpp')
-rw-r--r--src/mesa/pipe/llvm/llvmtgsi.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp
index b8e4e393162..ec284a624af 100644
--- a/src/mesa/pipe/llvm/llvmtgsi.cpp
+++ b/src/mesa/pipe/llvm/llvmtgsi.cpp
@@ -139,9 +139,24 @@ static inline void AddStandardCompilePasses(PassManager &PM) {
static void
translate_declaration(llvm::Module *module,
+ Storage *storage,
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 );
+ }
+ }
}
@@ -180,8 +195,10 @@ 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 {
- fprintf(stderr, "ERROR: not supported llvm source\n");
+ fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File);
return;
}
@@ -447,7 +464,6 @@ translate_instruction(llvm::Module *module,
case TGSI_OPCODE_ENDIF: {
instr->endif();
storage->setCurrentBlock(instr->currentBlock());
- storage->popPhiNode();
return; //just update the state
}
break;
@@ -642,7 +658,7 @@ tgsi_to_llvm(struct gallivm_prog *prog, const struct tgsi_token *tokens)
switch (parse.FullToken.Token.Type) {
case TGSI_TOKEN_TYPE_DECLARATION:
- translate_declaration(mod,
+ translate_declaration(mod, &storage,
&parse.FullToken.FullDeclaration,
&fd);
break;