12015-10-29 Filip Pizlo <fpizlo@apple.com>
2
3 B3::LowerToAir::imm() should work for both 32-bit and 64-bit immediates
4 https://bugs.webkit.org/show_bug.cgi?id=150685
5
6 Reviewed by NOBODY (OOPS!).
7
8 In B3, a constant must match the type of its use. In Air, immediates don't have type, they
9 only have representation. A 32-bit immediate (i.e. Arg::imm) can be used either for 32-bit
10 operations or for 64-bit operations. The only difference from a Arg::imm64 is that it
11 requires fewer bits.
12
13 In the B3->Air lowering, we have a lot of code that is effectively polymorphic over integer
14 type. That code should still be able to use Arg::imm, and it should work even for 64-bit
15 immediates - so long as they are representable as 32-bit immediates. Therefore, the imm()
16 helper should happily accept either Const32Value or Const64Value.
17
18 We already sort of had this with immAnyType(), but it just turns out that anyone using
19 immAnyType() should really be using imm().
20
21 * b3/B3LowerToAir.cpp:
22 (JSC::B3::Air::LowerToAir::imm):
23 (JSC::B3::Air::LowerToAir::tryStore):
24 (JSC::B3::Air::LowerToAir::tryConst64):
25 (JSC::B3::Air::LowerToAir::immAnyInt): Deleted.
26 * b3/testb3.cpp:
27 (JSC::B3::testAdd1):
28 (JSC::B3::testAdd1Ptr):
29 (JSC::B3::testStoreAddLoad):
30 (JSC::B3::run):
31