Rename 'rel' field to 'pcrel'.

This commit is contained in:
Olaf Seibert
2021-07-04 20:02:21 +02:00
parent 34b4815798
commit 1722fae3d4
3 changed files with 12 additions and 12 deletions

View File

@@ -511,7 +511,7 @@ void mode_extension(
} }
if (value->type == EX_LIT) { if (value->type == EX_LIT) {
if (mode->rel) { /* PC-relative? */ if (mode->pcrel) { /* PC-relative? */
if (current_pc->section->flags & PSECT_REL) { if (current_pc->section->flags & PSECT_REL) {
store_displaced_word(str, tr, 2, value->data.lit); store_displaced_word(str, tr, 2, value->data.lit);
} else { } else {
@@ -527,7 +527,7 @@ void mode_extension(
if (SYM_IS_IMPORTED(sym)) { if (SYM_IS_IMPORTED(sym)) {
/* Reference to a global symbol. */ /* Reference to a global symbol. */
/* Global symbol plus offset */ /* Global symbol plus offset */
if (mode->rel) if (mode->pcrel)
store_global_displaced_offset_word(str, tr, 2, offset, sym->label); store_global_displaced_offset_word(str, tr, 2, offset, sym->label);
else else
store_global_offset_word(str, tr, 2, offset, sym->label); store_global_offset_word(str, tr, 2, offset, sym->label);
@@ -535,14 +535,14 @@ void mode_extension(
/* Relative to non-external symbol. */ /* Relative to non-external symbol. */
if (current_pc->section == sym->section) { if (current_pc->section == sym->section) {
/* In the same section */ /* In the same section */
if (mode->rel) { if (mode->pcrel) {
/* I can compute this myself. */ /* I can compute this myself. */
store_word(str, tr, 2, sym->value + offset - DOT - 2); store_word(str, tr, 2, sym->value + offset - DOT - 2);
} else } else
store_internal_word(str, tr, 2, sym->value + offset); store_internal_word(str, tr, 2, sym->value + offset);
} else { } else {
/* In a different section */ /* In a different section */
if (mode->rel) if (mode->pcrel)
store_psect_displaced_offset_word(str, tr, 2, sym->value + offset, sym->section->label); store_psect_displaced_offset_word(str, tr, 2, sym->value + offset, sym->section->label);
else else
store_psect_offset_word(str, tr, 2, sym->value + offset, sym->section->label); store_psect_offset_word(str, tr, 2, sym->value + offset, sym->section->label);
@@ -551,7 +551,7 @@ void mode_extension(
} else { } else {
/* Complex relocation */ /* Complex relocation */
if (mode->rel) if (mode->pcrel)
store_complex_displaced(str, tr, 2, mode->offset); store_complex_displaced(str, tr, 2, mode->offset);
else else
store_complex(str, tr, 2, mode->offset); store_complex(str, tr, 2, mode->offset);

View File

@@ -15,7 +15,7 @@ typedef struct addr_mode {
/* bit 3 is indirect */ /* bit 3 is indirect */
/* bits 4:6 are mode, where 0=Rn, 1=(Rn)+, /* bits 4:6 are mode, where 0=Rn, 1=(Rn)+,
2=-(Rn), 3=offset(Rn) */ 2=-(Rn), 3=offset(Rn) */
int rel; /* the addressing mode is PC-relative */ int pcrel; /* the addressing mode is PC-relative */
EX_TREE *offset; /* Expression giving the offset */ EX_TREE *offset; /* Expression giving the offset */
} ADDR_MODE; } ADDR_MODE;

12
parse.c
View File

@@ -194,8 +194,8 @@ int get_mode(
EX_TREE *value; EX_TREE *value;
mode->offset = NULL; mode->offset = NULL;
mode->rel = 0; mode->pcrel = 0;
mode->type = 0; mode->type = MODE_REG;
cp = skipwhite(cp); cp = skipwhite(cp);
@@ -356,13 +356,13 @@ int get_mode(
if (mode->type & MODE_INDIRECT) { /* Have already noted indirection? */ if (mode->type & MODE_INDIRECT) { /* Have already noted indirection? */
mode->type |= MODE_OFFSET|MODE_PC;/* If so, then PC-relative is the only mode->type |= MODE_OFFSET|MODE_PC;/* If so, then PC-relative is the only
option */ option */
mode->rel = 1; /* Note PC-relative */ mode->pcrel = 1; /* Note PC-relative */
} else if (enabl_ama) { /* User asked for absolute adressing? */ } else if (enabl_ama) { /* User asked for absolute adressing? */
mode->type |= MODE_INDIRECT|MODE_AUTO_INCR|MODE_PC; mode->type |= MODE_INDIRECT|MODE_AUTO_INCR|MODE_PC;
/* Give it to him. */ /* Give it to him. */
} else { } else {
mode->type |= MODE_OFFSET|MODE_PC; /* PC-relative */ mode->type |= MODE_OFFSET|MODE_PC; /* PC-relative */
mode->rel = 1; /* Note PC-relative */ mode->pcrel = 1; /* Note PC-relative */
} }
return TRUE; return TRUE;
@@ -389,8 +389,8 @@ int get_fp_src_mode(
int ret = parse_float(cp, &fltendp, 1, flt); int ret = parse_float(cp, &fltendp, 1, flt);
if (ret) { if (ret) {
mode->type = 027; mode->type = MODE_AUTO_INCR | MODE_PC;
mode->rel = 0; mode->pcrel = 0;
mode->offset = new_ex_lit(flt[0]); mode->offset = new_ex_lit(flt[0]);
mode->offset->cp = fltendp; mode->offset->cp = fltendp;