diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-27 19:17:50 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-27 19:17:50 +0300 |
| commit | 67443867c2743eda27be650b58f5021004789a45 (patch) | |
| tree | 8034dd383552f37fb8c41ed02cd57f76d4126d1e /src/parser.y | |
| parent | 123860bc029465ff88c3bf82165a89170fa41153 (diff) | |
| download | qbt-67443867c2743eda27be650b58f5021004789a45.tar.gz qbt-67443867c2743eda27be650b58f5021004789a45.zip | |
allow compiling some massive functions
Diffstat (limited to 'src/parser.y')
| -rw-r--r-- | src/parser.y | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/parser.y b/src/parser.y index dd744c0..f41948f 100644 --- a/src/parser.y +++ b/src/parser.y @@ -516,12 +516,18 @@ call INS_REPLACE($[placeholder], insn_create(CALL, NOTYPE, noclass(), imm_ref($[addr]), noclass(), 0)); + + /* make some optimization phases easier by splitting each call + * into a separate block */ + NEW_BLOCK(J, noclass(), noclass(), NULL); } | id reset_index "(" opt_call_args ")" "=>" placeholder reset_index "(" opt_call_rets ")" { INS_REPLACE($[placeholder], insn_create(CALL, NOTYPE, noclass(), IDTOVAL($[id]), noclass(), 0)); + + NEW_BLOCK(J, noclass(), noclass(), NULL); } proc_ret @@ -555,15 +561,24 @@ insn | call | return -body - : insn ";" body - | label body +labels + : labels label | label - | insn ";" + +body + : body ";" labels insn + | body ";" insn + | labels insn + | labels + | insn + +body_opt_term + : body + | body ";" /** @todo add in return type checking? */ function - : id reset_index "(" opt_params ")" "{" body "}" { + : id reset_index "(" opt_params ")" "{" body_opt_term "}" { NEW_FUNCTION($[id]); } @@ -572,7 +587,7 @@ top | function unit - : top unit + : unit top | top | error { parser->failed = true; |
