From d12af8754e198dc1f8f19fea02229a7ee45678ce Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 1 Feb 2015 12:38:24 +0000 Subject: [PATCH] [multiversion] Remove a false freedom to leave the TargetMachine pointer null. For some reason some of the original TTI code supported a null target machine. This seems to have been legacy, and I made matters worse when refactoring this code by spreading that pattern further through the various targets. The TargetMachine can't actually be null, and it doesn't make sense to support that use case. I've now consistently removed it and removed all of the code trying to cope with that situation. This is probably good, as several targets *didn't* cope with it being null despite the null default argument in their constructors. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227734 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/BasicTTIImpl.h | 2 +- lib/Target/AArch64/AArch64TargetTransformInfo.h | 5 ++--- lib/Target/ARM/ARMTargetTransformInfo.h | 5 ++--- lib/Target/NVPTX/NVPTXTargetTransformInfo.h | 5 ++--- lib/Target/PowerPC/PPCTargetTransformInfo.h | 2 +- lib/Target/R600/AMDGPUTargetTransformInfo.h | 2 +- lib/Target/X86/X86TargetTransformInfo.h | 5 ++--- lib/Target/XCore/XCoreTargetTransformInfo.h | 2 +- 8 files changed, 12 insertions(+), 16 deletions(-) diff --git a/include/llvm/CodeGen/BasicTTIImpl.h b/include/llvm/CodeGen/BasicTTIImpl.h index 7fd16e1de54..616e39f9688 100644 --- a/include/llvm/CodeGen/BasicTTIImpl.h +++ b/include/llvm/CodeGen/BasicTTIImpl.h @@ -628,7 +628,7 @@ class BasicTTIImpl : public BasicTTIImplBase { typedef BasicTTIImplBase BaseT; public: - explicit BasicTTIImpl(const TargetMachine *TM = nullptr); + explicit BasicTTIImpl(const TargetMachine *TM); // Provide value semantics. MSVC requires that we spell all of these out. BasicTTIImpl(const BasicTTIImpl &Arg) diff --git a/lib/Target/AArch64/AArch64TargetTransformInfo.h b/lib/Target/AArch64/AArch64TargetTransformInfo.h index 30a2c23fd36..5d4b9a39f67 100644 --- a/lib/Target/AArch64/AArch64TargetTransformInfo.h +++ b/lib/Target/AArch64/AArch64TargetTransformInfo.h @@ -44,9 +44,8 @@ class AArch64TTIImpl : public BasicTTIImplBase { }; public: - explicit AArch64TTIImpl(const AArch64TargetMachine *TM = nullptr) - : BaseT(TM), ST(TM ? TM->getSubtargetImpl() : nullptr), - TLI(ST ? ST->getTargetLowering() : nullptr) {} + explicit AArch64TTIImpl(const AArch64TargetMachine *TM) + : BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {} // Provide value semantics. MSVC requires that we spell all of these out. AArch64TTIImpl(const AArch64TTIImpl &Arg) diff --git a/lib/Target/ARM/ARMTargetTransformInfo.h b/lib/Target/ARM/ARMTargetTransformInfo.h index 8f7c3b43352..f5cfc907fe6 100644 --- a/lib/Target/ARM/ARMTargetTransformInfo.h +++ b/lib/Target/ARM/ARMTargetTransformInfo.h @@ -37,9 +37,8 @@ class ARMTTIImpl : public BasicTTIImplBase { unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract); public: - explicit ARMTTIImpl(const ARMBaseTargetMachine *TM = nullptr) - : BaseT(TM), ST(TM ? TM->getSubtargetImpl() : nullptr), - TLI(ST ? ST->getTargetLowering() : nullptr) {} + explicit ARMTTIImpl(const ARMBaseTargetMachine *TM) + : BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {} // Provide value semantics. MSVC requires that we spell all of these out. ARMTTIImpl(const ARMTTIImpl &Arg) diff --git a/lib/Target/NVPTX/NVPTXTargetTransformInfo.h b/lib/Target/NVPTX/NVPTXTargetTransformInfo.h index 990de81cb7b..f18b5f01799 100644 --- a/lib/Target/NVPTX/NVPTXTargetTransformInfo.h +++ b/lib/Target/NVPTX/NVPTXTargetTransformInfo.h @@ -32,9 +32,8 @@ class NVPTXTTIImpl : public BasicTTIImplBase { const NVPTXTargetLowering *TLI; public: - explicit NVPTXTTIImpl(const NVPTXTargetMachine *TM = nullptr) - : BaseT(TM), - TLI(TM ? TM->getSubtargetImpl()->getTargetLowering() : nullptr) {} + explicit NVPTXTTIImpl(const NVPTXTargetMachine *TM) + : BaseT(TM), TLI(TM->getSubtargetImpl()->getTargetLowering()) {} // Provide value semantics. MSVC requires that we spell all of these out. NVPTXTTIImpl(const NVPTXTTIImpl &Arg) diff --git a/lib/Target/PowerPC/PPCTargetTransformInfo.h b/lib/Target/PowerPC/PPCTargetTransformInfo.h index 10d587ec376..cc780b6864b 100644 --- a/lib/Target/PowerPC/PPCTargetTransformInfo.h +++ b/lib/Target/PowerPC/PPCTargetTransformInfo.h @@ -33,7 +33,7 @@ class PPCTTIImpl : public BasicTTIImplBase { const PPCTargetLowering *TLI; public: - explicit PPCTTIImpl(const PPCTargetMachine *TM = nullptr) + explicit PPCTTIImpl(const PPCTargetMachine *TM) : BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {} // Provide value semantics. MSVC requires that we spell all of these out. diff --git a/lib/Target/R600/AMDGPUTargetTransformInfo.h b/lib/Target/R600/AMDGPUTargetTransformInfo.h index abf692bec82..c35bfab67a7 100644 --- a/lib/Target/R600/AMDGPUTargetTransformInfo.h +++ b/lib/Target/R600/AMDGPUTargetTransformInfo.h @@ -32,7 +32,7 @@ class AMDGPUTTIImpl : public BasicTTIImplBase { const AMDGPUSubtarget *ST; public: - explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM = nullptr) + explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM) : BaseT(TM), ST(TM->getSubtargetImpl()) {} // Provide value semantics. MSVC requires that we spell all of these out. diff --git a/lib/Target/X86/X86TargetTransformInfo.h b/lib/Target/X86/X86TargetTransformInfo.h index bb45cd7c2cf..c77452b0a56 100644 --- a/lib/Target/X86/X86TargetTransformInfo.h +++ b/lib/Target/X86/X86TargetTransformInfo.h @@ -35,9 +35,8 @@ class X86TTIImpl : public BasicTTIImplBase { unsigned getScalarizationOverhead(Type *Ty, bool Insert, bool Extract); public: - explicit X86TTIImpl(const X86TargetMachine *TM = nullptr) - : BaseT(TM), ST(TM ? TM->getSubtargetImpl() : nullptr), - TLI(ST ? ST->getTargetLowering() : nullptr) {} + explicit X86TTIImpl(const X86TargetMachine *TM) + : BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {} // Provide value semantics. MSVC requires that we spell all of these out. X86TTIImpl(const X86TTIImpl &Arg) diff --git a/lib/Target/XCore/XCoreTargetTransformInfo.h b/lib/Target/XCore/XCoreTargetTransformInfo.h index 5c2f36ff395..adb21cf467e 100644 --- a/lib/Target/XCore/XCoreTargetTransformInfo.h +++ b/lib/Target/XCore/XCoreTargetTransformInfo.h @@ -30,7 +30,7 @@ class XCoreTTIImpl : public BasicTTIImplBase { typedef TargetTransformInfo TTI; public: - explicit XCoreTTIImpl(const XCoreTargetMachine *TM = nullptr) : BaseT(TM) {} + explicit XCoreTTIImpl(const XCoreTargetMachine *TM) : BaseT(TM) {} // Provide value semantics. MSVC requires that we spell all of these out. XCoreTTIImpl(const XCoreTTIImpl &Arg)