wazevo: cleans up debug options (#1867)
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
This commit is contained in:
@@ -15,16 +15,11 @@ func NewCompiler(ctx context.Context, mach Machine, builder ssa.Builder) Compile
|
|||||||
return newCompiler(ctx, mach, builder)
|
return newCompiler(ctx, mach, builder)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCompiler(ctx context.Context, mach Machine, builder ssa.Builder) *compiler {
|
func newCompiler(_ context.Context, mach Machine, builder ssa.Builder) *compiler {
|
||||||
registerSetDebug := false
|
|
||||||
if wazevoapi.RegAllocValidationEnabled {
|
|
||||||
registerSetDebug = wazevoapi.IsHighRegisterPressure(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &compiler{
|
c := &compiler{
|
||||||
mach: mach, ssaBuilder: builder,
|
mach: mach, ssaBuilder: builder,
|
||||||
nextVRegID: regalloc.VRegIDNonReservedBegin,
|
nextVRegID: regalloc.VRegIDNonReservedBegin,
|
||||||
regAlloc: regalloc.NewAllocator(mach.RegisterInfo(registerSetDebug)),
|
regAlloc: regalloc.NewAllocator(mach.RegisterInfo()),
|
||||||
}
|
}
|
||||||
mach.SetCompiler(c)
|
mach.SetCompiler(c)
|
||||||
return c
|
return c
|
||||||
|
|||||||
@@ -320,25 +320,7 @@ func (r *regAllocBlockImpl) BlockParams(regs *[]regalloc.VReg) []regalloc.VReg {
|
|||||||
func (r *regAllocBlockImpl) Entry() bool { return r.sb.EntryBlock() }
|
func (r *regAllocBlockImpl) Entry() bool { return r.sb.EntryBlock() }
|
||||||
|
|
||||||
// RegisterInfo implements backend.Machine.
|
// RegisterInfo implements backend.Machine.
|
||||||
func (m *machine) RegisterInfo(debug bool) *regalloc.RegisterInfo {
|
func (m *machine) RegisterInfo() *regalloc.RegisterInfo {
|
||||||
if debug {
|
|
||||||
regInfoDebug := ®alloc.RegisterInfo{}
|
|
||||||
regInfoDebug.CalleeSavedRegisters = regInfo.CalleeSavedRegisters
|
|
||||||
regInfoDebug.CallerSavedRegisters = regInfo.CallerSavedRegisters
|
|
||||||
regInfoDebug.RealRegToVReg = regInfo.RealRegToVReg
|
|
||||||
regInfoDebug.RealRegName = regInfo.RealRegName
|
|
||||||
regInfoDebug.RealRegType = regInfo.RealRegType
|
|
||||||
regInfoDebug.AllocatableRegisters[regalloc.RegTypeFloat] = []regalloc.RealReg{
|
|
||||||
v18, // One callee saved.
|
|
||||||
v7, v6, v5, v4, v3, v2, v1, v0, // Allocatable sets == Argument registers.
|
|
||||||
}
|
|
||||||
regInfoDebug.AllocatableRegisters[regalloc.RegTypeInt] = []regalloc.RealReg{
|
|
||||||
x29, x30, // Caller saved, and special ones. But they should be able to get allocated.
|
|
||||||
x19, // One callee saved.
|
|
||||||
x7, x6, x5, x4, x3, x2, x1, x0, // Argument registers (all caller saved).
|
|
||||||
}
|
|
||||||
return regInfoDebug
|
|
||||||
}
|
|
||||||
return regInfo
|
return regInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ type (
|
|||||||
|
|
||||||
// RegisterInfo returns the set of registers that can be used for register allocation.
|
// RegisterInfo returns the set of registers that can be used for register allocation.
|
||||||
// This is only called once, and the result is shared across all compilations.
|
// This is only called once, and the result is shared across all compilations.
|
||||||
//
|
RegisterInfo() *regalloc.RegisterInfo
|
||||||
// If debug is true, this returns the register set for debugging purpose.
|
|
||||||
RegisterInfo(debug bool) *regalloc.RegisterInfo
|
|
||||||
|
|
||||||
// InitializeABI initializes the FunctionABI for the given signature.
|
// InitializeABI initializes the FunctionABI for the given signature.
|
||||||
InitializeABI(sig *ssa.Signature)
|
InitializeABI(sig *ssa.Signature)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func (m mockMachine) ResolveRelativeAddresses() {}
|
|||||||
func (m mockMachine) Function() (f regalloc.Function) { return }
|
func (m mockMachine) Function() (f regalloc.Function) { return }
|
||||||
|
|
||||||
// RegisterInfo implements Machine.RegisterInfo.
|
// RegisterInfo implements Machine.RegisterInfo.
|
||||||
func (m mockMachine) RegisterInfo(bool) *regalloc.RegisterInfo {
|
func (m mockMachine) RegisterInfo() *regalloc.RegisterInfo {
|
||||||
if m.rinfo != nil {
|
if m.rinfo != nil {
|
||||||
return m.rinfo
|
return m.rinfo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,18 +41,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ----- Validations -----
|
// ----- Validations -----
|
||||||
// These consts must be enabled by default until we reach the point where we can disable them (e.g. multiple days of fuzzing passes).
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
RegAllocValidationEnabled = true
|
// SSAValidationEnabled enables the SSA validation. This is disabled by default since the operation is expensive.
|
||||||
SSAValidationEnabled = true
|
SSAValidationEnabled = false
|
||||||
)
|
)
|
||||||
|
|
||||||
// ----- Stack Guard Check -----
|
// ----- Stack Guard Check -----
|
||||||
// These consts must be enabled by default until we reach the point where we can disable them (e.g. multiple days of fuzzing passes).
|
|
||||||
const (
|
const (
|
||||||
// StackGuardCheckEnabled enables the stack guard check to ensure that our stack bounds check works correctly.
|
// StackGuardCheckEnabled enables the stack guard check to ensure that our stack bounds check works correctly.
|
||||||
StackGuardCheckEnabled = true
|
StackGuardCheckEnabled = false
|
||||||
StackGuardCheckGuardPageSize = 8096
|
StackGuardCheckGuardPageSize = 8096
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user