This commit is contained in:
ZZY
2025-04-01 00:13:21 +08:00
parent 2b4857001c
commit 74f43a1ab7
79 changed files with 2271 additions and 2861 deletions

View File

@@ -0,0 +1,30 @@
#ifndef __SMCC_ASM_RISCV32_H__
#define __SMCC_ASM_RISCV32_H__
#include <lib/core.h>
#include <lib/utils/ds/vector.h>
#include <lib/utils/symtab/symtab.h>
#include "riscv32_def.h"
#include "symtab_asm.h"
typedef struct rotated_instr {
u32_t address;
symasm_entry_t target;
rv32_instr_t instr;
} rotated_instr_t;
typedef struct rv32_prog {
strpool_t* strpool;
symtab_asm_t symtab;
u32_t text_base_address;
vector_header(text, u32_t);
u32_t data_base_address;
vector_header(data, iptr_t);
vector_header(rinstrs, rotated_instr_t);
} rv32_prog_t;
void init_rv32_prog(rv32_prog_t* prog, strpool_t* strpool);
int emit_rv32_instr(rv32_prog_t* prog, rv32_instr_t *instr, u32_t idx, symasm_entry_t *target);
// int gen_rv32_instr(rv32_prog_t* prog);
#endif