mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
Make TargetTransformInfo keeping a reference to the Module DataLayout
DataLayout is no longer optional. It was initialized with or without a DataLayout, and the DataLayout when supplied could have been the one from the TargetMachine. Summary: This change is part of a series of commits dedicated to have a single DataLayout during compilation by using always the one owned by the module. Reviewers: echristo Subscribers: jholewinski, llvm-commits, rafael, yaron.keren Differential Revision: http://reviews.llvm.org/D11021 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241774 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
103bdfccee
commit
966e6ca1ac
@ -69,7 +69,7 @@ public:
|
|||||||
///
|
///
|
||||||
/// The TTI implementation will reflect the information in the DataLayout
|
/// The TTI implementation will reflect the information in the DataLayout
|
||||||
/// provided if non-null.
|
/// provided if non-null.
|
||||||
explicit TargetTransformInfo(const DataLayout *DL);
|
explicit TargetTransformInfo(const DataLayout &DL);
|
||||||
|
|
||||||
// Provide move semantics.
|
// Provide move semantics.
|
||||||
TargetTransformInfo(TargetTransformInfo &&Arg);
|
TargetTransformInfo(TargetTransformInfo &&Arg);
|
||||||
@ -541,7 +541,7 @@ private:
|
|||||||
class TargetTransformInfo::Concept {
|
class TargetTransformInfo::Concept {
|
||||||
public:
|
public:
|
||||||
virtual ~Concept() = 0;
|
virtual ~Concept() = 0;
|
||||||
|
virtual const DataLayout &getDataLayout() const = 0;
|
||||||
virtual unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) = 0;
|
virtual unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) = 0;
|
||||||
virtual unsigned getGEPCost(const Value *Ptr,
|
virtual unsigned getGEPCost(const Value *Ptr,
|
||||||
ArrayRef<const Value *> Operands) = 0;
|
ArrayRef<const Value *> Operands) = 0;
|
||||||
@ -636,6 +636,10 @@ public:
|
|||||||
Model(T Impl) : Impl(std::move(Impl)) {}
|
Model(T Impl) : Impl(std::move(Impl)) {}
|
||||||
~Model() override {}
|
~Model() override {}
|
||||||
|
|
||||||
|
const DataLayout &getDataLayout() const override {
|
||||||
|
return Impl.getDataLayout();
|
||||||
|
}
|
||||||
|
|
||||||
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) override {
|
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) override {
|
||||||
return Impl.getOperationCost(Opcode, Ty, OpTy);
|
return Impl.getOperationCost(Opcode, Ty, OpTy);
|
||||||
}
|
}
|
||||||
|
@ -30,26 +30,17 @@ class TargetTransformInfoImplBase {
|
|||||||
protected:
|
protected:
|
||||||
typedef TargetTransformInfo TTI;
|
typedef TargetTransformInfo TTI;
|
||||||
|
|
||||||
const DataLayout *DL;
|
const DataLayout &DL;
|
||||||
|
|
||||||
explicit TargetTransformInfoImplBase(const DataLayout *DL)
|
explicit TargetTransformInfoImplBase(const DataLayout &DL) : DL(DL) {}
|
||||||
: DL(DL) {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
TargetTransformInfoImplBase(const TargetTransformInfoImplBase &Arg)
|
TargetTransformInfoImplBase(const TargetTransformInfoImplBase &Arg)
|
||||||
: DL(Arg.DL) {}
|
: DL(Arg.DL) {}
|
||||||
TargetTransformInfoImplBase(TargetTransformInfoImplBase &&Arg)
|
TargetTransformInfoImplBase(TargetTransformInfoImplBase &&Arg) : DL(Arg.DL) {}
|
||||||
: DL(std::move(Arg.DL)) {}
|
|
||||||
TargetTransformInfoImplBase &
|
const DataLayout &getDataLayout() const { return DL; }
|
||||||
operator=(const TargetTransformInfoImplBase &RHS) {
|
|
||||||
DL = RHS.DL;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TargetTransformInfoImplBase &operator=(TargetTransformInfoImplBase &&RHS) {
|
|
||||||
DL = std::move(RHS.DL);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
|
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
|
||||||
switch (Opcode) {
|
switch (Opcode) {
|
||||||
@ -70,28 +61,22 @@ public:
|
|||||||
return TTI::TCC_Basic;
|
return TTI::TCC_Basic;
|
||||||
|
|
||||||
case Instruction::IntToPtr: {
|
case Instruction::IntToPtr: {
|
||||||
if (!DL)
|
|
||||||
return TTI::TCC_Basic;
|
|
||||||
|
|
||||||
// An inttoptr cast is free so long as the input is a legal integer type
|
// An inttoptr cast is free so long as the input is a legal integer type
|
||||||
// which doesn't contain values outside the range of a pointer.
|
// which doesn't contain values outside the range of a pointer.
|
||||||
unsigned OpSize = OpTy->getScalarSizeInBits();
|
unsigned OpSize = OpTy->getScalarSizeInBits();
|
||||||
if (DL->isLegalInteger(OpSize) &&
|
if (DL.isLegalInteger(OpSize) &&
|
||||||
OpSize <= DL->getPointerTypeSizeInBits(Ty))
|
OpSize <= DL.getPointerTypeSizeInBits(Ty))
|
||||||
return TTI::TCC_Free;
|
return TTI::TCC_Free;
|
||||||
|
|
||||||
// Otherwise it's not a no-op.
|
// Otherwise it's not a no-op.
|
||||||
return TTI::TCC_Basic;
|
return TTI::TCC_Basic;
|
||||||
}
|
}
|
||||||
case Instruction::PtrToInt: {
|
case Instruction::PtrToInt: {
|
||||||
if (!DL)
|
|
||||||
return TTI::TCC_Basic;
|
|
||||||
|
|
||||||
// A ptrtoint cast is free so long as the result is large enough to store
|
// A ptrtoint cast is free so long as the result is large enough to store
|
||||||
// the pointer, and a legal integer type.
|
// the pointer, and a legal integer type.
|
||||||
unsigned DestSize = Ty->getScalarSizeInBits();
|
unsigned DestSize = Ty->getScalarSizeInBits();
|
||||||
if (DL->isLegalInteger(DestSize) &&
|
if (DL.isLegalInteger(DestSize) &&
|
||||||
DestSize >= DL->getPointerTypeSizeInBits(OpTy))
|
DestSize >= DL.getPointerTypeSizeInBits(OpTy))
|
||||||
return TTI::TCC_Free;
|
return TTI::TCC_Free;
|
||||||
|
|
||||||
// Otherwise it's not a no-op.
|
// Otherwise it's not a no-op.
|
||||||
@ -100,7 +85,7 @@ public:
|
|||||||
case Instruction::Trunc:
|
case Instruction::Trunc:
|
||||||
// trunc to a native type is free (assuming the target has compare and
|
// trunc to a native type is free (assuming the target has compare and
|
||||||
// shift-right of the same width).
|
// shift-right of the same width).
|
||||||
if (DL && DL->isLegalInteger(DL->getTypeSizeInBits(Ty)))
|
if (DL.isLegalInteger(DL.getTypeSizeInBits(Ty)))
|
||||||
return TTI::TCC_Free;
|
return TTI::TCC_Free;
|
||||||
|
|
||||||
return TTI::TCC_Basic;
|
return TTI::TCC_Basic;
|
||||||
@ -353,8 +338,7 @@ private:
|
|||||||
typedef TargetTransformInfoImplBase BaseT;
|
typedef TargetTransformInfoImplBase BaseT;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit TargetTransformInfoImplCRTPBase(const DataLayout *DL)
|
explicit TargetTransformInfoImplCRTPBase(const DataLayout &DL) : BaseT(DL) {}
|
||||||
: BaseT(DL) {}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
@ -362,16 +346,6 @@ public:
|
|||||||
: BaseT(static_cast<const BaseT &>(Arg)) {}
|
: BaseT(static_cast<const BaseT &>(Arg)) {}
|
||||||
TargetTransformInfoImplCRTPBase(TargetTransformInfoImplCRTPBase &&Arg)
|
TargetTransformInfoImplCRTPBase(TargetTransformInfoImplCRTPBase &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))) {}
|
: BaseT(std::move(static_cast<BaseT &>(Arg))) {}
|
||||||
TargetTransformInfoImplCRTPBase &
|
|
||||||
operator=(const TargetTransformInfoImplCRTPBase &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
TargetTransformInfoImplCRTPBase &
|
|
||||||
operator=(TargetTransformInfoImplCRTPBase &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
using BaseT::getCallCost;
|
using BaseT::getCallCost;
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit BasicTTIImplBase(const TargetMachine *TM)
|
explicit BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
|
||||||
: BaseT(TM->getDataLayout()) {}
|
: BaseT(DL) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
@ -100,14 +100,6 @@ public:
|
|||||||
: BaseT(static_cast<const BaseT &>(Arg)) {}
|
: BaseT(static_cast<const BaseT &>(Arg)) {}
|
||||||
BasicTTIImplBase(BasicTTIImplBase &&Arg)
|
BasicTTIImplBase(BasicTTIImplBase &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))) {}
|
: BaseT(std::move(static_cast<BaseT &>(Arg))) {}
|
||||||
BasicTTIImplBase &operator=(const BasicTTIImplBase &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
BasicTTIImplBase &operator=(BasicTTIImplBase &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \name Scalar TTI Implementations
|
/// \name Scalar TTI Implementations
|
||||||
/// @{
|
/// @{
|
||||||
@ -816,18 +808,6 @@ public:
|
|||||||
BasicTTIImpl(BasicTTIImpl &&Arg)
|
BasicTTIImpl(BasicTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
BasicTTIImpl &operator=(const BasicTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
BasicTTIImpl &operator=(BasicTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ namespace {
|
|||||||
///
|
///
|
||||||
/// This is used when no target specific information is available.
|
/// This is used when no target specific information is available.
|
||||||
struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
|
struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
|
||||||
explicit NoTTIImpl(const DataLayout *DL)
|
explicit NoTTIImpl(const DataLayout &DL)
|
||||||
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
|
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetTransformInfo::TargetTransformInfo(const DataLayout *DL)
|
TargetTransformInfo::TargetTransformInfo(const DataLayout &DL)
|
||||||
: TTIImpl(new Model<NoTTIImpl>(NoTTIImpl(DL))) {}
|
: TTIImpl(new Model<NoTTIImpl>(NoTTIImpl(DL))) {}
|
||||||
|
|
||||||
TargetTransformInfo::~TargetTransformInfo() {}
|
TargetTransformInfo::~TargetTransformInfo() {}
|
||||||
@ -304,7 +304,7 @@ TargetIRAnalysis::Result TargetIRAnalysis::run(Function &F) {
|
|||||||
char TargetIRAnalysis::PassID;
|
char TargetIRAnalysis::PassID;
|
||||||
|
|
||||||
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(Function &F) {
|
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(Function &F) {
|
||||||
return Result(&F.getParent()->getDataLayout());
|
return Result(F.getParent()->getDataLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register the basic pass.
|
// Register the basic pass.
|
||||||
|
@ -34,4 +34,5 @@ cl::opt<unsigned>
|
|||||||
cl::Hidden);
|
cl::Hidden);
|
||||||
|
|
||||||
BasicTTIImpl::BasicTTIImpl(const TargetMachine *TM, Function &F)
|
BasicTTIImpl::BasicTTIImpl(const TargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
@ -31,7 +31,6 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
|
|||||||
typedef TargetTransformInfo TTI;
|
typedef TargetTransformInfo TTI;
|
||||||
friend BaseT;
|
friend BaseT;
|
||||||
|
|
||||||
const AArch64TargetMachine *TM;
|
|
||||||
const AArch64Subtarget *ST;
|
const AArch64Subtarget *ST;
|
||||||
const AArch64TargetLowering *TLI;
|
const AArch64TargetLowering *TLI;
|
||||||
|
|
||||||
@ -50,30 +49,15 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AArch64TTIImpl(const AArch64TargetMachine *TM, Function &F)
|
explicit AArch64TTIImpl(const AArch64TargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), TM(TM), ST(TM->getSubtargetImpl(F)),
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
||||||
TLI(ST->getTargetLowering()) {}
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
AArch64TTIImpl(const AArch64TTIImpl &Arg)
|
AArch64TTIImpl(const AArch64TTIImpl &Arg)
|
||||||
: BaseT(static_cast<const BaseT &>(Arg)), TM(Arg.TM), ST(Arg.ST),
|
: BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {}
|
||||||
TLI(Arg.TLI) {}
|
|
||||||
AArch64TTIImpl(AArch64TTIImpl &&Arg)
|
AArch64TTIImpl(AArch64TTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), TM(std::move(Arg.TM)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
ST(std::move(Arg.ST)), TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
AArch64TTIImpl &operator=(const AArch64TTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
TM = RHS.TM;
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
AArch64TTIImpl &operator=(AArch64TTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
TM = std::move(RHS.TM);
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \name Scalar TTI Implementations
|
/// \name Scalar TTI Implementations
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -156,8 +156,10 @@ public:
|
|||||||
} // End of anonymous namespace
|
} // End of anonymous namespace
|
||||||
|
|
||||||
TargetIRAnalysis AMDGPUTargetMachine::getTargetIRAnalysis() {
|
TargetIRAnalysis AMDGPUTargetMachine::getTargetIRAnalysis() {
|
||||||
return TargetIRAnalysis(
|
return TargetIRAnalysis([this](Function &F) {
|
||||||
[this](Function &F) { return TargetTransformInfo(AMDGPUTTIImpl(this)); });
|
return TargetTransformInfo(
|
||||||
|
AMDGPUTTIImpl(this, F.getParent()->getDataLayout()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AMDGPUPassConfig::addIRPasses() {
|
void AMDGPUPassConfig::addIRPasses() {
|
||||||
|
@ -37,8 +37,9 @@ class AMDGPUTTIImpl : public BasicTTIImplBase<AMDGPUTTIImpl> {
|
|||||||
const AMDGPUTargetLowering *getTLI() const { return TLI; }
|
const AMDGPUTargetLowering *getTLI() const { return TLI; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM)
|
explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM, const DataLayout &DL)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, DL), ST(TM->getSubtargetImpl()),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
AMDGPUTTIImpl(const AMDGPUTTIImpl &Arg)
|
AMDGPUTTIImpl(const AMDGPUTTIImpl &Arg)
|
||||||
@ -46,18 +47,6 @@ public:
|
|||||||
AMDGPUTTIImpl(AMDGPUTTIImpl &&Arg)
|
AMDGPUTTIImpl(AMDGPUTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
AMDGPUTTIImpl &operator=(const AMDGPUTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
AMDGPUTTIImpl &operator=(AMDGPUTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasBranchDivergence() { return true; }
|
bool hasBranchDivergence() { return true; }
|
||||||
|
|
||||||
|
@ -488,12 +488,12 @@ unsigned ARMTTIImpl::getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
|
|||||||
assert(isa<VectorType>(VecTy) && "Expect a vector type");
|
assert(isa<VectorType>(VecTy) && "Expect a vector type");
|
||||||
|
|
||||||
// vldN/vstN doesn't support vector types of i64/f64 element.
|
// vldN/vstN doesn't support vector types of i64/f64 element.
|
||||||
bool EltIs64Bits = DL->getTypeAllocSizeInBits(VecTy->getScalarType()) == 64;
|
bool EltIs64Bits = DL.getTypeAllocSizeInBits(VecTy->getScalarType()) == 64;
|
||||||
|
|
||||||
if (Factor <= TLI->getMaxSupportedInterleaveFactor() && !EltIs64Bits) {
|
if (Factor <= TLI->getMaxSupportedInterleaveFactor() && !EltIs64Bits) {
|
||||||
unsigned NumElts = VecTy->getVectorNumElements();
|
unsigned NumElts = VecTy->getVectorNumElements();
|
||||||
Type *SubVecTy = VectorType::get(VecTy->getScalarType(), NumElts / Factor);
|
Type *SubVecTy = VectorType::get(VecTy->getScalarType(), NumElts / Factor);
|
||||||
unsigned SubVecSize = TLI->getDataLayout()->getTypeAllocSize(SubVecTy);
|
unsigned SubVecSize = DL.getTypeAllocSize(SubVecTy);
|
||||||
|
|
||||||
// vldN/vstN only support legal vector types of size 64 or 128 in bits.
|
// vldN/vstN only support legal vector types of size 64 or 128 in bits.
|
||||||
if (NumElts % Factor == 0 && (SubVecSize == 64 || SubVecSize == 128))
|
if (NumElts % Factor == 0 && (SubVecSize == 64 || SubVecSize == 128))
|
||||||
|
@ -42,7 +42,8 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ARMTTIImpl(const ARMBaseTargetMachine *TM, Function &F)
|
explicit ARMTTIImpl(const ARMBaseTargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
ARMTTIImpl(const ARMTTIImpl &Arg)
|
ARMTTIImpl(const ARMTTIImpl &Arg)
|
||||||
@ -50,18 +51,6 @@ public:
|
|||||||
ARMTTIImpl(ARMTTIImpl &&Arg)
|
ARMTTIImpl(ARMTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
ARMTTIImpl &operator=(const ARMTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
ARMTTIImpl &operator=(ARMTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \name Scalar TTI Implementations
|
/// \name Scalar TTI Implementations
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -237,7 +237,7 @@ TargetIRAnalysis MipsTargetMachine::getTargetIRAnalysis() {
|
|||||||
if (Subtarget->allowMixed16_32()) {
|
if (Subtarget->allowMixed16_32()) {
|
||||||
DEBUG(errs() << "No Target Transform Info Pass Added\n");
|
DEBUG(errs() << "No Target Transform Info Pass Added\n");
|
||||||
// FIXME: This is no longer necessary as the TTI returned is per-function.
|
// FIXME: This is no longer necessary as the TTI returned is per-function.
|
||||||
return TargetTransformInfo(getDataLayout());
|
return TargetTransformInfo(F.getParent()->getDataLayout());
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(errs() << "Target Transform Info Pass Added\n");
|
DEBUG(errs() << "Target Transform Info Pass Added\n");
|
||||||
|
@ -148,8 +148,9 @@ TargetPassConfig *NVPTXTargetMachine::createPassConfig(PassManagerBase &PM) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetIRAnalysis NVPTXTargetMachine::getTargetIRAnalysis() {
|
TargetIRAnalysis NVPTXTargetMachine::getTargetIRAnalysis() {
|
||||||
return TargetIRAnalysis(
|
return TargetIRAnalysis([this](Function &F) {
|
||||||
[this](Function &) { return TargetTransformInfo(NVPTXTTIImpl(this)); });
|
return TargetTransformInfo(NVPTXTTIImpl(this, F));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NVPTXPassConfig::addIRPasses() {
|
void NVPTXPassConfig::addIRPasses() {
|
||||||
|
@ -37,8 +37,9 @@ class NVPTXTTIImpl : public BasicTTIImplBase<NVPTXTTIImpl> {
|
|||||||
const NVPTXTargetLowering *getTLI() const { return TLI; };
|
const NVPTXTargetLowering *getTLI() const { return TLI; };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit NVPTXTTIImpl(const NVPTXTargetMachine *TM)
|
explicit NVPTXTTIImpl(const NVPTXTargetMachine *TM, const Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl()),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
NVPTXTTIImpl(const NVPTXTTIImpl &Arg)
|
NVPTXTTIImpl(const NVPTXTTIImpl &Arg)
|
||||||
@ -46,18 +47,6 @@ public:
|
|||||||
NVPTXTTIImpl(NVPTXTTIImpl &&Arg)
|
NVPTXTTIImpl(NVPTXTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
NVPTXTTIImpl &operator=(const NVPTXTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
NVPTXTTIImpl &operator=(NVPTXTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasBranchDivergence() { return true; }
|
bool hasBranchDivergence() { return true; }
|
||||||
|
|
||||||
|
@ -38,7 +38,8 @@ class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PPCTTIImpl(const PPCTargetMachine *TM, Function &F)
|
explicit PPCTTIImpl(const PPCTargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
PPCTTIImpl(const PPCTTIImpl &Arg)
|
PPCTTIImpl(const PPCTTIImpl &Arg)
|
||||||
@ -46,18 +47,6 @@ public:
|
|||||||
PPCTTIImpl(PPCTTIImpl &&Arg)
|
PPCTTIImpl(PPCTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
PPCTTIImpl &operator=(const PPCTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
PPCTTIImpl &operator=(PPCTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \name Scalar TTI Implementations
|
/// \name Scalar TTI Implementations
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -29,7 +29,8 @@ class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SystemZTTIImpl(const SystemZTargetMachine *TM, Function &F)
|
explicit SystemZTTIImpl(const SystemZTargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
SystemZTTIImpl(const SystemZTTIImpl &Arg)
|
SystemZTTIImpl(const SystemZTTIImpl &Arg)
|
||||||
@ -37,18 +38,6 @@ public:
|
|||||||
SystemZTTIImpl(SystemZTTIImpl &&Arg)
|
SystemZTTIImpl(SystemZTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
SystemZTTIImpl &operator=(const SystemZTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
SystemZTTIImpl &operator=(SystemZTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \name Scalar TTI Implementations
|
/// \name Scalar TTI Implementations
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -150,8 +150,9 @@ void TargetMachine::setOptLevel(CodeGenOpt::Level Level) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
|
TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
|
||||||
return TargetIRAnalysis(
|
return TargetIRAnalysis([this](Function &F) {
|
||||||
[this](Function &) { return TargetTransformInfo(getDataLayout()); });
|
return TargetTransformInfo(F.getParent()->getDataLayout());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
|
static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
|
||||||
|
@ -40,7 +40,8 @@ class X86TTIImpl : public BasicTTIImplBase<X86TTIImpl> {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit X86TTIImpl(const X86TargetMachine *TM, Function &F)
|
explicit X86TTIImpl(const X86TargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl(F)), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl(F)),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
X86TTIImpl(const X86TTIImpl &Arg)
|
X86TTIImpl(const X86TTIImpl &Arg)
|
||||||
@ -48,18 +49,6 @@ public:
|
|||||||
X86TTIImpl(X86TTIImpl &&Arg)
|
X86TTIImpl(X86TTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
X86TTIImpl &operator=(const X86TTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
X86TTIImpl &operator=(X86TTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \name Scalar TTI Implementations
|
/// \name Scalar TTI Implementations
|
||||||
/// @{
|
/// @{
|
||||||
|
@ -85,6 +85,7 @@ extern "C" void LLVMInitializeXCoreTarget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetIRAnalysis XCoreTargetMachine::getTargetIRAnalysis() {
|
TargetIRAnalysis XCoreTargetMachine::getTargetIRAnalysis() {
|
||||||
return TargetIRAnalysis(
|
return TargetIRAnalysis([this](Function &F) {
|
||||||
[this](Function &) { return TargetTransformInfo(XCoreTTIImpl(this)); });
|
return TargetTransformInfo(XCoreTTIImpl(this, F));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,9 @@ class XCoreTTIImpl : public BasicTTIImplBase<XCoreTTIImpl> {
|
|||||||
const XCoreTargetLowering *getTLI() const { return TLI; }
|
const XCoreTargetLowering *getTLI() const { return TLI; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit XCoreTTIImpl(const XCoreTargetMachine *TM)
|
explicit XCoreTTIImpl(const XCoreTargetMachine *TM, Function &F)
|
||||||
: BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {}
|
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl()),
|
||||||
|
TLI(ST->getTargetLowering()) {}
|
||||||
|
|
||||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||||
XCoreTTIImpl(const XCoreTTIImpl &Arg)
|
XCoreTTIImpl(const XCoreTTIImpl &Arg)
|
||||||
@ -46,18 +47,6 @@ public:
|
|||||||
XCoreTTIImpl(XCoreTTIImpl &&Arg)
|
XCoreTTIImpl(XCoreTTIImpl &&Arg)
|
||||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||||
TLI(std::move(Arg.TLI)) {}
|
TLI(std::move(Arg.TLI)) {}
|
||||||
XCoreTTIImpl &operator=(const XCoreTTIImpl &RHS) {
|
|
||||||
BaseT::operator=(static_cast<const BaseT &>(RHS));
|
|
||||||
ST = RHS.ST;
|
|
||||||
TLI = RHS.TLI;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
XCoreTTIImpl &operator=(XCoreTTIImpl &&RHS) {
|
|
||||||
BaseT::operator=(std::move(static_cast<BaseT &>(RHS)));
|
|
||||||
ST = std::move(RHS.ST);
|
|
||||||
TLI = std::move(RHS.TLI);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned getNumberOfRegisters(bool Vector) {
|
unsigned getNumberOfRegisters(bool Vector) {
|
||||||
if (Vector) {
|
if (Vector) {
|
||||||
|
Loading…
Reference in New Issue
Block a user