OSDN Git Service

* struct-equiv.c (rtx_equiv_p): Fix POST_MODIFY case.
[pf3gnuchains/gcc-fork.git] / gcc / opt-functions.awk
index 9dc9640..3e4c805 100644 (file)
@@ -14,7 +14,7 @@
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 # Some common subroutines for use by opt[ch]-gen.awk.
 
@@ -89,6 +89,43 @@ function var_name(flags)
        return nth_arg(0, opt_args("Var", flags))
 }
 
+# Return true if the option described by FLAGS has a globally-visible state.
+function global_state_p(flags)
+{
+       return (var_name(flags) != "" \
+               || opt_args("Mask", flags) != "" \
+               || opt_args("InverseMask", flags) != "")
+}
+
+# Return true if the option described by FLAGS must have some state
+# associated with it.
+function needs_state_p(flags)
+{
+       return flag_set_p("Target", flags)
+}
+
+# If FLAGS describes an option that needs a static state variable,
+# return the name of that variable, otherwise return "".  NAME is
+# the name of the option.
+function static_var(name, flags)
+{
+       if (global_state_p(flags) || !needs_state_p(flags))
+               return ""
+       gsub ("[^A-Za-z0-9]", "_", name)
+       return "VAR_" name
+}
+
+# Return the type of variable that should be associated with the given flags.
+function var_type(flags)
+{
+       if (!flag_set_p("Joined.*", flags))
+               return "int "
+       else if (flag_set_p("UInteger", flags))
+               return "int "
+       else
+               return "const char *"
+}
+
 # Given that an option has flags FLAGS, return an initializer for the
 # "var_cond" and "var_value" fields of its cl_options[] entry.
 function var_set(flags)
@@ -109,17 +146,19 @@ function var_set(flags)
                vn = var_name(flags);
                if (vn)
                        return "CLVC_BIT_CLEAR, OPTION_MASK_" s
-                         else
+               else
                        return "CLVC_BIT_CLEAR, MASK_" s
        }
+       if (var_type(flags) == "const char *")
+               return "CLVC_STRING, 0"
        return "CLVC_BOOLEAN, 0"
 }
 
-# Given that an option has flags FLAGS, return an initializer for the
-# "flag_var" field of its cl_options[] entry.
-function var_ref(flags)
+# Given that an option called NAME has flags FLAGS, return an initializer
+# for the "flag_var" field of its cl_options[] entry.
+function var_ref(name, flags)
 {
-       name = var_name(flags)
+       name = var_name(flags) static_var(name, flags)
        if (name != "")
                return "&" name
        if (opt_args("Mask", flags) != "")