2021-01-03 22:49:17 +08:00
|
|
|
/*************************************************************/
|
|
|
|
/*
|
|
|
|
* ARM64 dummy assembler for TCC
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef TARGET_DEFS_ONLY
|
|
|
|
|
|
|
|
#define CONFIG_TCC_ASM
|
|
|
|
#define NB_ASM_REGS 16
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void g(TCCState *S, int c);
|
|
|
|
ST_FUNC void gen_le16(TCCState *S, int c);
|
|
|
|
ST_FUNC void gen_le32(TCCState *S, int c);
|
2021-01-03 22:49:17 +08:00
|
|
|
|
|
|
|
/*************************************************************/
|
|
|
|
#else
|
|
|
|
/*************************************************************/
|
|
|
|
#define USING_GLOBALS
|
|
|
|
#include "tcc.h"
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
static void asm_error(TCCState *S)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 13:20:00 +08:00
|
|
|
tcc_error(S, "ARM asm not implemented.");
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* XXX: make it faster ? */
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void g(TCCState *S, int c)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
|
|
|
int ind1;
|
2021-10-22 13:20:00 +08:00
|
|
|
if (S->nocode_wanted)
|
2021-01-03 22:49:17 +08:00
|
|
|
return;
|
2021-10-22 13:20:00 +08:00
|
|
|
ind1 = S->ind + 1;
|
2021-01-03 22:49:17 +08:00
|
|
|
if (ind1 > cur_text_section->data_allocated)
|
2021-10-22 13:20:00 +08:00
|
|
|
section_realloc(S, cur_text_section, ind1);
|
|
|
|
cur_text_section->data[S->ind] = c;
|
|
|
|
S->ind = ind1;
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void gen_le16 (TCCState *S, int i)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 02:09:42 +08:00
|
|
|
g(S, i);
|
|
|
|
g(S, i>>8);
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void gen_le32 (TCCState *S, int i)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 02:09:42 +08:00
|
|
|
gen_le16(S, i);
|
|
|
|
gen_le16(S, i>>16);
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void gen_expr32(TCCState *S, ExprValue *pe)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 02:09:42 +08:00
|
|
|
gen_le32(S, pe->v);
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-22 02:09:42 +08:00
|
|
|
ST_FUNC void asm_opcode(TCCState *S, int opcode)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 13:20:00 +08:00
|
|
|
asm_error(S);
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void subst_asm_operand(TCCState *S, CString *add_str, SValue *sv, int modifier)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 13:20:00 +08:00
|
|
|
asm_error(S);
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* generate prolog and epilog code for asm statement */
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void asm_gen_code(TCCState *S, ASMOperand *operands, int nb_operands,
|
2021-01-03 22:49:17 +08:00
|
|
|
int nb_outputs, int is_output,
|
|
|
|
uint8_t *clobber_regs,
|
|
|
|
int out_reg)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void asm_compute_constraints(TCCState *S, ASMOperand *operands,
|
2021-01-03 22:49:17 +08:00
|
|
|
int nb_operands, int nb_outputs,
|
|
|
|
const uint8_t *clobber_regs,
|
|
|
|
int *pout_reg)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC void asm_clobber(TCCState *S, uint8_t *clobber_regs, const char *str)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 13:20:00 +08:00
|
|
|
asm_error(S);
|
2021-01-03 22:49:17 +08:00
|
|
|
}
|
|
|
|
|
2021-10-22 13:20:00 +08:00
|
|
|
ST_FUNC int asm_parse_regvar (TCCState *S, int t)
|
2021-01-03 22:49:17 +08:00
|
|
|
{
|
2021-10-22 13:20:00 +08:00
|
|
|
asm_error(S);
|
2021-01-03 22:49:17 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************/
|
|
|
|
#endif /* ndef TARGET_DEFS_ONLY */
|