[PATCH] D113576: [AArch64] [COFF] Move jump tables back to the readonly section

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 23 00:39:42 PST 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e5488afb27a: [AArch64] [COFF] Move jump tables back to the readonly section (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113576/new/

https://reviews.llvm.org/D113576

Files:
  llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
  llvm/test/CodeGen/AArch64/win64-jumptable.ll


Index: llvm/test/CodeGen/AArch64/win64-jumptable.ll
===================================================================
--- llvm/test/CodeGen/AArch64/win64-jumptable.ll
+++ llvm/test/CodeGen/AArch64/win64-jumptable.ll
@@ -38,12 +38,14 @@
 ; CHECK:    .seh_proc f
 ; CHECK:    b g
 ; CHECK-NEXT:  .seh_endfunclet
+; CHECK-NEXT:  .section .rdata,"dr"
 ; CHECK-NEXT: .p2align  2
 ; CHECK-NEXT: .LJTI0_0:
 ; CHECK:    .word .LBB0_2-.Ltmp0
 ; CHECK:    .word .LBB0_3-.Ltmp0
 ; CHECK:    .word .LBB0_4-.Ltmp0
 ; CHECK:    .word .LBB0_5-.Ltmp0
+; CHECK:    .text
 ; CHECK:    .seh_endproc
 
 ; Check that we can emit an object file with correct unwind info.
Index: llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -818,18 +818,9 @@
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   if (JT.empty()) return;
 
-  const Function &F = MF->getFunction();
   const TargetLoweringObjectFile &TLOF = getObjFileLowering();
-  bool JTInDiffSection =
-      !STI->isTargetCOFF() ||
-      !TLOF.shouldPutJumpTableInFunctionSection(
-          MJTI->getEntryKind() == MachineJumpTableInfo::EK_LabelDifference32,
-          F);
-  if (JTInDiffSection) {
-      // Drop it in the readonly section.
-      MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(F, TM);
-      OutStreamer->SwitchSection(ReadOnlySec);
-  }
+  MCSection *ReadOnlySec = TLOF.getSectionForJumpTable(MF->getFunction(), TM);
+  OutStreamer->SwitchSection(ReadOnlySec);
 
   auto AFI = MF->getInfo<AArch64FunctionInfo>();
   for (unsigned JTI = 0, e = JT.size(); JTI != e; ++JTI) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113576.389108.patch
Type: text/x-patch
Size: 1728 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211123/c85863d1/attachment.bin>


More information about the llvm-commits mailing list