aboutsummaryrefslogtreecommitdiff
path: root/backendC
diff options
context:
space:
mode:
authorronny2001-10-04 11:48:43 +0000
committerronny2001-10-04 11:48:43 +0000
commit7606ce4e35327b6a5508113f7f711078864100b2 (patch)
treecd85f233f2d6b16d43a58705a0c3346a251d9aaf /backendC
parentremoved unused function makeCase (diff)
fail explicit cases
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@827 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC')
-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
-rw-r--r--backendC/backend.mcpbin57399 -> 110822 bytes
-rw-r--r--backendC/backend.rc2
6 files changed, 55 insertions, 3 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);
diff --git a/backendC/backend.mcp b/backendC/backend.mcp
index fdcdf52..eff7faa 100644
--- a/backendC/backend.mcp
+++ b/backendC/backend.mcp
Binary files differ
diff --git a/backendC/backend.rc b/backendC/backend.rc
index 768d7e5..16b1c8f 100644
--- a/backendC/backend.rc
+++ b/backendC/backend.rc
@@ -37,7 +37,7 @@ BEGIN
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename","backend.dll\0"
VALUE "ProductName", "Clean System"
- VALUE "ProductVersion", "2.0.d.12"
+ VALUE "ProductVersion", "2.0.d.0"
VALUE "OLESelfRegister", "\0"
END