mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
Added isPredecessor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31409 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bf105c8424
commit
c5fc57dcae
@ -2563,6 +2563,29 @@ bool SDNode::isOperand(SDNode *N) const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void findPredecessor(SDNode *N, const SDNode *P, bool &found,
|
||||||
|
std::set<SDNode *> &Visited) {
|
||||||
|
if (found || !Visited.insert(N).second)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (unsigned i = 0, e = N->getNumOperands(); !found && i != e; ++i) {
|
||||||
|
SDNode *Op = N->getOperand(i).Val;
|
||||||
|
if (Op == P) {
|
||||||
|
found = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
findPredecessor(Op, P, found, Visited);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// isPredecessor - Return true if this node is a predecessor of N.
|
||||||
|
bool SDNode::isPredecessor(SDNode *N) const {
|
||||||
|
std::set<SDNode *> Visited;
|
||||||
|
bool found = false;
|
||||||
|
findPredecessor(N, this, found, Visited);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t SDNode::getConstantOperandVal(unsigned Num) const {
|
uint64_t SDNode::getConstantOperandVal(unsigned Num) const {
|
||||||
assert(Num < NumOperands && "Invalid child # of SDNode!");
|
assert(Num < NumOperands && "Invalid child # of SDNode!");
|
||||||
return cast<ConstantSDNode>(OperandList[Num])->getValue();
|
return cast<ConstantSDNode>(OperandList[Num])->getValue();
|
||||||
|
Loading…
Reference in New Issue
Block a user