summaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2014-11-12 14:58:43 -0500
committerAustin Clements <austin@google.com>2014-11-12 14:58:43 -0500
commit8120faa2a9401f93d29ef69e1ca5180dad6c88d3 (patch)
tree16ab3ffa144474a869fd8be4bc4db7a95104fb75 /src/cmd
parent1e14e0972c00c7ff3f9fc7310de5093a11473cad (diff)
downloadgo-8120faa2a9401f93d29ef69e1ca5180dad6c88d3.tar.gz
[dev.power64] 9g: proginfo fixes
For D_OREG addresses, store the used registers in regindex instead of reguse because they're really part of addressing. Add implicit register use/set for DUFFZERO/DUFFCOPY. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/174050044
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/9g/prog.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/cmd/9g/prog.c b/src/cmd/9g/prog.c
index 0a51a533a..e3e50f28a 100644
--- a/src/cmd/9g/prog.c
+++ b/src/cmd/9g/prog.c
@@ -96,11 +96,8 @@ static ProgInfo progtable[ALAST] = {
[ABGT]= {Cjmp},
[ABLE]= {Cjmp},
[ARETURN]= {Break},
- // In addtion, duffzero reads R0,R2 and writes R2. This fact must be
- // encoded in peep.c (TODO)
+
[ADUFFZERO]= {Call},
- // In addtion, duffcopy reads R0,R2,R3 and writes R2,R3. This fact must be
- // encoded in peep.c (TODO)
[ADUFFCOPY]= {Call},
};
@@ -118,14 +115,14 @@ proginfo(ProgInfo *info, Prog *p)
info->flags |= /*CanRegRead |*/ RightRead;
}
- if(p->from.type == D_OREG && p->from.reg != NREG) {
- info->reguse |= RtoB(p->from.reg);
+ if((p->from.type == D_OREG || p->from.type == D_CONST) && p->from.reg != NREG) {
+ info->regindex |= RtoB(p->from.reg);
if(info->flags & PostInc) {
info->regset |= RtoB(p->from.reg);
}
}
- if(p->to.type == D_OREG && p->to.reg != NREG) {
- info->reguse |= RtoB(p->to.reg);
+ if((p->to.type == D_OREG || p->to.type == D_CONST) && p->to.reg != NREG) {
+ info->regindex |= RtoB(p->to.reg);
if(info->flags & PostInc) {
info->regset |= RtoB(p->to.reg);
}
@@ -135,4 +132,13 @@ proginfo(ProgInfo *info, Prog *p)
info->flags &= ~LeftRead;
info->flags |= LeftAddr;
}
+
+ if(p->as == ADUFFZERO) {
+ info->reguse |= RtoB(0) | RtoB(2);
+ info->regset |= RtoB(2);
+ }
+ if(p->as == ADUFFCOPY) {
+ info->reguse |= RtoB(0) | RtoB(2) | RtoB(3);
+ info->regset |= RtoB(2) | RtoB(3);
+ }
}