Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
tyfkda committed Apr 17, 2024
1 parent 1197fa3 commit aacea25
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
16 changes: 1 addition & 15 deletions src/as/arch/riscv64/ir_asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "ir_asm.h"

#include <assert.h>
#include <stdlib.h> // exit
#include <stdint.h>

#include "gen_section.h"
#include "inst.h"
Expand Down Expand Up @@ -155,8 +155,6 @@ bool calc_label_address(uintptr_t start_address, Vector **section_irs, Table *la

bool resolve_relative_address(Vector **section_irs, Table *label_table, Vector *unresolved) {
assert(unresolved != NULL);
Table unresolved_labels;
table_init(&unresolved_labels);
vec_clear(unresolved);
bool size_upgraded = false;
for (int sec = 0; sec < SECTION_COUNT; ++sec) {
Expand Down Expand Up @@ -205,18 +203,6 @@ bool resolve_relative_address(Vector **section_irs, Table *label_table, Vector *
}
}

if (unresolved_labels.count > 0 && unresolved == NULL) {
for (int i = 0; ;) {
const Name *name;
void *dummy;
i = table_iterate(&unresolved_labels, i, &name, &dummy);
if (i < 0)
break;
fprintf(stderr, "Undefined reference: `%.*s'\n", NAMES(name));
}
exit(1);
}

return !size_upgraded;
}

Expand Down
15 changes: 0 additions & 15 deletions src/as/arch/x64/ir_asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <assert.h>
#include <stdint.h>
#include <stdlib.h> // exit

#include "gen_section.h"
#include "inst.h"
Expand Down Expand Up @@ -177,8 +176,6 @@ static bool make_jmp_long(IR *ir) {

bool resolve_relative_address(Vector **section_irs, Table *label_table, Vector *unresolved) {
assert(unresolved != NULL);
Table unresolved_labels;
table_init(&unresolved_labels);
vec_clear(unresolved);
bool size_upgraded = false;
for (int sec = 0; sec < SECTION_COUNT; ++sec) {
Expand Down Expand Up @@ -322,18 +319,6 @@ bool resolve_relative_address(Vector **section_irs, Table *label_table, Vector *
}
}

if (unresolved_labels.count > 0 && unresolved == NULL) {
for (int i = 0; ;) {
const Name *name;
void *dummy;
i = table_iterate(&unresolved_labels, i, &name, &dummy);
if (i < 0)
break;
fprintf(stderr, "Undefined reference: `%.*s'\n", NAMES(name));
}
exit(1);
}

return !size_upgraded;
}

Expand Down

0 comments on commit aacea25

Please sign in to comment.