Skip to content

Commit db41712

Browse files
committed
Implement areInlineCompatible for PPC
1 parent ad61e53 commit db41712

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,20 @@ PPCTTIImpl::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
895895
return BaseT::getIntrinsicInstrCost(ICA, CostKind);
896896
}
897897

898+
bool PPCTTIImpl::areInlineCompatible(const Function *Caller,
899+
const Function *Callee) const {
900+
const TargetMachine &TM = getTLI()->getTargetMachine();
901+
902+
const FeatureBitset &CallerBits =
903+
TM.getSubtargetImpl(*Caller)->getFeatureBits();
904+
const FeatureBitset &CalleeBits =
905+
TM.getSubtargetImpl(*Callee)->getFeatureBits();
906+
907+
// Check that targets features are exactly the same. We can revisit to see if
908+
// we can improve this.
909+
return CallerBits == CalleeBits;
910+
}
911+
898912
bool PPCTTIImpl::areTypesABICompatible(const Function *Caller,
899913
const Function *Callee,
900914
const ArrayRef<Type *> &Types) const {

llvm/lib/Target/PowerPC/PPCTargetTransformInfo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ class PPCTTIImpl : public BasicTTIImplBase<PPCTTIImpl> {
139139
bool UseMaskForCond = false, bool UseMaskForGaps = false);
140140
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
141141
TTI::TargetCostKind CostKind);
142+
bool areInlineCompatible(const Function *Caller,
143+
const Function *Callee) const;
142144
bool areTypesABICompatible(const Function *Caller, const Function *Callee,
143145
const ArrayRef<Type *> &Types) const;
144146
bool hasActiveVectorLength(unsigned Opcode, Type *DataType,

0 commit comments

Comments
 (0)