2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief Check types and entities for correctness.
24 * @author Michael Beck, Goetz Lindenmaier
27 #ifndef FIRM_TR_TRVRFY_H
28 #define FIRM_TR_TRVRFY_H
30 #include "firm_types.h"
33 * possible trvrfy() error codes
35 enum trvrfy_error_codes {
36 no_error = 0, /**< no error */
37 error_ent_not_cont, /**< overwritten entity not in superclass */
38 error_null_mem, /**< compound contains NULL member */
39 error_const_on_wrong_irg, /**< constant placed on wrong IRG */
40 error_existent_entity_without_irg, /**< Method entities with pecularity_exist must have an irg */
41 error_wrong_ent_overwrites, /**< number of entity overwrites exceeds number of class overwrites */
42 error_inherited_ent_without_const, /**< inherited method entity not pointing to existent entity */
43 error_glob_ent_allocation, /**< wrong allocation of a global entity */
44 error_ent_const_mode, /**< Mode of constant in entity did not match entities type. */
45 error_ent_wrong_owner /**< Mode of constant in entity did not match entities type. */
52 * 0 if no error encountered
54 int check_type(ir_type *tp);
57 * Check an entity. Currently, we check only if initialized constants
58 * are build on the const irg graph.
61 * 0 if no error encountered
62 * != 0 a trvrfy_error_codes code
64 int check_entity(ir_entity *ent);
67 * Walks the type information and performs a set of sanity checks.
69 * Currently, the following checks are executed:
70 * - values of initialized entities must be allocated on the constant IRG
71 * - class types: doesn't have NULL members
72 * - class types: all overwrites are existent in the super type
75 * 0 if graph is correct
81 * If NDEBUG is defined performs nothing, else calls the tr_vrfy() function.
86 #define TR_VRFY() tr_vrfy()
89 #endif /* FIRM_TR_TRVRFY_H */