[PATCH] D10960: Where Triple has a suitable predicate, use it rather than the enum values. NFC.

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jul 6 15:14:18 PDT 2015


Lgtm
On Jul 6, 2015 11:06 AM, "Daniel Sanders" <daniel.sanders at imgtec.com> wrote:

>
> dsanders added subscribers: rengolin, llvm-commits.
>
> http://reviews.llvm.org/D10960
>
> Files:
>   lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
>   lib/Target/ARM/ARMBaseInstrInfo.cpp
>   lib/Target/ARM/ARMTargetMachine.cpp
>   lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
>   lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
>
> Index: lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
> ===================================================================
> --- lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
> +++ lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
> @@ -231,7 +231,7 @@
>  static MCTargetStreamer *
>  createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI) {
>    const Triple &TT = STI.getTargetTriple();
> -  if (TT.getObjectFormat() == Triple::ELF)
> +  if (TT.isOSBinFormatELF())
>      return new PPCTargetELFStreamer(S);
>    return new PPCTargetMachOStreamer(S);
>  }
> Index: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
> ===================================================================
> --- lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
> +++ lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
> @@ -1362,7 +1362,7 @@
>  MCTargetStreamer *createARMObjectTargetStreamer(MCStreamer &S,
>                                                  const MCSubtargetInfo
> &STI) {
>    const Triple &TT = STI.getTargetTriple();
> -  if (TT.getObjectFormat() == Triple::ELF)
> +  if (TT.isOSBinFormatELF())
>      return new ARMTargetELFStreamer(S);
>    return new ARMTargetStreamer(S);
>  }
> Index: lib/Target/ARM/ARMTargetMachine.cpp
> ===================================================================
> --- lib/Target/ARM/ARMTargetMachine.cpp
> +++ lib/Target/ARM/ARMTargetMachine.cpp
> @@ -80,8 +80,7 @@
>    // FIXME: This is duplicated code from the front end and should be
> unified.
>    if (TT.isOSBinFormatMachO()) {
>      if (TT.getEnvironment() == llvm::Triple::EABI ||
> -        (TT.getOS() == llvm::Triple::UnknownOS &&
> -         TT.getObjectFormat() == llvm::Triple::MachO) ||
> +        (TT.getOS() == llvm::Triple::UnknownOS &&
> TT.isOSBinFormatMachO()) ||
>          CPU.startswith("cortex-m")) {
>        TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS;
>      } else {
> @@ -104,8 +103,8 @@
>        TargetABI = ARMBaseTargetMachine::ARM_ABI_APCS;
>        break;
>      default:
> -      if (TT.getOS() == llvm::Triple::NetBSD)
> -       TargetABI = ARMBaseTargetMachine::ARM_ABI_APCS;
> +      if (TT.isOSNetBSD())
> +        TargetABI = ARMBaseTargetMachine::ARM_ABI_APCS;
>        else
>         TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS;
>        break;
> Index: lib/Target/ARM/ARMBaseInstrInfo.cpp
> ===================================================================
> --- lib/Target/ARM/ARMBaseInstrInfo.cpp
> +++ lib/Target/ARM/ARMBaseInstrInfo.cpp
> @@ -1230,8 +1230,7 @@
>    Reloc::Model RM = MF.getTarget().getRelocationModel();
>
>    if (MI->getOpcode() == TargetOpcode::LOAD_STACK_GUARD) {
> -    assert(getSubtarget().getTargetTriple().getObjectFormat() ==
> -           Triple::MachO &&
> +    assert(getSubtarget().getTargetTriple().isOSBinFormatMachO() &&
>             "LOAD_STACK_GUARD currently supported only for MachO.");
>      expandLoadStackGuard(MI, RM);
>      MI->getParent()->erase(MI);
> Index: lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
> ===================================================================
> --- lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
> +++ lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
> @@ -199,7 +199,7 @@
>  MCTargetStreamer *
>  createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo
> &STI) {
>    const Triple &TT = STI.getTargetTriple();
> -  if (TT.getObjectFormat() == Triple::ELF)
> +  if (TT.isOSBinFormatELF())
>      return new AArch64TargetELFStreamer(S);
>    return nullptr;
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150706/08a6a8c7/attachment.html>


More information about the llvm-commits mailing list