1
From 315185fe1db1296e511bec15894dad22432c9a7f Mon Sep 17 00:00:00 2001
2
From: Thomas Preud'homme <robotux@celest.fr>
3
Date: Sat, 21 Jul 2012 03:36:51 +0200
4
Subject: get_reg(): try to free r2 for an SValue first
6
To be able to load a long long value correctly on i386, gv() rely on the
7
fact that when get_reg() look at an SValue it tries first to free the
8
register in r2 and then r. More information about the context can be
10
http://lists.nongnu.org/archive/html/tinycc-devel/2012-06/msg00017.html
12
http://lists.nongnu.org/archive/html/tinycc-devel/2012-07/msg00021.html
14
Origin: upstream,http://repo.or.cz/w/tinycc.git/commit/d1694f7d7e6d96f64d1330c9b43491b613272b1e
15
Bug-Debian: http://bugs.debian.org/681281
16
Forwarded: http://lists.nongnu.org/archive/html/tinycc-devel/2012-06/msg00017.html
17
Last-Updated: 2012-07-21
18
Applied-Upstream: commit:d1694f7d7e6d96f64d1330c9b43491b613272b1e
20
tccgen.c | 9 +++++----
21
1 file changed, 5 insertions(+), 4 deletions(-)
23
diff --git a/tccgen.c b/tccgen.c
24
index d27bdba..71d0809 100644
27
@@ -589,11 +589,11 @@ ST_FUNC int get_reg(int rc)
28
IMPORTANT to start from the bottom to ensure that we don't
29
spill registers used in gen_opi()) */
30
for(p=vstack;p<=vtop;p++) {
31
- r = p->r & VT_VALMASK;
32
+ /* look at second register (if long long) */
33
+ r = p->r2 & VT_VALMASK;
34
if (r < VT_CONST && (reg_classes[r] & rc))
36
- /* also look at second register (if long long) */
37
- r = p->r2 & VT_VALMASK;
38
+ r = p->r & VT_VALMASK;
39
if (r < VT_CONST && (reg_classes[r] & rc)) {
42
@@ -812,7 +812,8 @@ ST_FUNC int gv(int rc)
43
vtop[-1].r = r; /* save register value */
44
vtop->r = vtop[-1].r2;
46
- /* allocate second register */
47
+ /* Allocate second register. Here we rely on the fact that
48
+ get_reg() tries first to free r2 of an SValue. */