llvm.org GIT mirror llvm / 55e4ae9
[PowerPC] Fix machine verify pass error for PATCHPOINT pseudo instruction that bad machine code Summary: For SDAG, we pretend patchpoints aren't special at all until we emit the code for the pseudo. Then the verifier runs and it seems like we have a use of an undefined register (the register will be reserved later, but the verifier doesn't know that). So this patch call setUsesTOCBasePtr before emit the code for the pseudo, so verifier can know X2 is a reserved register. Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D56148 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350165 91177308-0d34-0410-b5e6-96231b3b80d8 Kang Zhang 9 months ago
5 changed file(s) with 15 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
50965096
50975097 // All calls, in both the ELF V1 and V2 ABIs, need the TOC register live
50985098 // into the call.
5099 if (isSVR4ABI && isPPC64 && !isPatchPoint) {
5099 // We do need to reserve X2 to appease the verifier for the PATCHPOINT.
5100 if (isSVR4ABI && isPPC64) {
51005101 setUsesTOCBasePtr(DAG);
5101 Ops.push_back(DAG.getRegister(PPC::X2, PtrVT));
5102
5103 // We cannot add X2 as an operand here for PATCHPOINT, because there is no
5104 // way to mark dependencies as implicit here. We will add the X2 dependency
5105 // in EmitInstrWithCustomInserter.
5106 if (!isPatchPoint)
5107 Ops.push_back(DAG.getRegister(PPC::X2, PtrVT));
51025108 }
51035109
51045110 return CallOpc;
1034510351 // way to mark the dependence as implicit there, and so the stackmap code
1034610352 // will confuse it with a regular operand. Instead, add the dependence
1034710353 // here.
10348 setUsesTOCBasePtr(*BB->getParent());
1034910354 MI.addOperand(MachineOperand::CreateReg(PPC::X2, false, true));
1035010355 }
1035110356
None ; RUN: not llc < %s -mtriple=powerpc64-unknown-linux-gnu 2>&1 | FileCheck %s
0 ; RUN: not llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu 2>&1 | FileCheck %s
11 ;
22 ; Check that misuse of anyregcc results in a compile time error.
33
None ; RUN: llc < %s | FileCheck %s
0 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
11 target datalayout = "E-m:e-i64:64-n32:64"
22 target triple = "powerpc64-unknown-linux-gnu"
33
None ; RUN: llc < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
1 ; RUN: llc -fast-isel -fast-isel-abort=1 < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
2 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
3 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -fast-isel -fast-isel-abort=1 < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
0 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
1 ; RUN: llc -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-BE
2 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -verify-machineinstrs < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
3 ; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu -fast-isel -fast-isel-abort=1 -verify-machineinstrs < %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-LE
44
55 target triple = "powerpc64-unknown-linux-gnu"
66
None ; RUN: llc < %s | FileCheck %s
0 ; RUN: llc -verify-machineinstrs < %s | FileCheck %s
11 ;
22 ; Note: Print verbose stackmaps using -debug-only=stackmaps.
33