LLVM: lib/DebugInfo/LogicalView/Core/LVRange.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

16

17using namespace llvm;

19

20#define DEBUG_TYPE "Range"

21

23 RangesTree.clear();

24

25 LLVM_DEBUG({ dbgs() << "\nRanges Tree entries:\n"; });

26

27

28 for (LVRangeEntry &RangeEntry : RangeEntries) {

32 << "Range: [" << hexValue(RangeEntry.lower()) << ":"

33 << hexValue(RangeEntry.upper()) << "]\n";

34 });

35

36 RangesTree.insert(RangeEntry.lower(), RangeEntry.upper(),

37 RangeEntry.scope());

38 }

39

40

41 RangesTree.create();

42

44 dbgs() << "\nRanges Tree:\n";

45 RangesTree.print(dbgs());

46 });

47}

48

49

50

51

54

55 if (LowerAddress > UpperAddress)

56 std::swap(LowerAddress, UpperAddress);

57

58

59 if (LowerAddress < Lower)

60 Lower = LowerAddress;

61 if (UpperAddress > Upper)

62 Upper = UpperAddress;

63

64

65 RangeEntries.emplace_back(LowerAddress, UpperAddress, Scope);

66}

67

69 assert(Scope && "Scope must not be nullptr");

70

71

77

79 }

80}

81

82

85

90 for (LVRangesTree::find_iterator Iter = RangesTree.find(Address),

91 End = RangesTree.find_end();

92 Iter != End; ++Iter) {

94 { dbgs() << format("[0x%08x,0x%08x] ", Iter->left(), Iter->right()); });

95 Scope = Iter->value();

97 if (Level > TargetLevel) {

98 TargetLevel = Level;

100 }

101 }

102

104

106}

107

108

111 for (const LVRangeEntry &RangeEntry : RangeEntries)

112 if (LowerAddress >= RangeEntry.lower() && UpperAddress < RangeEntry.upper())

113 return RangeEntry.scope();

114 return nullptr;

115}

116

117

119 for (const LVRangeEntry &RangeEntry : RangeEntries)

120 if (LowerAddress == RangeEntry.lower() &&

121 UpperAddress == RangeEntry.upper())

122 return true;

123 return false;

124}

125

126

128 auto CompareRangeEntry = [](const LVRangeEntry &lhs,

130 if (lhs.lower() < rhs.lower())

131 return true;

132

133

134

135 if (lhs.lower() == rhs.lower())

136 return lhs.upper() < rhs.upper();

137

138 return false;

139 };

140

141

143}

144

146 size_t Indentation = 0;

147 for (const LVRangeEntry &RangeEntry : RangeEntries) {

149 Scope->printAttributes(OS, Full);

151 if (Indentation)

152 OS << " ";

153 OS << format("[0x%08x,0x%08x] ", RangeEntry.lower(), RangeEntry.upper())

155 << "\n";

156 }

158}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Target - Wrapper for Target specific information.

size_t indentationSize() const

LVScope * getEntry(LVAddress Address) const

Definition LVRange.cpp:83

bool hasEntry(LVAddress Low, LVAddress High) const

Definition LVRange.cpp:118

void printExtra(raw_ostream &OS, bool Full=true) const override

void print(raw_ostream &OS, bool Full=true) const override

Definition LVRange.cpp:145

void startSearch()

Definition LVRange.cpp:22

void sort()

Definition LVRange.cpp:127

void addEntry(LVScope *Scope, LVAddress LowerAddress, LVAddress UpperAddress)

Definition LVRange.cpp:52

This class implements an extremely fast bulk output stream that can only output to a stream.

FormattedNumber hexValue(uint64_t N, unsigned Width=HEX_WIDTH, bool Upper=false)

std::string formattedKind(StringRef Kind)

std::string formattedName(StringRef Name)

SmallVector< LVLocation *, 8 > LVLocations

This is an optimization pass for GlobalISel generic memory operations.

void stable_sort(R &&Range)

FormattedNumber format_decimal(int64_t N, unsigned Width)

format_decimal - Output N as a right justified, fixed-width decimal.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

format_object< Ts... > format(const char *Fmt, const Ts &... Vals)

These are helper functions used to produce formatted output.

void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)

Implement std::swap in terms of BitVector swap.