summary refs log tree commit diff
path: root/copy.c
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2017-02-27 09:38:02 -0500
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2017-02-27 09:38:02 -0500
commitda9a30bd77fd2fd49d801e23b816e7310c2004a8 (patch)
tree5dc2d88b8ea48914245bd574295d8b8f0af18547 /copy.c
parent2c2db15995ce6c0f362d65e174d5a1b933057b80 (diff)
downloadroux-da9a30bd77fd2fd49d801e23b816e7310c2004a8.tar.gz
cosmetic fixes
Diffstat (limited to 'copy.c')
-rw-r--r--copy.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/copy.c b/copy.c
index 7442306..55c31b2 100644
--- a/copy.c
+++ b/copy.c
@@ -63,30 +63,23 @@ iscopy(Ins *i, Ref r, Fn *fn)
 		[Wsw] = BIT(Wsw),
 		[Wuw] = BIT(Wuw),
 	};
-	int k, w;
+	bits b;
 	Tmp *t;
 
 	if (i->op == Ocopy)
 		return 1;
-	if (!isext(i->op))
+	if (!isext(i->op) || rtype(r) != RTmp)
 		return 0;
 	if (i->op == Oextsw || i->op == Oextuw)
 	if (i->cls == Kw)
 		return 1;
-	if (rtype(r) == RTmp) {
-		t = &fn->tmp[r.val];
-		w = t->width;
-		k = t->cls;
-		assert(k == Kw || k == Kl);
-	} else {
-		assert(rtype(r) == RCon);
-		w = WFull;
-		k = Kl;
-	}
-	if (i->cls == Kl && k == Kw)
-		/* not enough bits in r */
+
+	t = &fn->tmp[r.val];
+	assert(KBASE(t->cls) == 0);
+	if (i->cls == Kl && t->cls == Kw)
 		return 0;
-	return (BIT(Wsb + (i->op - Oextsb)) & extcpy[w]) != 0;
+	b = extcpy[t->width];
+	return (BIT(Wsb + (i->op-Oextsb)) & b) != 0;
 }
 
 static void