aboutsummaryrefslogtreecommitdiffstats
path: root/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
commit64d4e6125949ebdc31a488c7ed100373b3c99f15 (patch)
tree1e9172d8a609cd1f6b4a5c0f0b07c1ba6dc19896 /include
parent16a3e52d08c4eb3e7371afb09d78528f70799aa1 (diff)
downloadexternal_llvm-64d4e6125949ebdc31a488c7ed100373b3c99f15.zip
external_llvm-64d4e6125949ebdc31a488c7ed100373b3c99f15.tar.gz
external_llvm-64d4e6125949ebdc31a488c7ed100373b3c99f15.tar.bz2
Optimize most common case by using single RetVal in ReturnInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instructions.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index c9329db..70a98d7 100644
--- a/include/llvm/Instructions.h
+++ b/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; }