diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-14 15:47:53 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-14 15:47:53 +0000 |
commit | ab90b67e5730e294179da11c4fa1680cc19febf5 (patch) | |
tree | b9b240b3b0e9c9a5fc0a8dd259d3fa2ad0e27aa0 /gcc/optc-save-gen.awk | |
parent | ec485a18f6a7572976b8c1950c60fad73e4c4976 (diff) | |
download | gcc-ab90b67e5730e294179da11c4fa1680cc19febf5.tar.gz |
* optc-save-gen.awk: Output cl_target_option_eq,
cl_target_option_hash, cl_target_option_stream_out,
cl_target_option_stream_in functions.
* opth-gen.awk: Output prototypes for
cl_target_option_eq and cl_target_option_hash.
* lto-streamer.h (cl_target_option_stream_out,
cl_target_option_stream_in): Declare.
* tree.c (cl_option_hash_hash): Use cl_target_option_hash.
(cl_option_hash_eq): Use cl_target_option_eq.
* tree-streamer-in.c (unpack_value_fields): Stream in
TREE_TARGET_OPTION.
* lto-streamer-out.c (DFS::DFS_write_tree_body): Follow
DECL_FUNCTION_SPECIFIC_TARGET.
(hash_tree): Hash TREE_TARGET_OPTION; visit
DECL_FUNCTION_SPECIFIC_TARGET.
* tree-streamer-out.c (streamer_pack_tree_bitfields): Skip
TS_TARGET_OPTION.
(streamer_write_tree_body): Output TS_TARGET_OPTION.
* lto.c (compare_tree_sccs_1): Compare cl_target_option_eq.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217571 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optc-save-gen.awk')
-rw-r--r-- | gcc/optc-save-gen.awk | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index a5ec7e48660..861683460ad 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -39,6 +39,18 @@ print "#include " quote "intl.h" quote print "" print "#include " quote "flags.h" quote print "#include " quote "target.h" quote +print "#include " quote "inchash.h" quote +print "#include " quote "tree.h" quote +print "#include " quote "tree-ssa-alias.h" quote +print "#include " quote "is-a.h" quote +print "#include " quote "predict.h" quote +print "#include " quote "function.h" quote +print "#include " quote "basic-block.h" quote +print "#include " quote "gimple-expr.h" quote +print "#include " quote "gimple.h" quote +print "#include " quote "data-streamer.h" quote +print "#include " quote "ipa-ref.h" quote +print "#include " quote "cgraph.h" quote print "" if (n_extra_c_includes > 0) { @@ -417,4 +429,126 @@ print " targetm.target_option.print (file, indent, ptr);"; print "}"; +print ""; +print "/* Compare two target options */"; +print "bool"; +print "cl_target_option_eq (struct cl_target_option const *ptr1 ATTRIBUTE_UNUSED,"; +print " struct cl_target_option const *ptr2 ATTRIBUTE_UNUSED)"; +print "{"; +n_target_val = 0; +n_target_str = 0; + +for (i = 0; i < n_target_save; i++) { + var = target_save_decl[i]; + sub (" *=.*", "", var); + name = var; + type = var; + sub("^.*[ *]", "", name) + sub(" *" name "$", "", type) + if (target_save_decl[i] ~ "^const char \\*+[_" alnum "]+$") + var_target_str[n_target_str++] = name; + else { + var_target_val_type[n_target_val] = type; + var_target_val[n_target_val++] = name; + } +} +if (have_save) { + for (i = 0; i < n_opts; i++) { + if (flag_set_p("Save", flags[i])) { + name = var_name(flags[i]) + if(name == "") + name = "target_flags"; + + if(name in var_list_seen) + continue; + + var_list_seen[name]++; + otype = var_type_struct(flags[i]) + if (otype ~ "^const char \\**$") + var_target_str[n_target_str++] = "x_" name; + else { + var_target_val_type[n_target_val] = otype; + var_target_val[n_target_val++] = "x_" name; + } + } + } +} else { + var_target_val_type[n_target_val] = "int"; + var_target_val[n_target_val++] = "x_target_flags"; +} + +for (i = 0; i < n_target_str; i++) { + name = var_target_str[i] + print " if (ptr1->" name" != ptr2->" name; + print " && (!ptr1->" name" || !ptr2->" name + print " || strcmp (ptr1->" name", ptr2->" name ")))"; + print " return false;"; +} +for (i = 0; i < n_target_val; i++) { + name = var_target_val[i] + print " if (ptr1->" name" != ptr2->" name ")"; + print " return false;"; +} + +print " return true;"; + +print "}"; + +print ""; +print "/* Hash target options */"; +print "hashval_t"; +print "cl_target_option_hash (struct cl_target_option const *ptr ATTRIBUTE_UNUSED)"; +print "{"; +print " inchash::hash hstate;"; +for (i = 0; i < n_target_str; i++) { + name = var_target_str[i] + print " if (ptr->" name")"; + print " hstate.add (ptr->" name", strlen (ptr->" name"));"; + print " else"; + print " hstate.add_int (0);"; +} +for (i = 0; i < n_target_val; i++) { + name = var_target_val[i] + print " hstate.add_wide_int (ptr->" name");"; +} +print " return hstate.end ();"; +print "}"; + +print ""; +print "/* Stream out target options */"; +print "void"; +print "cl_target_option_stream_out (struct output_block *ob ATTRIBUTE_UNUSED,"; +print " struct bitpack_d *bp ATTRIBUTE_UNUSED,"; +print " struct cl_target_option *ptr ATTRIBUTE_UNUSED)"; +print "{"; +for (i = 0; i < n_target_str; i++) { + name = var_target_str[i] + print " bp_pack_string (ob, bp, ptr->" name", true);"; +} +for (i = 0; i < n_target_val; i++) { + name = var_target_val[i] + print " bp_pack_value (bp, ptr->" name", 64);"; +} +print "}"; + +print ""; +print "/* Stream in target options */"; +print "void"; +print "cl_target_option_stream_in (struct data_in *data_in ATTRIBUTE_UNUSED,"; +print " struct bitpack_d *bp ATTRIBUTE_UNUSED,"; +print " struct cl_target_option *ptr ATTRIBUTE_UNUSED)"; +print "{"; +for (i = 0; i < n_target_str; i++) { + name = var_target_str[i] + print " ptr->" name" = bp_unpack_string (data_in, bp);"; + print " if (ptr->" name")"; + print " ptr->" name" = xstrdup (ptr->" name");"; +} +for (i = 0; i < n_target_val; i++) { + name = var_target_val[i] + print " ptr->" name" = (" var_target_val_type[i] ") bp_unpack_value (bp, 64);"; +} + +print "}"; + } |