pass-lang/src/asm.c

21 lines
586 B
C

/// This file handles the contextual generation of machine code.
/// It abstracts over quirks like the limitations of addressing modes,
/// provides higher-level functionality, and can perform peephole optimization.
#include "asm.h"
#include "format.h"
#include "x86encode.h"
#include <stdlib.h>
#include <string.h>
void inst_jump(symbol sym) {
int32_t disp = symbol_offset(sym, X86_JMP_DISP8_SIZE);
if (disp >= INT8_MIN && disp <= INT8_MAX) {
x86_inst_jmp_disp8(disp);
}
x86_inst_jmp_disp32_op();
relocate_pc32(sym);
// TODO: support 64-bit jumps?
}