LLVM 20.0.0git
Interval.cpp
Go to the documentation of this file.
1//===- Interval.cpp -------------------------------------------------------===//
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
11#include "llvm/Support/Debug.h"
13
14namespace llvm::sandboxir {
15
16template <typename T> bool Interval<T>::disjoint(const Interval &Other) const {
17 if (Other.empty())
18 return true;
19 if (empty())
20 return true;
21 return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);
22}
23
24#ifndef NDEBUG
25template <typename T> void Interval<T>::print(raw_ostream &OS) const {
26 auto *Top = top();
27 auto *Bot = bottom();
28 OS << "Top: ";
29 if (Top != nullptr)
30 OS << *Top;
31 else
32 OS << "nullptr";
33 OS << "\n";
34
35 OS << "Bot: ";
36 if (Bot != nullptr)
37 OS << *Bot;
38 else
39 OS << "nullptr";
40 OS << "\n";
41}
42template <typename T> void Interval<T>::dump() const { print(dbgs()); }
43#endif
44
45template class Interval<Instruction>;
46template class Interval<MemDGNode>;
47
48} // namespace llvm::sandboxir
raw_pwrite_stream & OS
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
@ Other
Any other memory.