summaryrefslogtreecommitdiff
path: root/src/cmd/5g/opt.h
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:43 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:43 +0100
commitad47422646a18ffcb47cec916ef7393c923f2e76 (patch)
tree7c7861fb3d9539d61c1dcfd5b8dadee974c25760 /src/cmd/5g/opt.h
parent2c8d5d584a79781ca41bb6f4b396893fbbac5b97 (diff)
parent04b08da9af0c450d645ab7389d1467308cfc2db8 (diff)
downloadgolang-ad47422646a18ffcb47cec916ef7393c923f2e76.tar.gz
Merge tag 'upstream/1.1_hg20130304' into debian-sid
Upstream version 1.1~hg20130304
Diffstat (limited to 'src/cmd/5g/opt.h')
-rw-r--r--src/cmd/5g/opt.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cmd/5g/opt.h b/src/cmd/5g/opt.h
index 7a0070fc9..af7d654de 100644
--- a/src/cmd/5g/opt.h
+++ b/src/cmd/5g/opt.h
@@ -34,8 +34,6 @@
#define D_HI D_NONE
#define D_LO D_NONE
-#define isregtype(t) ((t)>= D_AX && (t)<=D_R15)
-
#define BLOAD(r) band(bnot(r->refbehind), r->refahead)
#define BSTORE(r) band(bnot(r->calbehind), r->calahead)
#define LOAD(r) (~r->refbehind.b[z] & r->refahead.b[z])
@@ -49,12 +47,16 @@
typedef struct Reg Reg;
typedef struct Rgn Rgn;
+// A Reg is a wrapper around a single Prog (one instruction) that holds
+// register optimization information while the optimizer runs.
+// r->prog is the instruction.
+// r->prog->regp points back to r.
struct Reg
{
- Bits set;
- Bits use1;
- Bits use2;
+ Bits set; // variables written by this instruction.
+ Bits use1; // variables read by prog->from.
+ Bits use2; // variables read by prog->to.
Bits refbehind;
Bits refahead;
@@ -70,13 +72,13 @@ struct Reg
uint16 loop; // x5 for every loop
uchar refset; // diagnostic generated
- Reg* p1;
- Reg* p2;
+ Reg* p1; // predecessors of this instruction: p1,
+ Reg* p2; // and then p2 linked though p2link.
Reg* p2link;
- Reg* s1;
+ Reg* s1; // successors of this instruction (at most two: s1 and s2).
Reg* s2;
- Reg* link;
- Prog* prog;
+ Reg* link; // next instruction in function code
+ Prog* prog; // actual instruction
};
#define R ((Reg*)0)