[llvm-commits] [llvm] r106838 - /llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp
Bill Wendling
wendling at apple.com
Fri Jun 25 14:27:37 PDT 2010
Hi Gabor,
This looks fine to me. Thanks!
-bw
On Jun 25, 2010, at 4:25 AM, Gabor Greif wrote:
> Author: ggreif
> Date: Fri Jun 25 06:25:30 2010
> New Revision: 106838
>
> URL: http://llvm.org/viewvc/llvm-project?rev=106838&view=rev
> Log:
> 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\!
>
> Modified:
> llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp
>
> Modified: llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp?rev=106838&r1=106837&r2=106838&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp (original)
> +++ llvm/trunk/lib/CodeGen/DwarfEHPrepare.cpp Fri Jun 25 06:25:30 2010
> @@ -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 @@
> 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 @@
>
> // 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.
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list