aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backendC/CleanCompilerSources/checker.h3
-rw-r--r--backendC/CleanCompilerSources/checker_2.c13
-rw-r--r--backendC/CleanCompilerSources/compiledefines.h2
-rw-r--r--backendC/CleanCompilerSources/sa.c15
4 files changed, 32 insertions, 1 deletions
diff --git a/backendC/CleanCompilerSources/checker.h b/backendC/CleanCompilerSources/checker.h
index 1a0121d..c399a30 100644
--- a/backendC/CleanCompilerSources/checker.h
+++ b/backendC/CleanCompilerSources/checker.h
@@ -13,6 +13,9 @@ extern Ident StrictListId,UnboxedListId,TailStrictListId,StrictTailStrictListId,
#ifdef CLEAN2
extern Ident DynamicId;
#endif
+#if SA_RECOGNIZES_ABORT_AND_UNDEF
+extern Ident StdMiscId,abort_id,undef_id;
+#endif
extern Symbol StartSymbol, UnboxedArrayClassSymbols [], UnboxedArrayFunctionSymbols [];
extern SymbDef scc_dependency_list,ArrayFunctionDefs[], StdArrayAbortDef;
diff --git a/backendC/CleanCompilerSources/checker_2.c b/backendC/CleanCompilerSources/checker_2.c
index 3a7694b..a155447 100644
--- a/backendC/CleanCompilerSources/checker_2.c
+++ b/backendC/CleanCompilerSources/checker_2.c
@@ -110,6 +110,10 @@ Ident AnnotatedId, ListId, TupleId, ConsId, NilId, ApplyId, SelectId,
DeltaBId, IfId, FailId, AndId, OrId,
StdArrayId, ArrayFunctionIds [NoArrayFun];
+#if SA_RECOGNIZES_ABORT_AND_UNDEF
+Ident StdMiscId,abort_id,undef_id;
+#endif
+
Symbol StartSymbol;
SymbDef ArrayFunctionDefs [NoArrayFun],StdArrayAbortDef;
@@ -193,10 +197,19 @@ void InitChecker (void)
AndId = PutStringInHashTable ("&&", SymbolIdTable);
OrId = PutStringInHashTable ("||", SymbolIdTable);
+#if SA_RECOGNIZES_ABORT_AND_UNDEF
+ abort_id = PutStringInHashTable ("abort",SymbolIdTable);
+ undef_id = PutStringInHashTable ("undef",SymbolIdTable);
+#endif
+
SystemFunctionsId = PutStringInHashTable ("StdEnum", ModuleIdTable);
DeltaBId = PutStringInHashTable ("StdBool", ModuleIdTable);
StdArrayId = PutStringInHashTable ("_SystemArray", ModuleIdTable);
+#if SA_RECOGNIZES_ABORT_AND_UNDEF
+ StdMiscId = PutStringInHashTable ("StdMisc",ModuleIdTable);
+#endif
+
/* Predefined Array functions */
StdArrayAbortId = PutStringInHashTable ("_abortArray", SymbolIdTable);
diff --git a/backendC/CleanCompilerSources/compiledefines.h b/backendC/CleanCompilerSources/compiledefines.h
index a49163b..3e89a85 100644
--- a/backendC/CleanCompilerSources/compiledefines.h
+++ b/backendC/CleanCompilerSources/compiledefines.h
@@ -18,6 +18,8 @@
#define WRITE_DCL_MODIFICATION_TIME 1
+#define SA_RECOGNIZES_ABORT_AND_UNDEF 0
+
#define STRICT_LISTS 1
#undef KARBON \ No newline at end of file
diff --git a/backendC/CleanCompilerSources/sa.c b/backendC/CleanCompilerSources/sa.c
index 179b75b..1bbc0c4 100644
--- a/backendC/CleanCompilerSources/sa.c
+++ b/backendC/CleanCompilerSources/sa.c
@@ -2240,7 +2240,20 @@ static Exp ConvertNode (Node node, NodeId nid)
TypeArgs typeargs;
unsigned int i;
Exp exp;
-
+
+#if SA_RECOGNIZES_ABORT_AND_UNDEF
+ if (sdef->sdef_module==StdMiscId->ident_name){
+ if ((sdef->sdef_ident==abort_id && node->node_arity==1) || sdef->sdef_ident==undef_id){
+ e->e_kind = Bottom;
+ e->e_sym = 0;
+ e->e_hnf = True;
+ e->e_spechnf= True;
+
+ return e;
+ }
+ }
+#endif
+
rule = sdef->sdef_rule_type->rule_type_rule;
typeargs = rule->type_alt_lhs->type_node_arguments;