SHL 2.2.x
Loading...
Searching...
No Matches
shl_node.h
1/*
2 * Copyright (C) 2016-2023 T-Head Semiconductor Co., Ltd. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19/* SHL version 2.2.x */
20
21#ifndef INCLUDE_SHL_NODE_H_
22#define INCLUDE_SHL_NODE_H_
23
24struct shl_node {
25 int type;
26 struct shl_node **in;
27 struct shl_node **out;
28 int subgraph_idx;
29 int in_num;
30 int out_num;
31 char *name;
32 void *data;
33 int ref_count;
34 int ref_count_init;
35 int visited;
36 int *restricted_map;
37 int restricted_map_num;
38};
39
40/* node */
41struct shl_node *shl_node_alloc(int node_type, char *name, int in_num, int out_num, void *data);
42struct shl_node *shl_node_var_alloc(char *name, void *data);
43struct shl_node *shl_node_const_var_alloc(char *name, void *data);
44int shl_node_free(struct shl_node *node);
45int shl_node_add_in(struct shl_node *node, struct shl_node *in, int index);
46int shl_node_add_out(struct shl_node *node, struct shl_node *out, int index);
47int shl_node_get_in_number(struct shl_node *node);
48int shl_node_get_out_number(struct shl_node *node);
49int shl_node_get_non_const_in_number(struct shl_node *node);
50struct shl_node *shl_node_get_in(struct shl_node *node, int index);
51struct shl_node *shl_node_get_out(struct shl_node *node, int index);
52int shl_node_restrict_map_insert(int value, struct shl_node *node);
53int shl_node_find(struct shl_node **list, int len, struct shl_node *node);
54
55#endif // INCLUDE_SHL_NODE_H_