14
14
#ifndef LLVM_CODEGEN_MACHINEBASICBLOCK_H
15
15
#define LLVM_CODEGEN_MACHINEBASICBLOCK_H
16
16
17
- #include " llvm/ADT/SortedVector.h"
18
17
#include " llvm/ADT/GraphTraits.h"
19
18
#include " llvm/CodeGen/MachineInstr.h"
20
19
#include " llvm/Support/DataTypes.h"
@@ -81,7 +80,7 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
81
80
82
81
// / LiveIns - Keep track of the physical registers that are livein of
83
82
// / the basicblock.
84
- mutable SortedVector <unsigned > LiveIns;
83
+ std::vector <unsigned > LiveIns;
85
84
86
85
// / Alignment - Alignment of the basic block. Zero if the basic block does
87
86
// / not need to be aligned.
@@ -319,12 +318,15 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
319
318
// / Adds the specified register as a live in. Note that it is an error to add
320
319
// / the same register to the same set more than once unless the intention is
321
320
// / to call sortUniqueLiveIns after all registers are added.
322
- void addLiveIn (unsigned Reg) { LiveIns.insert (Reg); }
321
+ void addLiveIn (unsigned Reg) { LiveIns.push_back (Reg); }
323
322
324
323
// / Sorts and uniques the LiveIns vector. It can be significantly faster to do
325
324
// / this than repeatedly calling isLiveIn before calling addLiveIn for every
326
325
// / LiveIn insertion.
327
- void sortUniqueLiveIns () { LiveIns.sortUnique (); }
326
+ void sortUniqueLiveIns () {
327
+ std::sort (LiveIns.begin (), LiveIns.end ());
328
+ LiveIns.erase (std::unique (LiveIns.begin (), LiveIns.end ()), LiveIns.end ());
329
+ }
328
330
329
331
// / Add PhysReg as live in to this block, and ensure that there is a copy of
330
332
// / PhysReg to a virtual register of class RC. Return the virtual register
@@ -337,20 +339,14 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
337
339
338
340
// / isLiveIn - Return true if the specified register is in the live in set.
339
341
// /
340
- bool isLiveIn (unsigned Reg) const { return LiveIns. has (Reg); }
342
+ bool isLiveIn (unsigned Reg) const ;
341
343
342
344
// Iteration support for live in sets. These sets are kept in sorted
343
345
// order by their register number.
344
346
typedef std::vector<unsigned >::const_iterator livein_iterator;
347
+ livein_iterator livein_begin () const { return LiveIns.begin (); }
348
+ livein_iterator livein_end () const { return LiveIns.end (); }
345
349
bool livein_empty () const { return LiveIns.empty (); }
346
- livein_iterator livein_begin () const {
347
- LiveIns.sortUnique ();
348
- return LiveIns.begin ();
349
- }
350
- livein_iterator livein_end () const {
351
- LiveIns.sortUnique ();
352
- return LiveIns.end ();
353
- }
354
350
355
351
// / getAlignment - Return alignment of the basic block.
356
352
// / The alignment is specified as log2(bytes).
0 commit comments