diff options
author | Tanya Lattner <tonic@nondot.org> | 2010-03-23 17:11:51 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2010-03-23 17:11:51 +0000 |
commit | 0afc8f4e10850ba5b0298d86269d3d4c34dda8ec (patch) | |
tree | 00e149181122d703f91746e5dbb5775197ee9321 /lib/CodeGen/MachineFunction.cpp | |
parent | 8a4f9390d0dddc2198f82b7f6bc01cc8abda11ba (diff) |
Merge r98845 from mainline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_27@99291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 4377d5bd71..ccbb2ddfea 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -594,16 +594,25 @@ unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const { return ~0; } -/// getJumpTableIndex - Create a new jump table entry in the jump table info -/// or return an existing one. +/// createJumpTableIndex - Create a new jump table entry in the jump table info. /// -unsigned MachineJumpTableInfo::getJumpTableIndex( +unsigned MachineJumpTableInfo::createJumpTableIndex( const std::vector<MachineBasicBlock*> &DestBBs) { assert(!DestBBs.empty() && "Cannot create an empty jump table!"); JumpTables.push_back(MachineJumpTableEntry(DestBBs)); return JumpTables.size()-1; } +/// getJumpTableIndex - Return the index for an existing jump table entry in +/// the jump table info. +unsigned MachineJumpTableInfo::getJumpTableIndex( + const std::vector<MachineBasicBlock*> &DestBBs) { + for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) + if (JumpTables[i].MBBs == DestBBs) + return i; + assert(false && "getJumpTableIndex failed to find matching table"); + return ~0; +} /// ReplaceMBBInJumpTables - If Old is the target of any jump tables, update /// the jump tables to branch to New instead. |