summary refs log tree commit diff
path: root/amd64/isel.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2017-05-17 09:40:07 -0400
committerQuentin Carbonneaux <quentin@c9x.me>2017-05-17 10:05:28 -0400
commita3a1451c5fabb5c94f7fbeb13fdc6b1e2c23181f (patch)
tree1fb1ba60e8f3cab09c629ce9dd63e00e01974c39 /amd64/isel.c
parent2d02070af019e9896ecf2a63bedc098092fd395d (diff)
downloadroux-a3a1451c5fabb5c94f7fbeb13fdc6b1e2c23181f.tar.gz
intern symbol names
Symbols in the source file are still limited in
length because the rest of the code assumes that
strings always fit in NString bytes.

Regardless, there is already a benefit because
comparing/copying symbol names does not require
using strcmp()/strcpy() anymore.
Diffstat (limited to 'amd64/isel.c')
-rw-r--r--amd64/isel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 0dbaad3..39fc9e8 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -61,6 +61,7 @@ rslot(Ref r, Fn *fn)
 static void
 fixarg(Ref *r, int k, int op, Fn *fn)
 {
+	char buf[32];
 	Addr a, *m;
 	Ref r0, r1;
 	int s, n, cpy, mem;
@@ -80,7 +81,8 @@ fixarg(Ref *r, int k, int op, Fn *fn)
 		a.offset.type = CAddr;
 		a.offset.local = 1;
 		n = gasstashfp(fn->con[r0.val].bits.i, KWIDE(k));
-		sprintf(a.offset.label, "fp%d", n);
+		sprintf(buf, "fp%d", n);
+		a.offset.label = intern(buf);
 		fn->mem[fn->nmem-1] = a;
 	}
 	else if (!cpy && k == Kl && noimm(r0, fn)) {