Skip to content

Commit

Permalink
small update; prepare for choice between set_ref and deref ops in cod…
Browse files Browse the repository at this point in the history
…egen.
  • Loading branch information
kjs committed May 31, 2012
1 parent bb2de1a commit faffddd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions m1_ast.h
Expand Up @@ -167,9 +167,11 @@ typedef struct m1_object {

enum m1_object_type type; /* selector for union */
struct m1_symbol *sym;
unsigned line;
unsigned line;

struct m1_object *parent;
struct m1_object *parent;
char is_target; /* true if this m1_object represents
an object on the lhs from an assignment. */

} m1_object;

Expand Down
8 changes: 6 additions & 2 deletions m1_gencode.c
Expand Up @@ -300,9 +300,13 @@ gencode_obj(M1_compiler *comp, m1_object *obj, m1_object **parent) {
fprintf(OUT, "\tadd_i <struct>, I%d\n", reg.no);
break;
case OBJECT_INDEX: /* b in a[b] */
reg = gencode_expr(comp, obj->obj.index);
fprintf(OUT, "\tadd_i <array>, I%d\n", reg.no);
{
int offset = 0;
m1_reg offsetreg = gencode_expr(comp, obj->obj.index);

// fprintf(OUT, "\tderef\t%d, <array>, I%d\n", reg.no);
break;
}
default:
break;
}
Expand Down

0 comments on commit faffddd

Please sign in to comment.