[PATCH] D63738: [AIX]Enable lowering of MCSymbol MachineOperand

Xiangling Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 13:54:00 PDT 2019


Xiangling_L created this revision.
Xiangling_L added reviewers: sfertile, hubert.reinterpretcast, jasonliu, cebowleratibm.
Xiangling_L added a project: LLVM.
Herald added subscribers: llvm-commits, jsji, kbarton, hiraditya, nemanjai.

Enable lowering of llvm::MachineOperand::MO_MCSymbol so we can emit assembly of a call instruction.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63738

Files:
  llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
  llvm/test/CodeGen/PowerPC/test_call_aix.ll


Index: llvm/test/CodeGen/PowerPC/test_call_aix.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/test_call_aix.ll
+++ llvm/test/CodeGen/PowerPC/test_call_aix.ll
@@ -4,6 +4,15 @@
 ; RUN: llc -mtriple powerpc64-ibm-aix-xcoff -stop-after=machine-cp < %s | \
 ; RUN: FileCheck --check-prefix=64BIT %s
 
+; RUN: llc -mtriple powerpc-ibm-aix-xcoff < %s | \
+; RUN: FileCheck --check-prefix=32BITASM %s
+
+; RUN: not llc -mtriple powerpc64-ibm-aix-xcoff < %s  2>&1 | \
+; RUN: FileCheck --check-prefix=64BITASM %s
+
+
+; 64BITASM: LLVM ERROR: 64-bit XCOFF object files are not supported yet.
+
 declare void @foo(...)
 
 define void @test_call() {
@@ -16,6 +25,10 @@
 ; 64BIT: BL8_NOP <mcsymbol .foo>, csr_aix64, implicit-def dead $lr8, implicit $rm, implicit $x2, implicit-def $r1
 ; 64BIT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1
 
+; 32BITASM-LABEL: test_call
+; 32BITASM: bl .foo
+; 32BITASM-NEXT: nop
+
   call void bitcast (void (...)* @foo to void ()*)()
   ret void
 }
@@ -35,6 +48,10 @@
 ; 64BIT: BL8 <mcsymbol .foo_local>, csr_aix64, implicit-def dead $lr8, implicit $rm, implicit $x2, implicit-def $r1
 ; 64BIT: ADJCALLSTACKUP 112, 0, implicit-def dead $r1, implicit $r1
 
+; 32BITASM-LABEL: test_local_call
+; 32BITASM: bl .foo_local
+; 32BITASM-NOT: nop
+
   call void @foo_local()
   ret void
 }
Index: llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
===================================================================
--- llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
+++ llvm/lib/Target/PowerPC/PPCMCInstLower.cpp
@@ -193,6 +193,9 @@
     OutMO = GetSymbolRef(MO, AP.GetBlockAddressSymbol(MO.getBlockAddress()), AP,
                          isDarwin);
     return true;
+  case MachineOperand::MO_MCSymbol:
+    OutMO = GetSymbolRef(MO, MO.getMCSymbol(), AP, isDarwin);
+    return true;
   case MachineOperand::MO_RegisterMask:
     return false;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63738.206297.patch
Type: text/x-patch
Size: 1925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190624/c1b9af01/attachment.bin>


More information about the llvm-commits mailing list