summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2012-03-26 17:56:29 +0200
committerFrancisco Jerez <[email protected]>2012-05-11 12:39:43 +0200
commita426b0d5bce24659a19c72af27a5aa4871782f9d (patch)
treee858c68167caf4bd5bb70440a1316744a8fe6d84
parent49468a1b2a241d5a6a1155f79b48fa6562524206 (diff)
gallium/tgsi/text: Make label parsing optional for branch instructions.
Structured branch instructions like IF, ELSE, BGNLOOP, ENDLOOP no longer require a label argument, make it optional for them.
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_text.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c
index c87313a3c16..a4320128c11 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_text.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_text.c
@@ -821,6 +821,7 @@ parse_instruction(
uint saturate = TGSI_SAT_NONE;
const struct tgsi_opcode_info *info;
struct tgsi_full_instruction inst;
+ const char *cur;
uint advance;
inst = tgsi_default_full_instruction();
@@ -866,7 +867,7 @@ parse_instruction(
*/
eat_opt_white( &ctx->cur );
for (i = 0; i < TGSI_OPCODE_LAST; i++) {
- const char *cur = ctx->cur;
+ cur = ctx->cur;
info = tgsi_get_opcode_info( i );
if (match_inst_mnemonic(&cur, info)) {
@@ -940,22 +941,20 @@ parse_instruction(
}
}
- if (info->is_branch) {
+ cur = ctx->cur;
+ eat_opt_white( &cur );
+ if (info->is_branch && *cur == ':') {
uint target;
- eat_opt_white( &ctx->cur );
- if (*ctx->cur != ':') {
- report_error( ctx, "Expected `:'" );
- return FALSE;
- }
- ctx->cur++;
- eat_opt_white( &ctx->cur );
- if (!parse_uint( &ctx->cur, &target )) {
+ cur++;
+ eat_opt_white( &cur );
+ if (!parse_uint( &cur, &target )) {
report_error( ctx, "Expected a label" );
return FALSE;
}
inst.Instruction.Label = 1;
inst.Label.Label = target;
+ ctx->cur = cur;
}
advance = tgsi_build_full_instruction(