brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · e651e92 Raw
50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h"10#include "llvm/SandboxIR/Instruction.h"11#include "llvm/Support/Compiler.h"12#include "llvm/Support/Debug.h"13#include "llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h"14 15namespace llvm::sandboxir {16 17template <typename T> bool Interval<T>::disjoint(const Interval &Other) const {18  if (Other.empty())19    return true;20  if (empty())21    return true;22  return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);23}24 25#ifndef NDEBUG26template <typename T> void Interval<T>::print(raw_ostream &OS) const {27  auto *Top = top();28  auto *Bot = bottom();29  OS << "Top: ";30  if (Top != nullptr)31    OS << *Top;32  else33    OS << "nullptr";34  OS << "\n";35 36  OS << "Bot: ";37  if (Bot != nullptr)38    OS << *Bot;39  else40    OS << "nullptr";41  OS << "\n";42}43template <typename T> void Interval<T>::dump() const { print(dbgs()); }44#endif45 46template class LLVM_EXPORT_TEMPLATE Interval<Instruction>;47template class LLVM_EXPORT_TEMPLATE Interval<MemDGNode>;48 49} // namespace llvm::sandboxir50