mirror of
https://github.com/danog/ir.git
synced 2024-11-26 20:34:53 +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_fold_hash.h
|
||||||
ir_emit_x86.h
|
ir_emit_x86.h
|
||||||
ir_emit_aarch64.h
|
ir_emit_aarch64.h
|
||||||
|
ir_emit_riscv64.h
|
||||||
minilua
|
minilua
|
||||||
gen_ir_fold_hash
|
gen_ir_fold_hash
|
||||||
ir_test
|
ir_test
|
||||||
|
11
Makefile
11
Makefile
@ -1,5 +1,5 @@
|
|||||||
# TRAGET may be "x86_64" or "x86" or "aarch64"
|
# TRAGET may be "x86_64" or "x86" or "aarch64" or "riscv64"
|
||||||
TARGET = x86_64
|
TARGET = riscv64
|
||||||
# BUILD can be "debug" or "release"
|
# BUILD can be "debug" or "release"
|
||||||
BUILD = debug
|
BUILD = debug
|
||||||
BUILD_DIR = .
|
BUILD_DIR = .
|
||||||
@ -40,6 +40,13 @@ ifeq (aarch64, $(TARGET))
|
|||||||
DASM_FLAGS =
|
DASM_FLAGS =
|
||||||
endif
|
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 \
|
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_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 \
|
$(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
|
# endif
|
||||||
#elif defined(IR_TARGET_AARCH64)
|
#elif defined(IR_TARGET_AARCH64)
|
||||||
# define IR_TARGET "aarch64"
|
# define IR_TARGET "aarch64"
|
||||||
|
#elif defined(IR_TARGET_RISCV64)
|
||||||
|
# define IR_TARGET "riscv64"
|
||||||
#else
|
#else
|
||||||
# error "Unknown IR target"
|
# error "Unknown IR target"
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# include "ir_x86.h"
|
# include "ir_x86.h"
|
||||||
#elif defined(IR_TARGET_AARCH64)
|
#elif defined(IR_TARGET_AARCH64)
|
||||||
# include "ir_aarch64.h"
|
# include "ir_aarch64.h"
|
||||||
|
#elif defined(IR_TARGET_RISCV64)
|
||||||
|
# include "ir_riscv.h"
|
||||||
#else
|
#else
|
||||||
# error "Unknown IR target"
|
# error "Unknown IR target"
|
||||||
#endif
|
#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)
|
#elif defined(IR_TARGET_AARCH64)
|
||||||
# include "dynasm/dasm_proto.h"
|
# include "dynasm/dasm_proto.h"
|
||||||
# include "dynasm/dasm_arm64.h"
|
# include "dynasm/dasm_arm64.h"
|
||||||
|
#elif defined(IR_TARGET_RISCV64)
|
||||||
|
# include "dynasm/dasm_proto.h"
|
||||||
|
# include "dynasm/dasm_riscv64.h"
|
||||||
#else
|
#else
|
||||||
# error "Unknown IR target"
|
# error "Unknown IR target"
|
||||||
#endif
|
#endif
|
||||||
@ -343,6 +348,8 @@ static void ir_emit_dessa_moves(ir_ctx *ctx, int b, ir_block *bb);
|
|||||||
# include "ir_emit_x86.h"
|
# include "ir_emit_x86.h"
|
||||||
#elif defined(IR_TARGET_AARCH64)
|
#elif defined(IR_TARGET_AARCH64)
|
||||||
# include "ir_emit_aarch64.h"
|
# include "ir_emit_aarch64.h"
|
||||||
|
#elif defined(IR_TARGET_RISCV64)
|
||||||
|
# include "ir_emit_riscv64.h"
|
||||||
#else
|
#else
|
||||||
# error "Unknown IR target"
|
# error "Unknown IR target"
|
||||||
#endif
|
#endif
|
||||||
|
2
ir_gdb.c
2
ir_gdb.c
@ -154,6 +154,8 @@ static const ir_elf_header ir_elfhdr_template = {
|
|||||||
.machine = 62,
|
.machine = 62,
|
||||||
#elif defined(IR_TARGET_AARCH64)
|
#elif defined(IR_TARGET_AARCH64)
|
||||||
.machine = 183,
|
.machine = 183,
|
||||||
|
#elif defined(IR_TARGET_RISCV64)
|
||||||
|
.machine = 243,
|
||||||
#else
|
#else
|
||||||
# error "Unsupported target architecture"
|
# error "Unsupported target architecture"
|
||||||
#endif
|
#endif
|
||||||
|
2
ir_ra.c
2
ir_ra.c
@ -21,6 +21,8 @@
|
|||||||
# include "ir_x86.h"
|
# include "ir_x86.h"
|
||||||
#elif defined(IR_TARGET_AARCH64)
|
#elif defined(IR_TARGET_AARCH64)
|
||||||
# include "ir_aarch64.h"
|
# include "ir_aarch64.h"
|
||||||
|
#elif defined(IR_TARGET_RISCV64)
|
||||||
|
# include "ir_riscv64.h"
|
||||||
#else
|
#else
|
||||||
# error "Unknown IR target"
|
# error "Unknown IR target"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user