summaryrefslogtreecommitdiff
path: root/gcc/opth-gen.awk
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-19 17:27:18 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-19 17:27:18 +0000
commit755fa783e823d11a964be88b24eab1bf7666368c (patch)
tree331042dabc400c80ac08ddae1835f9a3e6300ccc /gcc/opth-gen.awk
parentd7175aeff80486d3421f38002845779158ce107b (diff)
downloadgcc-755fa783e823d11a964be88b24eab1bf7666368c.tar.gz
Add PowerPC target attribute/pragma support
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166947 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opth-gen.awk')
-rw-r--r--gcc/opth-gen.awk63
1 files changed, 61 insertions, 2 deletions
diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk
index 4588a534428..9fafb99d460 100644
--- a/gcc/opth-gen.awk
+++ b/gcc/opth-gen.awk
@@ -29,7 +29,12 @@ BEGIN {
n_langs = 0
n_target_save = 0
n_extra_vars = 0
+ n_extra_target_vars = 0
n_extra_masks = 0
+ n_extra_c_includes = 0
+ n_extra_h_includes = 0
+ have_save = 0;
+ quote = "\042"
FS=SUBSEP
}
@@ -48,6 +53,30 @@ BEGIN {
extra_vars[n_extra_vars] = $2
n_extra_vars++
}
+ else if ($1 == "TargetVariable") {
+ # Combination of TargetSave and Variable
+ extra_vars[n_extra_vars] = $2
+ n_extra_vars++
+
+ var = $2
+ sub(" *=.*", "", var)
+ orig_var = var
+ name = var
+ type = var
+ sub("^.*[ *]", "", name)
+ sub(" *" name "$", "", type)
+ target_save_decl[n_target_save] = type " x_" name
+ n_target_save++
+
+ extra_target_vars[n_extra_target_vars] = name
+ n_extra_target_vars++
+ }
+ else if ($1 == "HeaderInclude") {
+ extra_h_includes[n_extra_h_includes++] = $2;
+ }
+ else if ($1 == "SourceInclude") {
+ extra_c_includes[n_extra_c_includes++] = $2;
+ }
else {
name = opt_args("Mask", $1)
if (name == "") {
@@ -73,11 +102,21 @@ print ""
print "#include \"flag-types.h\""
print ""
-have_save = 0;
+if (n_extra_h_includes > 0) {
+ for (i = 0; i < n_extra_h_includes; i++) {
+ print "#include " quote extra_h_includes[i] quote
+ }
+ print ""
+}
print "#if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS) && !defined(IN_RTS)"
print "#ifndef GENERATOR_FILE"
-print "struct gcc_options\n{"
+print "#if !defined(GCC_DRIVER) && !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)"
+print "struct GTY(()) gcc_options"
+print "#else"
+print "struct gcc_options"
+print "#endif"
+print "{"
print "#endif"
for (i = 0; i < n_extra_vars; i++) {
@@ -155,9 +194,11 @@ print "{";
n_opt_char = 2;
n_opt_short = 0;
n_opt_int = 0;
+n_opt_enum = 1;
n_opt_other = 0;
var_opt_char[0] = "unsigned char x_optimize";
var_opt_char[1] = "unsigned char x_optimize_size";
+var_opt_enum[0] = "enum fp_contract_mode x_flag_fp_contract_mode";
for (i = 0; i < n_opts; i++) {
if (flag_set_p("Optimization", flags[i])) {
@@ -179,6 +220,9 @@ for (i = 0; i < n_opts; i++) {
else if (otype ~ "^((un)?signed +)?char *$")
var_opt_char[n_opt_char++] = otype "x_" name;
+ else if (otype ~ ("^enum +[_" alnum "]+ *$"))
+ var_opt_enum[n_opt_enum++] = otype "x_" name;
+
else
var_opt_other[n_opt_other++] = otype "x_" name;
}
@@ -192,6 +236,10 @@ for (i = 0; i < n_opt_int; i++) {
print " " var_opt_int[i] ";";
}
+for (i = 0; i < n_opt_enum; i++) {
+ print " " var_opt_enum[i] ";";
+}
+
for (i = 0; i < n_opt_short; i++) {
print " " var_opt_short[i] ";";
}
@@ -211,6 +259,7 @@ print "{";
n_target_char = 0;
n_target_short = 0;
n_target_int = 0;
+n_target_enum = 0;
n_target_other = 0;
for (i = 0; i < n_target_save; i++) {
@@ -223,6 +272,9 @@ for (i = 0; i < n_target_save; i++) {
else if (target_save_decl[i] ~ "^((un)?signed +)?char +[_ " alnum "]+$")
var_target_char[n_target_char++] = target_save_decl[i];
+ else if (target_save_decl[i] ~ ("^enum +[_" alnum "]+ +[_" alnum "]+$")) {
+ var_target_enum[n_target_enum++] = target_save_decl[i];
+ }
else
var_target_other[n_target_other++] = target_save_decl[i];
}
@@ -248,6 +300,9 @@ if (have_save) {
else if (otype ~ "^((un)?signed +)?char *$")
var_target_char[n_target_char++] = otype "x_" name;
+ else if (otype ~ ("^enum +[_" alnum "]+ +[_" alnum "]+"))
+ var_target_enum[n_target_enum++] = otype "x_" name;
+
else
var_target_other[n_target_other++] = otype "x_" name;
}
@@ -260,6 +315,10 @@ for (i = 0; i < n_target_other; i++) {
print " " var_target_other[i] ";";
}
+for (i = 0; i < n_target_enum; i++) {
+ print " " var_target_enum[i] ";";
+}
+
for (i = 0; i < n_target_int; i++) {
print " " var_target_int[i] ";";
}