aboutsummaryrefslogtreecommitdiff
path: root/backendC/CleanCompilerSources
diff options
context:
space:
mode:
Diffstat (limited to 'backendC/CleanCompilerSources')
-rw-r--r--backendC/CleanCompilerSources/backend.h4
-rw-r--r--backendC/CleanCompilerSources/codegen3.c24
-rw-r--r--backendC/CleanCompilerSources/instructions.c25
-rw-r--r--backendC/CleanCompilerSources/instructions.h3
4 files changed, 54 insertions, 2 deletions
diff --git a/backendC/CleanCompilerSources/backend.h b/backendC/CleanCompilerSources/backend.h
index acfcf3e..004eb88 100644
--- a/backendC/CleanCompilerSources/backend.h
+++ b/backendC/CleanCompilerSources/backend.h
@@ -1,7 +1,7 @@
/* version info */
// increment this for every release
-# define kBEVersionCurrent 0x02000213
+# define kBEVersionCurrent 0x02000214
// change this to the same value as kBEVersionCurrent if the new release is not
// upward compatible (for example when a function is added)
@@ -9,7 +9,7 @@
// change this to the same value as kBEVersionCurrent if the new release is not
// downward compatible (for example when a function is removed)
-# define kBEVersionOldestImplementation 0x02000213
+# define kBEVersionOldestImplementation 0x02000214
# define kBEDebug 1
diff --git a/backendC/CleanCompilerSources/codegen3.c b/backendC/CleanCompilerSources/codegen3.c
index b5e6b83..5a5d370 100644
--- a/backendC/CleanCompilerSources/codegen3.c
+++ b/backendC/CleanCompilerSources/codegen3.c
@@ -860,9 +860,33 @@ static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenN
CodeRootSelection (root, rootid, asp, bsp,code_gen_node_ids_p,resultstate);
return;
case fail_symb:
+#if CLEAN2
+ {
+ IdentS case_ident_s;
+ SymbDefS case_def_s;
+
+ case_ident_s.ident_name=rootsymb->symb_string;
+ Assume (case_ident_s.ident_name != NULL, "codegen3", "CodeNormalRootNode (fail_symb)");
+
+ case_def_s.sdef_ident = &case_ident_s;
+ case_def_s.sdef_line = 0;
+
+ StaticMessage (FunctionMayFailIsError, "%D", "case may fail", &case_def_s);
+
+ if (! (IsOnBStack (resultstate) ||
+ (IsSimpleState (resultstate) && resultstate.state_kind==StrictRedirection)))
+ /* root needed */
+ asp++;
+
+ GenCaseNoMatchError (&case_def_s,asp,bsp);
+
+ return;
+ }
+#else /* ifndef CLEAN2 */
error_in_function ("CodeNormalRootNode");
/* JumpToNextAlternative (asp, bsp); */
return;
+#endif
case string_denot:
GenPopA (asp);
GenPopB (bsp);
diff --git a/backendC/CleanCompilerSources/instructions.c b/backendC/CleanCompilerSources/instructions.c
index 9e29575..b2d380b 100644
--- a/backendC/CleanCompilerSources/instructions.c
+++ b/backendC/CleanCompilerSources/instructions.c
@@ -3393,6 +3393,31 @@ void GenNoMatchError (SymbDef sdef,int asp,int bsp,int string_already_generated)
}
}
+#if CLEAN2
+void GenCaseNoMatchError (SymbDefP case_def,int asp,int bsp)
+{
+ static int case_number;
+
+ GenPopA (asp);
+ GenPopB (bsp);
+
+ put_instruction_b (pushD);
+ FPrintF (OutFile, "m_%s", CurrentModule);
+
+ put_instruction_b (pushD);
+ FPrintF (OutFile, "case_fail%u",case_number);
+
+ GenJmp (&match_error_lab);
+
+ put_directive_ (Dstring);
+ FPrintF (OutFile, "case_fail%u \"",case_number);
+ PrintSymbolOfIdent (case_def->sdef_ident,case_def->sdef_line,OutFile);
+ FPrintF (OutFile, "\"");
+
+ case_number++;
+}
+#endif
+
static void GenImpLab (char *label_name)
{
put_directive_b (implab);
diff --git a/backendC/CleanCompilerSources/instructions.h b/backendC/CleanCompilerSources/instructions.h
index 532aee7..8cd809b 100644
--- a/backendC/CleanCompilerSources/instructions.h
+++ b/backendC/CleanCompilerSources/instructions.h
@@ -187,6 +187,9 @@ void InitFileInfo (ImpMod imod);
/* void GenFileInfo (void); */
void GenNoMatchError (SymbDef sdef,int asp,int bsp,int string_already_generated);
+#if CLEAN2
+void GenCaseNoMatchError (SymbDefP case_def,int asp,int bsp);
+#endif
void InitInstructions (void);