-
Notifications
You must be signed in to change notification settings - Fork 0
Change getTgtMemIntrinsic interface with returning a pair #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
55c3ad2
d88808b
867b0d7
7e574c7
f2abced
e89d6ba
9f26e22
665ebae
766d8c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| //===--------- Definition of the InterestingMemoryOperand class -*- C++ | ||
| //-*------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // This file defines InterestingMemoryOperand class that is used when getting | ||
| // the information of a memory reference instruction. | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_ANALYSIS_INTERESTINGMEMORYOPERAND_H | ||
| #define LLVM_ANALYSIS_INTERESTINGMEMORYOPERAND_H | ||
|
|
||
| #include "llvm/IR/DataLayout.h" | ||
| #include "llvm/IR/Instruction.h" | ||
| #include "llvm/Support/TypeSize.h" | ||
|
|
||
| namespace llvm { | ||
| class InterestingMemoryOperand { | ||
| public: | ||
| Use *PtrUse; | ||
| bool IsWrite; | ||
| Type *OpType; | ||
| TypeSize TypeStoreSize = TypeSize::getFixed(0); | ||
| MaybeAlign Alignment; | ||
| // The mask Value, if we're looking at a masked load/store. | ||
| Value *MaybeMask; | ||
| // The EVL Value, if we're looking at a vp intrinsic. | ||
| Value *MaybeEVL; | ||
| // The Stride Value, if we're looking at a strided load/store. | ||
| Value *MaybeStride; | ||
|
|
||
| InterestingMemoryOperand(Instruction *I, unsigned OperandNo, bool IsWrite, | ||
| class Type *OpType, MaybeAlign Alignment, | ||
| Value *MaybeMask = nullptr, | ||
| Value *MaybeEVL = nullptr, | ||
| Value *MaybeStride = nullptr) | ||
| : IsWrite(IsWrite), OpType(OpType), Alignment(Alignment), | ||
| MaybeMask(MaybeMask), MaybeEVL(MaybeEVL), MaybeStride(MaybeStride) { | ||
| const DataLayout &DL = I->getDataLayout(); | ||
| TypeStoreSize = DL.getTypeStoreSizeInBits(OpType); | ||
| PtrUse = &I->getOperandUse(OperandNo); | ||
| } | ||
|
|
||
| Instruction *getInsn() { return cast<Instruction>(PtrUse->getUser()); } | ||
|
|
||
| Value *getPtr() { return PtrUse->get(); } | ||
| }; | ||
|
|
||
| } // namespace llvm | ||
| #endif | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| #include "llvm/ADT/APInt.h" | ||
| #include "llvm/ADT/ArrayRef.h" | ||
| #include "llvm/Analysis/IVDescriptors.h" | ||
| #include "llvm/Analysis/InterestingMemoryOperand.h" | ||
| #include "llvm/IR/FMF.h" | ||
| #include "llvm/IR/InstrTypes.h" | ||
| #include "llvm/IR/PassManager.h" | ||
|
|
@@ -1696,8 +1697,8 @@ class TargetTransformInfo { | |
| /// will contain additional information - whether the intrinsic may write | ||
| /// or read to memory, volatility and the pointer. Info is undefined | ||
| /// if false is returned. | ||
| LLVM_ABI bool getTgtMemIntrinsic(IntrinsicInst *Inst, | ||
| MemIntrinsicInfo &Info) const; | ||
| LLVM_ABI std::pair<MemIntrinsicInfo, SmallVector<InterestingMemoryOperand, 1>> | ||
|
||
| getTgtMemIntrinsic(IntrinsicInst *Inst) const; | ||
|
|
||
| /// \returns The maximum element size, in bytes, for an element | ||
| /// unordered-atomic memory intrinsic. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,8 +69,10 @@ class PPCTTIImpl final : public BasicTTIImplBase<PPCTTIImpl> { | |
| bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, | ||
| DominatorTree *DT, AssumptionCache *AC, | ||
| TargetLibraryInfo *LibInfo) const override; | ||
| bool getTgtMemIntrinsic(IntrinsicInst *Inst, | ||
| MemIntrinsicInfo &Info) const override; | ||
|
|
||
|
||
| std::pair<MemIntrinsicInfo, SmallVector<InterestingMemoryOperand, 1>> | ||
| getTgtMemIntrinsic(IntrinsicInst *Inst) const override; | ||
|
|
||
| void getUnrollingPreferences(Loop *L, ScalarEvolution &SE, | ||
| TTI::UnrollingPreferences &UP, | ||
| OptimizationRemarkEmitter *ORE) const override; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't wrap this line