mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[NFC] Move some methods into static functions
llvm-svn: 338843
This commit is contained in:
parent
17ff598941
commit
76fa18c0f1
@ -66,6 +66,33 @@ STATISTIC(GuardsEliminated, "Number of eliminated guards");
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
static Value *getGuardCondition(Instruction *GuardInst) {
|
||||||
|
IntrinsicInst *GI = cast<IntrinsicInst>(GuardInst);
|
||||||
|
assert(GI->getIntrinsicID() == Intrinsic::experimental_guard &&
|
||||||
|
"Bad guard intrinsic?");
|
||||||
|
return GI->getArgOperand(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the condition for \p GuardInst to \p NewCond.
|
||||||
|
static void setGuardCondition(Instruction *GuardInst, Value *NewCond) {
|
||||||
|
IntrinsicInst *GI = cast<IntrinsicInst>(GuardInst);
|
||||||
|
assert(GI->getIntrinsicID() == Intrinsic::experimental_guard &&
|
||||||
|
"Bad guard intrinsic?");
|
||||||
|
GI->setArgOperand(0, NewCond);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Whether or not the particular instruction \p I is a guard.
|
||||||
|
static bool isGuard(const Instruction *I) {
|
||||||
|
using namespace llvm::PatternMatch;
|
||||||
|
return match(I, m_Intrinsic<Intrinsic::experimental_guard>());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eliminates the guard instruction properly.
|
||||||
|
static void eliminateGuard(Instruction *GuardInst) {
|
||||||
|
GuardInst->eraseFromParent();
|
||||||
|
++GuardsEliminated;
|
||||||
|
}
|
||||||
|
|
||||||
class GuardWideningImpl {
|
class GuardWideningImpl {
|
||||||
DominatorTree &DT;
|
DominatorTree &DT;
|
||||||
PostDominatorTree *PDT;
|
PostDominatorTree *PDT;
|
||||||
@ -93,18 +120,6 @@ class GuardWideningImpl {
|
|||||||
const DenseMap<BasicBlock *, SmallVector<Instruction *, 8>> &
|
const DenseMap<BasicBlock *, SmallVector<Instruction *, 8>> &
|
||||||
GuardsPerBlock);
|
GuardsPerBlock);
|
||||||
|
|
||||||
// Get the condition from \p GuardInst.
|
|
||||||
Value *getGuardCondition(Instruction *GuardInst);
|
|
||||||
|
|
||||||
// Set the condition for \p GuardInst.
|
|
||||||
void setGuardCondition(Instruction *GuardInst, Value *NewCond);
|
|
||||||
|
|
||||||
// Whether or not the particular instruction is a guard.
|
|
||||||
bool isGuard(const Instruction *I);
|
|
||||||
|
|
||||||
// Eliminates the guard instruction properly.
|
|
||||||
void eliminateGuard(Instruction *GuardInst);
|
|
||||||
|
|
||||||
/// Used to keep track of which widening potential is more effective.
|
/// Used to keep track of which widening potential is more effective.
|
||||||
enum WideningScore {
|
enum WideningScore {
|
||||||
/// Don't widen.
|
/// Don't widen.
|
||||||
@ -343,31 +358,6 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *GuardWideningImpl::getGuardCondition(Instruction *GuardInst) {
|
|
||||||
IntrinsicInst *GI = cast<IntrinsicInst>(GuardInst);
|
|
||||||
assert(GI->getIntrinsicID() == Intrinsic::experimental_guard &&
|
|
||||||
"Bad guard intrinsic?");
|
|
||||||
return GI->getArgOperand(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GuardWideningImpl::setGuardCondition(Instruction *GuardInst,
|
|
||||||
Value *NewCond) {
|
|
||||||
IntrinsicInst *GI = cast<IntrinsicInst>(GuardInst);
|
|
||||||
assert(GI->getIntrinsicID() == Intrinsic::experimental_guard &&
|
|
||||||
"Bad guard intrinsic?");
|
|
||||||
GI->setArgOperand(0, NewCond);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GuardWideningImpl::isGuard(const Instruction* I) {
|
|
||||||
using namespace llvm::PatternMatch;
|
|
||||||
return match(I, m_Intrinsic<Intrinsic::experimental_guard>());
|
|
||||||
}
|
|
||||||
|
|
||||||
void GuardWideningImpl::eliminateGuard(Instruction *GuardInst) {
|
|
||||||
GuardInst->eraseFromParent();
|
|
||||||
++GuardsEliminated;
|
|
||||||
}
|
|
||||||
|
|
||||||
GuardWideningImpl::WideningScore GuardWideningImpl::computeWideningScore(
|
GuardWideningImpl::WideningScore GuardWideningImpl::computeWideningScore(
|
||||||
Instruction *DominatedGuard, Loop *DominatedGuardLoop,
|
Instruction *DominatedGuard, Loop *DominatedGuardLoop,
|
||||||
Instruction *DominatingGuard, Loop *DominatingGuardLoop) {
|
Instruction *DominatingGuard, Loop *DominatingGuardLoop) {
|
||||||
|
Loading…
Reference in New Issue
Block a user