Vasileios Porpodas acf6072fae Reapply "[SandboxVec][Interval][NFC] Move a few definitions from header to .cpp"
This reverts commit 069fbeb82f56f0ce7c0382dfd5d4fa4dc1983a13.
2025-01-15 16:38:37 -08:00

49 lines
1.3 KiB
C++

//===- Interval.cpp -------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h"
#include "llvm/SandboxIR/Instruction.h"
#include "llvm/Support/Debug.h"
#include "llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h"
namespace llvm::sandboxir {
template <typename T> bool Interval<T>::disjoint(const Interval &Other) const {
if (Other.empty())
return true;
if (empty())
return true;
return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);
}
#ifndef NDEBUG
template <typename T> void Interval<T>::print(raw_ostream &OS) const {
auto *Top = top();
auto *Bot = bottom();
OS << "Top: ";
if (Top != nullptr)
OS << *Top;
else
OS << "nullptr";
OS << "\n";
OS << "Bot: ";
if (Bot != nullptr)
OS << *Bot;
else
OS << "nullptr";
OS << "\n";
}
template <typename T> void Interval<T>::dump() const { print(dbgs()); }
#endif
template class Interval<Instruction>;
template class Interval<MemDGNode>;
} // namespace llvm::sandboxir