mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Add accessor methods to binary/unary operators
Add extra helper methods to PHI class git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -35,6 +35,9 @@ public:
|
|||||||
|
|
||||||
virtual bool setOperand(unsigned i, Value *Val) = 0;
|
virtual bool setOperand(unsigned i, Value *Val) = 0;
|
||||||
virtual const Value *getOperand(unsigned i) const = 0;
|
virtual const Value *getOperand(unsigned i) const = 0;
|
||||||
|
inline Value *getOperand(unsigned i) {
|
||||||
|
return (Value*)((const Instruction *)this)->getOperand(i);
|
||||||
|
}
|
||||||
|
|
||||||
// Additionally, they must provide a method to get at the successors of this
|
// Additionally, they must provide a method to get at the successors of this
|
||||||
// terminator instruction. If 'idx' is out of range, a null pointer shall be
|
// terminator instruction. If 'idx' is out of range, a null pointer shall be
|
||||||
@@ -78,6 +81,9 @@ public:
|
|||||||
virtual string getOpcode() const = 0;
|
virtual string getOpcode() const = 0;
|
||||||
|
|
||||||
virtual unsigned getNumOperands() const { return 1; }
|
virtual unsigned getNumOperands() const { return 1; }
|
||||||
|
inline Value *getOperand(unsigned i) {
|
||||||
|
return (i == 0) ? Source : 0;
|
||||||
|
}
|
||||||
virtual const Value *getOperand(unsigned i) const {
|
virtual const Value *getOperand(unsigned i) const {
|
||||||
return (i == 0) ? Source : 0;
|
return (i == 0) ? Source : 0;
|
||||||
}
|
}
|
||||||
@@ -126,6 +132,9 @@ public:
|
|||||||
virtual const Value *getOperand(unsigned i) const {
|
virtual const Value *getOperand(unsigned i) const {
|
||||||
return (i == 0) ? Source1 : ((i == 1) ? Source2 : 0);
|
return (i == 0) ? Source1 : ((i == 1) ? Source2 : 0);
|
||||||
}
|
}
|
||||||
|
inline Value *getOperand(unsigned i) {
|
||||||
|
return (i == 0) ? Source1 : ((i == 1) ? Source2 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool setOperand(unsigned i, Value *Val) {
|
virtual bool setOperand(unsigned i, Value *Val) {
|
||||||
// assert(Val && "operand must not be null!");
|
// assert(Val && "operand must not be null!");
|
||||||
|
@@ -46,6 +46,15 @@ public:
|
|||||||
virtual bool setOperand(unsigned i, Value *Val);
|
virtual bool setOperand(unsigned i, Value *Val);
|
||||||
virtual string getOpcode() const { return "phi"; }
|
virtual string getOpcode() const { return "phi"; }
|
||||||
|
|
||||||
|
// getNumIncomingValues - Return the number of incoming edges the PHI node has
|
||||||
|
inline unsigned getNumIncomingValues() const { return IncomingValues.size(); }
|
||||||
|
|
||||||
|
// getIncomingValue - Return incoming value #x
|
||||||
|
inline Value *getIncomingValue(unsigned i) const { return IncomingValues[i].first; }
|
||||||
|
|
||||||
|
// getIncomingBlock - Return incoming basic block #x
|
||||||
|
inline BasicBlock *getIncomingBlock(unsigned i) const { return IncomingValues[i].second; }
|
||||||
|
|
||||||
// addIncoming - Add an incoming value to the end of the PHI list
|
// addIncoming - Add an incoming value to the end of the PHI list
|
||||||
void addIncoming(Value *D, BasicBlock *BB);
|
void addIncoming(Value *D, BasicBlock *BB);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user