Skip to content

Commit acf6072

Browse files
committed
Reapply "[SandboxVec][Interval][NFC] Move a few definitions from header to .cpp"
This reverts commit 069fbeb.
1 parent b7722fb commit acf6072

File tree

2 files changed

+30
-26
lines changed
  • llvm
    • include/llvm/Transforms/Vectorize/SandboxVectorizer
    • lib/Transforms/Vectorize/SandboxVectorizer

2 files changed

+30
-26
lines changed

llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Interval.h

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,7 @@ template <typename T> class Interval {
136136
return bottom()->comesBefore(Other.top());
137137
}
138138
/// \Returns true if this and \p Other have nothing in common.
139-
bool disjoint(const Interval &Other) const {
140-
if (Other.empty())
141-
return true;
142-
if (empty())
143-
return true;
144-
return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(Other.Top);
145-
}
139+
bool disjoint(const Interval &Other) const;
146140
/// \Returns the intersection between this and \p Other.
147141
// Example:
148142
// |----| this
@@ -232,23 +226,7 @@ template <typename T> class Interval {
232226
}
233227

234228
#ifndef NDEBUG
235-
void print(raw_ostream &OS) const {
236-
auto *Top = top();
237-
auto *Bot = bottom();
238-
OS << "Top: ";
239-
if (Top != nullptr)
240-
OS << *Top;
241-
else
242-
OS << "nullptr";
243-
OS << "\n";
244-
245-
OS << "Bot: ";
246-
if (Bot != nullptr)
247-
OS << *Bot;
248-
else
249-
OS << "nullptr";
250-
OS << "\n";
251-
}
229+
void print(raw_ostream &OS) const;
252230
LLVM_DUMP_METHOD void dump() const;
253231
#endif
254232
};

llvm/lib/Transforms/Vectorize/SandboxVectorizer/Interval.cpp

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,36 @@
1313

1414
namespace llvm::sandboxir {
1515

16-
template class Interval<Instruction>;
17-
template class Interval<MemDGNode>;
16+
template <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+
}
1823

1924
#ifndef NDEBUG
25+
template <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+
}
2042
template <typename T> void Interval<T>::dump() const { print(dbgs()); }
2143
#endif
44+
45+
template class Interval<Instruction>;
46+
template class Interval<MemDGNode>;
47+
2248
} // namespace llvm::sandboxir

0 commit comments

Comments
 (0)