Skip to content

Commit

Permalink
all: rename SCALL to ECALL
Browse files Browse the repository at this point in the history
Rewrite any SCALLs encountered to ECALL. ECALL is the new ISA name for
SCALL.

Fixes golang#3

Change-Id: Iee25689d572a1d5251f1c5c5d4bf2d5950bcabce
  • Loading branch information
prattmic committed Jun 30, 2016
1 parent eda21a7 commit 0fcc8d3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cmd/asm/internal/asm/testdata/riscv_hello.s
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ TEXT _rt0_riscv_linux(SB),0,$8
// TODO: Add SEQZ support directly
SLTIU A0, $1, A0
MOV $SYS_EXIT_GROUP, A7
SCALL
ECALL
RET
1 change: 1 addition & 0 deletions src/cmd/asm/internal/asm/testdata/riscvenc.s
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ start:

RET // 67800000

ECALL // 73000000
SCALL // 73000000
RDCYCLE T0 // f32200c0
RDTIME T0 // f32210c0
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/riscv/prog.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var progmap = map[obj.As]obj.ProgInfo{
riscv.ASD: {Flags: gc.LeftRead | gc.RightWrite | gc.Move},
riscv.AMOV: {Flags: gc.LeftRead | gc.RightWrite | gc.Move},
riscv.ASEQZ: {Flags: gc.LeftRead | gc.RightWrite},
riscv.ASCALL: {Flags: gc.OK},
riscv.AECALL: {Flags: gc.OK},

// RISCV conditional branches
riscv.ABEQ: {Flags: gc.Cjmp | gc.LeftRead | gc.RegRead},
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/riscv/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = riscv.REG_A7
// SCALL
p = gc.Prog(riscv.ASCALL)
p = gc.Prog(riscv.AECALL)
default:
v.Fatalf("Unhandled op %v", v.Op)
}
Expand Down
9 changes: 7 additions & 2 deletions src/cmd/internal/obj/riscv/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ func progedit(ctxt *obj.Link, p *obj.Prog) {
case AJALR:
lowerjalr(p)

case ASCALL, ARDCYCLE, ARDTIME, ARDINSTRET:
case AECALL, ASCALL, ARDCYCLE, ARDTIME, ARDINSTRET:
// SCALL is the old name for ECALL.
if p.As == ASCALL {
p.As = AECALL
}

i, ok := encode(p.As)
if !ok {
panic("progedit: tried to rewrite nonexistent instruction")
Expand Down Expand Up @@ -590,7 +595,7 @@ func asmout(p *obj.Prog) uint32 {
AMULH, AMULHU, AMULHSU, AMULW, ADIV, ADIVU, AREM, AREMU, ADIVW,
ADIVUW, AREMW, AREMUW:
return instr_r(p)
case AADDI, ASLLI, AXORI, ASRLI, ASRAI, AORI, AANDI, AJALR, ASCALL,
case AADDI, ASLLI, AXORI, ASRLI, ASRAI, AORI, AANDI, AJALR, AECALL,
ARDCYCLE, ARDTIME, ARDINSTRET, ALB, ALH, ALW, ALD, ALBU, ALHU,
ALWU, ASLTI, ASLTIU:
return instr_i(p)
Expand Down

0 comments on commit 0fcc8d3

Please sign in to comment.