^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef GCC_COMMON_H_INCLUDED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define GCC_COMMON_H_INCLUDED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include "bversion.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #if BUILDING_GCC_VERSION >= 6000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include "gcc-plugin.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include "plugin.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "plugin-version.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "config.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "system.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "coretypes.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "tm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "line-map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "input.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include "tree.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "tree-inline.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include "version.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "rtl.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "tm_p.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include "flags.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include "hard-reg-set.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include "output.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include "except.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include "function.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include "toplev.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #if BUILDING_GCC_VERSION >= 5000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include "expr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include "basic-block.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include "intl.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include "ggc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include "timevar.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #if BUILDING_GCC_VERSION < 10000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include "params.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #if BUILDING_GCC_VERSION <= 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include "pointer-set.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include "hash-map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #if BUILDING_GCC_VERSION >= 7000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include "memmodel.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include "emit-rtl.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include "debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #include "target.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #include "langhooks.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #include "cfgloop.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #include "cgraph.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #include "opts.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #if BUILDING_GCC_VERSION == 4005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #include <sys/mman.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #if BUILDING_GCC_VERSION >= 4007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #include "tree-pretty-print.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #include "gimple-pretty-print.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #if BUILDING_GCC_VERSION >= 4006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * The c-family headers were moved into a subdirectory in GCC version
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * 4.7, but most plugin-building users of GCC 4.6 are using the Debian
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) * or Ubuntu package, which has an out-of-tree patch to move this to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * same location as found in 4.7 and later:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * https://sources.debian.net/src/gcc-4.6/4.6.3-14/debian/patches/pr45078.diff/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #include "c-family/c-common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) #include "c-common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #if BUILDING_GCC_VERSION <= 4008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #include "tree-flow.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) #include "tree-cfgcleanup.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) #include "tree-ssa-operands.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) #include "tree-into-ssa.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) #if BUILDING_GCC_VERSION >= 4008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) #include "is-a.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #include "diagnostic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #include "tree-dump.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #include "tree-pass.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #if BUILDING_GCC_VERSION >= 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #include "pass_manager.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #include "predict.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #include "ipa-utils.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #if BUILDING_GCC_VERSION >= 8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #include "stringpool.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #if BUILDING_GCC_VERSION >= 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #include "attribs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #include "varasm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #include "stor-layout.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) #include "internal-fn.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #include "gimple-expr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #include "gimple-fold.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #include "context.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #include "tree-ssa-alias.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #include "tree-ssa.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #include "stringpool.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #if BUILDING_GCC_VERSION >= 7000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #include "tree-vrp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #include "tree-ssanames.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #include "print-tree.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #include "tree-eh.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #include "stmt.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #include "gimplify.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #include "gimple.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) #if BUILDING_GCC_VERSION >= 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #include "tree-ssa-operands.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #include "tree-phinodes.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #include "tree-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #include "gimple-iterator.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) #include "gimple-ssa.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #include "ssa-iterators.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) #if BUILDING_GCC_VERSION >= 5000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #include "builtins.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) /* missing from basic_block.h... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) void debug_dominance_info(enum cdi_direction dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) void debug_dominance_tree(enum cdi_direction dir, basic_block root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #if BUILDING_GCC_VERSION == 4006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) void debug_gimple_stmt(gimple);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) void debug_gimple_seq(gimple_seq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) void print_gimple_seq(FILE *, gimple_seq, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) void print_gimple_stmt(FILE *, gimple, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) void print_gimple_expr(FILE *, gimple, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) void dump_gimple_stmt(pretty_printer *, gimple, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #ifndef __unused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define __unused __attribute__((__unused__))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) #ifndef __visible
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) #define __visible __attribute__((visibility("default")))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) #define DECL_NAME_POINTER(node) IDENTIFIER_POINTER(DECL_NAME(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) #define DECL_NAME_LENGTH(node) IDENTIFIER_LENGTH(DECL_NAME(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #define TYPE_NAME_POINTER(node) IDENTIFIER_POINTER(TYPE_NAME(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #define TYPE_NAME_LENGTH(node) IDENTIFIER_LENGTH(TYPE_NAME(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /* should come from c-tree.h if only it were installed for gcc 4.5... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) #define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static inline tree build_const_char_string(int len, const char *str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) tree cstr, elem, index, type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) cstr = build_string(len, str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) elem = build_type_variant(char_type_node, 1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) index = build_index_type(size_int(len - 1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) type = build_array_type(elem, index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) TREE_TYPE(cstr) = type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) TREE_CONSTANT(cstr) = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) TREE_READONLY(cstr) = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) TREE_STATIC(cstr) = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return cstr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #define PASS_INFO(NAME, REF, ID, POS) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) struct register_pass_info NAME##_pass_info = { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) .pass = make_##NAME##_pass(), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) .reference_pass_name = REF, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) .ref_pass_instance_number = ID, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) .pos_op = POS, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) #if BUILDING_GCC_VERSION == 4005
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #define FOR_EACH_LOCAL_DECL(FUN, I, D) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) for (tree vars = (FUN)->local_decls, (I) = 0; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) vars && ((D) = TREE_VALUE(vars)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) vars = TREE_CHAIN(vars), (I)++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define DECL_CHAIN(NODE) (TREE_CHAIN(DECL_MINIMAL_CHECK(NODE)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) #define FOR_EACH_VEC_ELT(T, V, I, P) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) for (I = 0; VEC_iterate(T, (V), (I), (P)); ++(I))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) #define TODO_rebuild_cgraph_edges 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #define SCOPE_FILE_SCOPE_P(EXP) (!(EXP))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) #ifndef O_BINARY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #define O_BINARY 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) typedef struct varpool_node *varpool_node_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static inline bool gimple_call_builtin_p(gimple stmt, enum built_in_function code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) tree fndecl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if (!is_gimple_call(stmt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) fndecl = gimple_call_fndecl(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) if (!fndecl || DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) return DECL_FUNCTION_CODE(fndecl) == code;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static inline bool is_simple_builtin(tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) if (decl && DECL_BUILT_IN_CLASS(decl) != BUILT_IN_NORMAL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) switch (DECL_FUNCTION_CODE(decl)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) /* Builtins that expand to constants. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) case BUILT_IN_CONSTANT_P:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) case BUILT_IN_EXPECT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) case BUILT_IN_OBJECT_SIZE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) case BUILT_IN_UNREACHABLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) /* Simple register moves or loads from stack. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) case BUILT_IN_RETURN_ADDRESS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) case BUILT_IN_EXTRACT_RETURN_ADDR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) case BUILT_IN_FROB_RETURN_ADDR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) case BUILT_IN_RETURN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) case BUILT_IN_AGGREGATE_INCOMING_ADDRESS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) case BUILT_IN_FRAME_ADDRESS:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) case BUILT_IN_VA_END:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) case BUILT_IN_STACK_SAVE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) case BUILT_IN_STACK_RESTORE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) /* Exception state returns or moves registers around. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) case BUILT_IN_EH_FILTER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) case BUILT_IN_EH_POINTER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) case BUILT_IN_EH_COPY_VALUES:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) static inline void add_local_decl(struct function *fun, tree d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) gcc_assert(TREE_CODE(d) == VAR_DECL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #if BUILDING_GCC_VERSION <= 4006
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #define ANY_RETURN_P(rtx) (GET_CODE(rtx) == RETURN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) #define C_DECL_REGISTER(EXP) DECL_LANG_FLAG_4(EXP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) #define EDGE_PRESERVE 0ULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #define HOST_WIDE_INT_PRINT_HEX_PURE "%" HOST_WIDE_INT_PRINT "x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #define flag_fat_lto_objects true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #define get_random_seed(noinit) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) unsigned HOST_WIDE_INT seed; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) sscanf(get_random_seed(noinit), "%" HOST_WIDE_INT_PRINT "x", &seed); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) seed * seed; })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #define int_const_binop(code, arg1, arg2) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) int_const_binop((code), (arg1), (arg2), 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) static inline bool gimple_clobber_p(gimple s __unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) static inline bool gimple_asm_clobbers_memory_p(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) unsigned i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) for (i = 0; i < gimple_asm_nclobbers(stmt); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) tree op = gimple_asm_clobber_op(stmt, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) if (!strcmp(TREE_STRING_POINTER(TREE_VALUE(op)), "memory"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) static inline tree builtin_decl_implicit(enum built_in_function fncode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) return implicit_built_in_decls[fncode];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) static inline int ipa_reverse_postorder(struct cgraph_node **order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) return cgraph_postorder(order);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) static inline struct cgraph_node *cgraph_create_node(tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) return cgraph_node(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) static inline struct cgraph_node *cgraph_get_create_node(tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) struct cgraph_node *node = cgraph_get_node(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) return node ? node : cgraph_node(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) static inline bool cgraph_function_with_gimple_body_p(struct cgraph_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) return node->analyzed && !node->thunk.thunk_p && !node->alias;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) static inline struct cgraph_node *cgraph_first_function_with_gimple_body(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) struct cgraph_node *node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) for (node = cgraph_nodes; node; node = node->next)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) if (cgraph_function_with_gimple_body_p(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) return node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct cgraph_node *node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) for (node = node->next; node; node = node->next)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) if (cgraph_function_with_gimple_body_p(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) return node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) cgraph_node_ptr alias;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) if (callback(node, data))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) for (alias = node->same_body; alias; alias = alias->next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) if (include_overwritable || cgraph_function_body_availability(alias) > AVAIL_OVERWRITABLE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) if (cgraph_for_node_and_aliases(alias, callback, data, include_overwritable))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) for ((node) = cgraph_first_function_with_gimple_body(); (node); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) (node) = cgraph_next_function_with_gimple_body(node))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) static inline void varpool_add_new_variable(tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) varpool_finalize_decl(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) #if BUILDING_GCC_VERSION <= 4007
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) #define FOR_EACH_FUNCTION(node) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) for (node = cgraph_nodes; node; node = node->next)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) #define FOR_EACH_VARIABLE(node) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) for (node = varpool_nodes; node; node = node->next)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) #define PROP_loops 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) #define NODE_SYMBOL(node) (node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) #define NODE_DECL(node) (node)->decl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) #define INSN_LOCATION(INSN) RTL_LOCATION(INSN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) #define vNULL NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) static inline int bb_loop_depth(const_basic_block bb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) return bb->loop_father ? loop_depth(bb->loop_father) : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) static inline bool gimple_store_p(gimple gs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) tree lhs = gimple_get_lhs(gs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) return lhs && !is_gimple_reg(lhs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) static inline void gimple_init_singleton(gimple g __unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) #if BUILDING_GCC_VERSION == 4007 || BUILDING_GCC_VERSION == 4008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) static inline struct cgraph_node *cgraph_alias_target(struct cgraph_node *n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) return cgraph_alias_aliased_node(n);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) #if BUILDING_GCC_VERSION <= 4008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) #define ENTRY_BLOCK_PTR_FOR_FN(FN) ENTRY_BLOCK_PTR_FOR_FUNCTION(FN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) #define EXIT_BLOCK_PTR_FOR_FN(FN) EXIT_BLOCK_PTR_FOR_FUNCTION(FN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) #define basic_block_info_for_fn(FN) ((FN)->cfg->x_basic_block_info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) #define n_basic_blocks_for_fn(FN) ((FN)->cfg->x_n_basic_blocks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) #define n_edges_for_fn(FN) ((FN)->cfg->x_n_edges)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) #define last_basic_block_for_fn(FN) ((FN)->cfg->x_last_basic_block)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) #define label_to_block_map_for_fn(FN) ((FN)->cfg->x_label_to_block_map)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) #define profile_status_for_fn(FN) ((FN)->cfg->x_profile_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) #define BASIC_BLOCK_FOR_FN(FN, N) BASIC_BLOCK_FOR_FUNCTION((FN), (N))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) #define NODE_IMPLICIT_ALIAS(node) (node)->same_body_alias
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) #define VAR_P(NODE) (TREE_CODE(NODE) == VAR_DECL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) static inline bool tree_fits_shwi_p(const_tree t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if (TREE_INT_CST_HIGH(t) == 0 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) if (TREE_INT_CST_HIGH(t) == -1 && (HOST_WIDE_INT)TREE_INT_CST_LOW(t) < 0 && !TYPE_UNSIGNED(TREE_TYPE(t)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) return true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) static inline bool tree_fits_uhwi_p(const_tree t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) if (t == NULL_TREE || TREE_CODE(t) != INTEGER_CST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) return false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) return TREE_INT_CST_HIGH(t) == 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) static inline HOST_WIDE_INT tree_to_shwi(const_tree t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) gcc_assert(tree_fits_shwi_p(t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) return TREE_INT_CST_LOW(t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) static inline unsigned HOST_WIDE_INT tree_to_uhwi(const_tree t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) gcc_assert(tree_fits_uhwi_p(t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) return TREE_INT_CST_LOW(t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) static inline const char *get_tree_code_name(enum tree_code code)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) gcc_assert(code < MAX_TREE_CODES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) return tree_code_name[code];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) #define ipa_remove_stmt_references(cnode, stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) typedef union gimple_statement_d gasm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) typedef union gimple_statement_d gassign;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) typedef union gimple_statement_d gcall;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) typedef union gimple_statement_d gcond;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) typedef union gimple_statement_d gdebug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) typedef union gimple_statement_d ggoto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) typedef union gimple_statement_d gphi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) typedef union gimple_statement_d greturn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) static inline gasm *as_a_gasm(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) static inline const gasm *as_a_const_gasm(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) static inline gassign *as_a_gassign(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) static inline const gassign *as_a_const_gassign(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) static inline gcall *as_a_gcall(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) static inline const gcall *as_a_const_gcall(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) static inline gcond *as_a_gcond(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) static inline const gcond *as_a_const_gcond(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) static inline gdebug *as_a_gdebug(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) static inline ggoto *as_a_ggoto(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) static inline gphi *as_a_gphi(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) static inline const gphi *as_a_const_gphi(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) static inline greturn *as_a_greturn(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) static inline const greturn *as_a_const_greturn(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) #if BUILDING_GCC_VERSION == 4008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) #define NODE_SYMBOL(node) (&(node)->symbol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) #define NODE_DECL(node) (node)->symbol.decl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) #if BUILDING_GCC_VERSION >= 4008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) #define add_referenced_var(var)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) #define mark_sym_for_renaming(var)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) #define varpool_mark_needed_node(node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) #define create_var_ann(var)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) #define TODO_dump_func 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) #define TODO_dump_cgraph 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) #if BUILDING_GCC_VERSION <= 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) #define TODO_verify_il 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) #define AVAIL_INTERPOSABLE AVAIL_OVERWRITABLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) #define section_name_prefix LTO_SECTION_NAME_PREFIX
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) #define fatal_error(loc, gmsgid, ...) fatal_error((gmsgid), __VA_ARGS__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) rtx emit_move_insn(rtx x, rtx y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) typedef struct rtx_def rtx_insn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) static inline const char *get_decl_section_name(const_tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) if (DECL_SECTION_NAME(decl) == NULL_TREE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) return TREE_STRING_POINTER(DECL_SECTION_NAME(decl));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) static inline void set_decl_section_name(tree node, const char *value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) if (value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) DECL_SECTION_NAME(node) = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) #if BUILDING_GCC_VERSION == 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) typedef struct gimple_statement_asm gasm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) typedef struct gimple_statement_base gassign;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) typedef struct gimple_statement_call gcall;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) typedef struct gimple_statement_base gcond;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) typedef struct gimple_statement_base gdebug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) typedef struct gimple_statement_base ggoto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) typedef struct gimple_statement_phi gphi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) typedef struct gimple_statement_base greturn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) static inline gasm *as_a_gasm(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) return as_a<gasm>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) static inline const gasm *as_a_const_gasm(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) return as_a<const gasm>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) static inline gassign *as_a_gassign(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) static inline const gassign *as_a_const_gassign(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) static inline gcall *as_a_gcall(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) return as_a<gcall>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) static inline const gcall *as_a_const_gcall(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) return as_a<const gcall>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) static inline gcond *as_a_gcond(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) static inline const gcond *as_a_const_gcond(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) static inline gdebug *as_a_gdebug(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) static inline const gdebug *as_a_const_gdebug(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) static inline ggoto *as_a_ggoto(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) static inline gphi *as_a_gphi(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) return as_a<gphi>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) static inline const gphi *as_a_const_gphi(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) return as_a<const gphi>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) static inline greturn *as_a_greturn(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) static inline const greturn *as_a_const_greturn(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) return stmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) #if BUILDING_GCC_VERSION >= 4009
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) #define TODO_ggc_collect 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) #define NODE_SYMBOL(node) (node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) #define NODE_DECL(node) (node)->decl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) #define cgraph_node_name(node) (node)->name()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) #define NODE_IMPLICIT_ALIAS(node) (node)->cpp_implicit_alias
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) static inline opt_pass *get_pass_for_id(int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) return g->get_passes()->get_pass_for_id(id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) #if BUILDING_GCC_VERSION >= 5000 && BUILDING_GCC_VERSION < 6000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) /* gimple related */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) template <>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) template <>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) inline bool is_a_helper<const gassign *>::test(const_gimple gs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) return gs->code == GIMPLE_ASSIGN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) #if BUILDING_GCC_VERSION >= 5000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) #define TODO_verify_ssa TODO_verify_il
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) #define TODO_verify_flow TODO_verify_il
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) #define TODO_verify_stmts TODO_verify_il
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) #define TODO_verify_rtl_sharing TODO_verify_il
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) #define INSN_DELETED_P(insn) (insn)->deleted()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) static inline const char *get_decl_section_name(const_tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) return DECL_SECTION_NAME(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) /* symtab/cgraph related */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) #define debug_cgraph_node(node) (node)->debug()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) #define cgraph_get_node(decl) cgraph_node::get(decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) #define cgraph_get_create_node(decl) cgraph_node::get_create(decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) #define cgraph_create_node(decl) cgraph_node::create(decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) #define cgraph_n_nodes symtab->cgraph_count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) #define cgraph_max_uid symtab->cgraph_max_uid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) #define varpool_get_node(decl) varpool_node::get(decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) #define dump_varpool_node(file, node) (node)->dump(file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) #if BUILDING_GCC_VERSION >= 8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) #define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) (caller)->create_edge((callee), (call_stmt), (count))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) #define cgraph_create_edge_including_clones(caller, callee, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) old_call_stmt, call_stmt, count, freq, reason) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) (caller)->create_edge_including_clones((callee), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) (old_call_stmt), (call_stmt), (count), (reason))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) #define cgraph_create_edge(caller, callee, call_stmt, count, freq) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) (caller)->create_edge((callee), (call_stmt), (count), (freq))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) #define cgraph_create_edge_including_clones(caller, callee, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) old_call_stmt, call_stmt, count, freq, reason) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) (caller)->create_edge_including_clones((callee), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) (old_call_stmt), (call_stmt), (count), (freq), (reason))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) typedef struct cgraph_node *cgraph_node_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) typedef struct cgraph_edge *cgraph_edge_p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) typedef struct varpool_node *varpool_node_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) static inline void change_decl_assembler_name(tree decl, tree name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) symtab->change_decl_assembler_name(decl, name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) static inline void varpool_finalize_decl(tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) varpool_node::finalize_decl(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) static inline void varpool_add_new_variable(tree decl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) varpool_node::add(decl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) static inline unsigned int rebuild_cgraph_edges(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) return cgraph_edge::rebuild_edges();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) return node->function_symbol(availability);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) static inline cgraph_node_ptr cgraph_function_or_thunk_node(cgraph_node_ptr node, enum availability *availability = NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) return node->ultimate_alias_target(availability);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) static inline bool cgraph_only_called_directly_p(cgraph_node_ptr node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) return node->only_called_directly_p();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) static inline enum availability cgraph_function_body_availability(cgraph_node_ptr node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) return node->get_availability();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) return node->get_alias_target();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) static inline bool cgraph_for_node_and_aliases(cgraph_node_ptr node, bool (*callback)(cgraph_node_ptr, void *), void *data, bool include_overwritable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) return node->call_for_symbol_thunks_and_aliases(callback, data, include_overwritable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799) return symtab->add_cgraph_insertion_hook(hook, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) static inline void cgraph_remove_function_insertion_hook(struct cgraph_node_hook_list *entry)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) symtab->remove_cgraph_insertion_hook(entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) static inline struct cgraph_node_hook_list *cgraph_add_node_removal_hook(cgraph_node_hook hook, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809) return symtab->add_cgraph_removal_hook(hook, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) static inline void cgraph_remove_node_removal_hook(struct cgraph_node_hook_list *entry)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) symtab->remove_cgraph_removal_hook(entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) static inline struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook(cgraph_2node_hook hook, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) return symtab->add_cgraph_duplication_hook(hook, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) static inline void cgraph_remove_node_duplication_hook(struct cgraph_2node_hook_list *entry)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) symtab->remove_cgraph_duplication_hook(entry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) static inline void cgraph_call_node_duplication_hooks(cgraph_node_ptr node, cgraph_node_ptr node2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829) symtab->call_cgraph_duplication_hooks(node, node2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832) static inline void cgraph_call_edge_duplication_hooks(cgraph_edge *cs1, cgraph_edge *cs2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) symtab->call_edge_duplication_hooks(cs1, cs2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) #if BUILDING_GCC_VERSION >= 6000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838) typedef gimple *gimple_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) typedef const gimple *const_gimple_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) #define gimple gimple_ptr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841) #define const_gimple const_gimple_ptr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) #undef CONST_CAST_GIMPLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) #define CONST_CAST_GIMPLE(X) CONST_CAST(gimple, (X))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) /* gimple related */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847) static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree lhs, tree op1, tree op2 MEM_STAT_DECL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) #if BUILDING_GCC_VERSION < 10000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) template <>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) template <>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855) inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) return gs->code == GIMPLE_GOTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) template <>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) template <>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) inline bool is_a_helper<const greturn *>::test(const_gimple gs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) return gs->code == GIMPLE_RETURN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) static inline gasm *as_a_gasm(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) return as_a<gasm *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) static inline const gasm *as_a_const_gasm(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875) return as_a<const gasm *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) static inline gassign *as_a_gassign(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) return as_a<gassign *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) static inline const gassign *as_a_const_gassign(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) return as_a<const gassign *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) static inline gcall *as_a_gcall(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) return as_a<gcall *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) static inline const gcall *as_a_const_gcall(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) return as_a<const gcall *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) static inline ggoto *as_a_ggoto(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) return as_a<ggoto *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) static inline const ggoto *as_a_const_ggoto(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) return as_a<const ggoto *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908) static inline gphi *as_a_gphi(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) return as_a<gphi *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) static inline const gphi *as_a_const_gphi(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) return as_a<const gphi *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) static inline greturn *as_a_greturn(gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920) return as_a<greturn *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) static inline const greturn *as_a_const_greturn(const_gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) return as_a<const greturn *>(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) /* IPA/LTO related */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) #define ipa_ref_list_referring_iterate(L, I, P) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) (L)->referring.iterate((I), &(P))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) #define ipa_ref_list_reference_iterate(L, I, P) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) (L)->reference.iterate((I), &(P))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934) static inline cgraph_node_ptr ipa_ref_referring_node(struct ipa_ref *ref)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) return dyn_cast<cgraph_node_ptr>(ref->referring);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939) static inline void ipa_remove_stmt_references(symtab_node *referring_node, gimple stmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) referring_node->remove_stmt_references(stmt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945) #if BUILDING_GCC_VERSION < 6000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, pvolatilep, keep_aligning)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) #define gen_rtx_set(ARG0, ARG1) gen_rtx_SET(VOIDmode, (ARG0), (ARG1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951) #if BUILDING_GCC_VERSION >= 6000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) #define gen_rtx_set(ARG0, ARG1) gen_rtx_SET((ARG0), (ARG1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) #ifdef __cplusplus
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) static inline void debug_tree(const_tree t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) debug_tree(CONST_CAST_TREE(t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) static inline void debug_gimple_stmt(const_gimple s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963) debug_gimple_stmt(CONST_CAST_GIMPLE(s));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) #define debug_tree(t) debug_tree(CONST_CAST_TREE(t))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970) #if BUILDING_GCC_VERSION >= 7000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971) #define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) #if BUILDING_GCC_VERSION < 7000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976) #define SET_DECL_ALIGN(decl, align) DECL_ALIGN(decl) = (align)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) #define SET_DECL_MODE(decl, mode) DECL_MODE(decl) = (mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980) #endif