summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-03-22 09:11:00 +0000
committerGabor Greif <ggreif@gmail.com>2010-03-22 09:11:00 +0000
commit1cde4af15712f6ccdb81ab540df800cda90d0d74 (patch)
tree815521d8e780e580649eadf2a1d71bdaeac048e8 /include
parent9b1061e2e3c3a463aa251e2e6631d5e4313a7ac6 (diff)
downloadllvm-1cde4af15712f6ccdb81ab540df800cda90d0d74.tar.gz
llvm-1cde4af15712f6ccdb81ab540df800cda90d0d74.tar.bz2
llvm-1cde4af15712f6ccdb81ab540df800cda90d0d74.tar.xz
backing out r99170 because it still fails on clang-x86_64-darwin10-fnt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instructions.h20
-rw-r--r--include/llvm/Support/CallSite.h30
2 files changed, 16 insertions, 34 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 2fe1abba13..b1f1996045 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -2508,31 +2508,32 @@ public:
/// indirect function invocation.
///
Function *getCalledFunction() const {
- return dyn_cast<Function>(Op<-3>());
+ return dyn_cast<Function>(getOperand(0));
}
/// getCalledValue - Get a pointer to the function that is invoked by this
/// instruction
- const Value *getCalledValue() const { return Op<-3>(); }
- Value *getCalledValue() { return Op<-3>(); }
+ const Value *getCalledValue() const { return getOperand(0); }
+ Value *getCalledValue() { return getOperand(0); }
/// setCalledFunction - Set the function called.
void setCalledFunction(Value* Fn) {
- Op<-3>() = Fn;
+ Op<0>() = Fn;
}
// get*Dest - Return the destination basic blocks...
BasicBlock *getNormalDest() const {
- return cast<BasicBlock>(Op<-2>());
+ return cast<BasicBlock>(getOperand(1));
}
BasicBlock *getUnwindDest() const {
- return cast<BasicBlock>(Op<-1>());
+ return cast<BasicBlock>(getOperand(2));
}
void setNormalDest(BasicBlock *B) {
- Op<-2>() = reinterpret_cast<Value*>(B);
+ setOperand(1, (Value*)B);
}
+
void setUnwindDest(BasicBlock *B) {
- Op<-1>() = reinterpret_cast<Value*>(B);
+ setOperand(2, (Value*)B);
}
BasicBlock *getSuccessor(unsigned i) const {
@@ -2542,7 +2543,7 @@ public:
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
assert(idx < 2 && "Successor # out of range for invoke!");
- *(&Op<-2>() + idx) = reinterpret_cast<Value*>(NewSucc);
+ setOperand(idx+1, (Value*)NewSucc);
}
unsigned getNumSuccessors() const { return 2; }
@@ -2555,7 +2556,6 @@ public:
static inline bool classof(const Value *V) {
return isa<Instruction>(V) && classof(cast<Instruction>(V));
}
-
private:
virtual BasicBlock *getSuccessorV(unsigned idx) const;
virtual unsigned getNumSuccessorsV() const;
diff --git a/include/llvm/Support/CallSite.h b/include/llvm/Support/CallSite.h
index 5bfcc6d84f..285b558afc 100644
--- a/include/llvm/Support/CallSite.h
+++ b/include/llvm/Support/CallSite.h
@@ -118,7 +118,7 @@ public:
///
Value *getCalledValue() const {
assert(getInstruction() && "Not a call or invoke instruction!");
- return *getCallee();
+ return getInstruction()->getOperand(0);
}
/// getCalledFunction - Return the function being called if this is a direct
@@ -132,7 +132,7 @@ public:
///
void setCalledFunction(Value *V) {
assert(getInstruction() && "Not a call or invoke instruction!");
- *getCallee() = V;
+ getInstruction()->setOperand(0, V);
}
Value *getArgument(unsigned ArgNo) const {
@@ -146,16 +146,6 @@ public:
getInstruction()->setOperand(getArgumentOffset() + ArgNo, newVal);
}
- /// Given a value use iterator, returns the argument that corresponds to it.
- /// Iterator must actually correspond to an argument.
- unsigned getArgumentNo(Value::use_iterator I) const {
- assert(getInstruction() && "Not a call or invoke instruction!");
- assert(arg_begin() <= &I.getUse() && &I.getUse() < arg_end()
- && "Argument # out of range!");
-
- return &I.getUse() - arg_begin();
- }
-
/// Given an operand number, returns the argument that corresponds to it.
/// OperandNo must be a valid operand number that actually corresponds to an
/// argument.
@@ -181,7 +171,7 @@ public:
return getInstruction()->op_begin() + getArgumentOffset();
}
- arg_iterator arg_end() const { return getInstruction()->op_end() - getArgumentEndOffset(); }
+ arg_iterator arg_end() const { return getInstruction()->op_end(); }
bool arg_empty() const { return arg_end() == arg_begin(); }
unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
@@ -190,25 +180,17 @@ public:
}
bool isCallee(Value::use_iterator UI) const {
- return getCallee() == &UI.getUse();
+ return getInstruction()->op_begin() == &UI.getUse();
}
+
private:
/// Returns the operand number of the first argument
unsigned getArgumentOffset() const {
if (isCall())
return 1; // Skip Function
else
- return 0; // Args are at the front
+ return 3; // Skip Function, BB, BB
}
-
- unsigned getArgumentEndOffset() const {
- if (isCall())
- return 0; // Unchanged
- else
- return 3; // Skip BB, BB, Function
- }
-
- User::op_iterator getCallee() const;
};
} // End llvm namespace