D21394: [Codegen] Reorganize PICLevel
Robinson, Paul via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 11:41:37 PDT 2016
> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On Behalf
> Of Davide Italiano via llvm-commits
> Sent: Wednesday, June 15, 2016 11:56 AM
> To: dccitaliano at gmail.com; rafael.espindola at gmail.com;
> jrh29 at alumni.cwru.edu; hfinkel at anl.gov
> Cc: junbuml at codeaurora.org; llvm-commits at lists.llvm.org
> Subject: [PATCH] D21394: [Codegen] Reorganize PICLevel
>
> davide created this revision.
> davide added reviewers: rafael, jhibbits, hfinkel.
> davide added a subscriber: llvm-commits.
>
> See http://reviews.llvm.org/D21100 for context/rationale behind this
> change.
> CC:ing PPC as it seems to be the only user of this feature.
>
> http://reviews.llvm.org/D21394
>
> Files:
> include/llvm/Support/CodeGen.h
> lib/IR/Module.cpp
> lib/Target/PowerPC/PPCAsmPrinter.cpp
> lib/Target/PowerPC/PPCISelDAGToDAG.cpp
> lib/Target/PowerPC/PPCISelLowering.cpp
>
> Index: lib/Target/PowerPC/PPCISelLowering.cpp
> ===================================================================
> --- lib/Target/PowerPC/PPCISelLowering.cpp
> +++ lib/Target/PowerPC/PPCISelLowering.cpp
> @@ -2172,7 +2172,7 @@
> GOTPtr = DAG.getNode(PPCISD::ADDIS_TLSGD_HA, dl, PtrVT,
> GOTReg, TGA);
> } else {
> - if (picLevel == PICLevel::Small)
> + if (picLevel == PICLevel::SmallPIC)
> GOTPtr = DAG.getNode(PPCISD::GlobalBaseReg, dl, PtrVT);
> else
> GOTPtr = DAG.getNode(PPCISD::PPC32_PICGOT, dl, PtrVT);
> @@ -2190,7 +2190,7 @@
> GOTPtr = DAG.getNode(PPCISD::ADDIS_TLSLD_HA, dl, PtrVT,
> GOTReg, TGA);
> } else {
> - if (picLevel == PICLevel::Small)
> + if (picLevel == PICLevel::SmallPIC)
> GOTPtr = DAG.getNode(PPCISD::GlobalBaseReg, dl, PtrVT);
> else
> GOTPtr = DAG.getNode(PPCISD::PPC32_PICGOT, dl, PtrVT);
> Index: lib/Target/PowerPC/PPCISelDAGToDAG.cpp
> ===================================================================
> --- lib/Target/PowerPC/PPCISelDAGToDAG.cpp
> +++ lib/Target/PowerPC/PPCISelDAGToDAG.cpp
> @@ -319,7 +319,7 @@
> if (PPCLowering->getPointerTy(CurDAG->getDataLayout()) == MVT::i32) {
> if (PPCSubTarget->isTargetELF()) {
> GlobalBaseReg = PPC::R30;
> - if (M->getPICLevel() == PICLevel::Small) {
> + if (M->getPICLevel() == PICLevel::SmallPIC) {
> BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MoveGOTtoLR));
> BuildMI(FirstMBB, MBBI, dl, TII.get(PPC::MFLR), GlobalBaseReg);
> MF->getInfo<PPCFunctionInfo>()->setUsesPICBase(true);
> Index: lib/Target/PowerPC/PPCAsmPrinter.cpp
> ===================================================================
> --- lib/Target/PowerPC/PPCAsmPrinter.cpp
> +++ lib/Target/PowerPC/PPCAsmPrinter.cpp
> @@ -601,7 +601,7 @@
> else if (MO.isBlockAddress())
> MOSymbol = GetBlockAddressSymbol(MO.getBlockAddress());
>
> - if (PL == PICLevel::Small) {
> + if (PL == PICLevel::SmallPIC) {
> const MCExpr *Exp =
> MCSymbolRefExpr::create(MOSymbol, MCSymbolRefExpr::VK_GOT,
> OutContext);
> @@ -1045,7 +1045,7 @@
> TM.getRelocationModel() != Reloc::PIC_)
> return AsmPrinter::EmitStartOfAsmFile(M);
>
> - if (M.getPICLevel() == PICLevel::Small)
> + if (M.getPICLevel() == PICLevel::SmallPIC)
> return AsmPrinter::EmitStartOfAsmFile(M);
>
> OutStreamer->SwitchSection(OutContext.getELFSection(
> @@ -1072,7 +1072,7 @@
> // linux/ppc32 - Normal entry label.
> if (!Subtarget->isPPC64() &&
> (TM.getRelocationModel() != Reloc::PIC_ ||
> - MF->getFunction()->getParent()->getPICLevel() == PICLevel::Small))
> + MF->getFunction()->getParent()->getPICLevel() ==
> PICLevel::SmallPIC))
> return AsmPrinter::EmitFunctionEntryLabel();
>
> if (!Subtarget->isPPC64()) {
> Index: lib/IR/Module.cpp
> ===================================================================
> --- lib/IR/Module.cpp
> +++ lib/IR/Module.cpp
> @@ -487,7 +487,7 @@
> auto *Val = cast_or_null<ConstantAsMetadata>(getModuleFlag("PIC
> Level"));
>
> if (!Val)
> - return PICLevel::Default;
> + return PICLevel::NotPIC;
>
> return static_cast<PICLevel::Level>(
> cast<ConstantInt>(Val->getValue())->getZExtValue());
> Index: include/llvm/Support/CodeGen.h
> ===================================================================
> --- include/llvm/Support/CodeGen.h
> +++ include/llvm/Support/CodeGen.h
> @@ -29,7 +29,7 @@
> }
>
> namespace PICLevel {
> - enum Level { Default=0, Small=1, Large=2 };
> + enum Level { NotPIC=0, SmallPIC=1, BigPic=2 };
Probably should be "BigPIC" for consistency?
> }
>
> namespace PIELevel {
>
More information about the llvm-commits
mailing list