diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2012-07-11 23:39:05 +0200 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2012-07-11 23:39:05 +0200 |
| commit | d1694f7d7e6d96f64d1330c9b43491b613272b1e (patch) | |
| tree | 223f41bca3974e04d5b409d7e546225fcccf0b78 | |
| parent | ed9c6b132abab8fad614b2a077a69b86cbb95cdd (diff) | |
| download | tinycc-d1694f7d7e6d96f64d1330c9b43491b613272b1e.tar.gz tinycc-d1694f7d7e6d96f64d1330c9b43491b613272b1e.tar.bz2 | |
get_reg(): try to free r2 for an SValue first
To be able to load a long long value correctly on i386, gv() rely on the
fact that when get_reg() look at an SValue it tries first to free the
register in r2 and then r. More information about the context can be
found at
http://lists.nongnu.org/archive/html/tinycc-devel/2012-06/msg00017.html
and later at
http://lists.nongnu.org/archive/html/tinycc-devel/2012-07/msg00021.html
| -rw-r--r-- | tccgen.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -589,11 +589,11 @@ ST_FUNC int get_reg(int rc) IMPORTANT to start from the bottom to ensure that we don't spill registers used in gen_opi()) */ for(p=vstack;p<=vtop;p++) { - r = p->r & VT_VALMASK; + /* look at second register (if long long) */ + r = p->r2 & VT_VALMASK; if (r < VT_CONST && (reg_classes[r] & rc)) goto save_found; - /* also look at second register (if long long) */ - r = p->r2 & VT_VALMASK; + r = p->r & VT_VALMASK; if (r < VT_CONST && (reg_classes[r] & rc)) { save_found: save_reg(r); @@ -812,7 +812,8 @@ ST_FUNC int gv(int rc) vtop[-1].r = r; /* save register value */ vtop->r = vtop[-1].r2; } - /* allocate second register */ + /* Allocate second register. Here we rely on the fact that + get_reg() tries first to free r2 of an SValue. */ r2 = get_reg(rc2); load(r2, vtop); vpop(); |
