spl.c
/* Substitute alias with constant or register */
Substitute alias with constant or register
Substitute alias with constant or register
node *substitute_id(node *id)
{
    struct define *temp;
    struct alias *temp2;
    temp = lookup_constant(id->name);
    if (temp != NULL)
    {
        id->nodetype = NODE_NUM;
        id->name = NULL;
        id->value = temp->value;
        return (id);
    }
    temp2 = lookup_alias(id->name);
    if (temp2 == NULL)
    {
        printf("\n%d: Unknown identifier %s used!!\n", linecount, id->name);
        exit(0);
    }
    id->nodetype = NODE_REG;
    id->name = NULL;
    id->value = temp2->reg;
    return id;
}
node * substitute_id ( node * id ) { struct define * temp ; struct alias * temp2 ; temp = lookup_constant ( id -> name ) ; if ( temp != NULL ) { id -> nodetype = NODE_NUM ; id -> name = NULL ; id -> value = temp -> value ; return ( id ) ; } temp2 = lookup_alias ( id -> name ) ; if ( temp2 == NULL ) { printf ( " \n \n " , linecount , id -> name ) ; exit ( 0 ) ; } id -> nodetype = NODE_REG ; id -> name = NULL ; id -> value = temp2 -> reg ; return id ; }
Substitute alias with constant or register
Substitute alias with constant or register