aboutsummaryrefslogtreecommitdiff
path: root/src/liblink/obj9.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2015-01-12 15:17:10 -0500
committerRuss Cox <rsc@golang.org>2015-01-14 19:18:05 +0000
commit3be0a0ef6fb80d099aefdba67b68df3b500188bc (patch)
tree8330ebaf4e92310212d0f383179b1065c3d0ca26 /src/liblink/obj9.c
parent5bfed7c6c03bf3cc9a0a1d7a0ab056b9dfaae920 (diff)
downloadgo-3be0a0ef6fb80d099aefdba67b68df3b500188bc.tar.xz
liblink: adjustments for c2go conversion
Mostly this is using uint32 instead of int32 for unsigned values like instruction encodings or float32 bit representations, removal of ternary operations, and removal of #defines. Delete sched9.c, because it is not compiled (it is still in the history if we ever need it). Change-Id: I68579cfea679438a27a80416727a9af932b088ae Reviewed-on: https://go-review.googlesource.com/2658 Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/liblink/obj9.c')
-rw-r--r--src/liblink/obj9.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/liblink/obj9.c b/src/liblink/obj9.c
index 2b6456d423..5ac575593d 100644
--- a/src/liblink/obj9.c
+++ b/src/liblink/obj9.c
@@ -118,11 +118,11 @@ progedit(Link *ctxt, Prog *p)
switch(p->as) {
case AFMOVS:
if(p->from.type == D_FCONST) {
- int32 i32;
+ uint32 i32;
float32 f32;
f32 = p->from.u.dval;
memmove(&i32, &f32, 4);
- sprint(literal, "$f32.%08ux", (uint32)i32);
+ sprint(literal, "$f32.%08ux", i32);
s = linklookup(ctxt, literal, 0);
s->size = 4;
p->from.type = D_OREG;
@@ -133,9 +133,9 @@ progedit(Link *ctxt, Prog *p)
break;
case AFMOVD:
if(p->from.type == D_FCONST) {
- int64 i64;
+ uint64 i64;
memmove(&i64, &p->from.u.dval, 8);
- sprint(literal, "$f64.%016llux", (uvlong)i64);
+ sprint(literal, "$f64.%016llux", i64);
s = linklookup(ctxt, literal, 0);
s->size = 8;
p->from.type = D_OREG;
@@ -414,7 +414,7 @@ addstacksplit(Link *ctxt, LSym *cursym)
else
if(autosize & 4)
autosize += 4;
- p->to.offset = (p->to.offset & (0xffffffffull<<32)) | (uint32)(autosize-8);
+ p->to.offset = ((uint64)p->to.offset & (0xffffffffull<<32)) | (uint32)(autosize-8);
if(!(p->reg & NOSPLIT))
p = stacksplit(ctxt, p, autosize, !(cursym->text->reg&NEEDCTXT)); // emit split check
@@ -668,14 +668,15 @@ addstacksplit(Link *ctxt, LSym *cursym)
}
}
-#if 0 // instruction scheduling
+/*
+// instruction scheduling
if(debug['Q'] == 0)
return;
curtext = nil;
- q = nil; /* p - 1 */
- q1 = firstp; /* top of block */
- o = 0; /* count of instructions */
+ 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++;
@@ -711,7 +712,7 @@ addstacksplit(Link *ctxt, LSym *cursym)
}
q = p;
}
-#endif
+*/
}
static Prog*