compiler: implement syscall.Syscall* as builtins

Treating them as builtins is easier to implement and likely reduces code
size.
This commit is contained in:
Ayke van Laethem
2019-02-05 00:25:33 +01:00
committed by Ron Evans
parent 6ae4b43eb2
commit f7b2a2c977
3 changed files with 72 additions and 13 deletions
+5
View File
@@ -1686,6 +1686,11 @@ func (c *Compiler) parseCall(frame *Frame, instr *ssa.CallCommon) (llvm.Value, e
return c.builder.CreateCall(target, args, ""), nil
}
switch fn.RelString(nil) {
case "syscall.Syscall", "syscall.Syscall6":
return c.emitSyscall(frame, instr)
}
targetFunc := c.ir.GetFunction(fn)
if targetFunc.LLVMFn.IsNil() {
return llvm.Value{}, c.makeError(instr.Pos(), "undefined function: "+targetFunc.LinkName())