1 /*
2  * Copyright (c) 2017-2018, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #ifndef VERIFY_H_
19 #define VERIFY_H_
20 
21 #include "universal.h"
22 
23 #if DEBUG
24 #define P(X) X;
25 #else
26 #define P(X) INLINE static X {}
27 #endif
28 
29 /**
30    \brief VERIFY_LEVEL specifies the depth to which to verify ILI.
31 
32    Deeper levels require more time.  A good strategy is to choose a depth for
33    which the verification time can be amortized against compiler work that have
34    happened since the last verification.
35  */
36 typedef enum VERIFY_LEVEL {
37   VERIFY_BLOCK,       /**< Verify down to blocks, but no deeper. */
38   VERIFY_ILT,         /**< Verify down to ILTs. */
39   VERIFY_ILI_SHALLOW, /**< Verify down to first ILI encountered. */
40   VERIFY_ILI_DEEP     /**< Verify down to ILI leaves. */
41 } VERIFY_LEVEL;
42 
43 /**
44    \brief Verify that a block is structurally correct down to given level.
45  */
46 P(void verify_block(int bihx, VERIFY_LEVEL level))
47 
48 /**
49    \brief Verify that function is structurally correct down to given level.
50  */
51 P(void verify_function_ili(VERIFY_LEVEL level))
52 
53 /**
54    \brief Verify that ILI nodes is structurally correct down to given level.
55  */
56 P(void verify_ili(int ilix, VERIFY_LEVEL level))
57 
58 /**
59    \brief Verify that an ILT is structurally correct down to given level.
60  */
61 P(void verify_ilt(int iltx, VERIFY_LEVEL level))
62 
63 #undef P
64 #endif // VERIFY_H_
65