Commit df47b821 authored by Michael Munday's avatar Michael Munday

cmd/internal/obj/s390x: cleanup objz.go

This CL deletes some unnecessary code in objz.go that existed to
support instruction scheduling. It's likely instruction scheduling
will never be done in this part of the backend so this code can
just be deleted.

This file can probably be cleaned up a bit more, but I think this
is a good start.

Passes: go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I1645632ac551a90a4f4be418045c046b488e9469
Reviewed-on: https://go-review.googlesource.com/38394
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d68bb16b
...@@ -159,16 +159,8 @@ const ( ...@@ -159,16 +159,8 @@ const (
const ( const (
// mark flags // mark flags
LABEL = 1 << 0 LEAF = 1 << iota
LEAF = 1 << 1 BRANCH
FLOAT = 1 << 2
BRANCH = 1 << 3
LOAD = 1 << 4
FCMP = 1 << 5
SYNC = 1 << 6
LIST = 1 << 7
FOLL = 1 << 8
NOSCHED = 1 << 9
) )
const ( // comments from func aclass in asmz.go const ( // comments from func aclass in asmz.go
......
...@@ -239,60 +239,20 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -239,60 +239,20 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
* find leaf subroutines * find leaf subroutines
* strip NOPs * strip NOPs
* expand RET * expand RET
* expand BECOME pseudo
*/ */
if ctxt.Debugvlog != 0 { if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f noops\n", obj.Cputime()) ctxt.Logf("%5.2f noops\n", obj.Cputime())
} }
var q *obj.Prog var q *obj.Prog
var q1 *obj.Prog
for p := cursym.Text; p != nil; p = p.Link { for p := cursym.Text; p != nil; p = p.Link {
switch p.As { switch p.As {
/* too hard, just leave alone */
case obj.ATEXT: case obj.ATEXT:
q = p q = p
p.Mark |= LEAF
p.Mark |= LABEL | LEAF | SYNC case ABL, ABCL:
if p.Link != nil {
p.Link.Mark |= LABEL
}
case ASYNC,
AWORD:
q = p
p.Mark |= LABEL | SYNC
continue
case AMOVW, AMOVWZ, AMOVD:
q = p q = p
if p.From.Reg >= REG_RESERVED || p.To.Reg >= REG_RESERVED {
p.Mark |= LABEL | SYNC
}
continue
case AFABS,
AFADD,
AFDIV,
AFMADD,
AFMOVD,
AFMOVS,
AFMSUB,
AFMUL,
AFNABS,
AFNEG,
ALEDBR,
ALDEBR,
AFSUB:
q = p
p.Mark |= FLOAT
continue
case ABL,
ABCL,
obj.ADUFFZERO,
obj.ADUFFCOPY:
cursym.Text.Mark &^= LEAF cursym.Text.Mark &^= LEAF
fallthrough fallthrough
...@@ -320,54 +280,26 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -320,54 +280,26 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
ACMPUBLE, ACMPUBLE,
ACMPUBLT, ACMPUBLT,
ACMPUBNE: ACMPUBNE:
p.Mark |= BRANCH
q = p q = p
q1 = p.Pcond p.Mark |= BRANCH
if q1 != nil { if p.Pcond != nil {
for q1.As == obj.ANOP { q := p.Pcond
q1 = q1.Link for q.As == obj.ANOP {
p.Pcond = q1 q = q.Link
} p.Pcond = q
if q1.Mark&LEAF == 0 {
q1.Mark |= LABEL
}
} else {
p.Mark |= LABEL
}
q1 = p.Link
if q1 != nil {
q1.Mark |= LABEL
} }
continue
case AFCMPO, AFCMPU:
q = p
p.Mark |= FCMP | FLOAT
continue
case obj.ARET:
q = p
if p.Link != nil {
p.Link.Mark |= LABEL
} }
continue
case obj.ANOP: case obj.ANOP:
q1 = p.Link q.Link = p.Link /* q is non-nop */
q.Link = q1 /* q is non-nop */ p.Link.Mark |= p.Mark
q1.Mark |= p.Mark
continue
default: default:
q = p q = p
continue
} }
} }
autosize := int32(0) autosize := int32(0)
var p1 *obj.Prog
var p2 *obj.Prog
var pLast *obj.Prog var pLast *obj.Prog
var pPre *obj.Prog var pPre *obj.Prog
var pPreempt *obj.Prog var pPreempt *obj.Prog
...@@ -397,7 +329,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -397,7 +329,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
p.To.Offset = int64(autosize) p.To.Offset = int64(autosize)
q = p q := p
if p.From3.Offset&obj.NOSPLIT == 0 { if p.From3.Offset&obj.NOSPLIT == 0 {
p, pPreempt = stacksplitPre(ctxt, p, autosize) // emit pre part of split check p, pPreempt = stacksplitPre(ctxt, p, autosize) // emit pre part of split check
...@@ -476,7 +408,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -476,7 +408,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
q = obj.Appendp(ctxt, q) q = obj.Appendp(ctxt, q)
q.As = ABEQ q.As = ABEQ
q.To.Type = obj.TYPE_BRANCH q.To.Type = obj.TYPE_BRANCH
p1 = q p1 := q
q = obj.Appendp(ctxt, q) q = obj.Appendp(ctxt, q)
q.As = AMOVD q.As = AMOVD
...@@ -504,7 +436,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -504,7 +436,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
q = obj.Appendp(ctxt, q) q = obj.Appendp(ctxt, q)
q.As = ABNE q.As = ABNE
q.To.Type = obj.TYPE_BRANCH q.To.Type = obj.TYPE_BRANCH
p2 = q p2 := q
q = obj.Appendp(ctxt, q) q = obj.Appendp(ctxt, q)
q.As = AADD q.As = AADD
...@@ -530,11 +462,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -530,11 +462,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
} }
case obj.ARET: case obj.ARET:
if p.From.Type == obj.TYPE_CONST {
ctxt.Diag("using BECOME (%v) is not supported!", p)
break
}
retTarget := p.To.Sym retTarget := p.To.Sym
if cursym.Text.Mark&LEAF != 0 { if cursym.Text.Mark&LEAF != 0 {
...@@ -608,55 +535,10 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) { ...@@ -608,55 +535,10 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
} }
} }
if wasSplit { if wasSplit {
pLast = stacksplitPost(ctxt, pLast, pPre, pPreempt, autosize) // emit post part of split check stacksplitPost(ctxt, pLast, pPre, pPreempt, autosize) // emit post part of split check
} }
} }
/*
// instruction scheduling
if(debug['Q'] == 0)
return;
curtext = nil;
q = nil; // p - 1
q1 = firstp; // top of block
o = 0; // count of instructions
for(p = firstp; p != nil; p = p1) {
p1 = p->link;
o++;
if(p->mark & NOSCHED){
if(q1 != p){
sched(q1, q);
}
for(; p != nil; p = p->link){
if(!(p->mark & NOSCHED))
break;
q = p;
}
p1 = p;
q1 = p;
o = 0;
continue;
}
if(p->mark & (LABEL|SYNC)) {
if(q1 != p)
sched(q1, q);
q1 = p;
o = 1;
}
if(p->mark & (BRANCH|SYNC)) {
sched(q1, p);
q1 = p1;
o = 0;
}
if(o >= NSCHED) {
sched(q1, p);
q1 = p1;
o = 0;
}
q = p;
}
*/
func stacksplitPre(ctxt *obj.Link, p *obj.Prog, framesize int32) (*obj.Prog, *obj.Prog) { func stacksplitPre(ctxt *obj.Link, p *obj.Prog, framesize int32) (*obj.Prog, *obj.Prog) {
var q *obj.Prog var q *obj.Prog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment