diff options
Diffstat (limited to 'lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 3ff3e8c..4bb17f1 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -12,6 +12,7 @@ #include "llvm/Target/MachineFrameInfo.h" #include "llvm/Target/MachineCacheInfo.h" #include "llvm/Method.h" +#include "llvm/BasicBlock.h" #include "llvm/iOther.h" #include <limits.h> @@ -56,11 +57,11 @@ ComputeMaxOptionalArgsSize(const TargetMachine& target, const Method* method) unsigned int maxSize = 0; - for (Method::const_inst_iterator I=method->inst_begin(),E=method->inst_end(); - I != E; ++I) - if ((*I)->getOpcode() == Instruction::Call) - { - CallInst* callInst = cast<CallInst>(*I); + for (Method::const_iterator MI=method->begin(), ME=method->end(); + MI != ME; ++MI) { + const BasicBlock *BB = *MI; + for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) + if (CallInst *callInst = dyn_cast<CallInst>(*I)) { unsigned int numOperands = callInst->getNumOperands() - 1; int numExtra = (int) numOperands - frameInfo.getNumFixedOutgoingArgs(); if (numExtra <= 0) @@ -84,7 +85,7 @@ ComputeMaxOptionalArgsSize(const TargetMachine& target, const Method* method) if (maxSize < sizeForThisCall) maxSize = sizeForThisCall; } - + } return maxSize; } |