[multiversion] Remove a false freedom to leave the TargetMachine pointer
authorChandler Carruth <chandlerc@gmail.com>
Sun, 1 Feb 2015 12:38:24 +0000 (12:38 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 1 Feb 2015 12:38:24 +0000 (12:38 +0000)
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
lib/Target/AArch64/AArch64TargetTransformInfo.h
lib/Target/ARM/ARMTargetTransformInfo.h
lib/Target/NVPTX/NVPTXTargetTransformInfo.h
lib/Target/PowerPC/PPCTargetTransformInfo.h
lib/Target/R600/AMDGPUTargetTransformInfo.h
lib/Target/X86/X86TargetTransformInfo.h
lib/Target/XCore/XCoreTargetTransformInfo.h

index 7fd16e1de5410491b6cad1328a2b9203d2231ddb..616e39f96887772e4b8e70c0735a708be1de1fb4 100644 (file)
@@ -628,7 +628,7 @@ class BasicTTIImpl : public BasicTTIImplBase<BasicTTIImpl> {
   typedef BasicTTIImplBase<BasicTTIImpl> 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)
index 30a2c23fd369ee61b112a0eeae52aba8cbe55f50..5d4b9a39f67aed70a360bc742198674b4797da32 100644 (file)
@@ -44,9 +44,8 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
   };
 
 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)
index 8f7c3b43352afd489dfc2a6affb37424172a61fa..f5cfc907fe63317553044e9e301407f701a90477 100644 (file)
@@ -37,9 +37,8 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
   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)
index 990de81cb7b42c1589600d0ce0b1576010ff6c85..f18b5f01799b0ab5482c5ad5488243b3f1154ca2 100644 (file)
@@ -32,9 +32,8 @@ class NVPTXTTIImpl : public BasicTTIImplBase<NVPTXTTIImpl> {
   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)
index 10d587ec376a0cdccd9d054ef9a9d3f9450c578c..cc780b6864b35fb06f0642ed88b6b69fb88080b4 100644 (file)
@@ -33,7 +33,7 @@ class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
   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.
index abf692bec823b573d85594e39a56c648ee509646..c35bfab67a7e6d00c6e4f1b41170d91e98f36ef9 100644 (file)
@@ -32,7 +32,7 @@ class AMDGPUTTIImpl : public BasicTTIImplBase<AMDGPUTTIImpl> {
   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.
index bb45cd7c2cfb641308f6b720bf27df165a6aa3d3..c77452b0a56fec3821e1a730cf551ddc788ae7dd 100644 (file)
@@ -35,9 +35,8 @@ class X86TTIImpl : public BasicTTIImplBase<X86TTIImpl> {
   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)
index 5c2f36ff395e9e364b6fbb41aeead5a71755f5dc..adb21cf467e80036d8c32114093b099585c0b647 100644 (file)
@@ -30,7 +30,7 @@ class XCoreTTIImpl : public BasicTTIImplBase<XCoreTTIImpl> {
   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)