blob: 35ec85f13b27c562686a106906b6bed7795431cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
//===- ConstraintAnalysisGraphTraits.h - Traits for CAGs --------*- C++ -*-===//
//
// Part of the MLIR 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
//
//===----------------------------------------------------------------------===//
//
// Provides graph traits for constraint analysis graphs.
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_QUANTIZER_SUPPORT_CONSTRAINTANALYSISGRAPHTRAITS_H
#define MLIR_QUANTIZER_SUPPORT_CONSTRAINTANALYSISGRAPHTRAITS_H
#include "mlir/Quantizer/Support/ConstraintAnalysisGraph.h"
#include "llvm/ADT/GraphTraits.h"
namespace llvm {
template <>
struct GraphTraits<const mlir::quantizer::CAGNode *> {
using NodeRef = const mlir::quantizer::CAGNode *;
static NodeRef getEntryNode(NodeRef node) { return node; }
// Successors.
using ChildIteratorType = mlir::quantizer::CAGNode::const_iterator;
static ChildIteratorType child_begin(NodeRef node) { return node->begin(); }
static ChildIteratorType child_end(NodeRef node) { return node->end(); }
};
template <>
struct GraphTraits<const mlir::quantizer::CAGSlice *>
: public llvm::GraphTraits<const mlir::quantizer::CAGNode *> {
using nodes_iterator = mlir::quantizer::CAGSlice::const_iterator;
static mlir::quantizer::CAGSlice::const_iterator
nodes_begin(const mlir::quantizer::CAGSlice *G) {
return G->begin();
}
static mlir::quantizer::CAGSlice::const_iterator
nodes_end(const mlir::quantizer::CAGSlice *G) {
return G->end();
}
};
} // end namespace llvm
#endif // MLIR_QUANTIZER_SUPPORT_CONSTRAINTANALYSISGRAPHTRAITS_H
|