[Autobackout][FuncReg]Revert of change: 543493b9d1

Inherit VC TTI from BasicTTIImplBase

Needed to make GenXSubtarget available there.
This commit is contained in:
Anton Zabaznov
2022-02-17 16:13:52 -08:00
committed by igcbot
parent c2518e653e
commit eaa414f468
2 changed files with 11 additions and 19 deletions

View File

@ -37,7 +37,6 @@ SPDX-License-Identifier: MIT
#include "GenX.h"
#include "GenXDebugInfo.h"
#include "GenXModule.h"
#include "GenXSubtarget.h"
#include "vc/GenXCodeGen/GenXOCLRuntimeInfo.h"
#include "vc/GenXOpts/GenXOpts.h"
@ -157,7 +156,8 @@ void initializeGenXPasses(PassRegistry &registry) {
}
TargetTransformInfo GenXTargetMachine::getTargetTransformInfo(const Function &F) {
return TargetTransformInfo(GenXTTIImpl(this, F));
GenXTTIImpl GTTI(F.getParent()->getDataLayout());
return TargetTransformInfo(GTTI);
}
} // namespace llvm

View File

@ -78,25 +78,17 @@ public:
CodeGenOpt::Level OL, bool JIT);
};
class GenXTTIImpl : public BasicTTIImplBase<GenXTTIImpl> {
using BaseT = BasicTTIImplBase<GenXTTIImpl>;
using TTI = TargetTransformInfo;
// This implementation allows us to define our own costs for
// the GenX backend. Did not use BasicTTIImplBase because the overloaded
// constructors have TragetMachine as an argument, so I inherited from
// its parent which has only DL as its arguments
class GenXTTIImpl : public TargetTransformInfoImplCRTPBase<GenXTTIImpl>
{
typedef TargetTransformInfoImplCRTPBase<GenXTTIImpl> BaseT;
typedef TargetTransformInfo TTI;
friend BaseT;
const GenXSubtarget &ST;
const GenXSubtarget *getST() const { return &ST; }
const TargetLowering *getTLI() const {
// No target lowering in VC.
return nullptr;
}
public:
explicit GenXTTIImpl(const GenXTargetMachine *TM, const Function &F)
: BaseT(TM, F.getParent()->getDataLayout()), ST(TM->getGenXSubtarget()) {}
GenXTTIImpl(const DataLayout& DL) : BaseT(DL) {}
bool shouldBuildLookupTables() { return false; }
unsigned getFlatAddressSpace() { return vc::AddrSpace::Generic; }