X7ROOT File Manager
Current Path:
/opt/golang/1.19.4/src/cmd/compile/internal/ssa
opt
/
golang
/
1.19.4
/
src
/
cmd
/
compile
/
internal
/
ssa
/
📁
..
📄
README.md
(8.14 KB)
📄
TODO
(950 B)
📄
addressingmodes.go
(23.64 KB)
📄
bench_test.go
(531 B)
📄
biasedsparsemap.go
(2.71 KB)
📄
block.go
(11.1 KB)
📄
branchelim.go
(11.98 KB)
📄
branchelim_test.go
(5.21 KB)
📄
cache.go
(2.46 KB)
📄
check.go
(16.59 KB)
📄
checkbce.go
(956 B)
📄
compile.go
(18.19 KB)
📄
config.go
(11.7 KB)
📄
copyelim.go
(1.83 KB)
📄
copyelim_test.go
(1.29 KB)
📄
critical.go
(3.19 KB)
📄
cse.go
(9.43 KB)
📄
cse_test.go
(4.25 KB)
📄
deadcode.go
(9.61 KB)
📄
deadcode_test.go
(3.49 KB)
📄
deadstore.go
(9.08 KB)
📄
deadstore_test.go
(4.09 KB)
📄
debug.go
(56.34 KB)
📄
debug_lines_test.go
(8.29 KB)
📄
debug_test.go
(28.75 KB)
📄
decompose.go
(13.41 KB)
📄
dom.go
(7.98 KB)
📄
dom_test.go
(13.34 KB)
📄
expand_calls.go
(63.5 KB)
📄
export_test.go
(3.23 KB)
📄
flagalloc.go
(6.68 KB)
📄
flags_amd64_test.s
(533 B)
📄
flags_arm64_test.s
(699 B)
📄
flags_test.go
(2.49 KB)
📄
func.go
(27.08 KB)
📄
func_test.go
(13.07 KB)
📄
fuse.go
(6.5 KB)
📄
fuse_branchredirect.go
(3.24 KB)
📄
fuse_comparisons.go
(4.04 KB)
📄
fuse_test.go
(7.21 KB)
📁
gen
📄
html.go
(34.72 KB)
📄
id.go
(576 B)
📄
layout.go
(4.82 KB)
📄
lca.go
(3.77 KB)
📄
lca_test.go
(1.65 KB)
📄
likelyadjust.go
(15.24 KB)
📄
location.go
(3.06 KB)
📄
loopbce.go
(10.54 KB)
📄
loopreschedchecks.go
(15.86 KB)
📄
looprotate.go
(2.61 KB)
📄
lower.go
(1.36 KB)
📄
magic.go
(15.77 KB)
📄
magic_test.go
(9.1 KB)
📄
nilcheck.go
(11.06 KB)
📄
nilcheck_test.go
(12.17 KB)
📄
numberlines.go
(7.83 KB)
📄
op.go
(18.65 KB)
📄
opGen.go
(1.01 MB)
📄
opt.go
(308 B)
📄
passbm_test.go
(3.14 KB)
📄
phielim.go
(1.48 KB)
📄
phiopt.go
(8.08 KB)
📄
poset.go
(37.2 KB)
📄
poset_test.go
(18.14 KB)
📄
print.go
(3.85 KB)
📄
prove.go
(41.82 KB)
📄
regalloc.go
(83.69 KB)
📄
regalloc_test.go
(6.49 KB)
📄
rewrite.go
(53.49 KB)
📄
rewrite386.go
(289.01 KB)
📄
rewrite386splitload.go
(4.05 KB)
📄
rewriteAMD64.go
(888.95 KB)
📄
rewriteAMD64splitload.go
(21.41 KB)
📄
rewriteARM.go
(487.7 KB)
📄
rewriteARM64.go
(751.84 KB)
📄
rewriteCond_test.go
(10.62 KB)
📄
rewriteLOONG64.go
(193.44 KB)
📄
rewriteMIPS.go
(174.44 KB)
📄
rewriteMIPS64.go
(195.55 KB)
📄
rewritePPC64.go
(431.6 KB)
📄
rewriteRISCV64.go
(159.66 KB)
📄
rewriteS390X.go
(433.4 KB)
📄
rewriteWasm.go
(109.86 KB)
📄
rewrite_test.go
(6.91 KB)
📄
rewritedec.go
(10.16 KB)
📄
rewritedec64.go
(63.77 KB)
📄
rewritegeneric.go
(617.96 KB)
📄
schedule.go
(18.23 KB)
📄
schedule_test.go
(2.91 KB)
📄
shift_test.go
(4.05 KB)
📄
shortcircuit.go
(12.63 KB)
📄
shortcircuit_test.go
(1.31 KB)
📄
sizeof_test.go
(855 B)
📄
softfloat.go
(1.99 KB)
📄
sparsemap.go
(1.98 KB)
📄
sparseset.go
(1.54 KB)
📄
sparsetree.go
(8.05 KB)
📄
stackalloc.go
(12.79 KB)
📄
stackframe.go
(290 B)
📄
stmtlines_test.go
(2.96 KB)
📁
testdata
📄
tighten.go
(4.3 KB)
📄
trim.go
(4.24 KB)
📄
tuple.go
(1.97 KB)
📄
value.go
(15.21 KB)
📄
writebarrier.go
(19.29 KB)
📄
writebarrier_test.go
(1.75 KB)
📄
xposmap.go
(3.29 KB)
📄
zcse.go
(2.07 KB)
📄
zeroextension_test.go
(1.66 KB)
Editing: config.go
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package ssa import ( "cmd/compile/internal/abi" "cmd/compile/internal/ir" "cmd/compile/internal/types" "cmd/internal/obj" "cmd/internal/src" "internal/buildcfg" ) // A Config holds readonly compilation information. // It is created once, early during compilation, // and shared across all compilations. type Config struct { arch string // "amd64", etc. PtrSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.PtrSize RegSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.RegSize Types Types lowerBlock blockRewriter // lowering function lowerValue valueRewriter // lowering function splitLoad valueRewriter // function for splitting merged load ops; only used on some architectures registers []Register // machine registers gpRegMask regMask // general purpose integer register mask fpRegMask regMask // floating point register mask fp32RegMask regMask // floating point register mask fp64RegMask regMask // floating point register mask specialRegMask regMask // special register mask intParamRegs []int8 // register numbers of integer param (in/out) registers floatParamRegs []int8 // register numbers of floating param (in/out) registers ABI1 *abi.ABIConfig // "ABIInternal" under development // TODO change comment when this becomes current ABI0 *abi.ABIConfig GCRegMap []*Register // garbage collector register map, by GC register index FPReg int8 // register number of frame pointer, -1 if not used LinkReg int8 // register number of link register if it is a general purpose register, -1 if not used hasGReg bool // has hardware g register ctxt *obj.Link // Generic arch information optimize bool // Do optimization noDuffDevice bool // Don't use Duff's device useSSE bool // Use SSE for non-float operations useAvg bool // Use optimizations that need Avg* operations useHmul bool // Use optimizations that need Hmul* operations SoftFloat bool // Race bool // race detector enabled BigEndian bool // UseFMA bool // Use hardware FMA operation } type ( blockRewriter func(*Block) bool valueRewriter func(*Value) bool ) type Types struct { Bool *types.Type Int8 *types.Type Int16 *types.Type Int32 *types.Type Int64 *types.Type UInt8 *types.Type UInt16 *types.Type UInt32 *types.Type UInt64 *types.Type Int *types.Type Float32 *types.Type Float64 *types.Type UInt *types.Type Uintptr *types.Type String *types.Type BytePtr *types.Type // TODO: use unsafe.Pointer instead? Int32Ptr *types.Type UInt32Ptr *types.Type IntPtr *types.Type UintptrPtr *types.Type Float32Ptr *types.Type Float64Ptr *types.Type BytePtrPtr *types.Type } // NewTypes creates and populates a Types. func NewTypes() *Types { t := new(Types) t.SetTypPtrs() return t } // SetTypPtrs populates t. func (t *Types) SetTypPtrs() { t.Bool = types.Types[types.TBOOL] t.Int8 = types.Types[types.TINT8] t.Int16 = types.Types[types.TINT16] t.Int32 = types.Types[types.TINT32] t.Int64 = types.Types[types.TINT64] t.UInt8 = types.Types[types.TUINT8] t.UInt16 = types.Types[types.TUINT16] t.UInt32 = types.Types[types.TUINT32] t.UInt64 = types.Types[types.TUINT64] t.Int = types.Types[types.TINT] t.Float32 = types.Types[types.TFLOAT32] t.Float64 = types.Types[types.TFLOAT64] t.UInt = types.Types[types.TUINT] t.Uintptr = types.Types[types.TUINTPTR] t.String = types.Types[types.TSTRING] t.BytePtr = types.NewPtr(types.Types[types.TUINT8]) t.Int32Ptr = types.NewPtr(types.Types[types.TINT32]) t.UInt32Ptr = types.NewPtr(types.Types[types.TUINT32]) t.IntPtr = types.NewPtr(types.Types[types.TINT]) t.UintptrPtr = types.NewPtr(types.Types[types.TUINTPTR]) t.Float32Ptr = types.NewPtr(types.Types[types.TFLOAT32]) t.Float64Ptr = types.NewPtr(types.Types[types.TFLOAT64]) t.BytePtrPtr = types.NewPtr(types.NewPtr(types.Types[types.TUINT8])) } type Logger interface { // Logf logs a message from the compiler. Logf(string, ...interface{}) // Log reports whether logging is not a no-op // some logging calls account for more than a few heap allocations. Log() bool // Fatal reports a compiler error and exits. Fatalf(pos src.XPos, msg string, args ...interface{}) // Warnl writes compiler messages in the form expected by "errorcheck" tests Warnl(pos src.XPos, fmt_ string, args ...interface{}) // Forwards the Debug flags from gc Debug_checknil() bool } type Frontend interface { CanSSA(t *types.Type) bool Logger // StringData returns a symbol pointing to the given string's contents. StringData(string) *obj.LSym // Auto returns a Node for an auto variable of the given type. // The SSA compiler uses this function to allocate space for spills. Auto(src.XPos, *types.Type) *ir.Name // Given the name for a compound type, returns the name we should use // for the parts of that compound type. SplitSlot(parent *LocalSlot, suffix string, offset int64, t *types.Type) LocalSlot // Line returns a string describing the given position. Line(src.XPos) string // AllocFrame assigns frame offsets to all live auto variables. AllocFrame(f *Func) // Syslook returns a symbol of the runtime function/variable with the // given name. Syslook(string) *obj.LSym // UseWriteBarrier reports whether write barrier is enabled UseWriteBarrier() bool // SetWBPos indicates that a write barrier has been inserted // in this function at position pos. SetWBPos(pos src.XPos) // MyImportPath provides the import name (roughly, the package) for the function being compiled. MyImportPath() string // LSym returns the linker symbol of the function being compiled. LSym() string } // NewConfig returns a new configuration object for the given architecture. func NewConfig(arch string, types Types, ctxt *obj.Link, optimize, softfloat bool) *Config { c := &Config{arch: arch, Types: types} c.useAvg = true c.useHmul = true switch arch { case "amd64": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockAMD64 c.lowerValue = rewriteValueAMD64 c.splitLoad = rewriteValueAMD64splitload c.registers = registersAMD64[:] c.gpRegMask = gpRegMaskAMD64 c.fpRegMask = fpRegMaskAMD64 c.specialRegMask = specialRegMaskAMD64 c.intParamRegs = paramIntRegAMD64 c.floatParamRegs = paramFloatRegAMD64 c.FPReg = framepointerRegAMD64 c.LinkReg = linkRegAMD64 c.hasGReg = true case "386": c.PtrSize = 4 c.RegSize = 4 c.lowerBlock = rewriteBlock386 c.lowerValue = rewriteValue386 c.splitLoad = rewriteValue386splitload c.registers = registers386[:] c.gpRegMask = gpRegMask386 c.fpRegMask = fpRegMask386 c.FPReg = framepointerReg386 c.LinkReg = linkReg386 c.hasGReg = false case "arm": c.PtrSize = 4 c.RegSize = 4 c.lowerBlock = rewriteBlockARM c.lowerValue = rewriteValueARM c.registers = registersARM[:] c.gpRegMask = gpRegMaskARM c.fpRegMask = fpRegMaskARM c.FPReg = framepointerRegARM c.LinkReg = linkRegARM c.hasGReg = true case "arm64": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockARM64 c.lowerValue = rewriteValueARM64 c.registers = registersARM64[:] c.gpRegMask = gpRegMaskARM64 c.fpRegMask = fpRegMaskARM64 c.intParamRegs = paramIntRegARM64 c.floatParamRegs = paramFloatRegARM64 c.FPReg = framepointerRegARM64 c.LinkReg = linkRegARM64 c.hasGReg = true c.noDuffDevice = buildcfg.GOOS == "darwin" || buildcfg.GOOS == "ios" // darwin linker cannot handle BR26 reloc with non-zero addend case "ppc64": c.BigEndian = true fallthrough case "ppc64le": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockPPC64 c.lowerValue = rewriteValuePPC64 c.registers = registersPPC64[:] c.gpRegMask = gpRegMaskPPC64 c.fpRegMask = fpRegMaskPPC64 c.specialRegMask = specialRegMaskPPC64 c.intParamRegs = paramIntRegPPC64 c.floatParamRegs = paramFloatRegPPC64 c.FPReg = framepointerRegPPC64 c.LinkReg = linkRegPPC64 c.hasGReg = true case "mips64": c.BigEndian = true fallthrough case "mips64le": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockMIPS64 c.lowerValue = rewriteValueMIPS64 c.registers = registersMIPS64[:] c.gpRegMask = gpRegMaskMIPS64 c.fpRegMask = fpRegMaskMIPS64 c.specialRegMask = specialRegMaskMIPS64 c.FPReg = framepointerRegMIPS64 c.LinkReg = linkRegMIPS64 c.hasGReg = true case "loong64": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockLOONG64 c.lowerValue = rewriteValueLOONG64 c.registers = registersLOONG64[:] c.gpRegMask = gpRegMaskLOONG64 c.fpRegMask = fpRegMaskLOONG64 c.FPReg = framepointerRegLOONG64 c.LinkReg = linkRegLOONG64 c.hasGReg = true case "s390x": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockS390X c.lowerValue = rewriteValueS390X c.registers = registersS390X[:] c.gpRegMask = gpRegMaskS390X c.fpRegMask = fpRegMaskS390X c.FPReg = framepointerRegS390X c.LinkReg = linkRegS390X c.hasGReg = true c.noDuffDevice = true c.BigEndian = true case "mips": c.BigEndian = true fallthrough case "mipsle": c.PtrSize = 4 c.RegSize = 4 c.lowerBlock = rewriteBlockMIPS c.lowerValue = rewriteValueMIPS c.registers = registersMIPS[:] c.gpRegMask = gpRegMaskMIPS c.fpRegMask = fpRegMaskMIPS c.specialRegMask = specialRegMaskMIPS c.FPReg = framepointerRegMIPS c.LinkReg = linkRegMIPS c.hasGReg = true c.noDuffDevice = true case "riscv64": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockRISCV64 c.lowerValue = rewriteValueRISCV64 c.registers = registersRISCV64[:] c.gpRegMask = gpRegMaskRISCV64 c.fpRegMask = fpRegMaskRISCV64 c.intParamRegs = paramIntRegRISCV64 c.floatParamRegs = paramFloatRegRISCV64 c.FPReg = framepointerRegRISCV64 c.hasGReg = true case "wasm": c.PtrSize = 8 c.RegSize = 8 c.lowerBlock = rewriteBlockWasm c.lowerValue = rewriteValueWasm c.registers = registersWasm[:] c.gpRegMask = gpRegMaskWasm c.fpRegMask = fpRegMaskWasm c.fp32RegMask = fp32RegMaskWasm c.fp64RegMask = fp64RegMaskWasm c.FPReg = framepointerRegWasm c.LinkReg = linkRegWasm c.hasGReg = true c.noDuffDevice = true c.useAvg = false c.useHmul = false default: ctxt.Diag("arch %s not implemented", arch) } c.ctxt = ctxt c.optimize = optimize c.useSSE = true c.UseFMA = true c.SoftFloat = softfloat if softfloat { c.floatParamRegs = nil // no FP registers in softfloat mode } c.ABI0 = abi.NewABIConfig(0, 0, ctxt.Arch.FixedFrameSize) c.ABI1 = abi.NewABIConfig(len(c.intParamRegs), len(c.floatParamRegs), ctxt.Arch.FixedFrameSize) // On Plan 9, floating point operations are not allowed in note handler. if buildcfg.GOOS == "plan9" { // Don't use FMA on Plan 9 c.UseFMA = false // Don't use Duff's device and SSE on Plan 9 AMD64. if arch == "amd64" { c.noDuffDevice = true c.useSSE = false } } if ctxt.Flag_shared { // LoweredWB is secretly a CALL and CALLs on 386 in // shared mode get rewritten by obj6.go to go through // the GOT, which clobbers BX. opcodeTable[Op386LoweredWB].reg.clobbers |= 1 << 3 // BX } // Create the GC register map index. // TODO: This is only used for debug printing. Maybe export config.registers? gcRegMapSize := int16(0) for _, r := range c.registers { if r.gcNum+1 > gcRegMapSize { gcRegMapSize = r.gcNum + 1 } } c.GCRegMap = make([]*Register, gcRegMapSize) for i, r := range c.registers { if r.gcNum != -1 { c.GCRegMap[r.gcNum] = &c.registers[i] } } return c } func (c *Config) Ctxt() *obj.Link { return c.ctxt }
Upload File
Create Folder