mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: separate ssa.Frontend and ssa.TypeSource
Prior to this CL, the ssa.Frontend field was responsible for providing types to the backend during compilation. However, the types needed by the backend are few and static. It makes more sense to use a struct for them and to hang that struct off the ssa.Config, which is the correct home for readonly data. Now that Types is a struct, we can clean up the names a bit as well. This has the added benefit of allowing early construction of all types needed by the backend. This will be useful for concurrent backend compilation. Passes toolstash-check -all. No compiler performance change. Updates #15756 Change-Id: I021658c8cf2836d6a22bbc20cc828ac38c7da08a Reviewed-on: https://go-review.googlesource.com/38336 Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
2c397c7a75
commit
aea3aff669
31 changed files with 4663 additions and 4623 deletions
|
|
@ -88,17 +88,17 @@ func writebarrier(f *Func) {
|
|||
}
|
||||
}
|
||||
if sb == nil {
|
||||
sb = f.Entry.NewValue0(initpos, OpSB, f.fe.TypeUintptr())
|
||||
sb = f.Entry.NewValue0(initpos, OpSB, f.Config.Types.Uintptr)
|
||||
}
|
||||
if sp == nil {
|
||||
sp = f.Entry.NewValue0(initpos, OpSP, f.fe.TypeUintptr())
|
||||
sp = f.Entry.NewValue0(initpos, OpSP, f.Config.Types.Uintptr)
|
||||
}
|
||||
wbsym := &ExternSymbol{Typ: f.fe.TypeBool(), Sym: f.fe.Syslook("writeBarrier")}
|
||||
wbaddr = f.Entry.NewValue1A(initpos, OpAddr, f.fe.TypeUInt32().PtrTo(), wbsym, sb)
|
||||
wbsym := &ExternSymbol{Typ: f.Config.Types.Bool, Sym: f.fe.Syslook("writeBarrier")}
|
||||
wbaddr = f.Entry.NewValue1A(initpos, OpAddr, f.Config.Types.UInt32.PtrTo(), wbsym, sb)
|
||||
writebarrierptr = f.fe.Syslook("writebarrierptr")
|
||||
typedmemmove = f.fe.Syslook("typedmemmove")
|
||||
typedmemclr = f.fe.Syslook("typedmemclr")
|
||||
const0 = f.ConstInt32(initpos, f.fe.TypeUInt32(), 0)
|
||||
const0 = f.ConstInt32(initpos, f.Config.Types.UInt32, 0)
|
||||
|
||||
// allocate auxiliary data structures for computing store order
|
||||
sset = f.newSparseSet(f.NumValues())
|
||||
|
|
@ -155,8 +155,9 @@ func writebarrier(f *Func) {
|
|||
|
||||
// set up control flow for write barrier test
|
||||
// load word, test word, avoiding partial register write from load byte.
|
||||
flag := b.NewValue2(pos, OpLoad, f.fe.TypeUInt32(), wbaddr, mem)
|
||||
flag = b.NewValue2(pos, OpNeq32, f.fe.TypeBool(), flag, const0)
|
||||
types := &f.Config.Types
|
||||
flag := b.NewValue2(pos, OpLoad, types.UInt32, wbaddr, mem)
|
||||
flag = b.NewValue2(pos, OpNeq32, types.Bool, flag, const0)
|
||||
b.Kind = BlockIf
|
||||
b.SetControl(flag)
|
||||
b.Likely = BranchUnlikely
|
||||
|
|
@ -175,7 +176,7 @@ func writebarrier(f *Func) {
|
|||
ptr := w.Args[0]
|
||||
var typ interface{}
|
||||
if w.Op != OpStoreWB {
|
||||
typ = &ExternSymbol{Typ: f.fe.TypeUintptr(), Sym: w.Aux.(Type).Symbol()}
|
||||
typ = &ExternSymbol{Typ: types.Uintptr, Sym: w.Aux.(Type).Symbol()}
|
||||
}
|
||||
pos = w.Pos
|
||||
|
||||
|
|
@ -280,7 +281,7 @@ func wbcall(pos src.XPos, b *Block, fn *obj.LSym, typ interface{}, ptr, val, mem
|
|||
off := config.ctxt.FixedFrameSize()
|
||||
|
||||
if typ != nil { // for typedmemmove
|
||||
taddr := b.NewValue1A(pos, OpAddr, b.Func.fe.TypeUintptr(), typ, sb)
|
||||
taddr := b.NewValue1A(pos, OpAddr, b.Func.Config.Types.Uintptr, typ, sb)
|
||||
off = round(off, taddr.Type.Alignment())
|
||||
arg := b.NewValue1I(pos, OpOffPtr, taddr.Type.PtrTo(), off, sp)
|
||||
mem = b.NewValue3A(pos, OpStore, TypeMem, ptr.Type, arg, taddr, mem)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue