Skip to content

Commit 00ae4b7

Browse files
committed
Revert "[X86] Remove obsolete tablegen rules for near data in small static code model (#84523)"
This reverts commit b4cf63d. Breaks indirect-branch-tracking-eh2.ll.
1 parent 82f479b commit 00ae4b7

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

llvm/lib/Target/X86/X86InstrCompiler.td

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,28 @@ def : Pat<(i64 (X86Wrapper mcsym:$dst)),
12471247
def : Pat<(i64 (X86Wrapper tblockaddress:$dst)),
12481248
(MOV64ri32 tblockaddress:$dst)>, Requires<[KernelCode]>;
12491249

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+
12501272
def : Pat<(i32 (X86RecoverFrameAlloc mcsym:$dst)), (MOV32ri mcsym:$dst)>;
12511273
def : Pat<(i64 (X86RecoverFrameAlloc mcsym:$dst)), (MOV64ri mcsym:$dst)>;
12521274

0 commit comments

Comments
 (0)