diff options
author | Tanya Lattner <tonic@nondot.org> | 2009-02-03 05:07:10 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2009-02-03 05:07:10 +0000 |
commit | 682ae9aa345df80fab3180fd494c99853e7de436 (patch) | |
tree | ff9e30cb68f18ffd4e6a5061fd8c1b64da01a298 /lib/CodeGen/MachineFunction.cpp | |
parent | 254a6e0c63b22de9ddca2fadbeb335abd9735920 (diff) | |
parent | dac5c4b10b387b55c2394cd98a64f3f1394df2e8 (diff) |
Create 2.5 branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_25@63604 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 8bae7bbb92..434034b888 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -192,9 +192,10 @@ void MachineFunction::RenumberBlocks(MachineBasicBlock *MBB) { /// of `new MachineInstr'. /// MachineInstr * -MachineFunction::CreateMachineInstr(const TargetInstrDesc &TID, bool NoImp) { +MachineFunction::CreateMachineInstr(const TargetInstrDesc &TID, + DebugLoc DL, bool NoImp) { return new (InstructionRecycler.Allocate<MachineInstr>(Allocator)) - MachineInstr(TID, NoImp); + MachineInstr(TID, DL, NoImp); } /// CloneMachineInstr - Create a new MachineInstr which is a copy of the @@ -378,6 +379,23 @@ MachineFunction& MachineFunction::get(const Function *F) return *mc; } +/// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given +/// source file, line, and column. If none currently exists, create add a new +/// new DebugLocTuple and insert it into the DebugIdMap. +unsigned MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line, + unsigned Col) { + struct DebugLocTuple Tuple(Src, Line, Col); + DenseMap<DebugLocTuple, unsigned>::iterator II + = DebugLocInfo.DebugIdMap.find(Tuple); + if (II != DebugLocInfo.DebugIdMap.end()) + return II->second; + // Add a new tuple. + unsigned Id = DebugLocInfo.DebugLocations.size(); + DebugLocInfo.DebugLocations.push_back(Tuple); + DebugLocInfo.DebugIdMap[Tuple] = Id; + return Id; +} + //===----------------------------------------------------------------------===// // MachineFrameInfo implementation //===----------------------------------------------------------------------===// |