LLVM 22.0.0git
LVRange.h
Go to the documentation of this file.
1//===-- LVRange.h -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the LVRange class, which is used to describe a debug
10// information range.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVRANGE_H
15#define LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVRANGE_H
16
20
21namespace llvm {
22namespace logicalview {
23
24using LVAddressRange = std::pair<LVAddress, LVAddress>;
25
26class LVRangeEntry final {
27 LVAddress Lower = 0;
28 LVAddress Upper = 0;
29 LVScope *Scope = nullptr;
30
31public:
33
34 LVRangeEntry() = delete;
35 LVRangeEntry(LVAddress LowerAddress, LVAddress UpperAddress, LVScope *Scope)
36 : Lower(LowerAddress), Upper(UpperAddress), Scope(Scope) {}
37
38 RangeType lower() const { return Lower; }
39 RangeType upper() const { return Upper; }
41 return LVAddressRange(lower(), upper());
42 }
43 LVScope *scope() const { return Scope; }
44};
45
46// Class to represent a list of range addresses associated with a
47// scope; the addresses are stored in ascending order and can overlap.
48using LVRangeEntries = std::vector<LVRangeEntry>;
49
50class LLVM_ABI LVRange final : public LVObject {
51 /// Map of where a user value is live, and its location.
54
56 LVRangesTree RangesTree;
57 LVRangeEntries RangeEntries;
58 LVAddress Lower = MaxAddress;
59 LVAddress Upper = 0;
60
61public:
62 LVRange() : LVObject(), RangesTree(Allocator) {}
63 LVRange(const LVRange &) = delete;
64 LVRange &operator=(const LVRange &) = delete;
65 ~LVRange() = default;
66
67 void addEntry(LVScope *Scope, LVAddress LowerAddress, LVAddress UpperAddress);
68 void addEntry(LVScope *Scope);
69 LVScope *getEntry(LVAddress Address) const;
70 LVScope *getEntry(LVAddress LowerAddress, LVAddress UpperAddress) const;
71 bool hasEntry(LVAddress Low, LVAddress High) const;
72 LVAddress getLower() const { return Lower; }
73 LVAddress getUpper() const { return Upper; }
74
75 const LVRangeEntries &getEntries() const { return RangeEntries; }
76
77 void clear() {
78 RangeEntries.clear();
79 Lower = MaxAddress;
80 Upper = 0;
81 }
82 bool empty() const { return RangeEntries.empty(); }
83 void sort();
84
85 void startSearch();
86 void endSearch() {}
87
88 void print(raw_ostream &OS, bool Full = true) const override;
89 void printExtra(raw_ostream &OS, bool Full = true) const override {}
90};
91
92} // end namespace logicalview
93} // end namespace llvm
94
95#endif // LLVM_DEBUGINFO_LOGICALVIEW_CORE_LVRANGE_H
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_ABI
Definition: Compiler.h:213
uint64_t High
Basic Register Allocator
raw_pwrite_stream & OS
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
LVRangeEntry(LVAddress LowerAddress, LVAddress UpperAddress, LVScope *Scope)
Definition: LVRange.h:35
LVAddressRange addressRange() const
Definition: LVRange.h:40
RangeType lower() const
Definition: LVRange.h:38
RangeType upper() const
Definition: LVRange.h:39
LVScope * scope() const
Definition: LVRange.h:43
void printExtra(raw_ostream &OS, bool Full=true) const override
Definition: LVRange.h:89
const LVRangeEntries & getEntries() const
Definition: LVRange.h:75
bool empty() const
Definition: LVRange.h:82
LVRange & operator=(const LVRange &)=delete
LVAddress getLower() const
Definition: LVRange.h:72
LVRange(const LVRange &)=delete
LVAddress getUpper() const
Definition: LVRange.h:73
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
const LVAddress MaxAddress
Definition: LVObject.h:95
std::pair< LVAddress, LVAddress > LVAddressRange
Definition: LVRange.h:24
std::vector< LVRangeEntry > LVRangeEntries
Definition: LVRange.h:48
uint64_t LVAddress
Definition: LVObject.h:37
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1669