-void MachineConstantPool::print(std::ostream &OS) const {
- for (unsigned i = 0, e = Constants.size(); i != e; ++i)
- OS << " <cp #" << i << "> is" << *(Value*)Constants[i] << "\n";
-}
-
-void MachineConstantPool::dump() const { print(std::cerr); }
-
-//===----------------------------------------------------------------------===//
-// MachineFunctionInfo implementation
-//===----------------------------------------------------------------------===//
-
-static unsigned
-ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F,
- unsigned &maxOptionalNumArgs)
-{
- const TargetFrameInfo &frameInfo = target.getFrameInfo();
-
- unsigned maxSize = 0;
-
- for (Function::const_iterator BB = F->begin(), BBE = F->end(); BB !=BBE; ++BB)
- for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
- if (const CallInst *callInst = dyn_cast<CallInst>(&*I))
- {
- unsigned numOperands = callInst->getNumOperands() - 1;
- int numExtra = (int)numOperands-frameInfo.getNumFixedOutgoingArgs();
- if (numExtra <= 0)
- continue;
-
- unsigned sizeForThisCall;
- if (frameInfo.argsOnStackHaveFixedSize())
- {
- int argSize = frameInfo.getSizeOfEachArgOnStack();
- sizeForThisCall = numExtra * (unsigned) argSize;
- }
- else
- {
- assert(0 && "UNTESTED CODE: Size per stack argument is not "
- "fixed on this architecture: use actual arg sizes to "
- "compute MaxOptionalArgsSize");
- sizeForThisCall = 0;
- for (unsigned i = 0; i < numOperands; ++i)
- sizeForThisCall += target.getTargetData().getTypeSize(callInst->
- getOperand(i)->getType());
- }
-
- if (maxSize < sizeForThisCall)
- maxSize = sizeForThisCall;
-
- if ((int)maxOptionalNumArgs < numExtra)
- maxOptionalNumArgs = (unsigned) numExtra;
- }
+/// getJumpTableIndex - Create a new jump table entry in the jump table info
+/// or return an existing one.
+///
+unsigned MachineJumpTableInfo::getJumpTableIndex(
+ const std::vector<MachineBasicBlock*> &DestBBs) {
+ assert(!DestBBs.empty() && "Cannot create an empty jump table!");
+ for (unsigned i = 0, e = JumpTables.size(); i != e; ++i)
+ if (JumpTables[i].MBBs == DestBBs)
+ return i;