mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-12 13:30:51 +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
|
||||
/// provided if non-null.
|
||||
explicit TargetTransformInfo(const DataLayout *DL);
|
||||
explicit TargetTransformInfo(const DataLayout &DL);
|
||||
|
||||
// Provide move semantics.
|
||||
TargetTransformInfo(TargetTransformInfo &&Arg);
|
||||
@ -541,7 +541,7 @@ private:
|
||||
class TargetTransformInfo::Concept {
|
||||
public:
|
||||
virtual ~Concept() = 0;
|
||||
|
||||
virtual const DataLayout &getDataLayout() const = 0;
|
||||
virtual unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) = 0;
|
||||
virtual unsigned getGEPCost(const Value *Ptr,
|
||||
ArrayRef<const Value *> Operands) = 0;
|
||||
@ -636,6 +636,10 @@ public:
|
||||
Model(T Impl) : Impl(std::move(Impl)) {}
|
||||
~Model() override {}
|
||||
|
||||
const DataLayout &getDataLayout() const override {
|
||||
return Impl.getDataLayout();
|
||||
}
|
||||
|
||||
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) override {
|
||||
return Impl.getOperationCost(Opcode, Ty, OpTy);
|
||||
}
|
||||
|
@ -30,26 +30,17 @@ class TargetTransformInfoImplBase {
|
||||
protected:
|
||||
typedef TargetTransformInfo TTI;
|
||||
|
||||
const DataLayout *DL;
|
||||
const DataLayout &DL;
|
||||
|
||||
explicit TargetTransformInfoImplBase(const DataLayout *DL)
|
||||
: DL(DL) {}
|
||||
explicit TargetTransformInfoImplBase(const DataLayout &DL) : DL(DL) {}
|
||||
|
||||
public:
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
TargetTransformInfoImplBase(const TargetTransformInfoImplBase &Arg)
|
||||
: DL(Arg.DL) {}
|
||||
TargetTransformInfoImplBase(TargetTransformInfoImplBase &&Arg)
|
||||
: DL(std::move(Arg.DL)) {}
|
||||
TargetTransformInfoImplBase &
|
||||
operator=(const TargetTransformInfoImplBase &RHS) {
|
||||
DL = RHS.DL;
|
||||
return *this;
|
||||
}
|
||||
TargetTransformInfoImplBase &operator=(TargetTransformInfoImplBase &&RHS) {
|
||||
DL = std::move(RHS.DL);
|
||||
return *this;
|
||||
}
|
||||
TargetTransformInfoImplBase(TargetTransformInfoImplBase &&Arg) : DL(Arg.DL) {}
|
||||
|
||||
const DataLayout &getDataLayout() const { return DL; }
|
||||
|
||||
unsigned getOperationCost(unsigned Opcode, Type *Ty, Type *OpTy) {
|
||||
switch (Opcode) {
|
||||
@ -70,28 +61,22 @@ public:
|
||||
return TTI::TCC_Basic;
|
||||
|
||||
case Instruction::IntToPtr: {
|
||||
if (!DL)
|
||||
return TTI::TCC_Basic;
|
||||
|
||||
// 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.
|
||||
unsigned OpSize = OpTy->getScalarSizeInBits();
|
||||
if (DL->isLegalInteger(OpSize) &&
|
||||
OpSize <= DL->getPointerTypeSizeInBits(Ty))
|
||||
if (DL.isLegalInteger(OpSize) &&
|
||||
OpSize <= DL.getPointerTypeSizeInBits(Ty))
|
||||
return TTI::TCC_Free;
|
||||
|
||||
// Otherwise it's not a no-op.
|
||||
return TTI::TCC_Basic;
|
||||
}
|
||||
case Instruction::PtrToInt: {
|
||||
if (!DL)
|
||||
return TTI::TCC_Basic;
|
||||
|
||||
// A ptrtoint cast is free so long as the result is large enough to store
|
||||
// the pointer, and a legal integer type.
|
||||
unsigned DestSize = Ty->getScalarSizeInBits();
|
||||
if (DL->isLegalInteger(DestSize) &&
|
||||
DestSize >= DL->getPointerTypeSizeInBits(OpTy))
|
||||
if (DL.isLegalInteger(DestSize) &&
|
||||
DestSize >= DL.getPointerTypeSizeInBits(OpTy))
|
||||
return TTI::TCC_Free;
|
||||
|
||||
// Otherwise it's not a no-op.
|
||||
@ -100,7 +85,7 @@ public:
|
||||
case Instruction::Trunc:
|
||||
// trunc to a native type is free (assuming the target has compare and
|
||||
// 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_Basic;
|
||||
@ -353,8 +338,7 @@ private:
|
||||
typedef TargetTransformInfoImplBase BaseT;
|
||||
|
||||
protected:
|
||||
explicit TargetTransformInfoImplCRTPBase(const DataLayout *DL)
|
||||
: BaseT(DL) {}
|
||||
explicit TargetTransformInfoImplCRTPBase(const DataLayout &DL) : BaseT(DL) {}
|
||||
|
||||
public:
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
@ -362,16 +346,6 @@ public:
|
||||
: BaseT(static_cast<const BaseT &>(Arg)) {}
|
||||
TargetTransformInfoImplCRTPBase(TargetTransformInfoImplCRTPBase &&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;
|
||||
|
||||
|
@ -91,8 +91,8 @@ private:
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit BasicTTIImplBase(const TargetMachine *TM)
|
||||
: BaseT(TM->getDataLayout()) {}
|
||||
explicit BasicTTIImplBase(const TargetMachine *TM, const DataLayout &DL)
|
||||
: BaseT(DL) {}
|
||||
|
||||
public:
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
@ -100,14 +100,6 @@ public:
|
||||
: BaseT(static_cast<const BaseT &>(Arg)) {}
|
||||
BasicTTIImplBase(BasicTTIImplBase &&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
|
||||
/// @{
|
||||
@ -816,18 +808,6 @@ public:
|
||||
BasicTTIImpl(BasicTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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.
|
||||
struct NoTTIImpl : TargetTransformInfoImplCRTPBase<NoTTIImpl> {
|
||||
explicit NoTTIImpl(const DataLayout *DL)
|
||||
explicit NoTTIImpl(const DataLayout &DL)
|
||||
: TargetTransformInfoImplCRTPBase<NoTTIImpl>(DL) {}
|
||||
};
|
||||
}
|
||||
|
||||
TargetTransformInfo::TargetTransformInfo(const DataLayout *DL)
|
||||
TargetTransformInfo::TargetTransformInfo(const DataLayout &DL)
|
||||
: TTIImpl(new Model<NoTTIImpl>(NoTTIImpl(DL))) {}
|
||||
|
||||
TargetTransformInfo::~TargetTransformInfo() {}
|
||||
@ -304,7 +304,7 @@ TargetIRAnalysis::Result TargetIRAnalysis::run(Function &F) {
|
||||
char TargetIRAnalysis::PassID;
|
||||
|
||||
TargetIRAnalysis::Result TargetIRAnalysis::getDefaultTTI(Function &F) {
|
||||
return Result(&F.getParent()->getDataLayout());
|
||||
return Result(F.getParent()->getDataLayout());
|
||||
}
|
||||
|
||||
// Register the basic pass.
|
||||
|
@ -34,4 +34,5 @@ cl::opt<unsigned>
|
||||
cl::Hidden);
|
||||
|
||||
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;
|
||||
friend BaseT;
|
||||
|
||||
const AArch64TargetMachine *TM;
|
||||
const AArch64Subtarget *ST;
|
||||
const AArch64TargetLowering *TLI;
|
||||
|
||||
@ -50,30 +49,15 @@ class AArch64TTIImpl : public BasicTTIImplBase<AArch64TTIImpl> {
|
||||
|
||||
public:
|
||||
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()) {}
|
||||
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
AArch64TTIImpl(const AArch64TTIImpl &Arg)
|
||||
: BaseT(static_cast<const BaseT &>(Arg)), TM(Arg.TM), ST(Arg.ST),
|
||||
TLI(Arg.TLI) {}
|
||||
: BaseT(static_cast<const BaseT &>(Arg)), ST(Arg.ST), TLI(Arg.TLI) {}
|
||||
AArch64TTIImpl(AArch64TTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), TM(std::move(Arg.TM)),
|
||||
ST(std::move(Arg.ST)), 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;
|
||||
}
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
TLI(std::move(Arg.TLI)) {}
|
||||
|
||||
/// \name Scalar TTI Implementations
|
||||
/// @{
|
||||
|
@ -156,8 +156,10 @@ public:
|
||||
} // End of anonymous namespace
|
||||
|
||||
TargetIRAnalysis AMDGPUTargetMachine::getTargetIRAnalysis() {
|
||||
return TargetIRAnalysis(
|
||||
[this](Function &F) { return TargetTransformInfo(AMDGPUTTIImpl(this)); });
|
||||
return TargetIRAnalysis([this](Function &F) {
|
||||
return TargetTransformInfo(
|
||||
AMDGPUTTIImpl(this, F.getParent()->getDataLayout()));
|
||||
});
|
||||
}
|
||||
|
||||
void AMDGPUPassConfig::addIRPasses() {
|
||||
|
@ -37,8 +37,9 @@ class AMDGPUTTIImpl : public BasicTTIImplBase<AMDGPUTTIImpl> {
|
||||
const AMDGPUTargetLowering *getTLI() const { return TLI; }
|
||||
|
||||
public:
|
||||
explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM)
|
||||
: BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {}
|
||||
explicit AMDGPUTTIImpl(const AMDGPUTargetMachine *TM, const DataLayout &DL)
|
||||
: BaseT(TM, DL), ST(TM->getSubtargetImpl()),
|
||||
TLI(ST->getTargetLowering()) {}
|
||||
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
AMDGPUTTIImpl(const AMDGPUTTIImpl &Arg)
|
||||
@ -46,18 +47,6 @@ public:
|
||||
AMDGPUTTIImpl(AMDGPUTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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; }
|
||||
|
||||
|
@ -488,12 +488,12 @@ unsigned ARMTTIImpl::getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy,
|
||||
assert(isa<VectorType>(VecTy) && "Expect a vector type");
|
||||
|
||||
// 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) {
|
||||
unsigned NumElts = VecTy->getVectorNumElements();
|
||||
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.
|
||||
if (NumElts % Factor == 0 && (SubVecSize == 64 || SubVecSize == 128))
|
||||
|
@ -42,7 +42,8 @@ class ARMTTIImpl : public BasicTTIImplBase<ARMTTIImpl> {
|
||||
|
||||
public:
|
||||
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.
|
||||
ARMTTIImpl(const ARMTTIImpl &Arg)
|
||||
@ -50,18 +51,6 @@ public:
|
||||
ARMTTIImpl(ARMTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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
|
||||
/// @{
|
||||
|
@ -237,7 +237,7 @@ TargetIRAnalysis MipsTargetMachine::getTargetIRAnalysis() {
|
||||
if (Subtarget->allowMixed16_32()) {
|
||||
DEBUG(errs() << "No Target Transform Info Pass Added\n");
|
||||
// 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");
|
||||
|
@ -148,8 +148,9 @@ TargetPassConfig *NVPTXTargetMachine::createPassConfig(PassManagerBase &PM) {
|
||||
}
|
||||
|
||||
TargetIRAnalysis NVPTXTargetMachine::getTargetIRAnalysis() {
|
||||
return TargetIRAnalysis(
|
||||
[this](Function &) { return TargetTransformInfo(NVPTXTTIImpl(this)); });
|
||||
return TargetIRAnalysis([this](Function &F) {
|
||||
return TargetTransformInfo(NVPTXTTIImpl(this, F));
|
||||
});
|
||||
}
|
||||
|
||||
void NVPTXPassConfig::addIRPasses() {
|
||||
|
@ -37,8 +37,9 @@ class NVPTXTTIImpl : public BasicTTIImplBase<NVPTXTTIImpl> {
|
||||
const NVPTXTargetLowering *getTLI() const { return TLI; };
|
||||
|
||||
public:
|
||||
explicit NVPTXTTIImpl(const NVPTXTargetMachine *TM)
|
||||
: BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {}
|
||||
explicit NVPTXTTIImpl(const NVPTXTargetMachine *TM, const Function &F)
|
||||
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl()),
|
||||
TLI(ST->getTargetLowering()) {}
|
||||
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
NVPTXTTIImpl(const NVPTXTTIImpl &Arg)
|
||||
@ -46,18 +47,6 @@ public:
|
||||
NVPTXTTIImpl(NVPTXTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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; }
|
||||
|
||||
|
@ -38,7 +38,8 @@ class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
|
||||
|
||||
public:
|
||||
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.
|
||||
PPCTTIImpl(const PPCTTIImpl &Arg)
|
||||
@ -46,18 +47,6 @@ public:
|
||||
PPCTTIImpl(PPCTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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
|
||||
/// @{
|
||||
|
@ -29,7 +29,8 @@ class SystemZTTIImpl : public BasicTTIImplBase<SystemZTTIImpl> {
|
||||
|
||||
public:
|
||||
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.
|
||||
SystemZTTIImpl(const SystemZTTIImpl &Arg)
|
||||
@ -37,18 +38,6 @@ public:
|
||||
SystemZTTIImpl(SystemZTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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
|
||||
/// @{
|
||||
|
@ -150,8 +150,9 @@ void TargetMachine::setOptLevel(CodeGenOpt::Level Level) const {
|
||||
}
|
||||
|
||||
TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
|
||||
return TargetIRAnalysis(
|
||||
[this](Function &) { return TargetTransformInfo(getDataLayout()); });
|
||||
return TargetIRAnalysis([this](Function &F) {
|
||||
return TargetTransformInfo(F.getParent()->getDataLayout());
|
||||
});
|
||||
}
|
||||
|
||||
static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo,
|
||||
|
@ -40,7 +40,8 @@ class X86TTIImpl : public BasicTTIImplBase<X86TTIImpl> {
|
||||
|
||||
public:
|
||||
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.
|
||||
X86TTIImpl(const X86TTIImpl &Arg)
|
||||
@ -48,18 +49,6 @@ public:
|
||||
X86TTIImpl(X86TTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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
|
||||
/// @{
|
||||
|
@ -85,6 +85,7 @@ extern "C" void LLVMInitializeXCoreTarget() {
|
||||
}
|
||||
|
||||
TargetIRAnalysis XCoreTargetMachine::getTargetIRAnalysis() {
|
||||
return TargetIRAnalysis(
|
||||
[this](Function &) { return TargetTransformInfo(XCoreTTIImpl(this)); });
|
||||
return TargetIRAnalysis([this](Function &F) {
|
||||
return TargetTransformInfo(XCoreTTIImpl(this, F));
|
||||
});
|
||||
}
|
||||
|
@ -37,8 +37,9 @@ class XCoreTTIImpl : public BasicTTIImplBase<XCoreTTIImpl> {
|
||||
const XCoreTargetLowering *getTLI() const { return TLI; }
|
||||
|
||||
public:
|
||||
explicit XCoreTTIImpl(const XCoreTargetMachine *TM)
|
||||
: BaseT(TM), ST(TM->getSubtargetImpl()), TLI(ST->getTargetLowering()) {}
|
||||
explicit XCoreTTIImpl(const XCoreTargetMachine *TM, Function &F)
|
||||
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getSubtargetImpl()),
|
||||
TLI(ST->getTargetLowering()) {}
|
||||
|
||||
// Provide value semantics. MSVC requires that we spell all of these out.
|
||||
XCoreTTIImpl(const XCoreTTIImpl &Arg)
|
||||
@ -46,18 +47,6 @@ public:
|
||||
XCoreTTIImpl(XCoreTTIImpl &&Arg)
|
||||
: BaseT(std::move(static_cast<BaseT &>(Arg))), ST(std::move(Arg.ST)),
|
||||
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) {
|
||||
if (Vector) {
|
||||
|
Loading…
Reference in New Issue
Block a user