From: Zijiao Ma Date: Wed, 17 Aug 2016 02:08:28 +0000 (+0000) Subject: Some places that could using TargetParser in LLVM. NFC. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53d55f45a1fde4683e2ebc0fc83c39c2a36a99d7;p=platform%2Fupstream%2Fllvm.git Some places that could using TargetParser in LLVM. NFC. llvm-svn: 278888 --- diff --git a/llvm/lib/Target/ARM/ARMSubtarget.cpp b/llvm/lib/Target/ARM/ARMSubtarget.cpp index 561f80a..b6e2b3a 100644 --- a/llvm/lib/Target/ARM/ARMSubtarget.cpp +++ b/llvm/lib/Target/ARM/ARMSubtarget.cpp @@ -31,6 +31,7 @@ #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" +#include "llvm/Support/TargetParser.h" using namespace llvm; @@ -117,10 +118,11 @@ void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) { if (isTargetDarwin()) { StringRef ArchName = TargetTriple.getArchName(); - if (ArchName.endswith("v7s")) + unsigned ArchKind = llvm::ARM::parseArch(ArchName); + if (ArchKind == llvm::ARM::AK_ARMV7S) // Default to the Swift CPU when targeting armv7s/thumbv7s. CPUString = "swift"; - else if (ArchName.endswith("v7k")) + else if (ArchKind == llvm::ARM::AK_ARMV7K) // Default to the Cortex-a7 CPU when targeting armv7k/thumbv7k. // ARMv7k does not use SjLj exception handling. CPUString = "cortex-a7"; diff --git a/llvm/lib/Target/ARM/ARMTargetMachine.cpp b/llvm/lib/Target/ARM/ARMTargetMachine.cpp index 066587a..4b24af8 100644 --- a/llvm/lib/Target/ARM/ARMTargetMachine.cpp +++ b/llvm/lib/Target/ARM/ARMTargetMachine.cpp @@ -23,6 +23,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/FormattedStream.h" #include "llvm/Support/TargetRegistry.h" +#include "llvm/Support/TargetParser.h" #include "llvm/Target/TargetOptions.h" #include "llvm/Transforms/Scalar.h" using namespace llvm; @@ -84,11 +85,13 @@ computeTargetABI(const Triple &TT, StringRef CPU, ARMBaseTargetMachine::ARMABI TargetABI = ARMBaseTargetMachine::ARM_ABI_UNKNOWN; + unsigned ArchKind = llvm::ARM::parseCPUArch(CPU); + StringRef ArchName = llvm::ARM::getArchName(ArchKind); // 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.isOSBinFormatMachO()) || - CPU.startswith("cortex-m")) { + llvm::ARM::parseArchProfile(ArchName) == llvm::ARM::PK_M) { TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS; } else if (TT.isWatchABI()) { TargetABI = ARMBaseTargetMachine::ARM_ABI_AAPCS16;