File tree Expand file tree Collapse file tree 7 files changed +51
-34
lines changed Expand file tree Collapse file tree 7 files changed +51
-34
lines changed Original file line number Diff line number Diff line change 16
16
#include " llvm/ADT/SmallBitVector.h"
17
17
#include " llvm/Support/raw_ostream.h"
18
18
19
- namespace llvm {
19
+ namespace swift {
20
20
21
- inline llvm::raw_ostream &operator <<(llvm::raw_ostream &os,
22
- const SmallBitVector &bv) {
23
- for (unsigned i = 0 , e = bv.size (); i != e; ++i)
24
- os << (bv[i] ? ' 1' : ' 0' );
25
- return os;
21
+ void printBitsAsArray (llvm::raw_ostream &OS, const llvm::SmallBitVector &bits,
22
+ bool bracketed);
23
+
24
+ inline llvm::raw_ostream &operator <<(llvm::raw_ostream &OS,
25
+ const llvm::SmallBitVector &bits) {
26
+ printBitsAsArray (OS, bits, /* bracketed=*/ false );
27
+ return OS;
26
28
}
27
29
28
- } // namespace llvm
30
+ void dumpBits (const llvm::SmallBitVector &bits);
31
+
32
+ } // namespace swift
29
33
30
34
#endif
Original file line number Diff line number Diff line change @@ -29,16 +29,6 @@ class SILFunction;
29
29
class SILBasicBlock ;
30
30
class SingleValueInstruction ;
31
31
32
- void printBitsAsArray (llvm::raw_ostream &OS, const SmallBitVector &bits);
33
-
34
- inline llvm::raw_ostream &operator <<(llvm::raw_ostream &OS,
35
- const SmallBitVector &bits) {
36
- printBitsAsArray (OS, bits);
37
- return OS;
38
- }
39
-
40
- void dumpBits (const SmallBitVector &bits);
41
-
42
32
// / The MemoryLocations utility provides functions to analyze memory locations.
43
33
// /
44
34
// / Memory locations are limited to addresses which are guaranteed to
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ add_swift_host_library(swiftBasic STATIC
67
67
Program .cpp
68
68
QuotedString.cpp
69
69
Sandbox.cpp
70
+ SmallBitVector.cpp
70
71
SourceLoc.cpp
71
72
StableHasher.cpp
72
73
Statistic.cpp
Original file line number Diff line number Diff line change
1
+ // ===--- SmallBitVector.cpp -----------------------------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2022 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ // ===----------------------------------------------------------------------===//
12
+
13
+ #include " swift/Basic/SmallBitVector.h"
14
+ #include " llvm/Support/Debug.h"
15
+
16
+ using namespace llvm ;
17
+
18
+ // / Debug dump a location bit vector.
19
+ void swift::printBitsAsArray (raw_ostream &OS, const SmallBitVector &bits,
20
+ bool bracketed) {
21
+ if (!bracketed) {
22
+ for (unsigned i = 0 , e = bits.size (); i != e; ++i)
23
+ OS << (bits[i] ? ' 1' : ' 0' );
24
+ }
25
+ const char *separator = " " ;
26
+ OS << ' [' ;
27
+ for (int idx = bits.find_first (); idx >= 0 ; idx = bits.find_next (idx)) {
28
+ OS << separator << idx;
29
+ separator = " ," ;
30
+ }
31
+ OS << ' ]' ;
32
+ }
33
+
34
+ void swift::dumpBits (const SmallBitVector &bits) { dbgs () << bits << ' \n ' ; }
Original file line number Diff line number Diff line change 12
12
13
13
#define DEBUG_TYPE " bit-dataflow"
14
14
#include " swift/SIL/BitDataflow.h"
15
+ #include " swift/Basic/SmallBitVector.h"
16
+ #include " swift/SIL/MemoryLocations.h"
15
17
#include " swift/SIL/SILBasicBlock.h"
16
18
#include " swift/SIL/SILFunction.h"
17
- #include " swift/SIL/MemoryLocations.h"
18
19
#include " llvm/Support/raw_ostream.h"
19
20
20
21
using namespace swift ;
Original file line number Diff line number Diff line change 12
12
13
13
#define DEBUG_TYPE " sil-memory-locations"
14
14
#include " swift/SIL/MemoryLocations.h"
15
+ #include " swift/Basic/SmallBitVector.h"
16
+ #include " swift/SIL/ApplySite.h"
15
17
#include " swift/SIL/SILBasicBlock.h"
16
18
#include " swift/SIL/SILFunction.h"
17
- #include " swift/SIL/ApplySite.h"
18
19
#include " swift/SIL/SILModule.h"
19
20
#include " llvm/Support/raw_ostream.h"
20
21
21
22
using namespace swift ;
22
23
23
- // / Debug dump a location bit vector.
24
- void swift::printBitsAsArray (llvm::raw_ostream &OS, const SmallBitVector &bits) {
25
- const char *separator = " " ;
26
- OS << ' [' ;
27
- for (int idx = bits.find_first (); idx >= 0 ; idx = bits.find_next (idx)) {
28
- OS << separator << idx;
29
- separator = " ," ;
30
- }
31
- OS << ' ]' ;
32
- }
33
-
34
- void swift::dumpBits (const SmallBitVector &bits) {
35
- llvm::dbgs () << bits << ' \n ' ;
36
- }
37
-
38
24
namespace swift {
39
25
namespace {
40
26
Original file line number Diff line number Diff line change 20
20
#include " swift/AST/Type.h"
21
21
#include " swift/Basic/FrozenMultiMap.h"
22
22
#include " swift/Basic/ImmutablePointerSet.h"
23
+ #include " swift/Basic/SmallBitVector.h"
23
24
#include " swift/SIL/BasicBlockData.h"
24
25
#include " swift/SIL/BasicBlockDatastructures.h"
25
26
#include " swift/SIL/DynamicCasts.h"
You can’t perform that action at this time.
0 commit comments