aboutsummaryrefslogtreecommitdiff
path: root/backendC/CleanCompilerSources/instructions.c
diff options
context:
space:
mode:
authorjohnvg2012-07-27 12:55:34 +0000
committerjohnvg2012-07-27 12:55:34 +0000
commitefb404b0ca9b1c288bbd2f47ac4337daf976bea4 (patch)
tree71e64fda92e8d89c8f9963c5568b6a131226ffcc /backendC/CleanCompilerSources/instructions.c
parentreplace function trySimpleExpressionT that parses either a pattern or an expr... (diff)
optimize is constructor functions
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2128 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC/CleanCompilerSources/instructions.c')
-rw-r--r--backendC/CleanCompilerSources/instructions.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/backendC/CleanCompilerSources/instructions.c b/backendC/CleanCompilerSources/instructions.c
index 7cbe692..2a97654 100644
--- a/backendC/CleanCompilerSources/instructions.c
+++ b/backendC/CleanCompilerSources/instructions.c
@@ -1217,7 +1217,7 @@ static void CallFunction2 (Label label, SymbDef def, Bool isjsr, StateS root_sta
CurrentModule = def->sdef_module;
CurrentExt = GetFileExtension (abcFile);
- StaticMessage (False, "%D", "no inline code for this rule", def);
+ StaticMessage (False, "%D", "no inline code for this function", def);
CurrentModule = previous_module;
CurrentExt = previous_ext;
@@ -1231,31 +1231,41 @@ static void CallFunction2 (Label label, SymbDef def, Bool isjsr, StateS root_sta
} else
GenJmp (label);
}
- } else if (def->sdef_kind==IMPRULE && IsInlineFromCurrentModule (def)){
- Instructions instruction, last, first, next;
+ return;
+ }
+ if (def->sdef_kind==IMPRULE){
+ if ((def->sdef_mark & SDEF_INLINE_IS_CONSTRUCTOR)!=0){
+ generate_is_constructor (def->sdef_rule);
+ if (!isjsr)
+ GenRtn (aout, bout, root_state);
+ return;
+ } else if (IsInlineFromCurrentModule (def)){
+ Instructions instruction, last, first, next;
- instruction=def->sdef_rule->rule_alts->alt_rhs_code->co_instr;
- instruction=instruction->instr_next;
- first=instruction;
+ instruction=def->sdef_rule->rule_alts->alt_rhs_code->co_instr;
+ instruction=instruction->instr_next;
+ first=instruction;
- last=NULL;
- for (;(next=instruction->instr_next)!=NULL;instruction=next)
- last=instruction;
+ last=NULL;
+ for (;(next=instruction->instr_next)!=NULL;instruction=next)
+ last=instruction;
- last->instr_next=NULL;
- GenInstructions (first);
- last->instr_next=instruction;
+ last->instr_next=NULL;
+ GenInstructions (first);
+ last->instr_next=instruction;
- if (!isjsr)
- GenRtn (aout, bout, root_state);
- } else {
- GenDStackLayout (ain, bin, fun_args);
- if (isjsr){
- GenJsr (label);
- GenOStackLayoutOfState (aout, bout, root_state);
- } else
- GenJmp (label);
- }
+ if (!isjsr)
+ GenRtn (aout, bout, root_state);
+ return;
+ }
+ }
+
+ GenDStackLayout (ain, bin, fun_args);
+ if (isjsr){
+ GenJsr (label);
+ GenOStackLayoutOfState (aout, bout, root_state);
+ } else
+ GenJmp (label);
}
void CallFunction (Label label, SymbDef def, Bool isjsr, Node root)