Commit 3abff7de authored by John van Groningen's avatar John van Groningen
Browse files

remove some unused fields and variables

parent c00a257f
......@@ -779,7 +779,6 @@ BESpecialArrayFunctionSymbol (BEArrayFunKind arrayFunKind, int functionIndex, in
newsdef->sdef_ident = newIdent;
newsdef->sdef_module = gBEState.be_icl.beicl_module->im_name->symb_def->sdef_module; /* phew! */
newsdef->sdef_over_arity = 0;
newsdef->sdef_mark = 0;
newsdef->sdef_isused = True;
newsdef->sdef_exported = False;
......@@ -2510,7 +2509,6 @@ DeclareFunctionC (char *name, int arity, int functionIndex, unsigned int ancesto
newSymbDef->sdef_kind = IMPRULE;
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_over_arity = 0;
newSymbDef->sdef_arity = arity;
newSymbDef->sdef_module = module->bem_name;
newSymbDef->sdef_ancestor = ancestor;
......@@ -2519,7 +2517,6 @@ DeclareFunctionC (char *name, int arity, int functionIndex, unsigned int ancesto
newSymbDef->sdef_exported = False;
newSymbDef->sdef_dcl_icl = NULL;
newSymbDef->sdef_isused = 0;
newSymbDef->sdef_no_sa = False;
newSymbDef->sdef_nr_of_lifted_nodeids = 0; /* used in PrintType */
newSymbDef->sdef_line = 0; /* used in PrintType */
......@@ -2666,7 +2663,6 @@ BEDefineRuleType (int functionIndex, int moduleIndex, BETypeAltP typeAlt)
sdef = functionSymbol->symb_def;
Assert (sdef->sdef_kind == NEWDEFINITION);
sdef->sdef_over_arity = 0;
sdef->sdef_arity = typeAlt->type_alt_lhs->type_node_arity;
sdef->sdef_arfun = NoArrayFun;
sdef->sdef_kind = module->bem_isSystemModule ? SYSRULE : DEFRULE;
......@@ -2856,7 +2852,6 @@ BEAlgebraicType (BEFlatTypeP lhs, BEConstructorListP constructors)
Assert (type->type_lhs->ft_symbol->symb_kind == definition);
sdef = type->type_lhs->ft_symbol->symb_def;
Assert (sdef->sdef_kind == NEWDEFINITION);
sdef->sdef_over_arity = 0;
sdef->sdef_kind = TYPE;
sdef->sdef_type = type;
} /* BEAlgebraicType */
......@@ -2902,7 +2897,6 @@ BERecordType (int moduleIndex, BEFlatTypeP lhs, BETypeNodeP constructorType, int
Assert (type->type_lhs->ft_symbol->symb_kind == definition);
sdef = type->type_lhs->ft_symbol->symb_def;
Assert (sdef->sdef_kind == NEWDEFINITION);
sdef->sdef_over_arity = 0;
sdef->sdef_cons_arity = constructorType->type_node_arity;
sdef->sdef_checkstatus = TypeChecked;
sdef->sdef_kind = RECORDTYPE;
......@@ -2944,7 +2938,6 @@ BEAbsType (BEFlatTypeP lhs)
Assert (lhs->ft_symbol->symb_kind == definition);
sdef = lhs->ft_symbol->symb_def;
Assert (sdef->sdef_kind == NEWDEFINITION);
sdef->sdef_over_arity = 0;
sdef->sdef_checkstatus = TypeChecked;
sdef->sdef_kind = ABSTYPE;
sdef->sdef_abs_type = absType;
......@@ -2988,7 +2981,6 @@ BEConstructor (BETypeNodeP type)
sdef->sdef_kind = CONSTRUCTOR;
sdef->sdef_constructor = constructor;
sdef->sdef_arity = type->type_node_arity;
sdef->sdef_over_arity = 0;
/* ifdef DEBUG */
sdef->sdef_type = NULL;
/* endif */
......@@ -3055,7 +3047,6 @@ BEField (int fieldIndex, int moduleIndex, BETypeNodeP type)
sdef->sdef_kind = FIELDSELECTOR;
sdef->sdef_sel_field = field;
sdef->sdef_arity = 1;
sdef->sdef_over_arity = 0;
sdef->sdef_mark = 0;
/* ifdef DEBUG */
sdef->sdef_type = NULL;
......@@ -3106,7 +3097,6 @@ BEDeclareConstructor (int constructorIndex, int moduleIndex, CleanString name)
newSymbDef->sdef_ident = newIdent;
newSymbDef->sdef_mark = 0;
newSymbDef->sdef_isused = 0;
newSymbDef->sdef_no_sa = False;
constructors [constructorIndex]->symb_kind = definition;
constructors [constructorIndex]->symb_def = newSymbDef;
......
......@@ -3,8 +3,6 @@
Version: 1.2
*/
#pragma segment checker
#define COMPLEX_ABSTYPES
#define MOVE_LIFTED_CONSTANTS
#define OPTIMIZE_APPLIES
......@@ -132,11 +130,9 @@ SymbDef MakeNewSymbolDefinition (char * module, Ident name, int arity, SDefKind
def->sdef_line = 0;
def->sdef_mark=0;
def->sdef_over_arity=0;
def->sdef_exported=False;
def->sdef_main_dcl=False;
def->sdef_infix=False;
def->sdef_arfun = NoArrayFun;
......
......@@ -160,8 +160,6 @@ Bool CallCompiler (int argc, char **argv)
StrictDepth = 10;/* 8; */
FunctionMayFailIsError = False;
NotUsedIsError = False;
FunctionNotUsedIsError = False;
#ifdef CLEAN2
StdErrorReopened = False;
......@@ -214,11 +212,7 @@ Bool CallCompiler (int argc, char **argv)
else if (strcmp (argv_i,"-wmt") == 0)
WriteModificationTimes=True;
else if (strcmp (argv_i,"-emf") == 0)
FunctionMayFailIsError=True;
else if (strcmp (argv_i,"-enu") ==0)
NotUsedIsError=True;
else if (strcmp (argv_i,"-efnu") ==0)
FunctionNotUsedIsError=True;
FunctionMayFailIsError=True;
else if (strcmp (argv_i,"-desc") ==0)
DoDescriptors=True;
else if (strcmp (argv_i,"-exl") ==0)
......
......@@ -1267,27 +1267,26 @@ void CodeGeneration (ImpMod imod, char *fname)
#endif
update_function_p=&first_update_function;
for_l (rule,imod->im_rules,rule_next)
if (rule->rule_root->node_symbol->symb_def->sdef_over_arity==0){
CodeRule (rule);
*update_function_p=NULL;
if (first_update_function){
while (first_update_function){
transform_patterns_to_case_and_guard_nodes (first_update_function->rule_alts);
for_l (rule,imod->im_rules,rule_next){
CodeRule (rule);
*update_function_p=NULL;
if (first_update_function){
while (first_update_function){
transform_patterns_to_case_and_guard_nodes (first_update_function->rule_alts);
#ifdef TRANSFORM_PATTERNS_BEFORE_STRICTNESS_ANALYSIS
determine_failing_cases_and_adjust_ref_counts_of_rule (first_update_function->rule_alts);
determine_failing_cases_and_adjust_ref_counts_of_rule (first_update_function->rule_alts);
#endif
CodeRule (first_update_function);
first_update_function=first_update_function->rule_next;
}
update_function_p=&first_update_function;
CodeRule (first_update_function);
first_update_function=first_update_function->rule_next;
}
ExitOnInterrupt ();
update_function_p=&first_update_function;
}
ExitOnInterrupt ();
}
GenerateCodeForLazyTupleSelectorEntries (LazyTupleSelectors);
GenerateCodeForLazyArrayFunctionEntries();
#if STRICT_LISTS
......
......@@ -872,7 +872,7 @@ int optimise_tuple_result_function (Node node,StateS demanded_state)
symbol=node->node_symbol;
sdef=symbol->symb_def;
if (sdef->sdef_kind!=IMPRULE || sdef->sdef_over_arity!=0 || node->node_arity!=sdef->sdef_arity)
if (sdef->sdef_kind!=IMPRULE || node->node_arity!=sdef->sdef_arity)
return 0;
result_type=sdef->sdef_rule->rule_type->type_alt_rhs;
......@@ -4023,51 +4023,48 @@ static void mark_shared_strict_tuple_and_record_elements (Args args,int ref_coun
static ImpRuleS **OptimiseRule (ImpRuleS *rule)
{
SymbDef rule_sdef;
RuleAlts alt;
CurrentSymbol = rule->rule_root->node_symbol;
rule_sdef= CurrentSymbol->symb_def;
if (rule_sdef->sdef_over_arity==0){
RuleAlts alt;
#ifndef TRANSFORM_PATTERNS_BEFORE_STRICTNESS_ANALYSIS
transform_patterns_to_case_and_guard_nodes (rule->rule_alts);
transform_patterns_to_case_and_guard_nodes (rule->rule_alts);
#endif
alt=rule->rule_alts;
CurrentLine = alt->alt_line;
alt=rule->rule_alts;
CurrentLine = alt->alt_line;
if (alt->alt_kind==Contractum){
if (alt->alt_kind==Contractum){
#ifdef REUSE_UNIQUE_NODES
if (DoReuseUniqueNodes)
mark_shared_strict_tuple_and_record_elements (alt->alt_lhs_root->node_arguments,1);
if (DoReuseUniqueNodes)
mark_shared_strict_tuple_and_record_elements (alt->alt_lhs_root->node_arguments,1);
#endif
#if OPTIMIZE_LAZY_TUPLE_RECURSION
current_rule_mark=rule->rule_mark;
current_rule_mark=rule->rule_mark;
#endif
optimise_root_node (alt->alt_rhs_root,alt->alt_rhs_defs,NULL);
optimise_root_node (alt->alt_rhs_root,alt->alt_rhs_defs,NULL);
ReorderNodeDefinitionsAndDetermineUsedEntries (&alt->alt_rhs_defs,alt->alt_rhs_root);
ReorderNodeDefinitionsAndDetermineUsedEntries (&alt->alt_rhs_defs,alt->alt_rhs_root);
determine_then_else_ref_counts (alt->alt_rhs_root);
}
determine_then_else_ref_counts (alt->alt_rhs_root);
}
while (new_rules){
ImpRuleP new_rule;
RuleAltP alt;
while (new_rules){
ImpRuleP new_rule;
RuleAltP alt;
new_rule=new_rules;
new_rules=new_rule->rule_next;
alt=new_rule->rule_alts;
DetermineStatesOfRootNodeAndDefs (alt->alt_rhs_root,&alt->alt_rhs_defs,alt->alt_lhs_root->node_state,0);
ReorderNodeDefinitionsAndDetermineUsedEntries (&alt->alt_rhs_defs,alt->alt_rhs_root);
new_rule->rule_next=rule->rule_next;
rule->rule_next=new_rule;
rule=new_rule;
}
new_rule=new_rules;
new_rules=new_rule->rule_next;
alt=new_rule->rule_alts;
DetermineStatesOfRootNodeAndDefs (alt->alt_rhs_root,&alt->alt_rhs_defs,alt->alt_lhs_root->node_state,0);
ReorderNodeDefinitionsAndDetermineUsedEntries (&alt->alt_rhs_defs,alt->alt_rhs_root);
new_rule->rule_next=rule->rule_next;
rule->rule_next=new_rule;
rule=new_rule;
}
return &rule->rule_next;
......
......@@ -3602,12 +3602,12 @@ static void ConvertSyntaxTree (Symbol symbols)
/* initialise the function table with symbols with a definition */
for_l (sdef,scc_dependency_list,sdef_next_scc)
if (sdef->sdef_kind==IMPRULE && sdef->sdef_over_arity==0)
if (sdef->sdef_kind==IMPRULE)
convert_imp_rule_type (sdef);
/* convert the rules */
for_l (sdef,scc_dependency_list,sdef_next_scc)
if (sdef->sdef_kind==IMPRULE && sdef->sdef_over_arity==0)
if (sdef->sdef_kind==IMPRULE)
convert_imp_rule_alts (sdef);
/* give a warning for annotated functions */
......@@ -3663,7 +3663,7 @@ static void UpdateSyntaxTree (void)
SymbDef sdef;
for_l (sdef,scc_dependency_list,sdef_next_scc)
if (sdef->sdef_kind==IMPRULE && sdef->sdef_over_arity==0)
if (sdef->sdef_kind==IMPRULE)
update_function_strictness (sdef);
}
......@@ -5502,9 +5502,7 @@ static void DeriveStrictness (Fun *f, unsigned arg, StrictKind arg_kind, StrictK
FindStrictPropsOfStrictInfo (&f->fun_strictargs[arg], arg_kind, context);
}
#define IsAnalysableFun(A) (! (A)->fun_symbol->sdef_no_sa &&\
(A)->fun_arity != 0 &&\
(A)->fun_kind == Function)
#define IsAnalysableFun(A) ((A)->fun_arity != 0 && (A)->fun_kind == Function)
static void FindStrictPropertiesOfFunction (Fun *f)
{
......@@ -5687,7 +5685,7 @@ void do_strictness_analysis (void)
SymbDef sdef;
for_l (sdef,scc_dependency_list,sdef_next_scc)
if (sdef->sdef_kind==IMPRULE && sdef->sdef_over_arity==0)
if (sdef->sdef_kind==IMPRULE)
FindStrictPropertiesOfFunction (sdef->sdef_sa_fun);
}
......
......@@ -47,7 +47,3 @@ Bool StrictDoVerbose = False;
Bool StrictDoAnnots = True;
Bool FunctionMayFailIsError = False;
Bool NotUsedIsError = False;
Bool FunctionNotUsedIsError = False;
Bool VERBOSE = True;
/*
Compiler setttings
Note that changes are of influence for project.c !!
*/
extern Bool DoCode; /* not generated in abc file */
......@@ -46,6 +45,4 @@ extern Bool StrictDoVerbose;
extern Bool StrictDoAnnots;
extern unsigned long StrictMemUse;
extern Bool VERBOSE;
extern Bool FunctionMayFailIsError,NotUsedIsError,FunctionNotUsedIsError;
extern Bool FunctionMayFailIsError;
......@@ -1125,9 +1125,6 @@ void ExamineTypesAndLhsOfSymbolDefinition (SymbDef def)
{
StateS rootstate;
if (def->sdef_over_arity!=0)
return;
def->sdef_number = 0;
if (def->sdef_exported && def->sdef_dcl_icl!=def)
......@@ -1268,7 +1265,7 @@ void ImportSymbols (Symbol symbols)
continue;
if (sdef->sdef_module!=CurrentModule){
if (sdef->sdef_isused && sdef->sdef_over_arity==0)
if (sdef->sdef_isused)
GenImport (sdef);
if (sdef->sdef_kind==RECORDTYPE){
......@@ -1279,7 +1276,7 @@ void ImportSymbols (Symbol symbols)
field_sdef=fields->fl_symbol->symb_def;
if (field_sdef->sdef_isused && field_sdef->sdef_over_arity==0)
if (field_sdef->sdef_isused)
GenImport (field_sdef);
}
}
......@@ -2951,37 +2948,36 @@ static void set_states_in_lhs (ArgP arguments,StateP states)
void GenerateStatesForRule (ImpRuleS *rule)
{
SymbDef rule_sdef;
RuleAlts alt;
#ifdef TRANSFORM_PATTERNS_BEFORE_STRICTNESS_ANALYSIS
StateP function_state_p;
#endif
CurrentSymbol=rule->rule_root->node_symbol;
rule_sdef=CurrentSymbol->symb_def;
if (rule_sdef->sdef_over_arity==0){
RuleAlts alt;
#ifdef TRANSFORM_PATTERNS_BEFORE_STRICTNESS_ANALYSIS
StateP function_state_p;
function_state_p=rule->rule_state_p;
function_state_p=rule->rule_state_p;
#endif
for_l (alt,rule->rule_alts,alt_next){
CurrentLine = alt->alt_line;
for_l (alt,rule->rule_alts,alt_next){
CurrentLine = alt->alt_line;
#ifdef TRANSFORM_PATTERNS_BEFORE_STRICTNESS_ANALYSIS
set_states_in_lhs (alt->alt_lhs_root->node_arguments,function_state_p);
alt->alt_lhs_root->node_state = function_state_p[-1]; /* i.e. the result state */
set_states_in_lhs (alt->alt_lhs_root->node_arguments,function_state_p);
alt->alt_lhs_root->node_state = function_state_p[-1]; /* i.e. the result state */
#endif
scope=1;
scope=1;
if (alt->alt_kind==Contractum){
DetermineStatesOfRootNodeAndDefs (alt->alt_rhs_root,&alt->alt_rhs_defs,alt->alt_lhs_root->node_state,0);
if (alt->alt_kind==Contractum){
DetermineStatesOfRootNodeAndDefs (alt->alt_rhs_root,&alt->alt_rhs_defs,alt->alt_lhs_root->node_state,0);
#ifdef OBSERVE_ARRAY_SELECTS_IN_PATTERN
set_states_of_array_selects_in_pattern (alt);
set_states_of_array_selects_in_pattern (alt);
#endif
} else if (rule->rule_type==NULL)
StaticMessage (True, "%S", ECodeBlock, CurrentSymbol);
}
} else if (rule->rule_type==NULL)
StaticMessage (True, "%S", ECodeBlock, CurrentSymbol);
}
}
......@@ -4013,23 +4009,20 @@ static void AnnotateStrictNodeIds (Node node,StrictNodeIdP strict_node_ids,NodeD
static void DetermineSharedAndAnnotatedNodesOfRule (ImpRuleP rule)
{
SymbDef rule_sdef;
RuleAlts alt;
CurrentSymbol=rule->rule_root->node_symbol;
rule_sdef=CurrentSymbol->symb_def;
if (rule_sdef->sdef_over_arity==0){
RuleAlts alt;
for_l (alt,rule->rule_alts,alt_next)
if (alt->alt_kind==Contractum){
CurrentLine = alt->alt_line;
for_l (alt,rule->rule_alts,alt_next)
if (alt->alt_kind==Contractum){
CurrentLine = alt->alt_line;
AnnotateStrictNodeIds (alt->alt_rhs_root,alt->alt_strict_node_ids,&alt->alt_rhs_defs);
AnnotateStrictNodeIds (alt->alt_rhs_root,alt->alt_strict_node_ids,&alt->alt_rhs_defs);
CollectSharedAndAnnotatedNodesInRhs (&alt->alt_rhs_root,&alt->alt_rhs_defs,alt->alt_strict_node_ids);
}
}
CollectSharedAndAnnotatedNodesInRhs (&alt->alt_rhs_root,&alt->alt_rhs_defs,alt->alt_strict_node_ids);
}
}
static void reset_states_and_ref_count_copies_of_node_defs (NodeDefS *node_def);
......@@ -4171,26 +4164,23 @@ static void reset_states_and_ref_count_copies_of_root_node (NodeP node_p)
void reset_states_and_ref_count_copies (ImpRuleS *rule)
{
SymbDef rule_sdef;
RuleAlts alt;
CurrentSymbol=rule->rule_root->node_symbol;
rule_sdef=CurrentSymbol->symb_def;
if (rule_sdef->sdef_over_arity==0){
RuleAlts alt;
for_l (alt,rule->rule_alts,alt_next)
if (alt->alt_kind==Contractum){
CurrentLine = alt->alt_line;
for_l (alt,rule->rule_alts,alt_next)
if (alt->alt_kind==Contractum){
CurrentLine = alt->alt_line;
#ifdef TRANSFORM_PATTERNS_BEFORE_STRICTNESS_ANALYSIS
reset_states_and_ref_count_copies_of_root_node (alt->alt_rhs_root);
reset_states_and_ref_count_copies_of_root_node (alt->alt_rhs_root);
#else
reset_states_and_ref_count_copies_of_node (alt->alt_rhs_root);
reset_states_and_ref_count_copies_of_node (alt->alt_rhs_root);
#endif
reset_states_and_ref_count_copies_of_node_defs (alt->alt_rhs_defs);
}
}
reset_states_and_ref_count_copies_of_node_defs (alt->alt_rhs_defs);
}
}
void DetermineSharedAndAnnotatedNodes (ImpRules rules,SymbolP *im_symbols_h)
......
......@@ -707,7 +707,6 @@ STRUCT (symbol_def,SymbDef){
unsigned sdef_ancestor;
short sdef_arity;
short sdef_cons_arity;
short sdef_over_arity;
unsigned short sdef_nr_of_lifted_nodeids;
union {
......@@ -734,29 +733,15 @@ STRUCT (symbol_def,SymbDef){
int sdef_mark;
Bool sdef_isused:1;
Bool sdef_no_sa:1;
Bool sdef_returnsnode:1;
Bool sdef_calledwithrootnode:1;
Bool sdef_unq_attributed:1;
Bool sdef_strict_constructor:1; /* for CONSTRUCTOR and RECORDTYPE */
Bool sdef_boxed_record:1; /* for RECORDTYPE */
Bool sdef_exported:1;
Bool sdef_main_dcl:1; /* if in .dcl of main .icl */
Bool sdef_infix:1;
#ifdef OS2
int sdef_stupid_gcc;
SDefKind sdef_kind:SDefKindSize;
unsigned sdef_infix_priority:4;
unsigned sdef_checkstatus:4; /* CheckStatus */
unsigned sdef_arfun:ArrayFunKindBitSize; /* ArrayFunKind */
unsigned sdef_infix_assoc:2; /* Assoc */
#else
unsigned sdef_kind:SDefKindSize;
unsigned sdef_infix_priority:4;
unsigned sdef_infix_assoc:2; /* Assoc */
unsigned sdef_checkstatus:3; /* CheckStatus */
unsigned sdef_arfun:ArrayFunKindBitSize; /* ArrayFunKind */
#endif
};
#define sdef_type sdef_u.u_type
......
......@@ -219,26 +219,6 @@ static Bool DetermineRefCountOfAttributeVarsInNode (TypeNode type_node)
} /* DetermineRefCountOfAttributeVarsInNode */
static void DetermineRefCountOfAttributeVars (TypeAlts type)
{
TypeArgs type_args;
UniVarEquations attr_equas;
ClearARC_Info ();
for (type_args = type -> type_alt_lhs -> type_node_arguments; type_args; type_args = type_args -> type_arg_next)
DetermineRefCountOfAttributeVarsInNode (type_args -> type_arg_node);
DetermineRefCountOfAttributeVarsInNode (type -> type_alt_rhs);
for (attr_equas = type -> type_alt_attr_equations; attr_equas; attr_equas = attr_equas -> uve_next)
{ AttributeKindList next;
UpdateRefCountInfo (attr_equas -> uve_demanded - FirstUniVarNumber, False);
for (next = attr_equas -> uve_offered; next; next = next -> akl_next)
UpdateRefCountInfo (next -> akl_elem - FirstUniVarNumber, False);
}
} /* DetermineRefCountOfAttributeVars */
static char *TypeConv = "typeconv";
static unsigned RetrieveRefCountInfo (int attr_var, Bool *used_implicitly)
......@@ -664,9 +644,6 @@ void PrintType (SymbDef tdef, TypeAlts type)
TypeArgs lhsargs = lhs_root -> type_node_arguments;
int i;
if (tdef -> sdef_unq_attributed && DoShowAttributes)
DetermineRefCountOfAttributeVars (type);
for (i=0; i<tdef -> sdef_nr_of_lifted_nodeids; i++)
lhsargs = lhsargs -> type_arg_next;
......
......@@ -30,15 +30,13 @@
#endif
typedef enum
{abcFile = 1, iclFile, dclFile, dumpFile, statFile,
stasFile, helpFile, applFile, assFile, sunAssFile,
{abcFile = 1, iclFile, dclFile, applFile, assFile, sunAssFile,
obj00File, obj20File, obj81File,
otherFile, hsFile
} FileKind;
#define EndOfFile ((int) -1)
#define FileNameMax 256
#define FOpenMax 10
#define SeekSet
#define SeekCur
#define SeekEnd
......
......@@ -35,17 +35,10 @@ char *GetFileExtension (FileKind kind)
return ".dcl";
case hsFile:
return ".hs";
case dumpFile:
return ".dmp";
case statFile:
return ".stt";
case stasFile:
return ".str";
case assFile:
return ".a";
case sunAssFile:
return ".s";
case helpFile:
case applFile:
case otherFile:
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment