History

Fix riscv assembler

riscv64-asm.c: asm_opcode: add return asm_parse_regvar: add abi register names riscv64-tok.h: add abi register names

herman ten brugge committed 4 years ago

Commit cd627c61 parent afc13622 files · +6 −3Browse files

Unified · Split

2 files
  1. riscv64-asm.c +6 −1
  2. riscv64-tok.h +0 −2
riscv64-asm.c+6−1
@@ -643,6 +643,7 @@ ST_FUNC void asm_opcode(TCCState *s1, int token) · 642 unmodified lines
643643 case TOK_ASM_sltu:
644644 case TOK_ASM_sltiu:
645645 asm_data_processing_opcode(s1, token);
646+ return;
646647
647648 case TOK_ASM_lb:
648649 case TOK_ASM_lh:
@@ -712,9 +713,13 @@ ST_FUNC void asm_clobber(uint8_t *clobber_regs, const char *str) · 63 unmodified lines
712713 ST_FUNC int asm_parse_regvar (int t)
713714 {
714715 if (t >= TOK_ASM_x0 && t <= TOK_ASM_pc) { /* register name */
716+ if (t >= TOK_ASM_zero && t <= TOK_ASM_t6)
717+ return t - TOK_ASM_zero;
715718 switch (t) {
719+ case TOK_ASM_s0:
720+ return 8;
716721 case TOK_ASM_pc:
717− return -1; // TODO: Figure out where it can be used after all
722+ tcc_error("PC register not implemented.");
718723 default:
719724 return t - TOK_ASM_x0;
720725 }
riscv64-tok.h+0−2
@@ -41,7 +41,6 @@ · 40 unmodified lines
4141 /* register macros */
4242
4343 DEF_ASM(zero)
44−/*
4544 DEF_ASM(ra)
4645 DEF_ASM(sp)
4746 DEF_ASM(gp)
@@ -75,7 +74,6 @@ · 27 unmodified lines
7574 DEF_ASM(t6)
7675
7776 DEF_ASM(s0) // = x8
78−*/
7977
8078 DEF_ASM(pc)
8179

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t