llvm.org GIT mirror llvm / c994a35
[NFC] Cleanup with variable name IsPPC64 & IsDarwin Clean up PPCAsmPrinter with IsPPC64 and IsDarwin. Differential Revision: https://reviews.llvm.org/D69259 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375420 91177308-0d34-0410-b5e6-96231b3b80d8 Xiangling Liao 1 year, 1 month ago
1 changed file(s) with 18 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
535535 void PPCAsmPrinter::EmitInstruction(const MachineInstr *MI) {
536536 MCInst TmpInst;
537537 const bool IsDarwin = TM.getTargetTriple().isOSDarwin();
538 const bool IsPPC64 = Subtarget->isPPC64();
538539 const bool IsAIX = Subtarget->isAIXABI();
539540 const Module *M = MF->getFunction().getParent();
540541 PICLevel::Level PL = M->getPICLevel();
758759 return;
759760 }
760761 case PPC::ADDIStocHA: {
761 assert((IsAIX && !Subtarget->isPPC64() &&
762 TM.getCodeModel() == CodeModel::Large) &&
762 assert((IsAIX && !IsPPC64 && TM.getCodeModel() == CodeModel::Large) &&
763763 "This pseudo should only be selected for 32-bit large code model on"
764764 " AIX.");
765765
789789 return;
790790 }
791791 case PPC::LWZtocL: {
792 assert(IsAIX && !Subtarget->isPPC64() &&
793 TM.getCodeModel() == CodeModel::Large &&
792 assert(IsAIX && !IsPPC64 && TM.getCodeModel() == CodeModel::Large &&
794793 "This pseudo should only be selected for 32-bit large code model on"
795794 " AIX.");
796795
920919 case PPC::ADDISgotTprelHA: {
921920 // Transform: %xd = ADDISgotTprelHA %x2, @sym
922921 // Into: %xd = ADDIS8 %x2, sym@got@tlsgd@ha
923 assert(Subtarget->isPPC64() && "Not supported for 32-bit PowerPC");
922 assert(IsPPC64 && "Not supported for 32-bit PowerPC");
924923 const MachineOperand &MO = MI->getOperand(2);
925924 const GlobalValue *GValue = MO.getGlobal();
926925 MCSymbol *MOSymbol = getSymbol(GValue);
939938 LowerPPCMachineInstrToMCInst(MI, TmpInst, *this, IsDarwin);
940939
941940 // Change the opcode to LD.
942 TmpInst.setOpcode(Subtarget->isPPC64() ? PPC::LD : PPC::LWZ);
941 TmpInst.setOpcode(IsPPC64 ? PPC::LD : PPC::LWZ);
943942 const MachineOperand &MO = MI->getOperand(1);
944943 const GlobalValue *GValue = MO.getGlobal();
945944 MCSymbol *MOSymbol = getSymbol(GValue);
946945 const MCExpr *Exp = MCSymbolRefExpr::create(
947 MOSymbol,
948 Subtarget->isPPC64() ? MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO
949 : MCSymbolRefExpr::VK_PPC_GOT_TPREL,
946 MOSymbol, IsPPC64 ? MCSymbolRefExpr::VK_PPC_GOT_TPREL_LO
947 : MCSymbolRefExpr::VK_PPC_GOT_TPREL,
950948 OutContext);
951949 TmpInst.getOperand(1) = MCOperand::createExpr(Exp);
952950 EmitToStreamer(*OutStreamer, TmpInst);
1000998 case PPC::ADDIStlsgdHA: {
1001999 // Transform: %xd = ADDIStlsgdHA %x2, @sym
10021000 // Into: %xd = ADDIS8 %x2, sym@got@tlsgd@ha
1003 assert(Subtarget->isPPC64() && "Not supported for 32-bit PowerPC");
1001 assert(IsPPC64 && "Not supported for 32-bit PowerPC");
10041002 const MachineOperand &MO = MI->getOperand(2);
10051003 const GlobalValue *GValue = MO.getGlobal();
10061004 MCSymbol *MOSymbol = getSymbol(GValue);
10231021 const GlobalValue *GValue = MO.getGlobal();
10241022 MCSymbol *MOSymbol = getSymbol(GValue);
10251023 const MCExpr *SymGotTlsGD = MCSymbolRefExpr::create(
1026 MOSymbol, Subtarget->isPPC64() ? MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO
1027 : MCSymbolRefExpr::VK_PPC_GOT_TLSGD,
1024 MOSymbol, IsPPC64 ? MCSymbolRefExpr::VK_PPC_GOT_TLSGD_LO
1025 : MCSymbolRefExpr::VK_PPC_GOT_TLSGD,
10281026 OutContext);
10291027 EmitToStreamer(*OutStreamer,
1030 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDI8 : PPC::ADDI)
1028 MCInstBuilder(IsPPC64 ? PPC::ADDI8 : PPC::ADDI)
10311029 .addReg(MI->getOperand(0).getReg())
10321030 .addReg(MI->getOperand(1).getReg())
10331031 .addExpr(SymGotTlsGD));
10451043 case PPC::ADDIStlsldHA: {
10461044 // Transform: %xd = ADDIStlsldHA %x2, @sym
10471045 // Into: %xd = ADDIS8 %x2, sym@got@tlsld@ha
1048 assert(Subtarget->isPPC64() && "Not supported for 32-bit PowerPC");
1046 assert(IsPPC64 && "Not supported for 32-bit PowerPC");
10491047 const MachineOperand &MO = MI->getOperand(2);
10501048 const GlobalValue *GValue = MO.getGlobal();
10511049 MCSymbol *MOSymbol = getSymbol(GValue);
10681066 const GlobalValue *GValue = MO.getGlobal();
10691067 MCSymbol *MOSymbol = getSymbol(GValue);
10701068 const MCExpr *SymGotTlsLD = MCSymbolRefExpr::create(
1071 MOSymbol, Subtarget->isPPC64() ? MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO
1072 : MCSymbolRefExpr::VK_PPC_GOT_TLSLD,
1069 MOSymbol, IsPPC64 ? MCSymbolRefExpr::VK_PPC_GOT_TLSLD_LO
1070 : MCSymbolRefExpr::VK_PPC_GOT_TLSLD,
10731071 OutContext);
10741072 EmitToStreamer(*OutStreamer,
1075 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDI8 : PPC::ADDI)
1073 MCInstBuilder(IsPPC64 ? PPC::ADDI8 : PPC::ADDI)
10761074 .addReg(MI->getOperand(0).getReg())
10771075 .addReg(MI->getOperand(1).getReg())
10781076 .addExpr(SymGotTlsLD));
11011099 OutContext);
11021100 EmitToStreamer(
11031101 *OutStreamer,
1104 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDIS8 : PPC::ADDIS)
1102 MCInstBuilder(IsPPC64 ? PPC::ADDIS8 : PPC::ADDIS)
11051103 .addReg(MI->getOperand(0).getReg())
11061104 .addReg(MI->getOperand(1).getReg())
11071105 .addExpr(SymDtprel));
11201118 MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_PPC_DTPREL_LO,
11211119 OutContext);
11221120 EmitToStreamer(*OutStreamer,
1123 MCInstBuilder(Subtarget->isPPC64() ? PPC::ADDI8 : PPC::ADDI)
1121 MCInstBuilder(IsPPC64 ? PPC::ADDI8 : PPC::ADDI)
11241122 .addReg(MI->getOperand(0).getReg())
11251123 .addReg(MI->getOperand(1).getReg())
11261124 .addExpr(SymDtprel));
11671165 // suite shows a handful of test cases that fail this check for
11681166 // Darwin. Those need to be investigated before this sanity test
11691167 // can be enabled for those subtargets.
1170 if (!Subtarget->isDarwin()) {
1168 if (!IsDarwin) {
11711169 unsigned OpNum = (MI->getOpcode() == PPC::STD) ? 2 : 1;
11721170 const MachineOperand &MO = MI->getOperand(OpNum);
11731171 if (MO.isGlobal() && MO.getGlobal()->getAlignment() < 4)