Commit 64ea7c9d authored by John van Groningen's avatar John van Groningen
Browse files

remove unused functions

parent 1ef4a441
......@@ -6,8 +6,4 @@ Author: Sjaak Smetsers
*/
extern BITVECT DetermineUniPropOfTypeCons (SymbDef typecons);
extern BITVECT DetermineConsVarsOfTypeCons (SymbDef typecons, ConsVarList * cons_vars);
extern void PrintNodeSymbol (Node node, int arg_nr, File file);
......@@ -22,40 +22,6 @@
#include "comparser.h"
#include "buildtree.h"
BITVECT DetermineUniPropOfTypeCons (SymbDef typecons)
{
if (typecons -> sdef_kind == TYPE || typecons -> sdef_kind == RECORDTYPE)
return (typecons -> sdef_type) ? typecons -> sdef_type -> type_uniprop : ALLBITSSET;
else
return (typecons -> sdef_kind == TYPESYN) ? typecons -> sdef_syn_type -> syntype_uniprop : ALLBITSSET;
} /* DetermineUniPropOfTypeCons */
BITVECT DetermineConsVarsOfTypeCons (SymbDef typecons, ConsVarList * cons_vars)
{
if (typecons -> sdef_kind == TYPE || typecons -> sdef_kind == RECORDTYPE)
{ if (typecons -> sdef_type)
{ * cons_vars = NULL;
return typecons -> sdef_type -> type_consvars;
}
else
{ * cons_vars = NULL;
return ALLBITSCLEAR;
}
}
else if (typecons -> sdef_kind == TYPESYN)
{ * cons_vars = NULL;
return typecons -> sdef_syn_type -> syn_consvars;
}
else
{ * cons_vars = NULL;
return ALLBITSCLEAR;
}
} /* DetermineConsVarsOfTypeCons */
#define SubstitutedType(typeargs) ((typeargs)[-1])
void PrintNodeSymbol (Node node, int arg_nr, File file)
{
Symbol rootsymb;
......
......@@ -35,190 +35,6 @@ typedef
static ARC_Info CurrentARC_Info;
static ARC_Info NewARC_Info (void)
{
ARC_Info new = CompAllocType (struct attr_ref_count_info);
new -> arci_used = ALLBITSCLEAR;
new -> arci_multiply_used = ALLBITSCLEAR;
new -> arci_implicitly_attributed = ALLBITSCLEAR;
new -> arci_next = NULL;
return new;
} /* NewARC_Info */
static void ClearARC_Info (void)
{
ARC_Info next;
for (next = CurrentARC_Info; next; next = next -> arci_next)
{ next -> arci_used = ALLBITSCLEAR;
next -> arci_multiply_used = ALLBITSCLEAR;
next -> arci_implicitly_attributed = ALLBITSCLEAR;
}
} /* ClearARC_Info */
static void UpdateRefCountInfo (int attr_var, Bool used_implicitly)
{
ARC_Info attrinfo = CurrentARC_Info;
while (attr_var >= 32)
{ attr_var -= 32;
if (attrinfo -> arci_next == NULL)
attrinfo -> arci_next = NewARC_Info ();
attrinfo = attrinfo -> arci_next;
}
if (used_implicitly)
attrinfo -> arci_implicitly_attributed |= BIT (attr_var);
if (BITTEST (attrinfo -> arci_used, attr_var))
attrinfo -> arci_multiply_used |= BIT (attr_var);
else
attrinfo -> arci_used |= BIT (attr_var);
} /* UpdateRefCountInfo */
static Bool DetermineRefCountOfAttributeVarsInTypeVar (TypeNode type_var)
{
if (type_var -> type_node_attribute >= FirstUniVarNumber)
{ if (type_var -> type_node_tv != NULL)
{ if (! TestMark (type_var -> type_node_tv, tv_mark, TV_UNIQUE_VARIABLE_PRINT_MASK))
{ SetMark (type_var -> type_node_tv, tv_mark, TV_UNIQUE_VARIABLE_PRINT_MASK);
UpdateRefCountInfo (type_var -> type_node_attribute - FirstUniVarNumber, False);
}
}
return True;
}
else
return False;
} /* DetermineRefCountOfAttributeVarsInTypeVar */
static BITVECT CombineTypeArguments (ConsVarList cons_var, int arity1, BITVECT args1, int arity2, BITVECT args2)
{
BITVECT combined_args = ALLBITSCLEAR;
int cons_var_arity = cons_var -> cvl_arity;
int i, j;
for (j = 0; j < cons_var_arity; j++)
{ BITVECT cons_var_prop = cons_var -> cvl_argclass [j].tac_uniprop;
for (i = 0; i < arity1; i++)
{ if (BITTEST (cons_var_prop, i) && BITTEST (args1, i))
combined_args |= BIT (j);
}
for (i = 0; i < arity2; i++)
{ if (BITTEST (cons_var_prop, i+arity1) && BITTEST (args2, i))
combined_args |= BIT (j);
}
}
return combined_args;
} /* CombineTypeArguments */
static Bool DetermineRefCountOfAttributeVarsInNode (TypeNode type_node);
static Bool DetermineRefCountOfAttributeVarsInTypeConsNode (TypeNode type_node, Symbol type_symb,
int nr_of_extra_args, BITVECT extra_prop_args)
{
TypeArgs type_args;
int arg_nr;
Bool contains_propating_univars = False;
ConsVarList cons_vars;
BITVECT uniprop, cons_var_vect, propagating_args = ALLBITSCLEAR;
if (type_symb -> symb_kind == definition)
{ cons_var_vect = DetermineConsVarsOfTypeCons (type_symb -> symb_def, & cons_vars);
uniprop = DetermineUniPropOfTypeCons (type_symb -> symb_def);
}
else
{ cons_var_vect = ALLBITSCLEAR;
cons_vars = NULL;
if (type_symb -> symb_kind == fun_type)
uniprop = ALLBITSCLEAR;
else if (type_symb -> symb_kind == apply_symb)
uniprop = BIT (0);
else
uniprop = ALLBITSSET;
}
for (type_args = type_node -> type_node_arguments, arg_nr=0; type_args;
type_args = type_args -> type_arg_next, arg_nr++)
{ if (! BITTEST (cons_var_vect, arg_nr))
{ if (DetermineRefCountOfAttributeVarsInNode (type_args -> type_arg_node))
{ propagating_args |= BIT(arg_nr);
if (BITTEST (uniprop, arg_nr))
contains_propating_univars = True;
}
}
}
for (type_args = type_node -> type_node_arguments, arg_nr=0; cons_vars; cons_vars = cons_vars -> cvl_next)
{ for (; type_args != NULL && arg_nr < cons_vars -> cvl_number; arg_nr++, type_args = type_args -> type_arg_next)
;
if (type_args != NULL)
{ TypeNode cons_node = type_args -> type_arg_node;
if (cons_node -> type_node_is_var)
{ if (DetermineRefCountOfAttributeVarsInTypeVar (cons_node) && BITTEST (uniprop, arg_nr))
contains_propating_univars = True;
}
else
{ BITVECT comb_args_prop = CombineTypeArguments (cons_vars, type_node -> type_node_arity, propagating_args,
nr_of_extra_args, extra_prop_args);
if (DetermineRefCountOfAttributeVarsInTypeConsNode (cons_node, cons_node -> type_node_symbol,
cons_vars -> cvl_arity, comb_args_prop) && BITTEST (uniprop, arg_nr))
contains_propating_univars = True;
}
}
}
if (! contains_propating_univars)
{ extra_prop_args &= uniprop >> type_node -> type_node_arity;
for (arg_nr = 0; arg_nr < nr_of_extra_args; arg_nr ++)
{ if (BITTEST (extra_prop_args, arg_nr))
{ contains_propating_univars = True;
break;
}
}
}
if (type_node -> type_node_attribute >= FirstUniVarNumber)
{ UpdateRefCountInfo (type_node -> type_node_attribute - FirstUniVarNumber, contains_propating_univars);
return True;
}
else
return contains_propating_univars;
} /* DetermineRefCountOfAttributeVarsInTypeConsNode */
static Bool DetermineRefCountOfAttributeVarsInNode (TypeNode type_node)
{
if (type_node -> type_node_is_var)
return DetermineRefCountOfAttributeVarsInTypeVar (type_node);
else
{ Symbol typesymb = type_node -> type_node_symbol;
if (typesymb -> symb_kind < Nr_Of_Basic_Types)
{ if (type_node -> type_node_attribute >= FirstUniVarNumber)
{ UpdateRefCountInfo (type_node -> type_node_attribute - FirstUniVarNumber, False);
return True;
}
else
return False;
}
else
return DetermineRefCountOfAttributeVarsInTypeConsNode (type_node, typesymb, 0, ALLBITSCLEAR);
}
} /* DetermineRefCountOfAttributeVarsInNode */
static char *TypeConv = "typeconv";
static unsigned RetrieveRefCountInfo (int attr_var, Bool *used_implicitly)
......
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