compiler,riscv: implement CSR operations as intrinsics

CSR operations must be implemented in assembly. The easiest way to
implement them is with some custom intrinsics in the compiler.
This commit is contained in:
Ayke van Laethem
2020-01-06 19:57:48 +01:00
committed by Ron Evans
parent ed9b2dbc03
commit 360923abbf
3 changed files with 324 additions and 0 deletions
+2
View File
@@ -1306,6 +1306,8 @@ func (c *Compiler) parseCall(frame *Frame, instr *ssa.CallCommon) (llvm.Value, e
return c.emitAsmFull(frame, instr)
case strings.HasPrefix(name, "device/arm.SVCall"):
return c.emitSVCall(frame, instr.Args)
case strings.HasPrefix(name, "(device/riscv.CSR)."):
return c.emitCSROperation(frame, instr)
case strings.HasPrefix(name, "syscall.Syscall"):
return c.emitSyscall(frame, instr)
case strings.HasPrefix(name, "runtime/volatile.Load"):