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 9 #include "llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h" 10 #include "llvm/SandboxIR/Instruction.h" 11 #include "llvm/Support/Debug.h" 12 #include "llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h" 13 14 namespace llvm::sandboxir { 15 16 template class Interval<Instruction>; 17 template class Interval<MemDGNode>; 18 19 template <typename T> bool Interval<T>::disjoint(const Interval &Other) const { 20 if (Other.empty()) 21 return true; 22 if (empty()) 23 return true; 24 return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top); 25 } 26 27 #ifndef NDEBUG 28 template <typename T> void Interval<T>::print(raw_ostream &OS) const { 29 auto *Top = top(); 30 auto *Bot = bottom(); 31 OS << "Top: "; 32 if (Top != nullptr) 33 OS << *Top; 34 else 35 OS << "nullptr"; 36 OS << "\n"; 37 38 OS << "Bot: "; 39 if (Bot != nullptr) 40 OS << *Bot; 41 else 42 OS << "nullptr"; 43 OS << "\n"; 44 } 45 template <typename T> void Interval<T>::dump() const { print(dbgs()); } 46 #endif 47 } // namespace llvm::sandboxir 48