[PATCH] D131473: [XCOFF] ignore the cold attribute.

Esme Yi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 02:04:44 PDT 2022


Esme created this revision.
Esme added reviewers: DiggerLin, shchenz, PowerPC, daltenty.
Herald added subscribers: hiraditya, nemanjai.
Herald added a project: All.
Esme requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

AIX assembly doesn't support the cold feature.
While it shouldn't be a function error when XCOFF catching the cold attribute.
As with the behavior of other formats, we just ignore the attribute for now.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131473

Files:
  llvm/lib/MC/MCXCOFFStreamer.cpp
  llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll


Index: llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/aix-xcoff-cold.ll
@@ -0,0 +1,16 @@
+; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -filetype=obj -o %t.o < %s
+; RUN: llvm-objdump --syms %t.o | FileCheck %s
+
+; CHECK:      SYMBOL TABLE:
+; CHECK-NEXT: 0000000000000000      df *DEBUG* 0000000000000000 <stdin>
+; CHECK-NEXT: 0000000000000000 l       .text   000000000000001e .text
+; CHECK-NEXT: 0000000000000000 g     F .text (csect: .text)  0000000000000000 .cold_fun
+; CHECK-NEXT: 0000000000000020 g     O .data   0000000000000018 cold_fun
+; CHECK-NEXT: 0000000000000038 l       .data   0000000000000000 TOC
+
+define dso_local void @cold_fun() #1 {
+entry:
+  ret void
+}
+
+attributes #1 = { cold }
Index: llvm/lib/MC/MCXCOFFStreamer.cpp
===================================================================
--- llvm/lib/MC/MCXCOFFStreamer.cpp
+++ llvm/lib/MC/MCXCOFFStreamer.cpp
@@ -37,6 +37,9 @@
   getAssembler().registerSymbol(*Symbol);
 
   switch (Attribute) {
+  case MCSA_Cold:
+    return false;
+
   case MCSA_Global:
   case MCSA_Extern:
     Symbol->setStorageClass(XCOFF::C_EXT);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131473.451062.patch
Type: text/x-patch
Size: 1210 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220809/4529cea0/attachment.bin>


More information about the llvm-commits mailing list