This reverts commit r321234. It breaks the -DBUILD_SHARED_LIBS=ON build.
llvm-svn: 321243
namespace llvm {
-class Function;
class GlobalValue;
class MachineModuleInfo;
class Mangler;
class Target;
class TargetIntrinsicInfo;
class TargetIRAnalysis;
-class TargetTransformInfo;
class TargetLoweringObjectFile;
class TargetPassConfig;
class TargetSubtargetInfo;
/// This is used to construct the new pass manager's target IR analysis pass,
/// set up appropriately for this target machine. Even the old pass manager
/// uses this to answer queries about the IR.
- TargetIRAnalysis getTargetIRAnalysis();
-
- /// \brief Return a TargetTransformInfo for a given function.
- ///
- /// The returned TargetTransformInfo is specialized to the subtarget
- /// corresponding to \p F.
- virtual TargetTransformInfo getTargetTransformInfo(const Function &F);
+ virtual TargetIRAnalysis getTargetIRAnalysis();
/// Allow the target to modify the pass manager, e.g. by calling
/// PassManagerBuilder::addExtension.
void initAsmInfo();
public:
- /// \brief Get a TargetTransformInfo implementation for the target.
+ /// \brief Get a TargetIRAnalysis implementation for the target.
///
- /// The TTI returned uses the common code generator to answer queries about
- /// the IR.
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ /// This analysis will produce a TTI result which uses the common code
+ /// generator to answer queries about the IR.
+ TargetIRAnalysis getTargetIRAnalysis() override;
/// Create a pass configuration object to be used by addPassToEmitX methods
/// for generating a pipeline of CodeGen passes.
this->OptLevel = OL;
}
-TargetTransformInfo
-LLVMTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(BasicTTIImpl(this, F));
+TargetIRAnalysis LLVMTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(BasicTTIImpl(this, F));
+ });
}
/// addPassesToX helper drives creation and initialization of TargetPassConfig.
} // end anonymous namespace
-TargetTransformInfo
-AArch64TargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(AArch64TTIImpl(this, F));
+TargetIRAnalysis AArch64TargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(AArch64TTIImpl(this, F));
+ });
}
TargetPassConfig *AArch64TargetMachine::createPassConfig(PassManagerBase &PM) {
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ /// \brief Get the TargetIRAnalysis for this target.
+ TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile* getObjFileLowering() const override {
return TLOF.get();
} // end anonymous namespace
-TargetTransformInfo
-AMDGPUTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(AMDGPUTTIImpl(this, F));
+TargetIRAnalysis AMDGPUTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(AMDGPUTTIImpl(this, F));
+ });
}
void AMDGPUPassConfig::addEarlyCSEOrGVNPass() {
TargetPassConfig *GCNTargetMachine::createPassConfig(PassManagerBase &PM) {
return new GCNPassConfig(*this, PM);
}
+
const AMDGPUIntrinsicInfo *getIntrinsicInfo() const override {
return &IntrinsicInfo;
}
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
RegisterTargetMachine<ARCTargetMachine> X(getTheARCTarget());
}
-TargetTransformInfo
-ARCTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(ARCTTIImpl(this, F));
+TargetIRAnalysis ARCTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(ARCTTIImpl(this, F));
+ });
}
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
}
return I.get();
}
-TargetTransformInfo
-ARMBaseTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(ARMTTIImpl(this, F));
+TargetIRAnalysis ARMBaseTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(ARMTTIImpl(this, F));
+ });
}
ARMLETargetMachine::ARMLETargetMachine(const Target &T, const Triple &TT,
const ARMSubtarget *getSubtargetImpl() const = delete;
bool isLittleEndian() const { return isLittle; }
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ /// \brief Get the TargetIRAnalysis for this target.
+ TargetIRAnalysis getTargetIRAnalysis() override;
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
});
}
-TargetTransformInfo
-HexagonTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(HexagonTTIImpl(this, F));
+TargetIRAnalysis HexagonTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(HexagonTTIImpl(this, F));
+ });
}
void adjustPassManager(PassManagerBuilder &PMB) override;
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
HexagonTargetObjectFile *getObjFileLowering() const override {
return static_cast<HexagonTargetObjectFile*>(TLOF.get());
initAsmInfo();
}
-TargetTransformInfo
-LanaiTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(LanaiTTIImpl(this, F));
+TargetIRAnalysis LanaiTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(LanaiTTIImpl(this, F));
+ });
}
namespace {
return &Subtarget;
}
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &pass_manager) override;
addPass(createMipsOptimizePICCallPass());
}
-TargetTransformInfo
-MipsTargetMachine::getTargetTransformInfo(const Function &F) {
- 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(F.getParent()->getDataLayout());
- }
-
- DEBUG(errs() << "Target Transform Info Pass Added\n");
- return TargetTransformInfo(BasicTTIImpl(this, F));
+TargetIRAnalysis MipsTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ 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(F.getParent()->getDataLayout());
+ }
+
+ DEBUG(errs() << "Target Transform Info Pass Added\n");
+ return TargetTransformInfo(BasicTTIImpl(this, F));
+ });
}
// Implemented by targets that want to run passes immediately before
CodeGenOpt::Level OL, bool JIT, bool isLittle);
~MipsTargetMachine() override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
const MipsSubtarget *getSubtargetImpl() const {
if (Subtarget)
});
}
-TargetTransformInfo
-NVPTXTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(NVPTXTTIImpl(this, F));
+TargetIRAnalysis NVPTXTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(NVPTXTTIImpl(this, F));
+ });
}
void NVPTXPassConfig::addEarlyCSEOrGVNPass() {
void adjustPassManager(PassManagerBuilder &) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
bool isMachineVerifierClean() const override {
return false;
addPass(createPPCBranchSelectionPass(), false);
}
-TargetTransformInfo
-PPCTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(PPCTTIImpl(this, F));
+TargetIRAnalysis PPCTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(PPCTTIImpl(this, F));
+ });
}
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
return new SystemZPassConfig(*this, PM);
}
-TargetTransformInfo
-SystemZTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(SystemZTTIImpl(this, F));
+TargetIRAnalysis SystemZTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(SystemZTTIImpl(this, F));
+ });
}
// Override LLVMTargetMachine
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();
void TargetMachine::setOptLevel(CodeGenOpt::Level Level) { OptLevel = Level; }
-TargetTransformInfo TargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(F.getParent()->getDataLayout());
+TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([](const Function &F) {
+ return TargetTransformInfo(F.getParent()->getDataLayout());
+ });
}
void TargetMachine::getNameWithPrefix(SmallVectorImpl<char> &Name,
getNameWithPrefix(NameStr, GV, TLOF->getMangler());
return TLOF->getContext().getOrCreateSymbol(NameStr);
}
-
-TargetIRAnalysis TargetMachine::getTargetIRAnalysis() {
- // Since Analysis can't depend on Target, use a std::function to invert the
- // dependency.
- return TargetIRAnalysis(
- [this](const Function &F) { return this->getTargetTransformInfo(F); });
-}
};
} // end anonymous namespace
-TargetTransformInfo
-WebAssemblyTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(WebAssemblyTTIImpl(this, F));
+TargetIRAnalysis WebAssemblyTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(WebAssemblyTTIImpl(this, F));
+ });
}
TargetPassConfig *
return TLOF.get();
}
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ /// \brief Get the TargetIRAnalysis for this target.
+ TargetIRAnalysis getTargetIRAnalysis() override;
bool usesPhysRegsForPEI() const override { return false; }
};
// X86 TTI query.
//===----------------------------------------------------------------------===//
-TargetTransformInfo
-X86TargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(X86TTIImpl(this, F));
+TargetIRAnalysis X86TargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(X86TTIImpl(this, F));
+ });
}
//===----------------------------------------------------------------------===//
// attributes of each function.
const X86Subtarget *getSubtargetImpl() const = delete;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
// Set up the pass pipeline.
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
RegisterTargetMachine<XCoreTargetMachine> X(getTheXCoreTarget());
}
-TargetTransformInfo
-XCoreTargetMachine::getTargetTransformInfo(const Function &F) {
- return TargetTransformInfo(XCoreTTIImpl(this, F));
+TargetIRAnalysis XCoreTargetMachine::getTargetIRAnalysis() {
+ return TargetIRAnalysis([this](const Function &F) {
+ return TargetTransformInfo(XCoreTTIImpl(this, F));
+ });
}
// Pass Pipeline Configuration
TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
- TargetTransformInfo getTargetTransformInfo(const Function &F) override;
+ TargetIRAnalysis getTargetIRAnalysis() override;
TargetLoweringObjectFile *getObjFileLowering() const override {
return TLOF.get();