From 035fd3fde67882dba9762bb587e2ff761034cb30 Mon Sep 17 00:00:00 2001 From: johnvg Date: Wed, 12 Sep 2001 11:50:42 +0000 Subject: clean 1.3 code for recognizing abort and undef in the strictness analyzer doesn't work yet in Clean 2.0 git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@773 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d --- backendC/CleanCompilerSources/checker.h | 3 +++ backendC/CleanCompilerSources/checker_2.c | 13 +++++++++++++ backendC/CleanCompilerSources/compiledefines.h | 2 ++ backendC/CleanCompilerSources/sa.c | 15 ++++++++++++++- 4 files changed, 32 insertions(+), 1 deletion(-) (limited to 'backendC') 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; -- cgit v1.2.3