summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/DwarfEHPrepare.cpp
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2010-06-25 11:25:30 +0000
committerGabor Greif <ggreif@gmail.com>2010-06-25 11:25:30 +0000
commitb890fc80234564953350fc5d1d132c6c4c4d66ab (patch)
treecf90126d30b0ee8214ce37a63e0987c6788ad241 /llvm/lib/CodeGen/DwarfEHPrepare.cpp
parent7dd3afdff38861aafcca69c73e45b8756924d605 (diff)
downloadbcm5719-llvm-b890fc80234564953350fc5d1d132c6c4c4d66ab.tar.gz
bcm5719-llvm-b890fc80234564953350fc5d1d132c6c4c4d66ab.zip
use ArgOperand accessors
and CallInst for getting hold of the intrinsic's arguments simplify along the way (at least for me this is much more legible now) Bill, Baldrick or Anton, please review\! llvm-svn: 106838
Diffstat (limited to 'llvm/lib/CodeGen/DwarfEHPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/DwarfEHPrepare.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/DwarfEHPrepare.cpp b/llvm/lib/CodeGen/DwarfEHPrepare.cpp
index 417215482f9..007289ce771 100644
--- a/llvm/lib/CodeGen/DwarfEHPrepare.cpp
+++ b/llvm/lib/CodeGen/DwarfEHPrepare.cpp
@@ -22,6 +22,7 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/Support/CallSite.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
@@ -193,8 +194,8 @@ FunctionPass *llvm::createDwarfEHPass(const TargetMachine *tm, bool fast) {
bool DwarfEHPrepare::HasCatchAllInSelector(IntrinsicInst *II) {
if (!EHCatchAllValue) return false;
- unsigned OpIdx = II->getNumOperands() - 1;
- GlobalVariable *GV = dyn_cast<GlobalVariable>(II->getOperand(OpIdx));
+ unsigned ArgIdx = II->getNumArgOperands() - 1;
+ GlobalVariable *GV = dyn_cast<GlobalVariable>(II->getArgOperand(ArgIdx));
return GV == EHCatchAllValue;
}
@@ -386,16 +387,20 @@ bool DwarfEHPrepare::HandleURoRInvokes() {
// Use the exception object pointer and the personality function
// from the original selector.
- Args.push_back(II->getArgOperand(0)); // Exception object pointer.
- Args.push_back(II->getArgOperand(1)); // Personality function.
+ CallSite CS(II);
+ IntrinsicInst::op_iterator I = CS.arg_begin();
+ Args.push_back(*I++); // Exception object pointer.
+ Args.push_back(*I++); // Personality function.
- unsigned I = 3;
- unsigned E = II->getNumOperands() -
- (isa<ConstantInt>(II->getOperand(II->getNumOperands() - 1)) ? 1 : 0);
+ IntrinsicInst::op_iterator E = CS.arg_end();
+ IntrinsicInst::op_iterator B = prior(E);
+
+ // Exclude last argument if it is an integer.
+ if (isa<ConstantInt>(B)) E = B;
// Add in any filter IDs.
- for (; I < E; ++I)
- Args.push_back(II->getOperand(I));
+ for (; I != E; ++I)
+ Args.push_back(*I);
Args.push_back(EHCatchAllValue->getInitializer()); // Catch-all indicator.
OpenPOWER on IntegriCloud