@@ -1247,6 +1247,28 @@ def : Pat<(i64 (X86Wrapper mcsym:$dst)),
1247
1247
def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
1248
1248
(MOV64ri32 tblockaddress:$dst)>, Requires<[KernelCode]>;
1249
1249
1250
+ // If we have small model and -static mode, it is safe to store global addresses
1251
+ // directly as immediates. FIXME: This is really a hack, the 'imm' predicate
1252
+ // for MOV64mi32 should handle this sort of thing.
1253
+ def : Pat<(store (i64 (X86Wrapper tconstpool:$src)), addr:$dst),
1254
+ (MOV64mi32 addr:$dst, tconstpool:$src)>,
1255
+ Requires<[NearData, IsNotPIC]>;
1256
+ def : Pat<(store (i64 (X86Wrapper tjumptable:$src)), addr:$dst),
1257
+ (MOV64mi32 addr:$dst, tjumptable:$src)>,
1258
+ Requires<[NearData, IsNotPIC]>;
1259
+ def : Pat<(store (i64 (X86Wrapper tglobaladdr:$src)), addr:$dst),
1260
+ (MOV64mi32 addr:$dst, tglobaladdr:$src)>,
1261
+ Requires<[NearData, IsNotPIC]>;
1262
+ def : Pat<(store (i64 (X86Wrapper texternalsym:$src)), addr:$dst),
1263
+ (MOV64mi32 addr:$dst, texternalsym:$src)>,
1264
+ Requires<[NearData, IsNotPIC]>;
1265
+ def : Pat<(store (i64 (X86Wrapper mcsym:$src)), addr:$dst),
1266
+ (MOV64mi32 addr:$dst, mcsym:$src)>,
1267
+ Requires<[NearData, IsNotPIC]>;
1268
+ def : Pat<(store (i64 (X86Wrapper tblockaddress:$src)), addr:$dst),
1269
+ (MOV64mi32 addr:$dst, tblockaddress:$src)>,
1270
+ Requires<[NearData, IsNotPIC]>;
1271
+
1250
1272
def : Pat<(i32 (X86RecoverFrameAlloc mcsym:$dst)), (MOV32ri mcsym:$dst)>;
1251
1273
def : Pat<(i64 (X86RecoverFrameAlloc mcsym:$dst)), (MOV64ri mcsym:$dst)>;
1252
1274
0 commit comments