GCC Wikia
Advertisement

このページを編集する際は,編集に関する方針に従ってください.[]

概要[]

引数[]

  • void

実装[]

1493 /* Process the options that have been parsed.  */
1494 static void
1495 process_options (void)
1496 {
1497   /* Just in case lang_hooks.post_options ends up calling a debug_hook.
1498      This can happen with incorrect pre-processed input. */
1499   debug_hooks = &do_nothing_debug_hooks;
1500 
1501   /* Allow the front end to perform consistency checks and do further
1502      initialization based on the command line options.  This hook also
1503      sets the original filename if appropriate (e.g. foo.i -> foo.c)
1504      so we can correctly initialize debug output.  */
1505   no_backend = lang_hooks.post_options (&main_input_filename);


  • USE_MAPPED_LOCATIONはconfigureに出てくる

1506 #ifndef USE_MAPPED_LOCATION
1507   input_filename = main_input_filename;
1508 #endif
1509 

  • OVERRIDE_OPTIONSはアーキテクチャごとに変わってくる様子
    • gcc-4.1.0/gcc/config/i386/i386.hのようにgcc-4.1.0/gcc/config/アーキテクチャ/アーキテクチャ.hになっている
    • i386では定義されている

1510 #ifdef OVERRIDE_OPTIONS
1511   /* Some machines may reject certain combinations of options.  */
1512   OVERRIDE_OPTIONS;
1513 #endif
1514 


1515   if (flag_short_enums == 2)
1516     flag_short_enums = targetm.default_short_enums ();
1517 
1518   /* Set aux_base_name if not already set.  */
1519   if (aux_base_name)
1520     ;
1521   else if (main_input_filename)
1522     {
1523       char *name = xstrdup (lbasename (main_input_filename));
1524 
1525       strip_off_ending (name, strlen (name));
1526       aux_base_name = name;
1527     }
1528   else
1529     aux_base_name = "gccaux";
1530 
1531   /* Set up the align_*_log variables, defaulting them to 1 if they
1532      were still unset.  */
1533   if (align_loops <= 0) align_loops = 1;
1534   if (align_loops_max_skip > align_loops || !align_loops)
1535     align_loops_max_skip = align_loops - 1;
1536   align_loops_log = floor_log2 (align_loops * 2 - 1);
1537   if (align_jumps <= 0) align_jumps = 1;
1538   if (align_jumps_max_skip > align_jumps || !align_jumps)
1539     align_jumps_max_skip = align_jumps - 1;
1540   align_jumps_log = floor_log2 (align_jumps * 2 - 1);
1541   if (align_labels <= 0) align_labels = 1;
1542   align_labels_log = floor_log2 (align_labels * 2 - 1);
1543   if (align_labels_max_skip > align_labels || !align_labels)
1544     align_labels_max_skip = align_labels - 1;
1545   if (align_functions <= 0) align_functions = 1;
1546   align_functions_log = floor_log2 (align_functions * 2 - 1);
1547 
1548   /* Unrolling all loops implies that standard loop unrolling must also
1549      be done.  */
1550   if (flag_unroll_all_loops)
1551     flag_unroll_loops = 1;
1552 
1553   /* The loop unrolling code assumes that cse will be run after loop.
1554      web and rename-registers also help when run after loop unrolling.  */
1555 
1556   if (flag_rerun_cse_after_loop == AUTODETECT_VALUE)
1557     flag_rerun_cse_after_loop = flag_unroll_loops || flag_peel_loops;
1558   if (flag_web == AUTODETECT_VALUE)
1559     flag_web = flag_unroll_loops || flag_peel_loops;
1560   if (flag_rename_registers == AUTODETECT_VALUE)
1561     flag_rename_registers = flag_unroll_loops || flag_peel_loops;
1562 
1563   /* If explicitly asked to run new loop optimizer, switch off the old
1564      one.  */
1565   if (flag_loop_optimize2)
1566     flag_loop_optimize = 0;
1567 
1568   /* Enable new loop optimizer pass if any of its optimizations is called.  */
1569   if (flag_move_loop_invariants
1570       || flag_unswitch_loops
1571       || flag_peel_loops
1572       || flag_unroll_loops
1573       || flag_branch_on_count_reg)
1574     flag_loop_optimize2 = 1;
1575 
1576   if (flag_non_call_exceptions)
1577     flag_asynchronous_unwind_tables = 1;
1578   if (flag_asynchronous_unwind_tables)
1579     flag_unwind_tables = 1;
1580 
1581   /* Disable unit-at-a-time mode for frontends not supporting callgraph
1582      interface.  */
1583   if (flag_unit_at_a_time && ! lang_hooks.callgraph.expand_function)
1584     flag_unit_at_a_time = 0;
1585 
1586   if (flag_value_profile_transformations)
1587     flag_profile_values = 1;
1588 
1589   /* Warn about options that are not supported on this machine.  */
1590 #ifndef INSN_SCHEDULING
1591   if (flag_schedule_insns || flag_schedule_insns_after_reload)
1592     warning (0, "instruction scheduling not supported on this target machine");
1593 #endif
1594 #ifndef DELAY_SLOTS
1595   if (flag_delayed_branch)
1596     warning (0, "this target machine does not have delayed branches");
1597 #endif
1598 
1599   user_label_prefix = USER_LABEL_PREFIX;
1600   if (flag_leading_underscore != -1)
1601     {
1602       /* If the default prefix is more complicated than "" or "_",
1603          issue a warning and ignore this option.  */
1604       if (user_label_prefix[0] == 0 ||
1605           (user_label_prefix[0] == '_' && user_label_prefix[1] == 0))
1606         {
1607           user_label_prefix = flag_leading_underscore ? "_" : "";
1608         }
1609       else
1610         warning (0, "-f%sleading-underscore not supported on this target machine",
1611                  flag_leading_underscore ? "" : "no-");
1612     }
1613 
1614   /* If we are in verbose mode, write out the version and maybe all the
1615      option flags in use.  */
1616   if (version_flag)
1617     {
1618       print_version (stderr, "");
1619       if (! quiet_flag)
1620         print_switch_values (stderr, 0, MAX_LINE, "", " ", "\n");
1621     }
1622 
1623   if (flag_syntax_only)
1624     {
1625       write_symbols = NO_DEBUG;
1626       profile_flag = 0;
1627     }
1628 
1629   /* A lot of code assumes write_symbols == NO_DEBUG if the debugging
1630      level is 0.  */
1631   if (debug_info_level == DINFO_LEVEL_NONE)
1632     write_symbols = NO_DEBUG;
1633 
1634   /* Now we know write_symbols, set up the debug hooks based on it.
1635      By default we do nothing for debug output.  */
1636   if (PREFERRED_DEBUGGING_TYPE == NO_DEBUG)
1637     default_debug_hooks = &do_nothing_debug_hooks;
1638 #if defined(DBX_DEBUGGING_INFO)
1639   else if (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG)
1640     default_debug_hooks = &dbx_debug_hooks;
1641 #endif
1642 #if defined(XCOFF_DEBUGGING_INFO)
1643   else if (PREFERRED_DEBUGGING_TYPE == XCOFF_DEBUG)
1644     default_debug_hooks = &xcoff_debug_hooks;
1645 #endif
1646 #ifdef SDB_DEBUGGING_INFO
1647   else if (PREFERRED_DEBUGGING_TYPE == SDB_DEBUG)
1648     default_debug_hooks = &sdb_debug_hooks;
1649 #endif
1650 #ifdef DWARF2_DEBUGGING_INFO
1651   else if (PREFERRED_DEBUGGING_TYPE == DWARF2_DEBUG)
1652     default_debug_hooks = &dwarf2_debug_hooks;
1653 #endif
1654 #ifdef VMS_DEBUGGING_INFO
1655   else if (PREFERRED_DEBUGGING_TYPE == VMS_DEBUG
1656            || PREFERRED_DEBUGGING_TYPE == VMS_AND_DWARF2_DEBUG)
1657     default_debug_hooks = &vmsdbg_debug_hooks;
1658 #endif
1659 
1660   if (write_symbols == NO_DEBUG)
1661     ;
1662 #if defined(DBX_DEBUGGING_INFO)
1663   else if (write_symbols == DBX_DEBUG)
1664     debug_hooks = &dbx_debug_hooks;
1665 #endif
1666 #if defined(XCOFF_DEBUGGING_INFO)
1667   else if (write_symbols == XCOFF_DEBUG)
1668     debug_hooks = &xcoff_debug_hooks;
1669 #endif
1670 #ifdef SDB_DEBUGGING_INFO
1671   else if (write_symbols == SDB_DEBUG)
1672     debug_hooks = &sdb_debug_hooks;
1673 #endif
1674 #ifdef DWARF2_DEBUGGING_INFO
1675   else if (write_symbols == DWARF2_DEBUG)
1676     debug_hooks = &dwarf2_debug_hooks;
1677 #endif
1678 #ifdef VMS_DEBUGGING_INFO
1679   else if (write_symbols == VMS_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG)
1680     debug_hooks = &vmsdbg_debug_hooks;
1681 #endif
1682   else
1683     error ("target system does not support the \"%s\" debug format",
1684            debug_type_names[[[write_symbols]]]);
1685 
1686   /* Now we know which debug output will be used so we can set
1687      flag_var_tracking, flag_rename_registers if the user has
1688      not specified them.  */
1689   if (debug_info_level < DINFO_LEVEL_NORMAL
1690       || debug_hooks->var_location == do_nothing_debug_hooks.var_location)
1691     {
1692       if (flag_var_tracking == 1)
1693         {
1694           if (debug_info_level < DINFO_LEVEL_NORMAL)
1695             warning (0, "variable tracking requested, but useless unless "
1696                      "producing debug info");
1697           else
1698             warning (0, "variable tracking requested, but not supported "
1699                      "by this debug format");
1700         }
1701       flag_var_tracking = 0;
1702     }
1703 
1704   if (flag_rename_registers == AUTODETECT_VALUE)
1705     flag_rename_registers = default_debug_hooks->var_location
1706                             != do_nothing_debug_hooks.var_location;
1707 
1708   if (flag_var_tracking == AUTODETECT_VALUE)
1709     flag_var_tracking = optimize >= 1;
1710 
1711   /* If auxiliary info generation is desired, open the output file.
1712      This goes in the same directory as the source file--unlike
1713      all the other output files.  */
1714   if (flag_gen_aux_info)
1715     {
1716       aux_info_file = fopen (aux_info_file_name, "w");
1717       if (aux_info_file == 0)
1718         fatal_error ("can%'t open %s: %m", aux_info_file_name);
1719     }
1720 
1721   if (! targetm.have_named_sections)
1722     {
1723       if (flag_function_sections)
1724         {
1725           warning (0, "-ffunction-sections not supported for this target");
1726           flag_function_sections = 0;
1727         }
1728       if (flag_data_sections)
1729         {
1730           warning (0, "-fdata-sections not supported for this target");
1731           flag_data_sections = 0;
1732         }
1733     }
1734 
1735   if (flag_function_sections && profile_flag)
1736     {
1737       warning (0, "-ffunction-sections disabled; it makes profiling impossible");
1738       flag_function_sections = 0;
1739     }
1740 
1741 #ifndef HAVE_prefetch
1742   if (flag_prefetch_loop_arrays)
1743     {
1744       warning (0, "-fprefetch-loop-arrays not supported for this target");
1745       flag_prefetch_loop_arrays = 0;
1746     }
1747 #else
1748   if (flag_prefetch_loop_arrays && !HAVE_prefetch)
1749     {
1750       warning (0, "-fprefetch-loop-arrays not supported for this target (try -march switches)");
1751       flag_prefetch_loop_arrays = 0;
1752     }
1753 #endif
1754 
1755   /* This combination of options isn't handled for i386 targets and doesn't
1756      make much sense anyway, so don't allow it.  */
1757   if (flag_prefetch_loop_arrays && optimize_size)
1758     {
1759       warning (0, "-fprefetch-loop-arrays is not supported with -Os");
1760       flag_prefetch_loop_arrays = 0;
1761     }
1762 
1763 #ifndef OBJECT_FORMAT_ELF
1764   if (flag_function_sections && write_symbols != NO_DEBUG)
1765     warning (0, "-ffunction-sections may affect debugging on some targets");
1766 #endif
1767 
1768   /* The presence of IEEE signaling NaNs, implies all math can trap.  */
1769   if (flag_signaling_nans)
1770     flag_trapping_math = 1;
1771 
1772   /* With -fcx-limited-range, we do cheap and quick complex arithmetic.  */
1773   if (flag_cx_limited_range)
1774     flag_complex_method = 0;
1775 
1776   /* Targets must be able to place spill slots at lower addresses.  If the
1777      target already uses a soft frame pointer, the transition is trivial.  */
1778   if (!FRAME_GROWS_DOWNWARD && flag_stack_protect)
1779     {
1780       warning (0, "-fstack-protector not supported for this target");
1781       flag_stack_protect = 0;
1782     }
1783   if (!flag_stack_protect)
1784     warn_stack_protect = 0;
1785 
1786   /* ??? Unwind info is not correct around the CFG unless either a frame
1787      pointer is present or A_O_A is set.  Fixing this requires rewriting
1788      unwind info generation to be aware of the CFG and propagating states
1789      around edges.  */
1790   if (flag_unwind_tables && !ACCUMULATE_OUTGOING_ARGS
1791       && flag_omit_frame_pointer)
1792     {
1793       warning (0, "unwind tables currently requires a frame pointer "
1794                "for correctness");
1795       flag_omit_frame_pointer = 0;
1796     }
1797 }



リンク元

Advertisement