diff options
author | Mike Pall <mike> | 2010-12-06 03:09:52 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2010-12-06 03:10:28 +0100 |
commit | b56b83487f51d7492bab8e78c3c26c2f708d4e3c (patch) | |
tree | 355c0514cabfc05d2beba7bab07d18e75bc489c8 /src | |
parent | a850b27da95036dc7fdae118684061eea09310ed (diff) | |
download | luajit-b56b83487f51d7492bab8e78c3c26c2f708d4e3c.tar.gz luajit-b56b83487f51d7492bab8e78c3c26c2f708d4e3c.tar.bz2 luajit-b56b83487f51d7492bab8e78c3c26c2f708d4e3c.zip |
Support all kinds of XLOAD/XSTORE references in backend.
Fuse pointer arithmetic, too.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_asm.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c index 302bc06b..5d48b6be 100644 --- a/src/lj_asm.c +++ b/src/lj_asm.c | |||
@@ -1297,14 +1297,21 @@ static void asm_fusestrref(ASMState *as, IRIns *ir, RegSet allow) | |||
1297 | } | 1297 | } |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | static void asm_fusexref(ASMState *as, IRIns *ir, RegSet allow) | 1300 | static void asm_fusexref(ASMState *as, IRRef ref, RegSet allow) |
1301 | { | 1301 | { |
1302 | IRIns *ir = IR(ref); | ||
1302 | if (ir->o == IR_KPTR) { | 1303 | if (ir->o == IR_KPTR) { |
1303 | as->mrm.ofs = ir->i; | 1304 | as->mrm.ofs = ir->i; |
1304 | as->mrm.base = as->mrm.idx = RID_NONE; | 1305 | as->mrm.base = as->mrm.idx = RID_NONE; |
1305 | } else { | 1306 | } else if (ir->o == IR_STRREF) { |
1306 | lua_assert(ir->o == IR_STRREF); | ||
1307 | asm_fusestrref(as, ir, allow); | 1307 | asm_fusestrref(as, ir, allow); |
1308 | } else if (mayfuse(as, ref) && ir->o == IR_ADD && | ||
1309 | asm_isk32(as, ir->op2, &as->mrm.ofs)) { | ||
1310 | /* NYI: gather index and shifts. */ | ||
1311 | as->mrm.idx = RID_NONE; | ||
1312 | as->mrm.base = (uint8_t)ra_alloc1(as, ir->op1, allow); | ||
1313 | } else { | ||
1314 | as->mrm.base = (uint8_t)ra_alloc1(as, ref, allow); | ||
1308 | } | 1315 | } |
1309 | } | 1316 | } |
1310 | 1317 | ||
@@ -1360,7 +1367,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow) | |||
1360 | */ | 1367 | */ |
1361 | if ((irt_isint(ir->t) || irt_isaddr(ir->t)) && | 1368 | if ((irt_isint(ir->t) || irt_isaddr(ir->t)) && |
1362 | noconflict(as, ref, IR_XSTORE)) { | 1369 | noconflict(as, ref, IR_XSTORE)) { |
1363 | asm_fusexref(as, IR(ir->op1), xallow); | 1370 | asm_fusexref(as, ir->op1, xallow); |
1364 | return RID_MRM; | 1371 | return RID_MRM; |
1365 | } | 1372 | } |
1366 | } else if (ir->o == IR_VLOAD) { | 1373 | } else if (ir->o == IR_VLOAD) { |
@@ -1962,7 +1969,7 @@ static void asm_fxload(ASMState *as, IRIns *ir) | |||
1962 | if (ir->o == IR_FLOAD) | 1969 | if (ir->o == IR_FLOAD) |
1963 | asm_fusefref(as, ir, RSET_GPR); | 1970 | asm_fusefref(as, ir, RSET_GPR); |
1964 | else | 1971 | else |
1965 | asm_fusexref(as, IR(ir->op1), RSET_GPR); | 1972 | asm_fusexref(as, ir->op1, RSET_GPR); |
1966 | /* ir->op2 is ignored -- unaligned loads are ok on x86. */ | 1973 | /* ir->op2 is ignored -- unaligned loads are ok on x86. */ |
1967 | switch (irt_type(ir->t)) { | 1974 | switch (irt_type(ir->t)) { |
1968 | case IRT_I8: xo = XO_MOVSXb; break; | 1975 | case IRT_I8: xo = XO_MOVSXb; break; |
@@ -1996,7 +2003,7 @@ static void asm_fxstore(ASMState *as, IRIns *ir) | |||
1996 | if (ir->o == IR_FSTORE) | 2003 | if (ir->o == IR_FSTORE) |
1997 | asm_fusefref(as, IR(ir->op1), allow); | 2004 | asm_fusefref(as, IR(ir->op1), allow); |
1998 | else | 2005 | else |
1999 | asm_fusexref(as, IR(ir->op1), allow); | 2006 | asm_fusexref(as, ir->op1, allow); |
2000 | /* ir->op2 is ignored -- unaligned stores are ok on x86. */ | 2007 | /* ir->op2 is ignored -- unaligned stores are ok on x86. */ |
2001 | if (ra_hasreg(src)) { | 2008 | if (ra_hasreg(src)) { |
2002 | x86Op xo; | 2009 | x86Op xo; |