diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-11-04 23:44:46 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-11-04 23:44:46 -0800 |
commit | 436b2b2eac33b893f7b9b0a7229ac1d98c034d2c (patch) | |
tree | 6619f453b5fd99b204380b17b94e9d8321e642f1 /040brace.cc | |
parent | 54275c64e2404612bf8754238bf71ae805f4022e (diff) | |
download | mu-436b2b2eac33b893f7b9b0a7229ac1d98c034d2c.tar.gz |
2360
More flailing around trying to come up with the right phase ordering. I've tried to narrow down each transform's constraints wrt transforms in previous layers. One issue that keeps biting me is the Type map containing empty records because of stray [] operations. That's gotta be important.
Diffstat (limited to '040brace.cc')
-rw-r--r-- | 040brace.cc | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/040brace.cc b/040brace.cc index fb6698b5..71324aaa 100644 --- a/040brace.cc +++ b/040brace.cc @@ -80,12 +80,18 @@ void transform_braces(const recipe_ordinal r) { } } // update instruction operation - if (inst.old_name.find("-if") != string::npos) + if (inst.old_name.find("-if") != string::npos) { inst.name = "jump-if"; - else if (inst.old_name.find("-unless") != string::npos) + inst.operation = JUMP_IF; + } + else if (inst.old_name.find("-unless") != string::npos) { inst.name = "jump-unless"; - else + inst.operation = JUMP_UNLESS; + } + else { inst.name = "jump"; + inst.operation = JUMP; + } // check for explicitly provided targets if (inst.old_name.find("-if") != string::npos || inst.old_name.find("-unless") != string::npos) { // conditional branches check arg 1 @@ -349,3 +355,29 @@ recipe main [ } ] +error: break-if expects 1 or 2 ingredients, but got none + +//: Make sure these pseudo recipes get consistent numbers in all tests, even +//: though they aren't implemented. Allows greater flexibility in ordering +//: transforms. + +:(before "End Primitive Recipe Declarations") +BREAK, +BREAK_IF, +BREAK_UNLESS, +LOOP, +LOOP_IF, +LOOP_UNLESS, +:(before "End Primitive Recipe Numbers") +Recipe_ordinal["break"] = BREAK; +Recipe_ordinal["break-if"] = BREAK_IF; +Recipe_ordinal["break-unless"] = BREAK_UNLESS; +Recipe_ordinal["loop"] = LOOP; +Recipe_ordinal["loop-if"] = LOOP_IF; +Recipe_ordinal["loop-unless"] = LOOP_UNLESS; +:(before "End Primitive Recipe Checks") +case BREAK: break; +case BREAK_IF: break; +case BREAK_UNLESS: break; +case LOOP: break; +case LOOP_IF: break; +case LOOP_UNLESS: break; |