summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-02-26 17:56:20 +0000
committerDevang Patel <dpatel@apple.com>2008-02-26 17:56:20 +0000
commitae682fb940835eb06e2e10f909b820ec147523c0 (patch)
treedecc13b1d831603e269c2da45d4b33ceb04d73db /llvm/include
parent1f17bf61719162b7ed20c96f4deabf83ff6f88e3 (diff)
downloadbcm5719-llvm-ae682fb940835eb06e2e10f909b820ec147523c0.tar.gz
bcm5719-llvm-ae682fb940835eb06e2e10f909b820ec147523c0.zip
Optimize most common case by using single RetVal in ReturnInst.
llvm-svn: 47607
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Instructions.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h
index c9329db29d7..70a98d78bed 100644
--- a/llvm/include/llvm/Instructions.h
+++ b/llvm/include/llvm/Instructions.h
@@ -1379,6 +1379,7 @@ public:
/// does not continue in this function any longer.
///
class ReturnInst : public TerminatorInst {
+ Use RetVal;
ReturnInst(const ReturnInst &RI);
void init(Value *RetVal);
void init(const std::vector<Value *> &RetVals);
@@ -1405,6 +1406,23 @@ public:
virtual ReturnInst *clone() const;
+ // Transparently provide more efficient getOperand methods.
+ Value *getOperand(unsigned i) const {
+ assert(i < getNumOperands() && "getOperand() out of range!");
+ if (getNumOperands() == 0 || getNumOperands() == 1)
+ return RetVal;
+
+ return OperandList[i];
+ }
+
+ void setOperand(unsigned i, Value *Val) {
+ assert(i < getNumOperands() && "setOperand() out of range!");
+ if (i == 0)
+ RetVal = Val;
+ else
+ OperandList[i] = Val;
+ }
+
Value *getReturnValue(unsigned n = 0) const;
unsigned getNumSuccessors() const { return 0; }
OpenPOWER on IntegriCloud