Something went wrong. Try again.
🌱 A minimal programming language and compiler. git.urbach.dev/cli/q
high-performance programming-language compiler
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334package codegen
import ( "git.urbach.dev/cli/q/src/cpu" "git.urbach.dev/cli/q/src/ssa" "git.urbach.dev/cli/q/src/token")
// clobberedRegisters returns the registers that are clobbered by the given instruction.func (f *Function) clobberedRegisters(step *Step) []cpu.Register { switch instr := step.Value.(type) { case *ssa.BinaryOp: switch instr.Op { case token.Div, token.Mod: return f.CPU.DivisionClobbered case token.Shl, token.Shr: return f.CPU.ShiftClobbered default: return nil } case *ssa.Branch, *ssa.Jump: return phiMoveClobbered(step) case *ssa.Call: return f.CPU.Call.Clobbered case *ssa.CallExtern: return f.CPU.ExternCall.Clobbered case *ssa.Cas: return f.CPU.CasClobbered case *ssa.Syscall: return append(f.CPU.Syscall.Clobbered, f.CPU.Syscall.In[:min(len(instr.Arguments), len(f.CPU.Syscall.In))]...) default: return nil }}