From e465ae6cedf98ef02b194d174f73ceaf6c45e542 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Wed, 21 May 2014 18:30:36 -0700 Subject: [PATCH] Add global loads with offset --- PLASMA/src/codegen.c | 14 ++++++++++++++ PLASMA/src/codegen.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/PLASMA/src/codegen.c b/PLASMA/src/codegen.c index 087e579b..e9ad2c79 100755 --- a/PLASMA/src/codegen.c +++ b/PLASMA/src/codegen.c @@ -556,6 +556,20 @@ void emit_law(int tag, int type) printf("\t%s\t$6A\t\t\t; LAW\t%s\n", DB, taglbl); printf("_F%03d%c\t%s\t%s\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl); } +void emit_lab_ofst(int tag, int offset, int type) +{ + int fixup = fixup_new(tag, type, FIXUP_WORD); + char *taglbl = tag_string(tag, type); + printf("\t%s\t$68\t\t\t; LAB\t%s\n", DB, taglbl); + printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); +} +void emit_law_ofst(int tag, int offset, int type) +{ + int fixup = fixup_new(tag, type, FIXUP_WORD); + char *taglbl = tag_string(tag, type); + printf("\t%s\t$6A\t\t\t; LAW\t%s\n", DB, taglbl); + printf("_F%03d%c\t%s\t%s+%d\t\t\n", fixup, LBL, DW, type & EXTERN_TYPE ? "0" : taglbl, offset); +} void emit_sb(void) { printf("\t%s\t$70\t\t\t; SB\n", DB); diff --git a/PLASMA/src/codegen.h b/PLASMA/src/codegen.h index 58a98928..646c3185 100755 --- a/PLASMA/src/codegen.h +++ b/PLASMA/src/codegen.h @@ -22,6 +22,8 @@ void emit_llb(int index); void emit_llw(int index); void emit_lab(int tag, int type); void emit_law(int tag, int type); +void emit_lab_ofst(int tag, int offset, int type); +void emit_law_ofst(int tag, int offset, int type); void emit_sb(void); void emit_sw(void); void emit_slb(int index);