@@ -909,6 +909,23 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
909
909
// Lower multi-instruction pseudo operations.
910
910
switch (MI->getOpcode ()) {
911
911
default : break ;
912
+ case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
913
+ assert (!Subtarget->isAIXABI () &&
914
+ " AIX does not support patchable function entry!" );
915
+ // PATCHABLE_FUNCTION_ENTER on little endian is for XRAY support which is
916
+ // handled in PPCLinuxAsmPrinter.
917
+ if (MAI->isLittleEndian ())
918
+ return ;
919
+ const Function &F = MF->getFunction ();
920
+ unsigned Num = 0 ;
921
+ (void )F.getFnAttribute (" patchable-function-entry" )
922
+ .getValueAsString ()
923
+ .getAsInteger (10 , Num);
924
+ if (!Num)
925
+ return ;
926
+ emitNops (Num);
927
+ return ;
928
+ }
912
929
case TargetOpcode::DBG_VALUE:
913
930
llvm_unreachable (" Should be handled target independently" );
914
931
case TargetOpcode::STACKMAP:
@@ -1780,7 +1797,7 @@ void PPCLinuxAsmPrinter::emitInstruction(const MachineInstr *MI) {
1780
1797
1781
1798
switch (MI->getOpcode ()) {
1782
1799
default :
1783
- return PPCAsmPrinter::emitInstruction (MI) ;
1800
+ break ;
1784
1801
case TargetOpcode::PATCHABLE_FUNCTION_ENTER: {
1785
1802
// .begin:
1786
1803
// b .end # lis 0, FuncId[16..32]
@@ -1793,6 +1810,9 @@ void PPCLinuxAsmPrinter::emitInstruction(const MachineInstr *MI) {
1793
1810
//
1794
1811
// Update compiler-rt/lib/xray/xray_powerpc64.cc accordingly when number
1795
1812
// of instructions change.
1813
+ // XRAY is only supported on PPC Linux little endian.
1814
+ if (!MAI->isLittleEndian ())
1815
+ break ;
1796
1816
MCSymbol *BeginOfSled = OutContext.createTempSymbol ();
1797
1817
MCSymbol *EndOfSled = OutContext.createTempSymbol ();
1798
1818
OutStreamer->emitLabel (BeginOfSled);
@@ -1909,6 +1929,7 @@ void PPCLinuxAsmPrinter::emitInstruction(const MachineInstr *MI) {
1909
1929
llvm_unreachable (" Tail call is handled in the normal case. See comments "
1910
1930
" around this assert." );
1911
1931
}
1932
+ return PPCAsmPrinter::emitInstruction (MI);
1912
1933
}
1913
1934
1914
1935
void PPCLinuxAsmPrinter::emitStartOfAsmFile (Module &M) {
0 commit comments