aboutsummaryrefslogtreecommitdiff
path: root/src/liblink/obj5.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-01-29 16:16:24 -0500
committerRuss Cox <rsc@golang.org>2015-02-03 18:22:45 +0000
commit76fed5426ceaea6cd08be0d22da57062d4ae29a9 (patch)
tree39b488ade818f7be3b231d033cfec286faf60629 /src/liblink/obj5.c
parent6654188190cb8ff2be716417cc1b5086b20a5fa3 (diff)
downloadgo-76fed5426ceaea6cd08be0d22da57062d4ae29a9.tar.xz
liblink: the zero Prog is now valid and ready for use
Use AXXX instead of AGOK (neither is a valid instruction but AXXX is zero) for the initial setting of Prog.as, and now there are no non-zero default field settings. Remove the arch-specific zprog/zprg in favor of a single global zprog. Remove the arch-specific prg constructor in favor of emallocz(sizeof(Prog)). Change-Id: Ia73078726768333d7cdba296f548170c1bea9498 Reviewed-on: https://go-review.googlesource.com/3575 Reviewed-by: Aram Hăvărneanu <aram@mgk.ro> Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/liblink/obj5.c')
-rw-r--r--src/liblink/obj5.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/liblink/obj5.c b/src/liblink/obj5.c
index 8d20173912..fd3d4071c5 100644
--- a/src/liblink/obj5.c
+++ b/src/liblink/obj5.c
@@ -35,11 +35,6 @@
#include "../cmd/5l/5.out.h"
#include "../runtime/stack.h"
-static Prog zprg5 = {
- .as = AGOK,
- .scond = C_SCOND_NONE,
-};
-
static int
isdata(Prog *p)
{
@@ -181,16 +176,6 @@ progedit(Link *ctxt, Prog *p)
}
}
-static Prog*
-prg(void)
-{
- Prog *p;
-
- p = emallocz(sizeof(*p));
- *p = zprg5;
- return p;
-}
-
static Prog* stacksplit(Link*, Prog*, int32, int);
static void initdiv(Link*);
static void softfloat(Link*, LSym*);
@@ -515,7 +500,7 @@ preprocess(Link *ctxt, LSym *cursym)
if(cursym->text->mark & LEAF) {
if(!autosize) {
p->as = AB;
- p->from = zprg5.from;
+ p->from = zprog.from;
if(p->to.sym) { // retjmp
p->to.type = TYPE_BRANCH;
} else {
@@ -731,11 +716,11 @@ softfloat(Link *ctxt, LSym *cursym)
soft:
if (!wasfloat || (p->mark&LABEL)) {
- next = ctxt->arch->prg();
+ next = emallocz(sizeof(Prog));
*next = *p;
// BL _sfloat(SB)
- *p = zprg5;
+ *p = zprog;
p->link = next;
p->as = ABL;
p->to.type = TYPE_BRANCH;
@@ -889,7 +874,7 @@ follow(Link *ctxt, LSym *s)
ctxt->cursym = s;
- firstp = ctxt->arch->prg();
+ firstp = emallocz(sizeof(Prog));
lastp = firstp;
xfol(ctxt, s->text, &lastp);
lastp->link = nil;
@@ -957,7 +942,7 @@ loop:
continue;
copy:
for(;;) {
- r = ctxt->arch->prg();
+ r = emallocz(sizeof(Prog));
*r = *p;
if(!(r->mark&FOLL))
print("can't happen 1\n");
@@ -985,7 +970,7 @@ loop:
}
}
a = AB;
- q = ctxt->arch->prg();
+ q = emallocz(sizeof(Prog));
q->as = a;
q->lineno = p->lineno;
q->to.type = TYPE_BRANCH;
@@ -1034,7 +1019,6 @@ LinkArch linkarm = {
.follow = follow,
.iscall = iscall,
.isdata = isdata,
- .prg = prg,
.progedit = progedit,
.minlc = 4,