mirror of
https://github.com/danog/ir.git
synced 2024-11-26 12:24:56 +01:00
Prepare riscv64
This commit is contained in:
parent
3b0de17cdd
commit
5100e84134
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,6 +5,7 @@
|
||||
ir_fold_hash.h
|
||||
ir_emit_x86.h
|
||||
ir_emit_aarch64.h
|
||||
ir_emit_riscv64.h
|
||||
minilua
|
||||
gen_ir_fold_hash
|
||||
ir_test
|
||||
|
11
Makefile
11
Makefile
@ -1,5 +1,5 @@
|
||||
# TRAGET may be "x86_64" or "x86" or "aarch64"
|
||||
TARGET = x86_64
|
||||
# TRAGET may be "x86_64" or "x86" or "aarch64" or "riscv64"
|
||||
TARGET = riscv64
|
||||
# BUILD can be "debug" or "release"
|
||||
BUILD = debug
|
||||
BUILD_DIR = .
|
||||
@ -40,6 +40,13 @@ ifeq (aarch64, $(TARGET))
|
||||
DASM_FLAGS =
|
||||
endif
|
||||
|
||||
ifeq (riscv64, $(TARGET))
|
||||
CC= riscv64-linux-gnu-gcc --sysroot=$(HOME)/php/RISCV64
|
||||
CFLAGS += -DIR_TARGET_RISCV64
|
||||
DASM_ARCH = riscv64
|
||||
DASM_FLAGS =
|
||||
endif
|
||||
|
||||
OBJS_COMMON = $(BUILD_DIR)/ir.o $(BUILD_DIR)/ir_strtab.o $(BUILD_DIR)/ir_cfg.o \
|
||||
$(BUILD_DIR)/ir_sccp.o $(BUILD_DIR)/ir_gcm.o $(BUILD_DIR)/ir_ra.o $(BUILD_DIR)/ir_emit.o \
|
||||
$(BUILD_DIR)/ir_load.o $(BUILD_DIR)/ir_save.o $(BUILD_DIR)/ir_emit_c.o $(BUILD_DIR)/ir_dump.o \
|
||||
|
2
ir.h
2
ir.h
@ -46,6 +46,8 @@ extern "C" {
|
||||
# endif
|
||||
#elif defined(IR_TARGET_AARCH64)
|
||||
# define IR_TARGET "aarch64"
|
||||
#elif defined(IR_TARGET_RISCV64)
|
||||
# define IR_TARGET "riscv64"
|
||||
#else
|
||||
# error "Unknown IR target"
|
||||
#endif
|
||||
|
@ -11,6 +11,8 @@
|
||||
# include "ir_x86.h"
|
||||
#elif defined(IR_TARGET_AARCH64)
|
||||
# include "ir_aarch64.h"
|
||||
#elif defined(IR_TARGET_RISCV64)
|
||||
# include "ir_riscv.h"
|
||||
#else
|
||||
# error "Unknown IR target"
|
||||
#endif
|
||||
@ -326,6 +328,9 @@ static void *ir_jmp_addr(ir_ctx *ctx, ir_insn *insn, ir_insn *addr_insn)
|
||||
#elif defined(IR_TARGET_AARCH64)
|
||||
# include "dynasm/dasm_proto.h"
|
||||
# include "dynasm/dasm_arm64.h"
|
||||
#elif defined(IR_TARGET_RISCV64)
|
||||
# include "dynasm/dasm_proto.h"
|
||||
# include "dynasm/dasm_riscv64.h"
|
||||
#else
|
||||
# error "Unknown IR target"
|
||||
#endif
|
||||
@ -343,6 +348,8 @@ static void ir_emit_dessa_moves(ir_ctx *ctx, int b, ir_block *bb);
|
||||
# include "ir_emit_x86.h"
|
||||
#elif defined(IR_TARGET_AARCH64)
|
||||
# include "ir_emit_aarch64.h"
|
||||
#elif defined(IR_TARGET_RISCV64)
|
||||
# include "ir_emit_riscv64.h"
|
||||
#else
|
||||
# error "Unknown IR target"
|
||||
#endif
|
||||
|
2
ir_gdb.c
2
ir_gdb.c
@ -154,6 +154,8 @@ static const ir_elf_header ir_elfhdr_template = {
|
||||
.machine = 62,
|
||||
#elif defined(IR_TARGET_AARCH64)
|
||||
.machine = 183,
|
||||
#elif defined(IR_TARGET_RISCV64)
|
||||
.machine = 243,
|
||||
#else
|
||||
# error "Unsupported target architecture"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user