comparison gcc/gimple.h @ 19:58ad6c70ea60

update gcc from 4.4.0 to 4.4.1.
author kent@firefly.cr.ie.u-ryukyu.ac.jp
date Thu, 24 Sep 2009 13:21:57 +0900
parents a06113de4d67
children 9de9dad105d4 77e2b8dfacca
comparison
equal deleted inserted replaced
18:33936f7f2835 19:58ad6c70ea60
1392 gimple_modified_p (const_gimple g) 1392 gimple_modified_p (const_gimple g)
1393 { 1393 {
1394 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false; 1394 return (gimple_has_ops (g)) ? (bool) g->gsbase.modified : false;
1395 } 1395 }
1396 1396
1397
1398 /* Return the tree code for the expression computed by STMT. This is
1399 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1400 GIMPLE_CALL, return CALL_EXPR as the expression code for
1401 consistency. This is useful when the caller needs to deal with the
1402 three kinds of computation that GIMPLE supports. */
1403
1404 static inline enum tree_code
1405 gimple_expr_code (const_gimple stmt)
1406 {
1407 enum gimple_code code = gimple_code (stmt);
1408 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1409 return (enum tree_code) stmt->gsbase.subcode;
1410 else if (code == GIMPLE_CALL)
1411 return CALL_EXPR;
1412 else
1413 gcc_unreachable ();
1414 }
1415
1416
1417 /* Mark statement S as modified, and update it. */
1418
1419 static inline void
1420 update_stmt (gimple s)
1421 {
1422 if (gimple_has_ops (s))
1423 {
1424 gimple_set_modified (s, true);
1425 update_stmt_operands (s);
1426 }
1427 }
1428
1429 /* Update statement S if it has been optimized. */
1430
1431 static inline void
1432 update_stmt_if_modified (gimple s)
1433 {
1434 if (gimple_modified_p (s))
1435 update_stmt_operands (s);
1436 }
1437
1438 /* Return true if statement STMT contains volatile operands. */
1439
1440 static inline bool
1441 gimple_has_volatile_ops (const_gimple stmt)
1442 {
1443 if (gimple_has_mem_ops (stmt))
1444 return stmt->gsbase.has_volatile_ops;
1445 else
1446 return false;
1447 }
1448
1449
1450 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1451
1452 static inline void
1453 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1454 {
1455 if (gimple_has_mem_ops (stmt))
1456 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1457 }
1458
1459
1460 /* Return true if statement STMT may access memory. */
1461
1462 static inline bool
1463 gimple_references_memory_p (gimple stmt)
1464 {
1465 return gimple_has_mem_ops (stmt) && stmt->gsbase.references_memory_p;
1466 }
1467
1468
1469 /* Set the REFERENCES_MEMORY_P flag for STMT to MEM_P. */
1470
1471 static inline void
1472 gimple_set_references_memory (gimple stmt, bool mem_p)
1473 {
1474 if (gimple_has_mem_ops (stmt))
1475 stmt->gsbase.references_memory_p = (unsigned) mem_p;
1476 }
1477
1478 /* Return the subcode for OMP statement S. */
1479
1480 static inline unsigned
1481 gimple_omp_subcode (const_gimple s)
1482 {
1483 gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1484 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1485 return s->gsbase.subcode;
1486 }
1487
1488 /* Set the subcode for OMP statement S to SUBCODE. */
1489
1490 static inline void
1491 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1492 {
1493 /* We only have 16 bits for the subcode. Assert that we are not
1494 overflowing it. */
1495 gcc_assert (subcode < (1 << 16));
1496 s->gsbase.subcode = subcode;
1497 }
1498
1499 /* Set the nowait flag on OMP_RETURN statement S. */
1500
1501 static inline void
1502 gimple_omp_return_set_nowait (gimple s)
1503 {
1504 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1505 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1506 }
1507
1508
1509 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1510 flag set. */
1511
1512 static inline bool
1513 gimple_omp_return_nowait_p (const_gimple g)
1514 {
1515 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1516 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1517 }
1518
1519
1520 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1521 flag set. */
1522
1523 static inline bool
1524 gimple_omp_section_last_p (const_gimple g)
1525 {
1526 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1527 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1528 }
1529
1530
1531 /* Set the GF_OMP_SECTION_LAST flag on G. */
1532
1533 static inline void
1534 gimple_omp_section_set_last (gimple g)
1535 {
1536 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1537 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1538 }
1539
1540
1541 /* Return true if OMP parallel statement G has the
1542 GF_OMP_PARALLEL_COMBINED flag set. */
1543
1544 static inline bool
1545 gimple_omp_parallel_combined_p (const_gimple g)
1546 {
1547 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1548 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1549 }
1550
1551
1552 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1553 value of COMBINED_P. */
1554
1555 static inline void
1556 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1557 {
1558 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1559 if (combined_p)
1560 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1561 else
1562 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1563 }
1564
1565
1566 /* Return the number of operands for statement GS. */
1567
1568 static inline unsigned
1569 gimple_num_ops (const_gimple gs)
1570 {
1571 return gs->gsbase.num_ops;
1572 }
1573
1574
1575 /* Set the number of operands for statement GS. */
1576
1577 static inline void
1578 gimple_set_num_ops (gimple gs, unsigned num_ops)
1579 {
1580 gs->gsbase.num_ops = num_ops;
1581 }
1582
1583
1584 /* Return the array of operands for statement GS. */
1585
1586 static inline tree *
1587 gimple_ops (gimple gs)
1588 {
1589 /* Offset in bytes to the location of the operand vector in every
1590 tuple structure. Defined in gimple.c */
1591 extern size_t const gimple_ops_offset_[];
1592
1593 if (!gimple_has_ops (gs))
1594 return NULL;
1595
1596 /* All the tuples have their operand vector at the very bottom
1597 of the structure. */
1598 return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)]));
1599 }
1600
1601
1602 /* Return operand I for statement GS. */
1603
1604 static inline tree
1605 gimple_op (const_gimple gs, unsigned i)
1606 {
1607 if (gimple_has_ops (gs))
1608 {
1609 gcc_assert (i < gimple_num_ops (gs));
1610 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1611 }
1612 else
1613 return NULL_TREE;
1614 }
1615
1616 /* Return a pointer to operand I for statement GS. */
1617
1618 static inline tree *
1619 gimple_op_ptr (const_gimple gs, unsigned i)
1620 {
1621 if (gimple_has_ops (gs))
1622 {
1623 gcc_assert (i < gimple_num_ops (gs));
1624 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1625 }
1626 else
1627 return NULL;
1628 }
1629
1630 /* Set operand I of statement GS to OP. */
1631
1632 static inline void
1633 gimple_set_op (gimple gs, unsigned i, tree op)
1634 {
1635 gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1636
1637 /* Note. It may be tempting to assert that OP matches
1638 is_gimple_operand, but that would be wrong. Different tuples
1639 accept slightly different sets of tree operands. Each caller
1640 should perform its own validation. */
1641 gimple_ops (gs)[i] = op;
1642 }
1643
1644 /* Return true if GS is a GIMPLE_ASSIGN. */
1645
1646 static inline bool
1647 is_gimple_assign (const_gimple gs)
1648 {
1649 return gimple_code (gs) == GIMPLE_ASSIGN;
1650 }
1651
1652 /* Determine if expression CODE is one of the valid expressions that can
1653 be used on the RHS of GIMPLE assignments. */
1654
1655 static inline enum gimple_rhs_class
1656 get_gimple_rhs_class (enum tree_code code)
1657 {
1658 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1659 }
1660
1661 /* Return the LHS of assignment statement GS. */
1662
1663 static inline tree
1664 gimple_assign_lhs (const_gimple gs)
1665 {
1666 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1667 return gimple_op (gs, 0);
1668 }
1669
1670
1671 /* Return a pointer to the LHS of assignment statement GS. */
1672
1673 static inline tree *
1674 gimple_assign_lhs_ptr (const_gimple gs)
1675 {
1676 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1677 return gimple_op_ptr (gs, 0);
1678 }
1679
1680
1681 /* Set LHS to be the LHS operand of assignment statement GS. */
1682
1683 static inline void
1684 gimple_assign_set_lhs (gimple gs, tree lhs)
1685 {
1686 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1687 gcc_assert (is_gimple_operand (lhs));
1688 gimple_set_op (gs, 0, lhs);
1689
1690 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1691 SSA_NAME_DEF_STMT (lhs) = gs;
1692 }
1693
1694
1695 /* Return the first operand on the RHS of assignment statement GS. */
1696
1697 static inline tree
1698 gimple_assign_rhs1 (const_gimple gs)
1699 {
1700 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1701 return gimple_op (gs, 1);
1702 }
1703
1704
1705 /* Return a pointer to the first operand on the RHS of assignment
1706 statement GS. */
1707
1708 static inline tree *
1709 gimple_assign_rhs1_ptr (const_gimple gs)
1710 {
1711 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1712 return gimple_op_ptr (gs, 1);
1713 }
1714
1715 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1716
1717 static inline void
1718 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1719 {
1720 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1721
1722 /* If there are 3 or more operands, the 2 operands on the RHS must be
1723 GIMPLE values. */
1724 if (gimple_num_ops (gs) >= 3)
1725 gcc_assert (is_gimple_val (rhs));
1726 else
1727 gcc_assert (is_gimple_operand (rhs));
1728
1729 gimple_set_op (gs, 1, rhs);
1730 }
1731
1732
1733 /* Return the second operand on the RHS of assignment statement GS.
1734 If GS does not have two operands, NULL is returned instead. */
1735
1736 static inline tree
1737 gimple_assign_rhs2 (const_gimple gs)
1738 {
1739 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1740
1741 if (gimple_num_ops (gs) >= 3)
1742 return gimple_op (gs, 2);
1743 else
1744 return NULL_TREE;
1745 }
1746
1747
1748 /* Return a pointer to the second operand on the RHS of assignment
1749 statement GS. */
1750
1751 static inline tree *
1752 gimple_assign_rhs2_ptr (const_gimple gs)
1753 {
1754 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1755 return gimple_op_ptr (gs, 2);
1756 }
1757
1758
1759 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1760
1761 static inline void
1762 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1763 {
1764 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1765
1766 /* The 2 operands on the RHS must be GIMPLE values. */
1767 gcc_assert (is_gimple_val (rhs));
1768
1769 gimple_set_op (gs, 2, rhs);
1770 }
1771
1772 /* Returns true if GS is a nontemporal move. */
1773
1774 static inline bool
1775 gimple_assign_nontemporal_move_p (const_gimple gs)
1776 {
1777 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1778 return gs->gsbase.nontemporal_move;
1779 }
1780
1781 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1782
1783 static inline void
1784 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1785 {
1786 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1787 gs->gsbase.nontemporal_move = nontemporal;
1788 }
1789
1790
1791 /* Return the code of the expression computed on the rhs of assignment
1792 statement GS. In case that the RHS is a single object, returns the
1793 tree code of the object. */
1794
1795 static inline enum tree_code
1796 gimple_assign_rhs_code (const_gimple gs)
1797 {
1798 enum tree_code code;
1799 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1800
1801 code = gimple_expr_code (gs);
1802 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1803 code = TREE_CODE (gimple_assign_rhs1 (gs));
1804
1805 return code;
1806 }
1807
1808
1809 /* Set CODE to be the code for the expression computed on the RHS of
1810 assignment S. */
1811
1812 static inline void
1813 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1814 {
1815 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1816 s->gsbase.subcode = code;
1817 }
1818
1819
1820 /* Return the gimple rhs class of the code of the expression computed on
1821 the rhs of assignment statement GS.
1822 This will never return GIMPLE_INVALID_RHS. */
1823
1824 static inline enum gimple_rhs_class
1825 gimple_assign_rhs_class (const_gimple gs)
1826 {
1827 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1828 }
1829
1830
1831 /* Return true if S is a type-cast assignment. */
1832
1833 static inline bool
1834 gimple_assign_cast_p (gimple s)
1835 {
1836 if (is_gimple_assign (s))
1837 {
1838 enum tree_code sc = gimple_assign_rhs_code (s);
1839 return CONVERT_EXPR_CODE_P (sc)
1840 || sc == VIEW_CONVERT_EXPR
1841 || sc == FIX_TRUNC_EXPR;
1842 }
1843
1844 return false;
1845 }
1846
1847
1848 /* Return true if GS is a GIMPLE_CALL. */
1849
1850 static inline bool
1851 is_gimple_call (const_gimple gs)
1852 {
1853 return gimple_code (gs) == GIMPLE_CALL;
1854 }
1855
1856 /* Return the LHS of call statement GS. */
1857
1858 static inline tree
1859 gimple_call_lhs (const_gimple gs)
1860 {
1861 GIMPLE_CHECK (gs, GIMPLE_CALL);
1862 return gimple_op (gs, 0);
1863 }
1864
1865
1866 /* Return a pointer to the LHS of call statement GS. */
1867
1868 static inline tree *
1869 gimple_call_lhs_ptr (const_gimple gs)
1870 {
1871 GIMPLE_CHECK (gs, GIMPLE_CALL);
1872 return gimple_op_ptr (gs, 0);
1873 }
1874
1875
1876 /* Set LHS to be the LHS operand of call statement GS. */
1877
1878 static inline void
1879 gimple_call_set_lhs (gimple gs, tree lhs)
1880 {
1881 GIMPLE_CHECK (gs, GIMPLE_CALL);
1882 gcc_assert (!lhs || is_gimple_operand (lhs));
1883 gimple_set_op (gs, 0, lhs);
1884 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1885 SSA_NAME_DEF_STMT (lhs) = gs;
1886 }
1887
1888
1889 /* Return the tree node representing the function called by call
1890 statement GS. */
1891
1892 static inline tree
1893 gimple_call_fn (const_gimple gs)
1894 {
1895 GIMPLE_CHECK (gs, GIMPLE_CALL);
1896 return gimple_op (gs, 1);
1897 }
1898
1899
1900 /* Return a pointer to the tree node representing the function called by call
1901 statement GS. */
1902
1903 static inline tree *
1904 gimple_call_fn_ptr (const_gimple gs)
1905 {
1906 GIMPLE_CHECK (gs, GIMPLE_CALL);
1907 return gimple_op_ptr (gs, 1);
1908 }
1909
1910
1911 /* Set FN to be the function called by call statement GS. */
1912
1913 static inline void
1914 gimple_call_set_fn (gimple gs, tree fn)
1915 {
1916 GIMPLE_CHECK (gs, GIMPLE_CALL);
1917 gcc_assert (is_gimple_operand (fn));
1918 gimple_set_op (gs, 1, fn);
1919 }
1920
1921
1922 /* Set FNDECL to be the function called by call statement GS. */
1923
1924 static inline void
1925 gimple_call_set_fndecl (gimple gs, tree decl)
1926 {
1927 GIMPLE_CHECK (gs, GIMPLE_CALL);
1928 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
1929 gimple_set_op (gs, 1, build_fold_addr_expr (decl));
1930 }
1931
1932
1933 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1934 Otherwise return NULL. This function is analogous to
1935 get_callee_fndecl in tree land. */
1936
1937 static inline tree
1938 gimple_call_fndecl (const_gimple gs)
1939 {
1940 tree addr = gimple_call_fn (gs);
1941 if (TREE_CODE (addr) == ADDR_EXPR)
1942 {
1943 gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
1944 return TREE_OPERAND (addr, 0);
1945 }
1946 return NULL_TREE;
1947 }
1948
1949
1950 /* Return the type returned by call statement GS. */
1951
1952 static inline tree
1953 gimple_call_return_type (const_gimple gs)
1954 {
1955 tree fn = gimple_call_fn (gs);
1956 tree type = TREE_TYPE (fn);
1957
1958 /* See through the pointer. */
1959 gcc_assert (POINTER_TYPE_P (type));
1960 type = TREE_TYPE (type);
1961
1962 gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
1963 || TREE_CODE (type) == METHOD_TYPE);
1964
1965 /* The type returned by a FUNCTION_DECL is the type of its
1966 function type. */
1967 return TREE_TYPE (type);
1968 }
1969
1970
1971 /* Return the static chain for call statement GS. */
1972
1973 static inline tree
1974 gimple_call_chain (const_gimple gs)
1975 {
1976 GIMPLE_CHECK (gs, GIMPLE_CALL);
1977 return gimple_op (gs, 2);
1978 }
1979
1980
1981 /* Return a pointer to the static chain for call statement GS. */
1982
1983 static inline tree *
1984 gimple_call_chain_ptr (const_gimple gs)
1985 {
1986 GIMPLE_CHECK (gs, GIMPLE_CALL);
1987 return gimple_op_ptr (gs, 2);
1988 }
1989
1990 /* Set CHAIN to be the static chain for call statement GS. */
1991
1992 static inline void
1993 gimple_call_set_chain (gimple gs, tree chain)
1994 {
1995 GIMPLE_CHECK (gs, GIMPLE_CALL);
1996 gcc_assert (chain == NULL
1997 || TREE_CODE (chain) == ADDR_EXPR
1998 || SSA_VAR_P (chain));
1999 gimple_set_op (gs, 2, chain);
2000 }
2001
2002
2003 /* Return the number of arguments used by call statement GS. */
2004
2005 static inline unsigned
2006 gimple_call_num_args (const_gimple gs)
2007 {
2008 unsigned num_ops;
2009 GIMPLE_CHECK (gs, GIMPLE_CALL);
2010 num_ops = gimple_num_ops (gs);
2011 gcc_assert (num_ops >= 3);
2012 return num_ops - 3;
2013 }
2014
2015
2016 /* Return the argument at position INDEX for call statement GS. */
2017
2018 static inline tree
2019 gimple_call_arg (const_gimple gs, unsigned index)
2020 {
2021 GIMPLE_CHECK (gs, GIMPLE_CALL);
2022 return gimple_op (gs, index + 3);
2023 }
2024
2025
2026 /* Return a pointer to the argument at position INDEX for call
2027 statement GS. */
2028
2029 static inline tree *
2030 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2031 {
2032 GIMPLE_CHECK (gs, GIMPLE_CALL);
2033 return gimple_op_ptr (gs, index + 3);
2034 }
2035
2036
2037 /* Set ARG to be the argument at position INDEX for call statement GS. */
2038
2039 static inline void
2040 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2041 {
2042 GIMPLE_CHECK (gs, GIMPLE_CALL);
2043 gcc_assert (is_gimple_operand (arg));
2044 gimple_set_op (gs, index + 3, arg);
2045 }
2046
2047
2048 /* If TAIL_P is true, mark call statement S as being a tail call
2049 (i.e., a call just before the exit of a function). These calls are
2050 candidate for tail call optimization. */
2051
2052 static inline void
2053 gimple_call_set_tail (gimple s, bool tail_p)
2054 {
2055 GIMPLE_CHECK (s, GIMPLE_CALL);
2056 if (tail_p)
2057 s->gsbase.subcode |= GF_CALL_TAILCALL;
2058 else
2059 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2060 }
2061
2062
2063 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2064
2065 static inline bool
2066 gimple_call_tail_p (gimple s)
2067 {
2068 GIMPLE_CHECK (s, GIMPLE_CALL);
2069 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2070 }
2071
2072
2073 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2074
2075 static inline void
2076 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2077 {
2078 GIMPLE_CHECK (s, GIMPLE_CALL);
2079 if (inlinable_p)
2080 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2081 else
2082 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2083 }
2084
2085
2086 /* Return true if GIMPLE_CALL S cannot be inlined. */
2087
2088 static inline bool
2089 gimple_call_cannot_inline_p (gimple s)
2090 {
2091 GIMPLE_CHECK (s, GIMPLE_CALL);
2092 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2093 }
2094
2095
2096 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2097 slot optimization. This transformation uses the target of the call
2098 expansion as the return slot for calls that return in memory. */
2099
2100 static inline void
2101 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2102 {
2103 GIMPLE_CHECK (s, GIMPLE_CALL);
2104 if (return_slot_opt_p)
2105 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2106 else
2107 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2108 }
2109
2110
2111 /* Return true if S is marked for return slot optimization. */
2112
2113 static inline bool
2114 gimple_call_return_slot_opt_p (gimple s)
2115 {
2116 GIMPLE_CHECK (s, GIMPLE_CALL);
2117 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2118 }
2119
2120
2121 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2122 thunk to the thunked-to function. */
2123
2124 static inline void
2125 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2126 {
2127 GIMPLE_CHECK (s, GIMPLE_CALL);
2128 if (from_thunk_p)
2129 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2130 else
2131 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2132 }
2133
2134
2135 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2136
2137 static inline bool
2138 gimple_call_from_thunk_p (gimple s)
2139 {
2140 GIMPLE_CHECK (s, GIMPLE_CALL);
2141 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2142 }
2143
2144
2145 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2146 argument pack in its argument list. */
2147
2148 static inline void
2149 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2150 {
2151 GIMPLE_CHECK (s, GIMPLE_CALL);
2152 if (pass_arg_pack_p)
2153 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2154 else
2155 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2156 }
2157
2158
2159 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2160 argument pack in its argument list. */
2161
2162 static inline bool
2163 gimple_call_va_arg_pack_p (gimple s)
2164 {
2165 GIMPLE_CHECK (s, GIMPLE_CALL);
2166 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2167 }
2168
2169
2170 /* Return true if S is a noreturn call. */
2171
2172 static inline bool
2173 gimple_call_noreturn_p (gimple s)
2174 {
2175 GIMPLE_CHECK (s, GIMPLE_CALL);
2176 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2177 }
2178
2179
2180 /* Return true if S is a nothrow call. */
2181
2182 static inline bool
2183 gimple_call_nothrow_p (gimple s)
2184 {
2185 GIMPLE_CHECK (s, GIMPLE_CALL);
2186 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2187 }
2188
2189
2190 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2191
2192 static inline void
2193 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2194 {
2195 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2196 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2197 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2198 }
2199
2200
2201 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2202 non-NULL lhs. */
2203
2204 static inline bool
2205 gimple_has_lhs (gimple stmt)
2206 {
2207 return (is_gimple_assign (stmt)
2208 || (is_gimple_call (stmt)
2209 && gimple_call_lhs (stmt) != NULL_TREE));
2210 }
2211
2212
2213 /* Return the code of the predicate computed by conditional statement GS. */
2214
2215 static inline enum tree_code
2216 gimple_cond_code (const_gimple gs)
2217 {
2218 GIMPLE_CHECK (gs, GIMPLE_COND);
2219 return gs->gsbase.subcode;
2220 }
2221
2222
2223 /* Set CODE to be the predicate code for the conditional statement GS. */
2224
2225 static inline void
2226 gimple_cond_set_code (gimple gs, enum tree_code code)
2227 {
2228 GIMPLE_CHECK (gs, GIMPLE_COND);
2229 gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
2230 gs->gsbase.subcode = code;
2231 }
2232
2233
2234 /* Return the LHS of the predicate computed by conditional statement GS. */
2235
2236 static inline tree
2237 gimple_cond_lhs (const_gimple gs)
2238 {
2239 GIMPLE_CHECK (gs, GIMPLE_COND);
2240 return gimple_op (gs, 0);
2241 }
2242
2243 /* Return the pointer to the LHS of the predicate computed by conditional
2244 statement GS. */
2245
2246 static inline tree *
2247 gimple_cond_lhs_ptr (const_gimple gs)
2248 {
2249 GIMPLE_CHECK (gs, GIMPLE_COND);
2250 return gimple_op_ptr (gs, 0);
2251 }
2252
2253 /* Set LHS to be the LHS operand of the predicate computed by
2254 conditional statement GS. */
2255
2256 static inline void
2257 gimple_cond_set_lhs (gimple gs, tree lhs)
2258 {
2259 GIMPLE_CHECK (gs, GIMPLE_COND);
2260 gcc_assert (is_gimple_operand (lhs));
2261 gimple_set_op (gs, 0, lhs);
2262 }
2263
2264
2265 /* Return the RHS operand of the predicate computed by conditional GS. */
2266
2267 static inline tree
2268 gimple_cond_rhs (const_gimple gs)
2269 {
2270 GIMPLE_CHECK (gs, GIMPLE_COND);
2271 return gimple_op (gs, 1);
2272 }
2273
2274 /* Return the pointer to the RHS operand of the predicate computed by
2275 conditional GS. */
2276
2277 static inline tree *
2278 gimple_cond_rhs_ptr (const_gimple gs)
2279 {
2280 GIMPLE_CHECK (gs, GIMPLE_COND);
2281 return gimple_op_ptr (gs, 1);
2282 }
2283
2284
2285 /* Set RHS to be the RHS operand of the predicate computed by
2286 conditional statement GS. */
2287
2288 static inline void
2289 gimple_cond_set_rhs (gimple gs, tree rhs)
2290 {
2291 GIMPLE_CHECK (gs, GIMPLE_COND);
2292 gcc_assert (is_gimple_operand (rhs));
2293 gimple_set_op (gs, 1, rhs);
2294 }
2295
2296
2297 /* Return the label used by conditional statement GS when its
2298 predicate evaluates to true. */
2299
2300 static inline tree
2301 gimple_cond_true_label (const_gimple gs)
2302 {
2303 GIMPLE_CHECK (gs, GIMPLE_COND);
2304 return gimple_op (gs, 2);
2305 }
2306
2307
2308 /* Set LABEL to be the label used by conditional statement GS when its
2309 predicate evaluates to true. */
2310
2311 static inline void
2312 gimple_cond_set_true_label (gimple gs, tree label)
2313 {
2314 GIMPLE_CHECK (gs, GIMPLE_COND);
2315 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2316 gimple_set_op (gs, 2, label);
2317 }
2318
2319
2320 /* Set LABEL to be the label used by conditional statement GS when its
2321 predicate evaluates to false. */
2322
2323 static inline void
2324 gimple_cond_set_false_label (gimple gs, tree label)
2325 {
2326 GIMPLE_CHECK (gs, GIMPLE_COND);
2327 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2328 gimple_set_op (gs, 3, label);
2329 }
2330
2331
2332 /* Return the label used by conditional statement GS when its
2333 predicate evaluates to false. */
2334
2335 static inline tree
2336 gimple_cond_false_label (const_gimple gs)
2337 {
2338 GIMPLE_CHECK (gs, GIMPLE_COND);
2339 return gimple_op (gs, 3);
2340 }
2341
2342
2343 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2344
2345 static inline void
2346 gimple_cond_make_false (gimple gs)
2347 {
2348 gimple_cond_set_lhs (gs, boolean_true_node);
2349 gimple_cond_set_rhs (gs, boolean_false_node);
2350 gs->gsbase.subcode = EQ_EXPR;
2351 }
2352
2353
2354 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2355
2356 static inline void
2357 gimple_cond_make_true (gimple gs)
2358 {
2359 gimple_cond_set_lhs (gs, boolean_true_node);
2360 gimple_cond_set_rhs (gs, boolean_true_node);
2361 gs->gsbase.subcode = EQ_EXPR;
2362 }
2363
2364 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2365 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2366
2367 static inline bool
2368 gimple_cond_true_p (const_gimple gs)
2369 {
2370 tree lhs = gimple_cond_lhs (gs);
2371 tree rhs = gimple_cond_rhs (gs);
2372 enum tree_code code = gimple_cond_code (gs);
2373
2374 if (lhs != boolean_true_node && lhs != boolean_false_node)
2375 return false;
2376
2377 if (rhs != boolean_true_node && rhs != boolean_false_node)
2378 return false;
2379
2380 if (code == NE_EXPR && lhs != rhs)
2381 return true;
2382
2383 if (code == EQ_EXPR && lhs == rhs)
2384 return true;
2385
2386 return false;
2387 }
2388
2389 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2390 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2391
2392 static inline bool
2393 gimple_cond_false_p (const_gimple gs)
2394 {
2395 tree lhs = gimple_cond_lhs (gs);
2396 tree rhs = gimple_cond_rhs (gs);
2397 enum tree_code code = gimple_cond_code (gs);
2398
2399 if (lhs != boolean_true_node && lhs != boolean_false_node)
2400 return false;
2401
2402 if (rhs != boolean_true_node && rhs != boolean_false_node)
2403 return false;
2404
2405 if (code == NE_EXPR && lhs == rhs)
2406 return true;
2407
2408 if (code == EQ_EXPR && lhs != rhs)
2409 return true;
2410
2411 return false;
2412 }
2413
2414 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2415 'if (var == 1)' */
2416
2417 static inline bool
2418 gimple_cond_single_var_p (gimple gs)
2419 {
2420 if (gimple_cond_code (gs) == NE_EXPR
2421 && gimple_cond_rhs (gs) == boolean_false_node)
2422 return true;
2423
2424 if (gimple_cond_code (gs) == EQ_EXPR
2425 && gimple_cond_rhs (gs) == boolean_true_node)
2426 return true;
2427
2428 return false;
2429 }
2430
2431 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2432
2433 static inline void
2434 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2435 {
2436 gimple_cond_set_code (stmt, code);
2437 gimple_cond_set_lhs (stmt, lhs);
2438 gimple_cond_set_rhs (stmt, rhs);
2439 }
2440
2441 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2442
2443 static inline tree
2444 gimple_label_label (const_gimple gs)
2445 {
2446 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2447 return gimple_op (gs, 0);
2448 }
2449
2450
2451 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2452 GS. */
2453
2454 static inline void
2455 gimple_label_set_label (gimple gs, tree label)
2456 {
2457 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2458 gcc_assert (TREE_CODE (label) == LABEL_DECL);
2459 gimple_set_op (gs, 0, label);
2460 }
2461
2462
2463 /* Return the destination of the unconditional jump GS. */
2464
2465 static inline tree
2466 gimple_goto_dest (const_gimple gs)
2467 {
2468 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2469 return gimple_op (gs, 0);
2470 }
2471
2472
2473 /* Set DEST to be the destination of the unconditonal jump GS. */
2474
2475 static inline void
2476 gimple_goto_set_dest (gimple gs, tree dest)
2477 {
2478 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2479 gcc_assert (is_gimple_operand (dest));
2480 gimple_set_op (gs, 0, dest);
2481 }
2482
2483
2484 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2485
2486 static inline tree
2487 gimple_bind_vars (const_gimple gs)
2488 {
2489 GIMPLE_CHECK (gs, GIMPLE_BIND);
2490 return gs->gimple_bind.vars;
2491 }
2492
2493
2494 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2495 statement GS. */
2496
2497 static inline void
2498 gimple_bind_set_vars (gimple gs, tree vars)
2499 {
2500 GIMPLE_CHECK (gs, GIMPLE_BIND);
2501 gs->gimple_bind.vars = vars;
2502 }
2503
2504
2505 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2506 statement GS. */
2507
2508 static inline void
2509 gimple_bind_append_vars (gimple gs, tree vars)
2510 {
2511 GIMPLE_CHECK (gs, GIMPLE_BIND);
2512 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2513 }
2514
2515
2516 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2517
2518 static inline gimple_seq
2519 gimple_bind_body (gimple gs)
2520 {
2521 GIMPLE_CHECK (gs, GIMPLE_BIND);
2522 return gs->gimple_bind.body;
2523 }
2524
2525
2526 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2527 statement GS. */
2528
2529 static inline void
2530 gimple_bind_set_body (gimple gs, gimple_seq seq)
2531 {
2532 GIMPLE_CHECK (gs, GIMPLE_BIND);
2533 gs->gimple_bind.body = seq;
2534 }
2535
2536
2537 /* Append a statement to the end of a GIMPLE_BIND's body. */
2538
2539 static inline void
2540 gimple_bind_add_stmt (gimple gs, gimple stmt)
2541 {
2542 GIMPLE_CHECK (gs, GIMPLE_BIND);
2543 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2544 }
2545
2546
2547 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2548
2549 static inline void
2550 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2551 {
2552 GIMPLE_CHECK (gs, GIMPLE_BIND);
2553 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2554 }
2555
2556
2557 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2558 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2559
2560 static inline tree
2561 gimple_bind_block (const_gimple gs)
2562 {
2563 GIMPLE_CHECK (gs, GIMPLE_BIND);
2564 return gs->gimple_bind.block;
2565 }
2566
2567
2568 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2569 statement GS. */
2570
2571 static inline void
2572 gimple_bind_set_block (gimple gs, tree block)
2573 {
2574 GIMPLE_CHECK (gs, GIMPLE_BIND);
2575 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2576 gs->gimple_bind.block = block;
2577 }
2578
2579
2580 /* Return the number of input operands for GIMPLE_ASM GS. */
2581
2582 static inline unsigned
2583 gimple_asm_ninputs (const_gimple gs)
2584 {
2585 GIMPLE_CHECK (gs, GIMPLE_ASM);
2586 return gs->gimple_asm.ni;
2587 }
2588
2589
2590 /* Return the number of output operands for GIMPLE_ASM GS. */
2591
2592 static inline unsigned
2593 gimple_asm_noutputs (const_gimple gs)
2594 {
2595 GIMPLE_CHECK (gs, GIMPLE_ASM);
2596 return gs->gimple_asm.no;
2597 }
2598
2599
2600 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2601
2602 static inline unsigned
2603 gimple_asm_nclobbers (const_gimple gs)
2604 {
2605 GIMPLE_CHECK (gs, GIMPLE_ASM);
2606 return gs->gimple_asm.nc;
2607 }
2608
2609
2610 /* Return input operand INDEX of GIMPLE_ASM GS. */
2611
2612 static inline tree
2613 gimple_asm_input_op (const_gimple gs, unsigned index)
2614 {
2615 GIMPLE_CHECK (gs, GIMPLE_ASM);
2616 gcc_assert (index <= gs->gimple_asm.ni);
2617 return gimple_op (gs, index);
2618 }
2619
2620 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2621
2622 static inline tree *
2623 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2624 {
2625 GIMPLE_CHECK (gs, GIMPLE_ASM);
2626 gcc_assert (index <= gs->gimple_asm.ni);
2627 return gimple_op_ptr (gs, index);
2628 }
2629
2630
2631 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2632
2633 static inline void
2634 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2635 {
2636 GIMPLE_CHECK (gs, GIMPLE_ASM);
2637 gcc_assert (index <= gs->gimple_asm.ni);
2638 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2639 gimple_set_op (gs, index, in_op);
2640 }
2641
2642
2643 /* Return output operand INDEX of GIMPLE_ASM GS. */
2644
2645 static inline tree
2646 gimple_asm_output_op (const_gimple gs, unsigned index)
2647 {
2648 GIMPLE_CHECK (gs, GIMPLE_ASM);
2649 gcc_assert (index <= gs->gimple_asm.no);
2650 return gimple_op (gs, index + gs->gimple_asm.ni);
2651 }
2652
2653 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2654
2655 static inline tree *
2656 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2657 {
2658 GIMPLE_CHECK (gs, GIMPLE_ASM);
2659 gcc_assert (index <= gs->gimple_asm.no);
2660 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2661 }
2662
2663
2664 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2665
2666 static inline void
2667 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2668 {
2669 GIMPLE_CHECK (gs, GIMPLE_ASM);
2670 gcc_assert (index <= gs->gimple_asm.no);
2671 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2672 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2673 }
2674
2675
2676 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2677
2678 static inline tree
2679 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2680 {
2681 GIMPLE_CHECK (gs, GIMPLE_ASM);
2682 gcc_assert (index <= gs->gimple_asm.nc);
2683 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2684 }
2685
2686
2687 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2688
2689 static inline void
2690 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2691 {
2692 GIMPLE_CHECK (gs, GIMPLE_ASM);
2693 gcc_assert (index <= gs->gimple_asm.nc);
2694 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2695 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2696 }
2697
2698
2699 /* Return the string representing the assembly instruction in
2700 GIMPLE_ASM GS. */
2701
2702 static inline const char *
2703 gimple_asm_string (const_gimple gs)
2704 {
2705 GIMPLE_CHECK (gs, GIMPLE_ASM);
2706 return gs->gimple_asm.string;
2707 }
2708
2709
2710 /* Return true if GS is an asm statement marked volatile. */
2711
2712 static inline bool
2713 gimple_asm_volatile_p (const_gimple gs)
2714 {
2715 GIMPLE_CHECK (gs, GIMPLE_ASM);
2716 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2717 }
2718
2719
2720 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2721
2722 static inline void
2723 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2724 {
2725 GIMPLE_CHECK (gs, GIMPLE_ASM);
2726 if (volatile_p)
2727 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2728 else
2729 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2730 }
2731
2732
2733 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2734
2735 static inline void
2736 gimple_asm_set_input (gimple gs, bool input_p)
2737 {
2738 GIMPLE_CHECK (gs, GIMPLE_ASM);
2739 if (input_p)
2740 gs->gsbase.subcode |= GF_ASM_INPUT;
2741 else
2742 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2743 }
2744
2745
2746 /* Return true if asm GS is an ASM_INPUT. */
2747
2748 static inline bool
2749 gimple_asm_input_p (const_gimple gs)
2750 {
2751 GIMPLE_CHECK (gs, GIMPLE_ASM);
2752 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2753 }
2754
2755
2756 /* Return the types handled by GIMPLE_CATCH statement GS. */
2757
2758 static inline tree
2759 gimple_catch_types (const_gimple gs)
2760 {
2761 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2762 return gs->gimple_catch.types;
2763 }
2764
2765
2766 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2767
2768 static inline tree *
2769 gimple_catch_types_ptr (gimple gs)
2770 {
2771 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2772 return &gs->gimple_catch.types;
2773 }
2774
2775
2776 /* Return the GIMPLE sequence representing the body of the handler of
2777 GIMPLE_CATCH statement GS. */
2778
2779 static inline gimple_seq
2780 gimple_catch_handler (gimple gs)
2781 {
2782 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2783 return gs->gimple_catch.handler;
2784 }
2785
2786
2787 /* Return a pointer to the GIMPLE sequence representing the body of
2788 the handler of GIMPLE_CATCH statement GS. */
2789
2790 static inline gimple_seq *
2791 gimple_catch_handler_ptr (gimple gs)
2792 {
2793 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2794 return &gs->gimple_catch.handler;
2795 }
2796
2797
2798 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2799
2800 static inline void
2801 gimple_catch_set_types (gimple gs, tree t)
2802 {
2803 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2804 gs->gimple_catch.types = t;
2805 }
2806
2807
2808 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2809
2810 static inline void
2811 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2812 {
2813 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2814 gs->gimple_catch.handler = handler;
2815 }
2816
2817
2818 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2819
2820 static inline tree
2821 gimple_eh_filter_types (const_gimple gs)
2822 {
2823 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2824 return gs->gimple_eh_filter.types;
2825 }
2826
2827
2828 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2829 GS. */
2830
2831 static inline tree *
2832 gimple_eh_filter_types_ptr (gimple gs)
2833 {
2834 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2835 return &gs->gimple_eh_filter.types;
2836 }
2837
2838
2839 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2840 statement fails. */
2841
2842 static inline gimple_seq
2843 gimple_eh_filter_failure (gimple gs)
2844 {
2845 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2846 return gs->gimple_eh_filter.failure;
2847 }
2848
2849
2850 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2851
2852 static inline void
2853 gimple_eh_filter_set_types (gimple gs, tree types)
2854 {
2855 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2856 gs->gimple_eh_filter.types = types;
2857 }
2858
2859
2860 /* Set FAILURE to be the sequence of statements to execute on failure
2861 for GIMPLE_EH_FILTER GS. */
2862
2863 static inline void
2864 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2865 {
2866 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2867 gs->gimple_eh_filter.failure = failure;
2868 }
2869
2870 /* Return the EH_FILTER_MUST_NOT_THROW flag. */
2871
2872 static inline bool
2873
2874 gimple_eh_filter_must_not_throw (gimple gs)
2875 {
2876 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2877 return gs->gsbase.subcode != 0;
2878 }
2879
2880 /* Set the EH_FILTER_MUST_NOT_THROW flag to the value MNTP. */
2881
2882 static inline void
2883 gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp)
2884 {
2885 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2886 gs->gsbase.subcode = (unsigned int) mntp;
2887 }
2888
2889
2890 /* GIMPLE_TRY accessors. */
2891
2892 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2893 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2894
2895 static inline enum gimple_try_flags
2896 gimple_try_kind (const_gimple gs)
2897 {
2898 GIMPLE_CHECK (gs, GIMPLE_TRY);
2899 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2900 }
2901
2902
2903 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2904
2905 static inline void
2906 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2907 {
2908 GIMPLE_CHECK (gs, GIMPLE_TRY);
2909 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2910 if (gimple_try_kind (gs) != kind)
2911 gs->gsbase.subcode = (unsigned int) kind;
2912 }
2913
2914
2915 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2916
2917 static inline bool
2918 gimple_try_catch_is_cleanup (const_gimple gs)
2919 {
2920 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2921 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2922 }
2923
2924
2925 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2926
2927 static inline gimple_seq
2928 gimple_try_eval (gimple gs)
2929 {
2930 GIMPLE_CHECK (gs, GIMPLE_TRY);
2931 return gs->gimple_try.eval;
2932 }
2933
2934
2935 /* Return the sequence of statements used as the cleanup body for
2936 GIMPLE_TRY GS. */
2937
2938 static inline gimple_seq
2939 gimple_try_cleanup (gimple gs)
2940 {
2941 GIMPLE_CHECK (gs, GIMPLE_TRY);
2942 return gs->gimple_try.cleanup;
2943 }
2944
2945
2946 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2947
2948 static inline void
2949 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2950 {
2951 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
2952 if (catch_is_cleanup)
2953 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
2954 else
2955 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
2956 }
2957
2958
2959 /* Set EVAL to be the sequence of statements to use as the body for
2960 GIMPLE_TRY GS. */
2961
2962 static inline void
2963 gimple_try_set_eval (gimple gs, gimple_seq eval)
2964 {
2965 GIMPLE_CHECK (gs, GIMPLE_TRY);
2966 gs->gimple_try.eval = eval;
2967 }
2968
2969
2970 /* Set CLEANUP to be the sequence of statements to use as the cleanup
2971 body for GIMPLE_TRY GS. */
2972
2973 static inline void
2974 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
2975 {
2976 GIMPLE_CHECK (gs, GIMPLE_TRY);
2977 gs->gimple_try.cleanup = cleanup;
2978 }
2979
2980
2981 /* Return the cleanup sequence for cleanup statement GS. */
2982
2983 static inline gimple_seq
2984 gimple_wce_cleanup (gimple gs)
2985 {
2986 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2987 return gs->gimple_wce.cleanup;
2988 }
2989
2990
2991 /* Set CLEANUP to be the cleanup sequence for GS. */
2992
2993 static inline void
2994 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
2995 {
2996 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
2997 gs->gimple_wce.cleanup = cleanup;
2998 }
2999
3000
3001 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3002
3003 static inline bool
3004 gimple_wce_cleanup_eh_only (const_gimple gs)
3005 {
3006 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3007 return gs->gsbase.subcode != 0;
3008 }
3009
3010
3011 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3012
3013 static inline void
3014 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3015 {
3016 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3017 gs->gsbase.subcode = (unsigned int) eh_only_p;
3018 }
3019
3020
3021 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3022
3023 static inline unsigned
3024 gimple_phi_capacity (const_gimple gs)
3025 {
3026 GIMPLE_CHECK (gs, GIMPLE_PHI);
3027 return gs->gimple_phi.capacity;
3028 }
3029
3030
3031 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3032 be exactly the number of incoming edges for the basic block holding
3033 GS. */
3034
3035 static inline unsigned
3036 gimple_phi_num_args (const_gimple gs)
3037 {
3038 GIMPLE_CHECK (gs, GIMPLE_PHI);
3039 return gs->gimple_phi.nargs;
3040 }
3041
3042
3043 /* Return the SSA name created by GIMPLE_PHI GS. */
3044
3045 static inline tree
3046 gimple_phi_result (const_gimple gs)
3047 {
3048 GIMPLE_CHECK (gs, GIMPLE_PHI);
3049 return gs->gimple_phi.result;
3050 }
3051
3052 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3053
3054 static inline tree *
3055 gimple_phi_result_ptr (gimple gs)
3056 {
3057 GIMPLE_CHECK (gs, GIMPLE_PHI);
3058 return &gs->gimple_phi.result;
3059 }
3060
3061 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3062
3063 static inline void
3064 gimple_phi_set_result (gimple gs, tree result)
3065 {
3066 GIMPLE_CHECK (gs, GIMPLE_PHI);
3067 gs->gimple_phi.result = result;
3068 }
3069
3070
3071 /* Return the PHI argument corresponding to incoming edge INDEX for
3072 GIMPLE_PHI GS. */
3073
3074 static inline struct phi_arg_d *
3075 gimple_phi_arg (gimple gs, unsigned index)
3076 {
3077 GIMPLE_CHECK (gs, GIMPLE_PHI);
3078 gcc_assert (index <= gs->gimple_phi.capacity);
3079 return &(gs->gimple_phi.args[index]);
3080 }
3081
3082 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3083 for GIMPLE_PHI GS. */
3084
3085 static inline void
3086 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3087 {
3088 GIMPLE_CHECK (gs, GIMPLE_PHI);
3089 gcc_assert (index <= gs->gimple_phi.nargs);
3090 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3091 }
3092
3093 /* Return the region number for GIMPLE_RESX GS. */
3094
3095 static inline int
3096 gimple_resx_region (const_gimple gs)
3097 {
3098 GIMPLE_CHECK (gs, GIMPLE_RESX);
3099 return gs->gimple_resx.region;
3100 }
3101
3102 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3103
3104 static inline void
3105 gimple_resx_set_region (gimple gs, int region)
3106 {
3107 GIMPLE_CHECK (gs, GIMPLE_RESX);
3108 gs->gimple_resx.region = region;
3109 }
3110
3111
3112 /* Return the number of labels associated with the switch statement GS. */
3113
3114 static inline unsigned
3115 gimple_switch_num_labels (const_gimple gs)
3116 {
3117 unsigned num_ops;
3118 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3119 num_ops = gimple_num_ops (gs);
3120 gcc_assert (num_ops > 1);
3121 return num_ops - 1;
3122 }
3123
3124
3125 /* Set NLABELS to be the number of labels for the switch statement GS. */
3126
3127 static inline void
3128 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3129 {
3130 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3131 gimple_set_num_ops (g, nlabels + 1);
3132 }
3133
3134
3135 /* Return the index variable used by the switch statement GS. */
3136
3137 static inline tree
3138 gimple_switch_index (const_gimple gs)
3139 {
3140 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3141 return gimple_op (gs, 0);
3142 }
3143
3144
3145 /* Return a pointer to the index variable for the switch statement GS. */
3146
3147 static inline tree *
3148 gimple_switch_index_ptr (const_gimple gs)
3149 {
3150 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3151 return gimple_op_ptr (gs, 0);
3152 }
3153
3154
3155 /* Set INDEX to be the index variable for switch statement GS. */
3156
3157 static inline void
3158 gimple_switch_set_index (gimple gs, tree index)
3159 {
3160 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3161 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3162 gimple_set_op (gs, 0, index);
3163 }
3164
3165
3166 /* Return the label numbered INDEX. The default label is 0, followed by any
3167 labels in a switch statement. */
3168
3169 static inline tree
3170 gimple_switch_label (const_gimple gs, unsigned index)
3171 {
3172 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3173 gcc_assert (gimple_num_ops (gs) > index + 1);
3174 return gimple_op (gs, index + 1);
3175 }
3176
3177 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3178
3179 static inline void
3180 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3181 {
3182 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3183 gcc_assert (gimple_num_ops (gs) > index + 1);
3184 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3185 gimple_set_op (gs, index + 1, label);
3186 }
3187
3188 /* Return the default label for a switch statement. */
3189
3190 static inline tree
3191 gimple_switch_default_label (const_gimple gs)
3192 {
3193 return gimple_switch_label (gs, 0);
3194 }
3195
3196 /* Set the default label for a switch statement. */
3197
3198 static inline void
3199 gimple_switch_set_default_label (gimple gs, tree label)
3200 {
3201 gimple_switch_set_label (gs, 0, label);
3202 }
3203
3204
3205 /* Return the body for the OMP statement GS. */
3206
3207 static inline gimple_seq
3208 gimple_omp_body (gimple gs)
3209 {
3210 return gs->omp.body;
3211 }
3212
3213 /* Set BODY to be the body for the OMP statement GS. */
3214
3215 static inline void
3216 gimple_omp_set_body (gimple gs, gimple_seq body)
3217 {
3218 gs->omp.body = body;
3219 }
3220
3221
3222 /* Return the name associated with OMP_CRITICAL statement GS. */
3223
3224 static inline tree
3225 gimple_omp_critical_name (const_gimple gs)
3226 {
3227 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3228 return gs->gimple_omp_critical.name;
3229 }
3230
3231
3232 /* Return a pointer to the name associated with OMP critical statement GS. */
3233
3234 static inline tree *
3235 gimple_omp_critical_name_ptr (gimple gs)
3236 {
3237 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3238 return &gs->gimple_omp_critical.name;
3239 }
3240
3241
3242 /* Set NAME to be the name associated with OMP critical statement GS. */
3243
3244 static inline void
3245 gimple_omp_critical_set_name (gimple gs, tree name)
3246 {
3247 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3248 gs->gimple_omp_critical.name = name;
3249 }
3250
3251
3252 /* Return the clauses associated with OMP_FOR GS. */
3253
3254 static inline tree
3255 gimple_omp_for_clauses (const_gimple gs)
3256 {
3257 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3258 return gs->gimple_omp_for.clauses;
3259 }
3260
3261
3262 /* Return a pointer to the OMP_FOR GS. */
3263
3264 static inline tree *
3265 gimple_omp_for_clauses_ptr (gimple gs)
3266 {
3267 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3268 return &gs->gimple_omp_for.clauses;
3269 }
3270
3271
3272 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3273
3274 static inline void
3275 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3276 {
3277 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3278 gs->gimple_omp_for.clauses = clauses;
3279 }
3280
3281
3282 /* Get the collapse count of OMP_FOR GS. */
3283
3284 static inline size_t
3285 gimple_omp_for_collapse (gimple gs)
3286 {
3287 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3288 return gs->gimple_omp_for.collapse;
3289 }
3290
3291
3292 /* Return the index variable for OMP_FOR GS. */
3293
3294 static inline tree
3295 gimple_omp_for_index (const_gimple gs, size_t i)
3296 {
3297 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3298 gcc_assert (i < gs->gimple_omp_for.collapse);
3299 return gs->gimple_omp_for.iter[i].index;
3300 }
3301
3302
3303 /* Return a pointer to the index variable for OMP_FOR GS. */
3304
3305 static inline tree *
3306 gimple_omp_for_index_ptr (gimple gs, size_t i)
3307 {
3308 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3309 gcc_assert (i < gs->gimple_omp_for.collapse);
3310 return &gs->gimple_omp_for.iter[i].index;
3311 }
3312
3313
3314 /* Set INDEX to be the index variable for OMP_FOR GS. */
3315
3316 static inline void
3317 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3318 {
3319 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3320 gcc_assert (i < gs->gimple_omp_for.collapse);
3321 gs->gimple_omp_for.iter[i].index = index;
3322 }
3323
3324
3325 /* Return the initial value for OMP_FOR GS. */
3326
3327 static inline tree
3328 gimple_omp_for_initial (const_gimple gs, size_t i)
3329 {
3330 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3331 gcc_assert (i < gs->gimple_omp_for.collapse);
3332 return gs->gimple_omp_for.iter[i].initial;
3333 }
3334
3335
3336 /* Return a pointer to the initial value for OMP_FOR GS. */
3337
3338 static inline tree *
3339 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3340 {
3341 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3342 gcc_assert (i < gs->gimple_omp_for.collapse);
3343 return &gs->gimple_omp_for.iter[i].initial;
3344 }
3345
3346
3347 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3348
3349 static inline void
3350 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3351 {
3352 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3353 gcc_assert (i < gs->gimple_omp_for.collapse);
3354 gs->gimple_omp_for.iter[i].initial = initial;
3355 }
3356
3357
3358 /* Return the final value for OMP_FOR GS. */
3359
3360 static inline tree
3361 gimple_omp_for_final (const_gimple gs, size_t i)
3362 {
3363 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3364 gcc_assert (i < gs->gimple_omp_for.collapse);
3365 return gs->gimple_omp_for.iter[i].final;
3366 }
3367
3368
3369 /* Return a pointer to the final value for OMP_FOR GS. */
3370
3371 static inline tree *
3372 gimple_omp_for_final_ptr (gimple gs, size_t i)
3373 {
3374 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3375 gcc_assert (i < gs->gimple_omp_for.collapse);
3376 return &gs->gimple_omp_for.iter[i].final;
3377 }
3378
3379
3380 /* Set FINAL to be the final value for OMP_FOR GS. */
3381
3382 static inline void
3383 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3384 {
3385 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3386 gcc_assert (i < gs->gimple_omp_for.collapse);
3387 gs->gimple_omp_for.iter[i].final = final;
3388 }
3389
3390
3391 /* Return the increment value for OMP_FOR GS. */
3392
3393 static inline tree
3394 gimple_omp_for_incr (const_gimple gs, size_t i)
3395 {
3396 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3397 gcc_assert (i < gs->gimple_omp_for.collapse);
3398 return gs->gimple_omp_for.iter[i].incr;
3399 }
3400
3401
3402 /* Return a pointer to the increment value for OMP_FOR GS. */
3403
3404 static inline tree *
3405 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3406 {
3407 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3408 gcc_assert (i < gs->gimple_omp_for.collapse);
3409 return &gs->gimple_omp_for.iter[i].incr;
3410 }
3411
3412
3413 /* Set INCR to be the increment value for OMP_FOR GS. */
3414
3415 static inline void
3416 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3417 {
3418 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3419 gcc_assert (i < gs->gimple_omp_for.collapse);
3420 gs->gimple_omp_for.iter[i].incr = incr;
3421 }
3422
3423
3424 /* Return the sequence of statements to execute before the OMP_FOR
3425 statement GS starts. */
3426
3427 static inline gimple_seq
3428 gimple_omp_for_pre_body (gimple gs)
3429 {
3430 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3431 return gs->gimple_omp_for.pre_body;
3432 }
3433
3434
3435 /* Set PRE_BODY to be the sequence of statements to execute before the
3436 OMP_FOR statement GS starts. */
3437
3438 static inline void
3439 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3440 {
3441 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3442 gs->gimple_omp_for.pre_body = pre_body;
3443 }
3444
3445
3446 /* Return the clauses associated with OMP_PARALLEL GS. */
3447
3448 static inline tree
3449 gimple_omp_parallel_clauses (const_gimple gs)
3450 {
3451 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3452 return gs->gimple_omp_parallel.clauses;
3453 }
3454
3455
3456 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3457
3458 static inline tree *
3459 gimple_omp_parallel_clauses_ptr (gimple gs)
3460 {
3461 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3462 return &gs->gimple_omp_parallel.clauses;
3463 }
3464
3465
3466 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3467 GS. */
3468
3469 static inline void
3470 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3471 {
3472 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3473 gs->gimple_omp_parallel.clauses = clauses;
3474 }
3475
3476
3477 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3478
3479 static inline tree
3480 gimple_omp_parallel_child_fn (const_gimple gs)
3481 {
3482 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3483 return gs->gimple_omp_parallel.child_fn;
3484 }
3485
3486 /* Return a pointer to the child function used to hold the body of
3487 OMP_PARALLEL GS. */
3488
3489 static inline tree *
3490 gimple_omp_parallel_child_fn_ptr (gimple gs)
3491 {
3492 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3493 return &gs->gimple_omp_parallel.child_fn;
3494 }
3495
3496
3497 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3498
3499 static inline void
3500 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3501 {
3502 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3503 gs->gimple_omp_parallel.child_fn = child_fn;
3504 }
3505
3506
3507 /* Return the artificial argument used to send variables and values
3508 from the parent to the children threads in OMP_PARALLEL GS. */
3509
3510 static inline tree
3511 gimple_omp_parallel_data_arg (const_gimple gs)
3512 {
3513 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3514 return gs->gimple_omp_parallel.data_arg;
3515 }
3516
3517
3518 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3519
3520 static inline tree *
3521 gimple_omp_parallel_data_arg_ptr (gimple gs)
3522 {
3523 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3524 return &gs->gimple_omp_parallel.data_arg;
3525 }
3526
3527
3528 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3529
3530 static inline void
3531 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3532 {
3533 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3534 gs->gimple_omp_parallel.data_arg = data_arg;
3535 }
3536
3537
3538 /* Return the clauses associated with OMP_TASK GS. */
3539
3540 static inline tree
3541 gimple_omp_task_clauses (const_gimple gs)
3542 {
3543 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3544 return gs->gimple_omp_parallel.clauses;
3545 }
3546
3547
3548 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3549
3550 static inline tree *
3551 gimple_omp_task_clauses_ptr (gimple gs)
3552 {
3553 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3554 return &gs->gimple_omp_parallel.clauses;
3555 }
3556
3557
3558 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3559 GS. */
3560
3561 static inline void
3562 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3563 {
3564 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3565 gs->gimple_omp_parallel.clauses = clauses;
3566 }
3567
3568
3569 /* Return the child function used to hold the body of OMP_TASK GS. */
3570
3571 static inline tree
3572 gimple_omp_task_child_fn (const_gimple gs)
3573 {
3574 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3575 return gs->gimple_omp_parallel.child_fn;
3576 }
3577
3578 /* Return a pointer to the child function used to hold the body of
3579 OMP_TASK GS. */
3580
3581 static inline tree *
3582 gimple_omp_task_child_fn_ptr (gimple gs)
3583 {
3584 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3585 return &gs->gimple_omp_parallel.child_fn;
3586 }
3587
3588
3589 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3590
3591 static inline void
3592 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3593 {
3594 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3595 gs->gimple_omp_parallel.child_fn = child_fn;
3596 }
3597
3598
3599 /* Return the artificial argument used to send variables and values
3600 from the parent to the children threads in OMP_TASK GS. */
3601
3602 static inline tree
3603 gimple_omp_task_data_arg (const_gimple gs)
3604 {
3605 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3606 return gs->gimple_omp_parallel.data_arg;
3607 }
3608
3609
3610 /* Return a pointer to the data argument for OMP_TASK GS. */
3611
3612 static inline tree *
3613 gimple_omp_task_data_arg_ptr (gimple gs)
3614 {
3615 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3616 return &gs->gimple_omp_parallel.data_arg;
3617 }
3618
3619
3620 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3621
3622 static inline void
3623 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3624 {
3625 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3626 gs->gimple_omp_parallel.data_arg = data_arg;
3627 }
3628
3629
3630 /* Return the clauses associated with OMP_TASK GS. */
3631
3632 static inline tree
3633 gimple_omp_taskreg_clauses (const_gimple gs)
3634 {
3635 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3636 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3637 return gs->gimple_omp_parallel.clauses;
3638 }
3639
3640
3641 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3642
3643 static inline tree *
3644 gimple_omp_taskreg_clauses_ptr (gimple gs)
3645 {
3646 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3647 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3648 return &gs->gimple_omp_parallel.clauses;
3649 }
3650
3651
3652 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3653 GS. */
3654
3655 static inline void
3656 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3657 {
3658 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3659 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3660 gs->gimple_omp_parallel.clauses = clauses;
3661 }
3662
3663
3664 /* Return the child function used to hold the body of OMP_TASK GS. */
3665
3666 static inline tree
3667 gimple_omp_taskreg_child_fn (const_gimple gs)
3668 {
3669 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3670 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3671 return gs->gimple_omp_parallel.child_fn;
3672 }
3673
3674 /* Return a pointer to the child function used to hold the body of
3675 OMP_TASK GS. */
3676
3677 static inline tree *
3678 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3679 {
3680 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3681 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3682 return &gs->gimple_omp_parallel.child_fn;
3683 }
3684
3685
3686 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3687
3688 static inline void
3689 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3690 {
3691 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3692 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3693 gs->gimple_omp_parallel.child_fn = child_fn;
3694 }
3695
3696
3697 /* Return the artificial argument used to send variables and values
3698 from the parent to the children threads in OMP_TASK GS. */
3699
3700 static inline tree
3701 gimple_omp_taskreg_data_arg (const_gimple gs)
3702 {
3703 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3704 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3705 return gs->gimple_omp_parallel.data_arg;
3706 }
3707
3708
3709 /* Return a pointer to the data argument for OMP_TASK GS. */
3710
3711 static inline tree *
3712 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3713 {
3714 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3715 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3716 return &gs->gimple_omp_parallel.data_arg;
3717 }
3718
3719
3720 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3721
3722 static inline void
3723 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3724 {
3725 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3726 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3727 gs->gimple_omp_parallel.data_arg = data_arg;
3728 }
3729
3730
3731 /* Return the copy function used to hold the body of OMP_TASK GS. */
3732
3733 static inline tree
3734 gimple_omp_task_copy_fn (const_gimple gs)
3735 {
3736 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3737 return gs->gimple_omp_task.copy_fn;
3738 }
3739
3740 /* Return a pointer to the copy function used to hold the body of
3741 OMP_TASK GS. */
3742
3743 static inline tree *
3744 gimple_omp_task_copy_fn_ptr (gimple gs)
3745 {
3746 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3747 return &gs->gimple_omp_task.copy_fn;
3748 }
3749
3750
3751 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3752
3753 static inline void
3754 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3755 {
3756 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3757 gs->gimple_omp_task.copy_fn = copy_fn;
3758 }
3759
3760
3761 /* Return size of the data block in bytes in OMP_TASK GS. */
3762
3763 static inline tree
3764 gimple_omp_task_arg_size (const_gimple gs)
3765 {
3766 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3767 return gs->gimple_omp_task.arg_size;
3768 }
3769
3770
3771 /* Return a pointer to the data block size for OMP_TASK GS. */
3772
3773 static inline tree *
3774 gimple_omp_task_arg_size_ptr (gimple gs)
3775 {
3776 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3777 return &gs->gimple_omp_task.arg_size;
3778 }
3779
3780
3781 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3782
3783 static inline void
3784 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3785 {
3786 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3787 gs->gimple_omp_task.arg_size = arg_size;
3788 }
3789
3790
3791 /* Return align of the data block in bytes in OMP_TASK GS. */
3792
3793 static inline tree
3794 gimple_omp_task_arg_align (const_gimple gs)
3795 {
3796 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3797 return gs->gimple_omp_task.arg_align;
3798 }
3799
3800
3801 /* Return a pointer to the data block align for OMP_TASK GS. */
3802
3803 static inline tree *
3804 gimple_omp_task_arg_align_ptr (gimple gs)
3805 {
3806 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3807 return &gs->gimple_omp_task.arg_align;
3808 }
3809
3810
3811 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
3812
3813 static inline void
3814 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
3815 {
3816 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3817 gs->gimple_omp_task.arg_align = arg_align;
3818 }
3819
3820
3821 /* Return the clauses associated with OMP_SINGLE GS. */
3822
3823 static inline tree
3824 gimple_omp_single_clauses (const_gimple gs)
3825 {
3826 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3827 return gs->gimple_omp_single.clauses;
3828 }
3829
3830
3831 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
3832
3833 static inline tree *
3834 gimple_omp_single_clauses_ptr (gimple gs)
3835 {
3836 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3837 return &gs->gimple_omp_single.clauses;
3838 }
3839
3840
3841 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
3842
3843 static inline void
3844 gimple_omp_single_set_clauses (gimple gs, tree clauses)
3845 {
3846 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3847 gs->gimple_omp_single.clauses = clauses;
3848 }
3849
3850
3851 /* Return the clauses associated with OMP_SECTIONS GS. */
3852
3853 static inline tree
3854 gimple_omp_sections_clauses (const_gimple gs)
3855 {
3856 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3857 return gs->gimple_omp_sections.clauses;
3858 }
3859
3860
3861 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
3862
3863 static inline tree *
3864 gimple_omp_sections_clauses_ptr (gimple gs)
3865 {
3866 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3867 return &gs->gimple_omp_sections.clauses;
3868 }
3869
3870
3871 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
3872 GS. */
3873
3874 static inline void
3875 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
3876 {
3877 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3878 gs->gimple_omp_sections.clauses = clauses;
3879 }
3880
3881
3882 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
3883 in GS. */
3884
3885 static inline tree
3886 gimple_omp_sections_control (const_gimple gs)
3887 {
3888 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3889 return gs->gimple_omp_sections.control;
3890 }
3891
3892
3893 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
3894 GS. */
3895
3896 static inline tree *
3897 gimple_omp_sections_control_ptr (gimple gs)
3898 {
3899 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3900 return &gs->gimple_omp_sections.control;
3901 }
3902
3903
3904 /* Set CONTROL to be the set of clauses associated with the
3905 GIMPLE_OMP_SECTIONS in GS. */
3906
3907 static inline void
3908 gimple_omp_sections_set_control (gimple gs, tree control)
3909 {
3910 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3911 gs->gimple_omp_sections.control = control;
3912 }
3913
3914
3915 /* Set COND to be the condition code for OMP_FOR GS. */
3916
3917 static inline void
3918 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
3919 {
3920 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3921 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
3922 gcc_assert (i < gs->gimple_omp_for.collapse);
3923 gs->gimple_omp_for.iter[i].cond = cond;
3924 }
3925
3926
3927 /* Return the condition code associated with OMP_FOR GS. */
3928
3929 static inline enum tree_code
3930 gimple_omp_for_cond (const_gimple gs, size_t i)
3931 {
3932 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3933 gcc_assert (i < gs->gimple_omp_for.collapse);
3934 return gs->gimple_omp_for.iter[i].cond;
3935 }
3936
3937
3938 /* Set the value being stored in an atomic store. */
3939
3940 static inline void
3941 gimple_omp_atomic_store_set_val (gimple g, tree val)
3942 {
3943 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3944 g->gimple_omp_atomic_store.val = val;
3945 }
3946
3947
3948 /* Return the value being stored in an atomic store. */
3949
3950 static inline tree
3951 gimple_omp_atomic_store_val (const_gimple g)
3952 {
3953 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3954 return g->gimple_omp_atomic_store.val;
3955 }
3956
3957
3958 /* Return a pointer to the value being stored in an atomic store. */
3959
3960 static inline tree *
3961 gimple_omp_atomic_store_val_ptr (gimple g)
3962 {
3963 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3964 return &g->gimple_omp_atomic_store.val;
3965 }
3966
3967
3968 /* Set the LHS of an atomic load. */
3969
3970 static inline void
3971 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
3972 {
3973 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
3974 g->gimple_omp_atomic_load.lhs = lhs;
3975 }
3976
3977
3978 /* Get the LHS of an atomic load. */
3979
3980 static inline tree
3981 gimple_omp_atomic_load_lhs (const_gimple g)
3982 {
3983 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
3984 return g->gimple_omp_atomic_load.lhs;
3985 }
3986
3987
3988 /* Return a pointer to the LHS of an atomic load. */
3989
3990 static inline tree *
3991 gimple_omp_atomic_load_lhs_ptr (gimple g)
3992 {
3993 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
3994 return &g->gimple_omp_atomic_load.lhs;
3995 }
3996
3997
3998 /* Set the RHS of an atomic load. */
3999
4000 static inline void
4001 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4002 {
4003 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4004 g->gimple_omp_atomic_load.rhs = rhs;
4005 }
4006
4007
4008 /* Get the RHS of an atomic load. */
4009
4010 static inline tree
4011 gimple_omp_atomic_load_rhs (const_gimple g)
4012 {
4013 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4014 return g->gimple_omp_atomic_load.rhs;
4015 }
4016
4017
4018 /* Return a pointer to the RHS of an atomic load. */
4019
4020 static inline tree *
4021 gimple_omp_atomic_load_rhs_ptr (gimple g)
4022 {
4023 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4024 return &g->gimple_omp_atomic_load.rhs;
4025 }
4026
4027
4028 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4029
4030 static inline tree
4031 gimple_omp_continue_control_def (const_gimple g)
4032 {
4033 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4034 return g->gimple_omp_continue.control_def;
4035 }
4036
4037 /* The same as above, but return the address. */
4038
4039 static inline tree *
4040 gimple_omp_continue_control_def_ptr (gimple g)
4041 {
4042 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4043 return &g->gimple_omp_continue.control_def;
4044 }
4045
4046 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4047
4048 static inline void
4049 gimple_omp_continue_set_control_def (gimple g, tree def)
4050 {
4051 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4052 g->gimple_omp_continue.control_def = def;
4053 }
4054
4055
4056 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4057
4058 static inline tree
4059 gimple_omp_continue_control_use (const_gimple g)
4060 {
4061 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4062 return g->gimple_omp_continue.control_use;
4063 }
4064
4065
4066 /* The same as above, but return the address. */
4067
4068 static inline tree *
4069 gimple_omp_continue_control_use_ptr (gimple g)
4070 {
4071 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4072 return &g->gimple_omp_continue.control_use;
4073 }
4074
4075
4076 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4077
4078 static inline void
4079 gimple_omp_continue_set_control_use (gimple g, tree use)
4080 {
4081 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4082 g->gimple_omp_continue.control_use = use;
4083 }
4084
4085
4086 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4087
4088 static inline tree *
4089 gimple_return_retval_ptr (const_gimple gs)
4090 {
4091 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4092 gcc_assert (gimple_num_ops (gs) == 1);
4093 return gimple_op_ptr (gs, 0);
4094 }
4095
4096 /* Return the return value for GIMPLE_RETURN GS. */
4097
4098 static inline tree
4099 gimple_return_retval (const_gimple gs)
4100 {
4101 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4102 gcc_assert (gimple_num_ops (gs) == 1);
4103 return gimple_op (gs, 0);
4104 }
4105
4106
4107 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4108
4109 static inline void
4110 gimple_return_set_retval (gimple gs, tree retval)
4111 {
4112 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4113 gcc_assert (gimple_num_ops (gs) == 1);
4114 gcc_assert (retval == NULL_TREE
4115 || TREE_CODE (retval) == RESULT_DECL
4116 || is_gimple_val (retval));
4117 gimple_set_op (gs, 0, retval);
4118 }
4119
4120
4121 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4122
4123 static inline bool
4124 is_gimple_omp (const_gimple stmt)
4125 {
4126 return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
4127 || gimple_code (stmt) == GIMPLE_OMP_TASK
4128 || gimple_code (stmt) == GIMPLE_OMP_FOR
4129 || gimple_code (stmt) == GIMPLE_OMP_SECTIONS
4130 || gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH
4131 || gimple_code (stmt) == GIMPLE_OMP_SINGLE
4132 || gimple_code (stmt) == GIMPLE_OMP_SECTION
4133 || gimple_code (stmt) == GIMPLE_OMP_MASTER
4134 || gimple_code (stmt) == GIMPLE_OMP_ORDERED
4135 || gimple_code (stmt) == GIMPLE_OMP_CRITICAL
4136 || gimple_code (stmt) == GIMPLE_OMP_RETURN
4137 || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
4138 || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
4139 || gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
4140 }
4141
4142
4143 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4144
4145 static inline bool
4146 gimple_nop_p (const_gimple g)
4147 {
4148 return gimple_code (g) == GIMPLE_NOP;
4149 }
4150
4151
4152 /* Return the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
4153
4154 static inline tree
4155 gimple_cdt_new_type (gimple gs)
4156 {
4157 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4158 return gimple_op (gs, 1);
4159 }
4160
4161 /* Return a pointer to the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE
4162 statement GS. */
4163
4164 static inline tree *
4165 gimple_cdt_new_type_ptr (gimple gs)
4166 {
4167 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4168 return gimple_op_ptr (gs, 1);
4169 }
4170
4171 /* Set NEW_TYPE to be the type returned by GIMPLE_CHANGE_DYNAMIC_TYPE
4172 statement GS. */
4173
4174 static inline void
4175 gimple_cdt_set_new_type (gimple gs, tree new_type)
4176 {
4177 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4178 gcc_assert (TREE_CODE_CLASS (TREE_CODE (new_type)) == tcc_type);
4179 gimple_set_op (gs, 1, new_type);
4180 }
4181
4182
4183 /* Return the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
4184
4185 static inline tree
4186 gimple_cdt_location (gimple gs)
4187 {
4188 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4189 return gimple_op (gs, 0);
4190 }
4191
4192
4193 /* Return a pointer to the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
4194 statement GS. */
4195
4196 static inline tree *
4197 gimple_cdt_location_ptr (gimple gs)
4198 {
4199 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4200 return gimple_op_ptr (gs, 0);
4201 }
4202
4203
4204 /* Set PTR to be the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
4205 statement GS. */
4206
4207 static inline void
4208 gimple_cdt_set_location (gimple gs, tree ptr)
4209 {
4210 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4211 gimple_set_op (gs, 0, ptr);
4212 }
4213
4214
4215 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4216
4217 static inline enum br_predictor
4218 gimple_predict_predictor (gimple gs)
4219 {
4220 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4221 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4222 }
4223
4224
4225 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4226
4227 static inline void
4228 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4229 {
4230 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4231 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4232 | (unsigned) predictor;
4233 }
4234
4235
4236 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4237
4238 static inline enum prediction
4239 gimple_predict_outcome (gimple gs)
4240 {
4241 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4242 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4243 }
4244
4245
4246 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4247
4248 static inline void
4249 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4250 {
4251 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4252 if (outcome == TAKEN)
4253 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4254 else
4255 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4256 }
4257
4258
1397 /* Return the type of the main expression computed by STMT. Return 4259 /* Return the type of the main expression computed by STMT. Return
1398 void_type_node if the statement computes nothing. */ 4260 void_type_node if the statement computes nothing. */
1399 4261
1400 static inline tree 4262 static inline tree
1401 gimple_expr_type (const_gimple stmt) 4263 gimple_expr_type (const_gimple stmt)
1402 { 4264 {
1403 enum gimple_code code = gimple_code (stmt); 4265 enum gimple_code code = gimple_code (stmt);
1404 4266
1405 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) 4267 if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL)
1406 { 4268 {
1407 tree type = TREE_TYPE (gimple_get_lhs (stmt)); 4269 tree type;
4270 /* In general we want to pass out a type that can be substituted
4271 for both the RHS and the LHS types if there is a possibly
4272 useless conversion involved. That means returning the
4273 original RHS type as far as we can reconstruct it. */
4274 if (code == GIMPLE_CALL)
4275 type = gimple_call_return_type (stmt);
4276 else
4277 switch (gimple_assign_rhs_code (stmt))
4278 {
4279 case POINTER_PLUS_EXPR:
4280 type = TREE_TYPE (gimple_assign_rhs1 (stmt));
4281 break;
4282
4283 default:
4284 /* As fallback use the type of the LHS. */
4285 type = TREE_TYPE (gimple_get_lhs (stmt));
4286 break;
4287 }
4288
1408 /* Integral sub-types are never the type of the expression, 4289 /* Integral sub-types are never the type of the expression,
1409 but they still can be the type of the result as the base 4290 but they still can be the type of the result as the base
1410 type (in which expressions are computed) is trivially 4291 type (in which expressions are computed) is trivially
1411 convertible to one of its sub-types. So always return 4292 convertible to one of its sub-types. So always return
1412 the base type here. */ 4293 the base type here. */
1419 } 4300 }
1420 else if (code == GIMPLE_COND) 4301 else if (code == GIMPLE_COND)
1421 return boolean_type_node; 4302 return boolean_type_node;
1422 else 4303 else
1423 return void_type_node; 4304 return void_type_node;
1424 }
1425
1426
1427 /* Return the tree code for the expression computed by STMT. This is
1428 only valid for GIMPLE_COND, GIMPLE_CALL and GIMPLE_ASSIGN. For
1429 GIMPLE_CALL, return CALL_EXPR as the expression code for
1430 consistency. This is useful when the caller needs to deal with the
1431 three kinds of computation that GIMPLE supports. */
1432
1433 static inline enum tree_code
1434 gimple_expr_code (const_gimple stmt)
1435 {
1436 enum gimple_code code = gimple_code (stmt);
1437 if (code == GIMPLE_ASSIGN || code == GIMPLE_COND)
1438 return (enum tree_code) stmt->gsbase.subcode;
1439 else if (code == GIMPLE_CALL)
1440 return CALL_EXPR;
1441 else
1442 gcc_unreachable ();
1443 }
1444
1445
1446 /* Mark statement S as modified, and update it. */
1447
1448 static inline void
1449 update_stmt (gimple s)
1450 {
1451 if (gimple_has_ops (s))
1452 {
1453 gimple_set_modified (s, true);
1454 update_stmt_operands (s);
1455 }
1456 }
1457
1458 /* Update statement S if it has been optimized. */
1459
1460 static inline void
1461 update_stmt_if_modified (gimple s)
1462 {
1463 if (gimple_modified_p (s))
1464 update_stmt_operands (s);
1465 }
1466
1467 /* Return true if statement STMT contains volatile operands. */
1468
1469 static inline bool
1470 gimple_has_volatile_ops (const_gimple stmt)
1471 {
1472 if (gimple_has_mem_ops (stmt))
1473 return stmt->gsbase.has_volatile_ops;
1474 else
1475 return false;
1476 }
1477
1478
1479 /* Set the HAS_VOLATILE_OPS flag to VOLATILEP. */
1480
1481 static inline void
1482 gimple_set_has_volatile_ops (gimple stmt, bool volatilep)
1483 {
1484 if (gimple_has_mem_ops (stmt))
1485 stmt->gsbase.has_volatile_ops = (unsigned) volatilep;
1486 }
1487
1488
1489 /* Return true if statement STMT may access memory. */
1490
1491 static inline bool
1492 gimple_references_memory_p (gimple stmt)
1493 {
1494 return gimple_has_mem_ops (stmt) && stmt->gsbase.references_memory_p;
1495 }
1496
1497
1498 /* Set the REFERENCES_MEMORY_P flag for STMT to MEM_P. */
1499
1500 static inline void
1501 gimple_set_references_memory (gimple stmt, bool mem_p)
1502 {
1503 if (gimple_has_mem_ops (stmt))
1504 stmt->gsbase.references_memory_p = (unsigned) mem_p;
1505 }
1506
1507 /* Return the subcode for OMP statement S. */
1508
1509 static inline unsigned
1510 gimple_omp_subcode (const_gimple s)
1511 {
1512 gcc_assert (gimple_code (s) >= GIMPLE_OMP_ATOMIC_LOAD
1513 && gimple_code (s) <= GIMPLE_OMP_SINGLE);
1514 return s->gsbase.subcode;
1515 }
1516
1517 /* Set the subcode for OMP statement S to SUBCODE. */
1518
1519 static inline void
1520 gimple_omp_set_subcode (gimple s, unsigned int subcode)
1521 {
1522 /* We only have 16 bits for the subcode. Assert that we are not
1523 overflowing it. */
1524 gcc_assert (subcode < (1 << 16));
1525 s->gsbase.subcode = subcode;
1526 }
1527
1528 /* Set the nowait flag on OMP_RETURN statement S. */
1529
1530 static inline void
1531 gimple_omp_return_set_nowait (gimple s)
1532 {
1533 GIMPLE_CHECK (s, GIMPLE_OMP_RETURN);
1534 s->gsbase.subcode |= GF_OMP_RETURN_NOWAIT;
1535 }
1536
1537
1538 /* Return true if OMP return statement G has the GF_OMP_RETURN_NOWAIT
1539 flag set. */
1540
1541 static inline bool
1542 gimple_omp_return_nowait_p (const_gimple g)
1543 {
1544 GIMPLE_CHECK (g, GIMPLE_OMP_RETURN);
1545 return (gimple_omp_subcode (g) & GF_OMP_RETURN_NOWAIT) != 0;
1546 }
1547
1548
1549 /* Return true if OMP section statement G has the GF_OMP_SECTION_LAST
1550 flag set. */
1551
1552 static inline bool
1553 gimple_omp_section_last_p (const_gimple g)
1554 {
1555 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1556 return (gimple_omp_subcode (g) & GF_OMP_SECTION_LAST) != 0;
1557 }
1558
1559
1560 /* Set the GF_OMP_SECTION_LAST flag on G. */
1561
1562 static inline void
1563 gimple_omp_section_set_last (gimple g)
1564 {
1565 GIMPLE_CHECK (g, GIMPLE_OMP_SECTION);
1566 g->gsbase.subcode |= GF_OMP_SECTION_LAST;
1567 }
1568
1569
1570 /* Return true if OMP parallel statement G has the
1571 GF_OMP_PARALLEL_COMBINED flag set. */
1572
1573 static inline bool
1574 gimple_omp_parallel_combined_p (const_gimple g)
1575 {
1576 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1577 return (gimple_omp_subcode (g) & GF_OMP_PARALLEL_COMBINED) != 0;
1578 }
1579
1580
1581 /* Set the GF_OMP_PARALLEL_COMBINED field in G depending on the boolean
1582 value of COMBINED_P. */
1583
1584 static inline void
1585 gimple_omp_parallel_set_combined_p (gimple g, bool combined_p)
1586 {
1587 GIMPLE_CHECK (g, GIMPLE_OMP_PARALLEL);
1588 if (combined_p)
1589 g->gsbase.subcode |= GF_OMP_PARALLEL_COMBINED;
1590 else
1591 g->gsbase.subcode &= ~GF_OMP_PARALLEL_COMBINED;
1592 }
1593
1594
1595 /* Return the number of operands for statement GS. */
1596
1597 static inline unsigned
1598 gimple_num_ops (const_gimple gs)
1599 {
1600 return gs->gsbase.num_ops;
1601 }
1602
1603
1604 /* Set the number of operands for statement GS. */
1605
1606 static inline void
1607 gimple_set_num_ops (gimple gs, unsigned num_ops)
1608 {
1609 gs->gsbase.num_ops = num_ops;
1610 }
1611
1612
1613 /* Return the array of operands for statement GS. */
1614
1615 static inline tree *
1616 gimple_ops (gimple gs)
1617 {
1618 /* Offset in bytes to the location of the operand vector in every
1619 tuple structure. Defined in gimple.c */
1620 extern size_t const gimple_ops_offset_[];
1621
1622 if (!gimple_has_ops (gs))
1623 return NULL;
1624
1625 /* All the tuples have their operand vector at the very bottom
1626 of the structure. */
1627 return ((tree *) ((char *) gs + gimple_ops_offset_[gimple_code (gs)]));
1628 }
1629
1630
1631 /* Return operand I for statement GS. */
1632
1633 static inline tree
1634 gimple_op (const_gimple gs, unsigned i)
1635 {
1636 if (gimple_has_ops (gs))
1637 {
1638 gcc_assert (i < gimple_num_ops (gs));
1639 return gimple_ops (CONST_CAST_GIMPLE (gs))[i];
1640 }
1641 else
1642 return NULL_TREE;
1643 }
1644
1645 /* Return a pointer to operand I for statement GS. */
1646
1647 static inline tree *
1648 gimple_op_ptr (const_gimple gs, unsigned i)
1649 {
1650 if (gimple_has_ops (gs))
1651 {
1652 gcc_assert (i < gimple_num_ops (gs));
1653 return gimple_ops (CONST_CAST_GIMPLE (gs)) + i;
1654 }
1655 else
1656 return NULL;
1657 }
1658
1659 /* Set operand I of statement GS to OP. */
1660
1661 static inline void
1662 gimple_set_op (gimple gs, unsigned i, tree op)
1663 {
1664 gcc_assert (gimple_has_ops (gs) && i < gimple_num_ops (gs));
1665
1666 /* Note. It may be tempting to assert that OP matches
1667 is_gimple_operand, but that would be wrong. Different tuples
1668 accept slightly different sets of tree operands. Each caller
1669 should perform its own validation. */
1670 gimple_ops (gs)[i] = op;
1671 }
1672
1673 /* Return true if GS is a GIMPLE_ASSIGN. */
1674
1675 static inline bool
1676 is_gimple_assign (const_gimple gs)
1677 {
1678 return gimple_code (gs) == GIMPLE_ASSIGN;
1679 }
1680
1681 /* Determine if expression CODE is one of the valid expressions that can
1682 be used on the RHS of GIMPLE assignments. */
1683
1684 static inline enum gimple_rhs_class
1685 get_gimple_rhs_class (enum tree_code code)
1686 {
1687 return (enum gimple_rhs_class) gimple_rhs_class_table[(int) code];
1688 }
1689
1690 /* Return the LHS of assignment statement GS. */
1691
1692 static inline tree
1693 gimple_assign_lhs (const_gimple gs)
1694 {
1695 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1696 return gimple_op (gs, 0);
1697 }
1698
1699
1700 /* Return a pointer to the LHS of assignment statement GS. */
1701
1702 static inline tree *
1703 gimple_assign_lhs_ptr (const_gimple gs)
1704 {
1705 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1706 return gimple_op_ptr (gs, 0);
1707 }
1708
1709
1710 /* Set LHS to be the LHS operand of assignment statement GS. */
1711
1712 static inline void
1713 gimple_assign_set_lhs (gimple gs, tree lhs)
1714 {
1715 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1716 gcc_assert (is_gimple_operand (lhs));
1717 gimple_set_op (gs, 0, lhs);
1718
1719 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1720 SSA_NAME_DEF_STMT (lhs) = gs;
1721 }
1722
1723
1724 /* Return the first operand on the RHS of assignment statement GS. */
1725
1726 static inline tree
1727 gimple_assign_rhs1 (const_gimple gs)
1728 {
1729 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1730 return gimple_op (gs, 1);
1731 }
1732
1733
1734 /* Return a pointer to the first operand on the RHS of assignment
1735 statement GS. */
1736
1737 static inline tree *
1738 gimple_assign_rhs1_ptr (const_gimple gs)
1739 {
1740 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1741 return gimple_op_ptr (gs, 1);
1742 }
1743
1744 /* Set RHS to be the first operand on the RHS of assignment statement GS. */
1745
1746 static inline void
1747 gimple_assign_set_rhs1 (gimple gs, tree rhs)
1748 {
1749 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1750
1751 /* If there are 3 or more operands, the 2 operands on the RHS must be
1752 GIMPLE values. */
1753 if (gimple_num_ops (gs) >= 3)
1754 gcc_assert (is_gimple_val (rhs));
1755 else
1756 gcc_assert (is_gimple_operand (rhs));
1757
1758 gimple_set_op (gs, 1, rhs);
1759 }
1760
1761
1762 /* Return the second operand on the RHS of assignment statement GS.
1763 If GS does not have two operands, NULL is returned instead. */
1764
1765 static inline tree
1766 gimple_assign_rhs2 (const_gimple gs)
1767 {
1768 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1769
1770 if (gimple_num_ops (gs) >= 3)
1771 return gimple_op (gs, 2);
1772 else
1773 return NULL_TREE;
1774 }
1775
1776
1777 /* Return a pointer to the second operand on the RHS of assignment
1778 statement GS. */
1779
1780 static inline tree *
1781 gimple_assign_rhs2_ptr (const_gimple gs)
1782 {
1783 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1784 return gimple_op_ptr (gs, 2);
1785 }
1786
1787
1788 /* Set RHS to be the second operand on the RHS of assignment statement GS. */
1789
1790 static inline void
1791 gimple_assign_set_rhs2 (gimple gs, tree rhs)
1792 {
1793 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1794
1795 /* The 2 operands on the RHS must be GIMPLE values. */
1796 gcc_assert (is_gimple_val (rhs));
1797
1798 gimple_set_op (gs, 2, rhs);
1799 }
1800
1801 /* Returns true if GS is a nontemporal move. */
1802
1803 static inline bool
1804 gimple_assign_nontemporal_move_p (const_gimple gs)
1805 {
1806 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1807 return gs->gsbase.nontemporal_move;
1808 }
1809
1810 /* Sets nontemporal move flag of GS to NONTEMPORAL. */
1811
1812 static inline void
1813 gimple_assign_set_nontemporal_move (gimple gs, bool nontemporal)
1814 {
1815 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1816 gs->gsbase.nontemporal_move = nontemporal;
1817 }
1818
1819
1820 /* Return the code of the expression computed on the rhs of assignment
1821 statement GS. In case that the RHS is a single object, returns the
1822 tree code of the object. */
1823
1824 static inline enum tree_code
1825 gimple_assign_rhs_code (const_gimple gs)
1826 {
1827 enum tree_code code;
1828 GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
1829
1830 code = gimple_expr_code (gs);
1831 if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
1832 code = TREE_CODE (gimple_assign_rhs1 (gs));
1833
1834 return code;
1835 }
1836
1837
1838 /* Set CODE to be the code for the expression computed on the RHS of
1839 assignment S. */
1840
1841 static inline void
1842 gimple_assign_set_rhs_code (gimple s, enum tree_code code)
1843 {
1844 GIMPLE_CHECK (s, GIMPLE_ASSIGN);
1845 s->gsbase.subcode = code;
1846 }
1847
1848
1849 /* Return the gimple rhs class of the code of the expression computed on
1850 the rhs of assignment statement GS.
1851 This will never return GIMPLE_INVALID_RHS. */
1852
1853 static inline enum gimple_rhs_class
1854 gimple_assign_rhs_class (const_gimple gs)
1855 {
1856 return get_gimple_rhs_class (gimple_assign_rhs_code (gs));
1857 }
1858
1859
1860 /* Return true if S is a type-cast assignment. */
1861
1862 static inline bool
1863 gimple_assign_cast_p (gimple s)
1864 {
1865 if (is_gimple_assign (s))
1866 {
1867 enum tree_code sc = gimple_assign_rhs_code (s);
1868 return CONVERT_EXPR_CODE_P (sc)
1869 || sc == VIEW_CONVERT_EXPR
1870 || sc == FIX_TRUNC_EXPR;
1871 }
1872
1873 return false;
1874 }
1875
1876
1877 /* Return true if GS is a GIMPLE_CALL. */
1878
1879 static inline bool
1880 is_gimple_call (const_gimple gs)
1881 {
1882 return gimple_code (gs) == GIMPLE_CALL;
1883 }
1884
1885 /* Return the LHS of call statement GS. */
1886
1887 static inline tree
1888 gimple_call_lhs (const_gimple gs)
1889 {
1890 GIMPLE_CHECK (gs, GIMPLE_CALL);
1891 return gimple_op (gs, 0);
1892 }
1893
1894
1895 /* Return a pointer to the LHS of call statement GS. */
1896
1897 static inline tree *
1898 gimple_call_lhs_ptr (const_gimple gs)
1899 {
1900 GIMPLE_CHECK (gs, GIMPLE_CALL);
1901 return gimple_op_ptr (gs, 0);
1902 }
1903
1904
1905 /* Set LHS to be the LHS operand of call statement GS. */
1906
1907 static inline void
1908 gimple_call_set_lhs (gimple gs, tree lhs)
1909 {
1910 GIMPLE_CHECK (gs, GIMPLE_CALL);
1911 gcc_assert (!lhs || is_gimple_operand (lhs));
1912 gimple_set_op (gs, 0, lhs);
1913 if (lhs && TREE_CODE (lhs) == SSA_NAME)
1914 SSA_NAME_DEF_STMT (lhs) = gs;
1915 }
1916
1917
1918 /* Return the tree node representing the function called by call
1919 statement GS. */
1920
1921 static inline tree
1922 gimple_call_fn (const_gimple gs)
1923 {
1924 GIMPLE_CHECK (gs, GIMPLE_CALL);
1925 return gimple_op (gs, 1);
1926 }
1927
1928
1929 /* Return a pointer to the tree node representing the function called by call
1930 statement GS. */
1931
1932 static inline tree *
1933 gimple_call_fn_ptr (const_gimple gs)
1934 {
1935 GIMPLE_CHECK (gs, GIMPLE_CALL);
1936 return gimple_op_ptr (gs, 1);
1937 }
1938
1939
1940 /* Set FN to be the function called by call statement GS. */
1941
1942 static inline void
1943 gimple_call_set_fn (gimple gs, tree fn)
1944 {
1945 GIMPLE_CHECK (gs, GIMPLE_CALL);
1946 gcc_assert (is_gimple_operand (fn));
1947 gimple_set_op (gs, 1, fn);
1948 }
1949
1950
1951 /* Set FNDECL to be the function called by call statement GS. */
1952
1953 static inline void
1954 gimple_call_set_fndecl (gimple gs, tree decl)
1955 {
1956 GIMPLE_CHECK (gs, GIMPLE_CALL);
1957 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL);
1958 gimple_set_op (gs, 1, build_fold_addr_expr (decl));
1959 }
1960
1961
1962 /* If a given GIMPLE_CALL's callee is a FUNCTION_DECL, return it.
1963 Otherwise return NULL. This function is analogous to
1964 get_callee_fndecl in tree land. */
1965
1966 static inline tree
1967 gimple_call_fndecl (const_gimple gs)
1968 {
1969 tree addr = gimple_call_fn (gs);
1970 if (TREE_CODE (addr) == ADDR_EXPR)
1971 {
1972 gcc_assert (TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL);
1973 return TREE_OPERAND (addr, 0);
1974 }
1975 return NULL_TREE;
1976 }
1977
1978
1979 /* Return the type returned by call statement GS. */
1980
1981 static inline tree
1982 gimple_call_return_type (const_gimple gs)
1983 {
1984 tree fn = gimple_call_fn (gs);
1985 tree type = TREE_TYPE (fn);
1986
1987 /* See through the pointer. */
1988 gcc_assert (POINTER_TYPE_P (type));
1989 type = TREE_TYPE (type);
1990
1991 gcc_assert (TREE_CODE (type) == FUNCTION_TYPE
1992 || TREE_CODE (type) == METHOD_TYPE);
1993
1994 /* The type returned by a FUNCTION_DECL is the type of its
1995 function type. */
1996 return TREE_TYPE (type);
1997 }
1998
1999
2000 /* Return the static chain for call statement GS. */
2001
2002 static inline tree
2003 gimple_call_chain (const_gimple gs)
2004 {
2005 GIMPLE_CHECK (gs, GIMPLE_CALL);
2006 return gimple_op (gs, 2);
2007 }
2008
2009
2010 /* Return a pointer to the static chain for call statement GS. */
2011
2012 static inline tree *
2013 gimple_call_chain_ptr (const_gimple gs)
2014 {
2015 GIMPLE_CHECK (gs, GIMPLE_CALL);
2016 return gimple_op_ptr (gs, 2);
2017 }
2018
2019 /* Set CHAIN to be the static chain for call statement GS. */
2020
2021 static inline void
2022 gimple_call_set_chain (gimple gs, tree chain)
2023 {
2024 GIMPLE_CHECK (gs, GIMPLE_CALL);
2025 gcc_assert (chain == NULL
2026 || TREE_CODE (chain) == ADDR_EXPR
2027 || SSA_VAR_P (chain));
2028 gimple_set_op (gs, 2, chain);
2029 }
2030
2031
2032 /* Return the number of arguments used by call statement GS. */
2033
2034 static inline unsigned
2035 gimple_call_num_args (const_gimple gs)
2036 {
2037 unsigned num_ops;
2038 GIMPLE_CHECK (gs, GIMPLE_CALL);
2039 num_ops = gimple_num_ops (gs);
2040 gcc_assert (num_ops >= 3);
2041 return num_ops - 3;
2042 }
2043
2044
2045 /* Return the argument at position INDEX for call statement GS. */
2046
2047 static inline tree
2048 gimple_call_arg (const_gimple gs, unsigned index)
2049 {
2050 GIMPLE_CHECK (gs, GIMPLE_CALL);
2051 return gimple_op (gs, index + 3);
2052 }
2053
2054
2055 /* Return a pointer to the argument at position INDEX for call
2056 statement GS. */
2057
2058 static inline tree *
2059 gimple_call_arg_ptr (const_gimple gs, unsigned index)
2060 {
2061 GIMPLE_CHECK (gs, GIMPLE_CALL);
2062 return gimple_op_ptr (gs, index + 3);
2063 }
2064
2065
2066 /* Set ARG to be the argument at position INDEX for call statement GS. */
2067
2068 static inline void
2069 gimple_call_set_arg (gimple gs, unsigned index, tree arg)
2070 {
2071 GIMPLE_CHECK (gs, GIMPLE_CALL);
2072 gcc_assert (is_gimple_operand (arg));
2073 gimple_set_op (gs, index + 3, arg);
2074 }
2075
2076
2077 /* If TAIL_P is true, mark call statement S as being a tail call
2078 (i.e., a call just before the exit of a function). These calls are
2079 candidate for tail call optimization. */
2080
2081 static inline void
2082 gimple_call_set_tail (gimple s, bool tail_p)
2083 {
2084 GIMPLE_CHECK (s, GIMPLE_CALL);
2085 if (tail_p)
2086 s->gsbase.subcode |= GF_CALL_TAILCALL;
2087 else
2088 s->gsbase.subcode &= ~GF_CALL_TAILCALL;
2089 }
2090
2091
2092 /* Return true if GIMPLE_CALL S is marked as a tail call. */
2093
2094 static inline bool
2095 gimple_call_tail_p (gimple s)
2096 {
2097 GIMPLE_CHECK (s, GIMPLE_CALL);
2098 return (s->gsbase.subcode & GF_CALL_TAILCALL) != 0;
2099 }
2100
2101
2102 /* Set the inlinable status of GIMPLE_CALL S to INLINABLE_P. */
2103
2104 static inline void
2105 gimple_call_set_cannot_inline (gimple s, bool inlinable_p)
2106 {
2107 GIMPLE_CHECK (s, GIMPLE_CALL);
2108 if (inlinable_p)
2109 s->gsbase.subcode |= GF_CALL_CANNOT_INLINE;
2110 else
2111 s->gsbase.subcode &= ~GF_CALL_CANNOT_INLINE;
2112 }
2113
2114
2115 /* Return true if GIMPLE_CALL S cannot be inlined. */
2116
2117 static inline bool
2118 gimple_call_cannot_inline_p (gimple s)
2119 {
2120 GIMPLE_CHECK (s, GIMPLE_CALL);
2121 return (s->gsbase.subcode & GF_CALL_CANNOT_INLINE) != 0;
2122 }
2123
2124
2125 /* If RETURN_SLOT_OPT_P is true mark GIMPLE_CALL S as valid for return
2126 slot optimization. This transformation uses the target of the call
2127 expansion as the return slot for calls that return in memory. */
2128
2129 static inline void
2130 gimple_call_set_return_slot_opt (gimple s, bool return_slot_opt_p)
2131 {
2132 GIMPLE_CHECK (s, GIMPLE_CALL);
2133 if (return_slot_opt_p)
2134 s->gsbase.subcode |= GF_CALL_RETURN_SLOT_OPT;
2135 else
2136 s->gsbase.subcode &= ~GF_CALL_RETURN_SLOT_OPT;
2137 }
2138
2139
2140 /* Return true if S is marked for return slot optimization. */
2141
2142 static inline bool
2143 gimple_call_return_slot_opt_p (gimple s)
2144 {
2145 GIMPLE_CHECK (s, GIMPLE_CALL);
2146 return (s->gsbase.subcode & GF_CALL_RETURN_SLOT_OPT) != 0;
2147 }
2148
2149
2150 /* If FROM_THUNK_P is true, mark GIMPLE_CALL S as being the jump from a
2151 thunk to the thunked-to function. */
2152
2153 static inline void
2154 gimple_call_set_from_thunk (gimple s, bool from_thunk_p)
2155 {
2156 GIMPLE_CHECK (s, GIMPLE_CALL);
2157 if (from_thunk_p)
2158 s->gsbase.subcode |= GF_CALL_FROM_THUNK;
2159 else
2160 s->gsbase.subcode &= ~GF_CALL_FROM_THUNK;
2161 }
2162
2163
2164 /* Return true if GIMPLE_CALL S is a jump from a thunk. */
2165
2166 static inline bool
2167 gimple_call_from_thunk_p (gimple s)
2168 {
2169 GIMPLE_CHECK (s, GIMPLE_CALL);
2170 return (s->gsbase.subcode & GF_CALL_FROM_THUNK) != 0;
2171 }
2172
2173
2174 /* If PASS_ARG_PACK_P is true, GIMPLE_CALL S is a stdarg call that needs the
2175 argument pack in its argument list. */
2176
2177 static inline void
2178 gimple_call_set_va_arg_pack (gimple s, bool pass_arg_pack_p)
2179 {
2180 GIMPLE_CHECK (s, GIMPLE_CALL);
2181 if (pass_arg_pack_p)
2182 s->gsbase.subcode |= GF_CALL_VA_ARG_PACK;
2183 else
2184 s->gsbase.subcode &= ~GF_CALL_VA_ARG_PACK;
2185 }
2186
2187
2188 /* Return true if GIMPLE_CALL S is a stdarg call that needs the
2189 argument pack in its argument list. */
2190
2191 static inline bool
2192 gimple_call_va_arg_pack_p (gimple s)
2193 {
2194 GIMPLE_CHECK (s, GIMPLE_CALL);
2195 return (s->gsbase.subcode & GF_CALL_VA_ARG_PACK) != 0;
2196 }
2197
2198
2199 /* Return true if S is a noreturn call. */
2200
2201 static inline bool
2202 gimple_call_noreturn_p (gimple s)
2203 {
2204 GIMPLE_CHECK (s, GIMPLE_CALL);
2205 return (gimple_call_flags (s) & ECF_NORETURN) != 0;
2206 }
2207
2208
2209 /* Return true if S is a nothrow call. */
2210
2211 static inline bool
2212 gimple_call_nothrow_p (gimple s)
2213 {
2214 GIMPLE_CHECK (s, GIMPLE_CALL);
2215 return (gimple_call_flags (s) & ECF_NOTHROW) != 0;
2216 }
2217
2218
2219 /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */
2220
2221 static inline void
2222 gimple_call_copy_flags (gimple dest_call, gimple orig_call)
2223 {
2224 GIMPLE_CHECK (dest_call, GIMPLE_CALL);
2225 GIMPLE_CHECK (orig_call, GIMPLE_CALL);
2226 dest_call->gsbase.subcode = orig_call->gsbase.subcode;
2227 }
2228
2229
2230 /* Returns true if this is a GIMPLE_ASSIGN or a GIMPLE_CALL with a
2231 non-NULL lhs. */
2232
2233 static inline bool
2234 gimple_has_lhs (gimple stmt)
2235 {
2236 return (is_gimple_assign (stmt)
2237 || (is_gimple_call (stmt)
2238 && gimple_call_lhs (stmt) != NULL_TREE));
2239 }
2240
2241
2242 /* Return the code of the predicate computed by conditional statement GS. */
2243
2244 static inline enum tree_code
2245 gimple_cond_code (const_gimple gs)
2246 {
2247 GIMPLE_CHECK (gs, GIMPLE_COND);
2248 return gs->gsbase.subcode;
2249 }
2250
2251
2252 /* Set CODE to be the predicate code for the conditional statement GS. */
2253
2254 static inline void
2255 gimple_cond_set_code (gimple gs, enum tree_code code)
2256 {
2257 GIMPLE_CHECK (gs, GIMPLE_COND);
2258 gcc_assert (TREE_CODE_CLASS (code) == tcc_comparison);
2259 gs->gsbase.subcode = code;
2260 }
2261
2262
2263 /* Return the LHS of the predicate computed by conditional statement GS. */
2264
2265 static inline tree
2266 gimple_cond_lhs (const_gimple gs)
2267 {
2268 GIMPLE_CHECK (gs, GIMPLE_COND);
2269 return gimple_op (gs, 0);
2270 }
2271
2272 /* Return the pointer to the LHS of the predicate computed by conditional
2273 statement GS. */
2274
2275 static inline tree *
2276 gimple_cond_lhs_ptr (const_gimple gs)
2277 {
2278 GIMPLE_CHECK (gs, GIMPLE_COND);
2279 return gimple_op_ptr (gs, 0);
2280 }
2281
2282 /* Set LHS to be the LHS operand of the predicate computed by
2283 conditional statement GS. */
2284
2285 static inline void
2286 gimple_cond_set_lhs (gimple gs, tree lhs)
2287 {
2288 GIMPLE_CHECK (gs, GIMPLE_COND);
2289 gcc_assert (is_gimple_operand (lhs));
2290 gimple_set_op (gs, 0, lhs);
2291 }
2292
2293
2294 /* Return the RHS operand of the predicate computed by conditional GS. */
2295
2296 static inline tree
2297 gimple_cond_rhs (const_gimple gs)
2298 {
2299 GIMPLE_CHECK (gs, GIMPLE_COND);
2300 return gimple_op (gs, 1);
2301 }
2302
2303 /* Return the pointer to the RHS operand of the predicate computed by
2304 conditional GS. */
2305
2306 static inline tree *
2307 gimple_cond_rhs_ptr (const_gimple gs)
2308 {
2309 GIMPLE_CHECK (gs, GIMPLE_COND);
2310 return gimple_op_ptr (gs, 1);
2311 }
2312
2313
2314 /* Set RHS to be the RHS operand of the predicate computed by
2315 conditional statement GS. */
2316
2317 static inline void
2318 gimple_cond_set_rhs (gimple gs, tree rhs)
2319 {
2320 GIMPLE_CHECK (gs, GIMPLE_COND);
2321 gcc_assert (is_gimple_operand (rhs));
2322 gimple_set_op (gs, 1, rhs);
2323 }
2324
2325
2326 /* Return the label used by conditional statement GS when its
2327 predicate evaluates to true. */
2328
2329 static inline tree
2330 gimple_cond_true_label (const_gimple gs)
2331 {
2332 GIMPLE_CHECK (gs, GIMPLE_COND);
2333 return gimple_op (gs, 2);
2334 }
2335
2336
2337 /* Set LABEL to be the label used by conditional statement GS when its
2338 predicate evaluates to true. */
2339
2340 static inline void
2341 gimple_cond_set_true_label (gimple gs, tree label)
2342 {
2343 GIMPLE_CHECK (gs, GIMPLE_COND);
2344 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2345 gimple_set_op (gs, 2, label);
2346 }
2347
2348
2349 /* Set LABEL to be the label used by conditional statement GS when its
2350 predicate evaluates to false. */
2351
2352 static inline void
2353 gimple_cond_set_false_label (gimple gs, tree label)
2354 {
2355 GIMPLE_CHECK (gs, GIMPLE_COND);
2356 gcc_assert (!label || TREE_CODE (label) == LABEL_DECL);
2357 gimple_set_op (gs, 3, label);
2358 }
2359
2360
2361 /* Return the label used by conditional statement GS when its
2362 predicate evaluates to false. */
2363
2364 static inline tree
2365 gimple_cond_false_label (const_gimple gs)
2366 {
2367 GIMPLE_CHECK (gs, GIMPLE_COND);
2368 return gimple_op (gs, 3);
2369 }
2370
2371
2372 /* Set the conditional COND_STMT to be of the form 'if (1 == 0)'. */
2373
2374 static inline void
2375 gimple_cond_make_false (gimple gs)
2376 {
2377 gimple_cond_set_lhs (gs, boolean_true_node);
2378 gimple_cond_set_rhs (gs, boolean_false_node);
2379 gs->gsbase.subcode = EQ_EXPR;
2380 }
2381
2382
2383 /* Set the conditional COND_STMT to be of the form 'if (1 == 1)'. */
2384
2385 static inline void
2386 gimple_cond_make_true (gimple gs)
2387 {
2388 gimple_cond_set_lhs (gs, boolean_true_node);
2389 gimple_cond_set_rhs (gs, boolean_true_node);
2390 gs->gsbase.subcode = EQ_EXPR;
2391 }
2392
2393 /* Check if conditional statemente GS is of the form 'if (1 == 1)',
2394 'if (0 == 0)', 'if (1 != 0)' or 'if (0 != 1)' */
2395
2396 static inline bool
2397 gimple_cond_true_p (const_gimple gs)
2398 {
2399 tree lhs = gimple_cond_lhs (gs);
2400 tree rhs = gimple_cond_rhs (gs);
2401 enum tree_code code = gimple_cond_code (gs);
2402
2403 if (lhs != boolean_true_node && lhs != boolean_false_node)
2404 return false;
2405
2406 if (rhs != boolean_true_node && rhs != boolean_false_node)
2407 return false;
2408
2409 if (code == NE_EXPR && lhs != rhs)
2410 return true;
2411
2412 if (code == EQ_EXPR && lhs == rhs)
2413 return true;
2414
2415 return false;
2416 }
2417
2418 /* Check if conditional statement GS is of the form 'if (1 != 1)',
2419 'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
2420
2421 static inline bool
2422 gimple_cond_false_p (const_gimple gs)
2423 {
2424 tree lhs = gimple_cond_lhs (gs);
2425 tree rhs = gimple_cond_rhs (gs);
2426 enum tree_code code = gimple_cond_code (gs);
2427
2428 if (lhs != boolean_true_node && lhs != boolean_false_node)
2429 return false;
2430
2431 if (rhs != boolean_true_node && rhs != boolean_false_node)
2432 return false;
2433
2434 if (code == NE_EXPR && lhs == rhs)
2435 return true;
2436
2437 if (code == EQ_EXPR && lhs != rhs)
2438 return true;
2439
2440 return false;
2441 }
2442
2443 /* Check if conditional statement GS is of the form 'if (var != 0)' or
2444 'if (var == 1)' */
2445
2446 static inline bool
2447 gimple_cond_single_var_p (gimple gs)
2448 {
2449 if (gimple_cond_code (gs) == NE_EXPR
2450 && gimple_cond_rhs (gs) == boolean_false_node)
2451 return true;
2452
2453 if (gimple_cond_code (gs) == EQ_EXPR
2454 && gimple_cond_rhs (gs) == boolean_true_node)
2455 return true;
2456
2457 return false;
2458 }
2459
2460 /* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
2461
2462 static inline void
2463 gimple_cond_set_condition (gimple stmt, enum tree_code code, tree lhs, tree rhs)
2464 {
2465 gimple_cond_set_code (stmt, code);
2466 gimple_cond_set_lhs (stmt, lhs);
2467 gimple_cond_set_rhs (stmt, rhs);
2468 }
2469
2470 /* Return the LABEL_DECL node used by GIMPLE_LABEL statement GS. */
2471
2472 static inline tree
2473 gimple_label_label (const_gimple gs)
2474 {
2475 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2476 return gimple_op (gs, 0);
2477 }
2478
2479
2480 /* Set LABEL to be the LABEL_DECL node used by GIMPLE_LABEL statement
2481 GS. */
2482
2483 static inline void
2484 gimple_label_set_label (gimple gs, tree label)
2485 {
2486 GIMPLE_CHECK (gs, GIMPLE_LABEL);
2487 gcc_assert (TREE_CODE (label) == LABEL_DECL);
2488 gimple_set_op (gs, 0, label);
2489 }
2490
2491
2492 /* Return the destination of the unconditional jump GS. */
2493
2494 static inline tree
2495 gimple_goto_dest (const_gimple gs)
2496 {
2497 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2498 return gimple_op (gs, 0);
2499 }
2500
2501
2502 /* Set DEST to be the destination of the unconditonal jump GS. */
2503
2504 static inline void
2505 gimple_goto_set_dest (gimple gs, tree dest)
2506 {
2507 GIMPLE_CHECK (gs, GIMPLE_GOTO);
2508 gcc_assert (is_gimple_operand (dest));
2509 gimple_set_op (gs, 0, dest);
2510 }
2511
2512
2513 /* Return the variables declared in the GIMPLE_BIND statement GS. */
2514
2515 static inline tree
2516 gimple_bind_vars (const_gimple gs)
2517 {
2518 GIMPLE_CHECK (gs, GIMPLE_BIND);
2519 return gs->gimple_bind.vars;
2520 }
2521
2522
2523 /* Set VARS to be the set of variables declared in the GIMPLE_BIND
2524 statement GS. */
2525
2526 static inline void
2527 gimple_bind_set_vars (gimple gs, tree vars)
2528 {
2529 GIMPLE_CHECK (gs, GIMPLE_BIND);
2530 gs->gimple_bind.vars = vars;
2531 }
2532
2533
2534 /* Append VARS to the set of variables declared in the GIMPLE_BIND
2535 statement GS. */
2536
2537 static inline void
2538 gimple_bind_append_vars (gimple gs, tree vars)
2539 {
2540 GIMPLE_CHECK (gs, GIMPLE_BIND);
2541 gs->gimple_bind.vars = chainon (gs->gimple_bind.vars, vars);
2542 }
2543
2544
2545 /* Return the GIMPLE sequence contained in the GIMPLE_BIND statement GS. */
2546
2547 static inline gimple_seq
2548 gimple_bind_body (gimple gs)
2549 {
2550 GIMPLE_CHECK (gs, GIMPLE_BIND);
2551 return gs->gimple_bind.body;
2552 }
2553
2554
2555 /* Set SEQ to be the GIMPLE sequence contained in the GIMPLE_BIND
2556 statement GS. */
2557
2558 static inline void
2559 gimple_bind_set_body (gimple gs, gimple_seq seq)
2560 {
2561 GIMPLE_CHECK (gs, GIMPLE_BIND);
2562 gs->gimple_bind.body = seq;
2563 }
2564
2565
2566 /* Append a statement to the end of a GIMPLE_BIND's body. */
2567
2568 static inline void
2569 gimple_bind_add_stmt (gimple gs, gimple stmt)
2570 {
2571 GIMPLE_CHECK (gs, GIMPLE_BIND);
2572 gimple_seq_add_stmt (&gs->gimple_bind.body, stmt);
2573 }
2574
2575
2576 /* Append a sequence of statements to the end of a GIMPLE_BIND's body. */
2577
2578 static inline void
2579 gimple_bind_add_seq (gimple gs, gimple_seq seq)
2580 {
2581 GIMPLE_CHECK (gs, GIMPLE_BIND);
2582 gimple_seq_add_seq (&gs->gimple_bind.body, seq);
2583 }
2584
2585
2586 /* Return the TREE_BLOCK node associated with GIMPLE_BIND statement
2587 GS. This is analogous to the BIND_EXPR_BLOCK field in trees. */
2588
2589 static inline tree
2590 gimple_bind_block (const_gimple gs)
2591 {
2592 GIMPLE_CHECK (gs, GIMPLE_BIND);
2593 return gs->gimple_bind.block;
2594 }
2595
2596
2597 /* Set BLOCK to be the TREE_BLOCK node associated with GIMPLE_BIND
2598 statement GS. */
2599
2600 static inline void
2601 gimple_bind_set_block (gimple gs, tree block)
2602 {
2603 GIMPLE_CHECK (gs, GIMPLE_BIND);
2604 gcc_assert (block == NULL_TREE || TREE_CODE (block) == BLOCK);
2605 gs->gimple_bind.block = block;
2606 }
2607
2608
2609 /* Return the number of input operands for GIMPLE_ASM GS. */
2610
2611 static inline unsigned
2612 gimple_asm_ninputs (const_gimple gs)
2613 {
2614 GIMPLE_CHECK (gs, GIMPLE_ASM);
2615 return gs->gimple_asm.ni;
2616 }
2617
2618
2619 /* Return the number of output operands for GIMPLE_ASM GS. */
2620
2621 static inline unsigned
2622 gimple_asm_noutputs (const_gimple gs)
2623 {
2624 GIMPLE_CHECK (gs, GIMPLE_ASM);
2625 return gs->gimple_asm.no;
2626 }
2627
2628
2629 /* Return the number of clobber operands for GIMPLE_ASM GS. */
2630
2631 static inline unsigned
2632 gimple_asm_nclobbers (const_gimple gs)
2633 {
2634 GIMPLE_CHECK (gs, GIMPLE_ASM);
2635 return gs->gimple_asm.nc;
2636 }
2637
2638
2639 /* Return input operand INDEX of GIMPLE_ASM GS. */
2640
2641 static inline tree
2642 gimple_asm_input_op (const_gimple gs, unsigned index)
2643 {
2644 GIMPLE_CHECK (gs, GIMPLE_ASM);
2645 gcc_assert (index <= gs->gimple_asm.ni);
2646 return gimple_op (gs, index);
2647 }
2648
2649 /* Return a pointer to input operand INDEX of GIMPLE_ASM GS. */
2650
2651 static inline tree *
2652 gimple_asm_input_op_ptr (const_gimple gs, unsigned index)
2653 {
2654 GIMPLE_CHECK (gs, GIMPLE_ASM);
2655 gcc_assert (index <= gs->gimple_asm.ni);
2656 return gimple_op_ptr (gs, index);
2657 }
2658
2659
2660 /* Set IN_OP to be input operand INDEX in GIMPLE_ASM GS. */
2661
2662 static inline void
2663 gimple_asm_set_input_op (gimple gs, unsigned index, tree in_op)
2664 {
2665 GIMPLE_CHECK (gs, GIMPLE_ASM);
2666 gcc_assert (index <= gs->gimple_asm.ni);
2667 gcc_assert (TREE_CODE (in_op) == TREE_LIST);
2668 gimple_set_op (gs, index, in_op);
2669 }
2670
2671
2672 /* Return output operand INDEX of GIMPLE_ASM GS. */
2673
2674 static inline tree
2675 gimple_asm_output_op (const_gimple gs, unsigned index)
2676 {
2677 GIMPLE_CHECK (gs, GIMPLE_ASM);
2678 gcc_assert (index <= gs->gimple_asm.no);
2679 return gimple_op (gs, index + gs->gimple_asm.ni);
2680 }
2681
2682 /* Return a pointer to output operand INDEX of GIMPLE_ASM GS. */
2683
2684 static inline tree *
2685 gimple_asm_output_op_ptr (const_gimple gs, unsigned index)
2686 {
2687 GIMPLE_CHECK (gs, GIMPLE_ASM);
2688 gcc_assert (index <= gs->gimple_asm.no);
2689 return gimple_op_ptr (gs, index + gs->gimple_asm.ni);
2690 }
2691
2692
2693 /* Set OUT_OP to be output operand INDEX in GIMPLE_ASM GS. */
2694
2695 static inline void
2696 gimple_asm_set_output_op (gimple gs, unsigned index, tree out_op)
2697 {
2698 GIMPLE_CHECK (gs, GIMPLE_ASM);
2699 gcc_assert (index <= gs->gimple_asm.no);
2700 gcc_assert (TREE_CODE (out_op) == TREE_LIST);
2701 gimple_set_op (gs, index + gs->gimple_asm.ni, out_op);
2702 }
2703
2704
2705 /* Return clobber operand INDEX of GIMPLE_ASM GS. */
2706
2707 static inline tree
2708 gimple_asm_clobber_op (const_gimple gs, unsigned index)
2709 {
2710 GIMPLE_CHECK (gs, GIMPLE_ASM);
2711 gcc_assert (index <= gs->gimple_asm.nc);
2712 return gimple_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no);
2713 }
2714
2715
2716 /* Set CLOBBER_OP to be clobber operand INDEX in GIMPLE_ASM GS. */
2717
2718 static inline void
2719 gimple_asm_set_clobber_op (gimple gs, unsigned index, tree clobber_op)
2720 {
2721 GIMPLE_CHECK (gs, GIMPLE_ASM);
2722 gcc_assert (index <= gs->gimple_asm.nc);
2723 gcc_assert (TREE_CODE (clobber_op) == TREE_LIST);
2724 gimple_set_op (gs, index + gs->gimple_asm.ni + gs->gimple_asm.no, clobber_op);
2725 }
2726
2727
2728 /* Return the string representing the assembly instruction in
2729 GIMPLE_ASM GS. */
2730
2731 static inline const char *
2732 gimple_asm_string (const_gimple gs)
2733 {
2734 GIMPLE_CHECK (gs, GIMPLE_ASM);
2735 return gs->gimple_asm.string;
2736 }
2737
2738
2739 /* Return true if GS is an asm statement marked volatile. */
2740
2741 static inline bool
2742 gimple_asm_volatile_p (const_gimple gs)
2743 {
2744 GIMPLE_CHECK (gs, GIMPLE_ASM);
2745 return (gs->gsbase.subcode & GF_ASM_VOLATILE) != 0;
2746 }
2747
2748
2749 /* If VOLATLE_P is true, mark asm statement GS as volatile. */
2750
2751 static inline void
2752 gimple_asm_set_volatile (gimple gs, bool volatile_p)
2753 {
2754 GIMPLE_CHECK (gs, GIMPLE_ASM);
2755 if (volatile_p)
2756 gs->gsbase.subcode |= GF_ASM_VOLATILE;
2757 else
2758 gs->gsbase.subcode &= ~GF_ASM_VOLATILE;
2759 }
2760
2761
2762 /* If INPUT_P is true, mark asm GS as an ASM_INPUT. */
2763
2764 static inline void
2765 gimple_asm_set_input (gimple gs, bool input_p)
2766 {
2767 GIMPLE_CHECK (gs, GIMPLE_ASM);
2768 if (input_p)
2769 gs->gsbase.subcode |= GF_ASM_INPUT;
2770 else
2771 gs->gsbase.subcode &= ~GF_ASM_INPUT;
2772 }
2773
2774
2775 /* Return true if asm GS is an ASM_INPUT. */
2776
2777 static inline bool
2778 gimple_asm_input_p (const_gimple gs)
2779 {
2780 GIMPLE_CHECK (gs, GIMPLE_ASM);
2781 return (gs->gsbase.subcode & GF_ASM_INPUT) != 0;
2782 }
2783
2784
2785 /* Return the types handled by GIMPLE_CATCH statement GS. */
2786
2787 static inline tree
2788 gimple_catch_types (const_gimple gs)
2789 {
2790 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2791 return gs->gimple_catch.types;
2792 }
2793
2794
2795 /* Return a pointer to the types handled by GIMPLE_CATCH statement GS. */
2796
2797 static inline tree *
2798 gimple_catch_types_ptr (gimple gs)
2799 {
2800 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2801 return &gs->gimple_catch.types;
2802 }
2803
2804
2805 /* Return the GIMPLE sequence representing the body of the handler of
2806 GIMPLE_CATCH statement GS. */
2807
2808 static inline gimple_seq
2809 gimple_catch_handler (gimple gs)
2810 {
2811 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2812 return gs->gimple_catch.handler;
2813 }
2814
2815
2816 /* Return a pointer to the GIMPLE sequence representing the body of
2817 the handler of GIMPLE_CATCH statement GS. */
2818
2819 static inline gimple_seq *
2820 gimple_catch_handler_ptr (gimple gs)
2821 {
2822 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2823 return &gs->gimple_catch.handler;
2824 }
2825
2826
2827 /* Set T to be the set of types handled by GIMPLE_CATCH GS. */
2828
2829 static inline void
2830 gimple_catch_set_types (gimple gs, tree t)
2831 {
2832 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2833 gs->gimple_catch.types = t;
2834 }
2835
2836
2837 /* Set HANDLER to be the body of GIMPLE_CATCH GS. */
2838
2839 static inline void
2840 gimple_catch_set_handler (gimple gs, gimple_seq handler)
2841 {
2842 GIMPLE_CHECK (gs, GIMPLE_CATCH);
2843 gs->gimple_catch.handler = handler;
2844 }
2845
2846
2847 /* Return the types handled by GIMPLE_EH_FILTER statement GS. */
2848
2849 static inline tree
2850 gimple_eh_filter_types (const_gimple gs)
2851 {
2852 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2853 return gs->gimple_eh_filter.types;
2854 }
2855
2856
2857 /* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
2858 GS. */
2859
2860 static inline tree *
2861 gimple_eh_filter_types_ptr (gimple gs)
2862 {
2863 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2864 return &gs->gimple_eh_filter.types;
2865 }
2866
2867
2868 /* Return the sequence of statement to execute when GIMPLE_EH_FILTER
2869 statement fails. */
2870
2871 static inline gimple_seq
2872 gimple_eh_filter_failure (gimple gs)
2873 {
2874 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2875 return gs->gimple_eh_filter.failure;
2876 }
2877
2878
2879 /* Set TYPES to be the set of types handled by GIMPLE_EH_FILTER GS. */
2880
2881 static inline void
2882 gimple_eh_filter_set_types (gimple gs, tree types)
2883 {
2884 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2885 gs->gimple_eh_filter.types = types;
2886 }
2887
2888
2889 /* Set FAILURE to be the sequence of statements to execute on failure
2890 for GIMPLE_EH_FILTER GS. */
2891
2892 static inline void
2893 gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
2894 {
2895 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2896 gs->gimple_eh_filter.failure = failure;
2897 }
2898
2899 /* Return the EH_FILTER_MUST_NOT_THROW flag. */
2900
2901 static inline bool
2902
2903 gimple_eh_filter_must_not_throw (gimple gs)
2904 {
2905 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2906 return gs->gsbase.subcode != 0;
2907 }
2908
2909 /* Set the EH_FILTER_MUST_NOT_THROW flag to the value MNTP. */
2910
2911 static inline void
2912 gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp)
2913 {
2914 GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
2915 gs->gsbase.subcode = (unsigned int) mntp;
2916 }
2917
2918
2919 /* GIMPLE_TRY accessors. */
2920
2921 /* Return the kind of try block represented by GIMPLE_TRY GS. This is
2922 either GIMPLE_TRY_CATCH or GIMPLE_TRY_FINALLY. */
2923
2924 static inline enum gimple_try_flags
2925 gimple_try_kind (const_gimple gs)
2926 {
2927 GIMPLE_CHECK (gs, GIMPLE_TRY);
2928 return (enum gimple_try_flags) (gs->gsbase.subcode & GIMPLE_TRY_KIND);
2929 }
2930
2931
2932 /* Set the kind of try block represented by GIMPLE_TRY GS. */
2933
2934 static inline void
2935 gimple_try_set_kind (gimple gs, enum gimple_try_flags kind)
2936 {
2937 GIMPLE_CHECK (gs, GIMPLE_TRY);
2938 gcc_assert (kind == GIMPLE_TRY_CATCH || kind == GIMPLE_TRY_FINALLY);
2939 if (gimple_try_kind (gs) != kind)
2940 gs->gsbase.subcode = (unsigned int) kind;
2941 }
2942
2943
2944 /* Return the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2945
2946 static inline bool
2947 gimple_try_catch_is_cleanup (const_gimple gs)
2948 {
2949 gcc_assert (gimple_try_kind (gs) == GIMPLE_TRY_CATCH);
2950 return (gs->gsbase.subcode & GIMPLE_TRY_CATCH_IS_CLEANUP) != 0;
2951 }
2952
2953
2954 /* Return the sequence of statements used as the body for GIMPLE_TRY GS. */
2955
2956 static inline gimple_seq
2957 gimple_try_eval (gimple gs)
2958 {
2959 GIMPLE_CHECK (gs, GIMPLE_TRY);
2960 return gs->gimple_try.eval;
2961 }
2962
2963
2964 /* Return the sequence of statements used as the cleanup body for
2965 GIMPLE_TRY GS. */
2966
2967 static inline gimple_seq
2968 gimple_try_cleanup (gimple gs)
2969 {
2970 GIMPLE_CHECK (gs, GIMPLE_TRY);
2971 return gs->gimple_try.cleanup;
2972 }
2973
2974
2975 /* Set the GIMPLE_TRY_CATCH_IS_CLEANUP flag. */
2976
2977 static inline void
2978 gimple_try_set_catch_is_cleanup (gimple g, bool catch_is_cleanup)
2979 {
2980 gcc_assert (gimple_try_kind (g) == GIMPLE_TRY_CATCH);
2981 if (catch_is_cleanup)
2982 g->gsbase.subcode |= GIMPLE_TRY_CATCH_IS_CLEANUP;
2983 else
2984 g->gsbase.subcode &= ~GIMPLE_TRY_CATCH_IS_CLEANUP;
2985 }
2986
2987
2988 /* Set EVAL to be the sequence of statements to use as the body for
2989 GIMPLE_TRY GS. */
2990
2991 static inline void
2992 gimple_try_set_eval (gimple gs, gimple_seq eval)
2993 {
2994 GIMPLE_CHECK (gs, GIMPLE_TRY);
2995 gs->gimple_try.eval = eval;
2996 }
2997
2998
2999 /* Set CLEANUP to be the sequence of statements to use as the cleanup
3000 body for GIMPLE_TRY GS. */
3001
3002 static inline void
3003 gimple_try_set_cleanup (gimple gs, gimple_seq cleanup)
3004 {
3005 GIMPLE_CHECK (gs, GIMPLE_TRY);
3006 gs->gimple_try.cleanup = cleanup;
3007 }
3008
3009
3010 /* Return the cleanup sequence for cleanup statement GS. */
3011
3012 static inline gimple_seq
3013 gimple_wce_cleanup (gimple gs)
3014 {
3015 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3016 return gs->gimple_wce.cleanup;
3017 }
3018
3019
3020 /* Set CLEANUP to be the cleanup sequence for GS. */
3021
3022 static inline void
3023 gimple_wce_set_cleanup (gimple gs, gimple_seq cleanup)
3024 {
3025 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3026 gs->gimple_wce.cleanup = cleanup;
3027 }
3028
3029
3030 /* Return the CLEANUP_EH_ONLY flag for a WCE tuple. */
3031
3032 static inline bool
3033 gimple_wce_cleanup_eh_only (const_gimple gs)
3034 {
3035 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3036 return gs->gsbase.subcode != 0;
3037 }
3038
3039
3040 /* Set the CLEANUP_EH_ONLY flag for a WCE tuple. */
3041
3042 static inline void
3043 gimple_wce_set_cleanup_eh_only (gimple gs, bool eh_only_p)
3044 {
3045 GIMPLE_CHECK (gs, GIMPLE_WITH_CLEANUP_EXPR);
3046 gs->gsbase.subcode = (unsigned int) eh_only_p;
3047 }
3048
3049
3050 /* Return the maximum number of arguments supported by GIMPLE_PHI GS. */
3051
3052 static inline unsigned
3053 gimple_phi_capacity (const_gimple gs)
3054 {
3055 GIMPLE_CHECK (gs, GIMPLE_PHI);
3056 return gs->gimple_phi.capacity;
3057 }
3058
3059
3060 /* Return the number of arguments in GIMPLE_PHI GS. This must always
3061 be exactly the number of incoming edges for the basic block holding
3062 GS. */
3063
3064 static inline unsigned
3065 gimple_phi_num_args (const_gimple gs)
3066 {
3067 GIMPLE_CHECK (gs, GIMPLE_PHI);
3068 return gs->gimple_phi.nargs;
3069 }
3070
3071
3072 /* Return the SSA name created by GIMPLE_PHI GS. */
3073
3074 static inline tree
3075 gimple_phi_result (const_gimple gs)
3076 {
3077 GIMPLE_CHECK (gs, GIMPLE_PHI);
3078 return gs->gimple_phi.result;
3079 }
3080
3081 /* Return a pointer to the SSA name created by GIMPLE_PHI GS. */
3082
3083 static inline tree *
3084 gimple_phi_result_ptr (gimple gs)
3085 {
3086 GIMPLE_CHECK (gs, GIMPLE_PHI);
3087 return &gs->gimple_phi.result;
3088 }
3089
3090 /* Set RESULT to be the SSA name created by GIMPLE_PHI GS. */
3091
3092 static inline void
3093 gimple_phi_set_result (gimple gs, tree result)
3094 {
3095 GIMPLE_CHECK (gs, GIMPLE_PHI);
3096 gs->gimple_phi.result = result;
3097 }
3098
3099
3100 /* Return the PHI argument corresponding to incoming edge INDEX for
3101 GIMPLE_PHI GS. */
3102
3103 static inline struct phi_arg_d *
3104 gimple_phi_arg (gimple gs, unsigned index)
3105 {
3106 GIMPLE_CHECK (gs, GIMPLE_PHI);
3107 gcc_assert (index <= gs->gimple_phi.capacity);
3108 return &(gs->gimple_phi.args[index]);
3109 }
3110
3111 /* Set PHIARG to be the argument corresponding to incoming edge INDEX
3112 for GIMPLE_PHI GS. */
3113
3114 static inline void
3115 gimple_phi_set_arg (gimple gs, unsigned index, struct phi_arg_d * phiarg)
3116 {
3117 GIMPLE_CHECK (gs, GIMPLE_PHI);
3118 gcc_assert (index <= gs->gimple_phi.nargs);
3119 memcpy (gs->gimple_phi.args + index, phiarg, sizeof (struct phi_arg_d));
3120 }
3121
3122 /* Return the region number for GIMPLE_RESX GS. */
3123
3124 static inline int
3125 gimple_resx_region (const_gimple gs)
3126 {
3127 GIMPLE_CHECK (gs, GIMPLE_RESX);
3128 return gs->gimple_resx.region;
3129 }
3130
3131 /* Set REGION to be the region number for GIMPLE_RESX GS. */
3132
3133 static inline void
3134 gimple_resx_set_region (gimple gs, int region)
3135 {
3136 GIMPLE_CHECK (gs, GIMPLE_RESX);
3137 gs->gimple_resx.region = region;
3138 }
3139
3140
3141 /* Return the number of labels associated with the switch statement GS. */
3142
3143 static inline unsigned
3144 gimple_switch_num_labels (const_gimple gs)
3145 {
3146 unsigned num_ops;
3147 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3148 num_ops = gimple_num_ops (gs);
3149 gcc_assert (num_ops > 1);
3150 return num_ops - 1;
3151 }
3152
3153
3154 /* Set NLABELS to be the number of labels for the switch statement GS. */
3155
3156 static inline void
3157 gimple_switch_set_num_labels (gimple g, unsigned nlabels)
3158 {
3159 GIMPLE_CHECK (g, GIMPLE_SWITCH);
3160 gimple_set_num_ops (g, nlabels + 1);
3161 }
3162
3163
3164 /* Return the index variable used by the switch statement GS. */
3165
3166 static inline tree
3167 gimple_switch_index (const_gimple gs)
3168 {
3169 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3170 return gimple_op (gs, 0);
3171 }
3172
3173
3174 /* Return a pointer to the index variable for the switch statement GS. */
3175
3176 static inline tree *
3177 gimple_switch_index_ptr (const_gimple gs)
3178 {
3179 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3180 return gimple_op_ptr (gs, 0);
3181 }
3182
3183
3184 /* Set INDEX to be the index variable for switch statement GS. */
3185
3186 static inline void
3187 gimple_switch_set_index (gimple gs, tree index)
3188 {
3189 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3190 gcc_assert (SSA_VAR_P (index) || CONSTANT_CLASS_P (index));
3191 gimple_set_op (gs, 0, index);
3192 }
3193
3194
3195 /* Return the label numbered INDEX. The default label is 0, followed by any
3196 labels in a switch statement. */
3197
3198 static inline tree
3199 gimple_switch_label (const_gimple gs, unsigned index)
3200 {
3201 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3202 gcc_assert (gimple_num_ops (gs) > index + 1);
3203 return gimple_op (gs, index + 1);
3204 }
3205
3206 /* Set the label number INDEX to LABEL. 0 is always the default label. */
3207
3208 static inline void
3209 gimple_switch_set_label (gimple gs, unsigned index, tree label)
3210 {
3211 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
3212 gcc_assert (gimple_num_ops (gs) > index + 1);
3213 gcc_assert (label == NULL_TREE || TREE_CODE (label) == CASE_LABEL_EXPR);
3214 gimple_set_op (gs, index + 1, label);
3215 }
3216
3217 /* Return the default label for a switch statement. */
3218
3219 static inline tree
3220 gimple_switch_default_label (const_gimple gs)
3221 {
3222 return gimple_switch_label (gs, 0);
3223 }
3224
3225 /* Set the default label for a switch statement. */
3226
3227 static inline void
3228 gimple_switch_set_default_label (gimple gs, tree label)
3229 {
3230 gimple_switch_set_label (gs, 0, label);
3231 }
3232
3233
3234 /* Return the body for the OMP statement GS. */
3235
3236 static inline gimple_seq
3237 gimple_omp_body (gimple gs)
3238 {
3239 return gs->omp.body;
3240 }
3241
3242 /* Set BODY to be the body for the OMP statement GS. */
3243
3244 static inline void
3245 gimple_omp_set_body (gimple gs, gimple_seq body)
3246 {
3247 gs->omp.body = body;
3248 }
3249
3250
3251 /* Return the name associated with OMP_CRITICAL statement GS. */
3252
3253 static inline tree
3254 gimple_omp_critical_name (const_gimple gs)
3255 {
3256 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3257 return gs->gimple_omp_critical.name;
3258 }
3259
3260
3261 /* Return a pointer to the name associated with OMP critical statement GS. */
3262
3263 static inline tree *
3264 gimple_omp_critical_name_ptr (gimple gs)
3265 {
3266 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3267 return &gs->gimple_omp_critical.name;
3268 }
3269
3270
3271 /* Set NAME to be the name associated with OMP critical statement GS. */
3272
3273 static inline void
3274 gimple_omp_critical_set_name (gimple gs, tree name)
3275 {
3276 GIMPLE_CHECK (gs, GIMPLE_OMP_CRITICAL);
3277 gs->gimple_omp_critical.name = name;
3278 }
3279
3280
3281 /* Return the clauses associated with OMP_FOR GS. */
3282
3283 static inline tree
3284 gimple_omp_for_clauses (const_gimple gs)
3285 {
3286 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3287 return gs->gimple_omp_for.clauses;
3288 }
3289
3290
3291 /* Return a pointer to the OMP_FOR GS. */
3292
3293 static inline tree *
3294 gimple_omp_for_clauses_ptr (gimple gs)
3295 {
3296 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3297 return &gs->gimple_omp_for.clauses;
3298 }
3299
3300
3301 /* Set CLAUSES to be the list of clauses associated with OMP_FOR GS. */
3302
3303 static inline void
3304 gimple_omp_for_set_clauses (gimple gs, tree clauses)
3305 {
3306 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3307 gs->gimple_omp_for.clauses = clauses;
3308 }
3309
3310
3311 /* Get the collapse count of OMP_FOR GS. */
3312
3313 static inline size_t
3314 gimple_omp_for_collapse (gimple gs)
3315 {
3316 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3317 return gs->gimple_omp_for.collapse;
3318 }
3319
3320
3321 /* Return the index variable for OMP_FOR GS. */
3322
3323 static inline tree
3324 gimple_omp_for_index (const_gimple gs, size_t i)
3325 {
3326 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3327 gcc_assert (i < gs->gimple_omp_for.collapse);
3328 return gs->gimple_omp_for.iter[i].index;
3329 }
3330
3331
3332 /* Return a pointer to the index variable for OMP_FOR GS. */
3333
3334 static inline tree *
3335 gimple_omp_for_index_ptr (gimple gs, size_t i)
3336 {
3337 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3338 gcc_assert (i < gs->gimple_omp_for.collapse);
3339 return &gs->gimple_omp_for.iter[i].index;
3340 }
3341
3342
3343 /* Set INDEX to be the index variable for OMP_FOR GS. */
3344
3345 static inline void
3346 gimple_omp_for_set_index (gimple gs, size_t i, tree index)
3347 {
3348 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3349 gcc_assert (i < gs->gimple_omp_for.collapse);
3350 gs->gimple_omp_for.iter[i].index = index;
3351 }
3352
3353
3354 /* Return the initial value for OMP_FOR GS. */
3355
3356 static inline tree
3357 gimple_omp_for_initial (const_gimple gs, size_t i)
3358 {
3359 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3360 gcc_assert (i < gs->gimple_omp_for.collapse);
3361 return gs->gimple_omp_for.iter[i].initial;
3362 }
3363
3364
3365 /* Return a pointer to the initial value for OMP_FOR GS. */
3366
3367 static inline tree *
3368 gimple_omp_for_initial_ptr (gimple gs, size_t i)
3369 {
3370 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3371 gcc_assert (i < gs->gimple_omp_for.collapse);
3372 return &gs->gimple_omp_for.iter[i].initial;
3373 }
3374
3375
3376 /* Set INITIAL to be the initial value for OMP_FOR GS. */
3377
3378 static inline void
3379 gimple_omp_for_set_initial (gimple gs, size_t i, tree initial)
3380 {
3381 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3382 gcc_assert (i < gs->gimple_omp_for.collapse);
3383 gs->gimple_omp_for.iter[i].initial = initial;
3384 }
3385
3386
3387 /* Return the final value for OMP_FOR GS. */
3388
3389 static inline tree
3390 gimple_omp_for_final (const_gimple gs, size_t i)
3391 {
3392 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3393 gcc_assert (i < gs->gimple_omp_for.collapse);
3394 return gs->gimple_omp_for.iter[i].final;
3395 }
3396
3397
3398 /* Return a pointer to the final value for OMP_FOR GS. */
3399
3400 static inline tree *
3401 gimple_omp_for_final_ptr (gimple gs, size_t i)
3402 {
3403 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3404 gcc_assert (i < gs->gimple_omp_for.collapse);
3405 return &gs->gimple_omp_for.iter[i].final;
3406 }
3407
3408
3409 /* Set FINAL to be the final value for OMP_FOR GS. */
3410
3411 static inline void
3412 gimple_omp_for_set_final (gimple gs, size_t i, tree final)
3413 {
3414 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3415 gcc_assert (i < gs->gimple_omp_for.collapse);
3416 gs->gimple_omp_for.iter[i].final = final;
3417 }
3418
3419
3420 /* Return the increment value for OMP_FOR GS. */
3421
3422 static inline tree
3423 gimple_omp_for_incr (const_gimple gs, size_t i)
3424 {
3425 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3426 gcc_assert (i < gs->gimple_omp_for.collapse);
3427 return gs->gimple_omp_for.iter[i].incr;
3428 }
3429
3430
3431 /* Return a pointer to the increment value for OMP_FOR GS. */
3432
3433 static inline tree *
3434 gimple_omp_for_incr_ptr (gimple gs, size_t i)
3435 {
3436 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3437 gcc_assert (i < gs->gimple_omp_for.collapse);
3438 return &gs->gimple_omp_for.iter[i].incr;
3439 }
3440
3441
3442 /* Set INCR to be the increment value for OMP_FOR GS. */
3443
3444 static inline void
3445 gimple_omp_for_set_incr (gimple gs, size_t i, tree incr)
3446 {
3447 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3448 gcc_assert (i < gs->gimple_omp_for.collapse);
3449 gs->gimple_omp_for.iter[i].incr = incr;
3450 }
3451
3452
3453 /* Return the sequence of statements to execute before the OMP_FOR
3454 statement GS starts. */
3455
3456 static inline gimple_seq
3457 gimple_omp_for_pre_body (gimple gs)
3458 {
3459 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3460 return gs->gimple_omp_for.pre_body;
3461 }
3462
3463
3464 /* Set PRE_BODY to be the sequence of statements to execute before the
3465 OMP_FOR statement GS starts. */
3466
3467 static inline void
3468 gimple_omp_for_set_pre_body (gimple gs, gimple_seq pre_body)
3469 {
3470 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3471 gs->gimple_omp_for.pre_body = pre_body;
3472 }
3473
3474
3475 /* Return the clauses associated with OMP_PARALLEL GS. */
3476
3477 static inline tree
3478 gimple_omp_parallel_clauses (const_gimple gs)
3479 {
3480 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3481 return gs->gimple_omp_parallel.clauses;
3482 }
3483
3484
3485 /* Return a pointer to the clauses associated with OMP_PARALLEL GS. */
3486
3487 static inline tree *
3488 gimple_omp_parallel_clauses_ptr (gimple gs)
3489 {
3490 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3491 return &gs->gimple_omp_parallel.clauses;
3492 }
3493
3494
3495 /* Set CLAUSES to be the list of clauses associated with OMP_PARALLEL
3496 GS. */
3497
3498 static inline void
3499 gimple_omp_parallel_set_clauses (gimple gs, tree clauses)
3500 {
3501 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3502 gs->gimple_omp_parallel.clauses = clauses;
3503 }
3504
3505
3506 /* Return the child function used to hold the body of OMP_PARALLEL GS. */
3507
3508 static inline tree
3509 gimple_omp_parallel_child_fn (const_gimple gs)
3510 {
3511 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3512 return gs->gimple_omp_parallel.child_fn;
3513 }
3514
3515 /* Return a pointer to the child function used to hold the body of
3516 OMP_PARALLEL GS. */
3517
3518 static inline tree *
3519 gimple_omp_parallel_child_fn_ptr (gimple gs)
3520 {
3521 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3522 return &gs->gimple_omp_parallel.child_fn;
3523 }
3524
3525
3526 /* Set CHILD_FN to be the child function for OMP_PARALLEL GS. */
3527
3528 static inline void
3529 gimple_omp_parallel_set_child_fn (gimple gs, tree child_fn)
3530 {
3531 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3532 gs->gimple_omp_parallel.child_fn = child_fn;
3533 }
3534
3535
3536 /* Return the artificial argument used to send variables and values
3537 from the parent to the children threads in OMP_PARALLEL GS. */
3538
3539 static inline tree
3540 gimple_omp_parallel_data_arg (const_gimple gs)
3541 {
3542 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3543 return gs->gimple_omp_parallel.data_arg;
3544 }
3545
3546
3547 /* Return a pointer to the data argument for OMP_PARALLEL GS. */
3548
3549 static inline tree *
3550 gimple_omp_parallel_data_arg_ptr (gimple gs)
3551 {
3552 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3553 return &gs->gimple_omp_parallel.data_arg;
3554 }
3555
3556
3557 /* Set DATA_ARG to be the data argument for OMP_PARALLEL GS. */
3558
3559 static inline void
3560 gimple_omp_parallel_set_data_arg (gimple gs, tree data_arg)
3561 {
3562 GIMPLE_CHECK (gs, GIMPLE_OMP_PARALLEL);
3563 gs->gimple_omp_parallel.data_arg = data_arg;
3564 }
3565
3566
3567 /* Return the clauses associated with OMP_TASK GS. */
3568
3569 static inline tree
3570 gimple_omp_task_clauses (const_gimple gs)
3571 {
3572 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3573 return gs->gimple_omp_parallel.clauses;
3574 }
3575
3576
3577 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3578
3579 static inline tree *
3580 gimple_omp_task_clauses_ptr (gimple gs)
3581 {
3582 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3583 return &gs->gimple_omp_parallel.clauses;
3584 }
3585
3586
3587 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3588 GS. */
3589
3590 static inline void
3591 gimple_omp_task_set_clauses (gimple gs, tree clauses)
3592 {
3593 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3594 gs->gimple_omp_parallel.clauses = clauses;
3595 }
3596
3597
3598 /* Return the child function used to hold the body of OMP_TASK GS. */
3599
3600 static inline tree
3601 gimple_omp_task_child_fn (const_gimple gs)
3602 {
3603 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3604 return gs->gimple_omp_parallel.child_fn;
3605 }
3606
3607 /* Return a pointer to the child function used to hold the body of
3608 OMP_TASK GS. */
3609
3610 static inline tree *
3611 gimple_omp_task_child_fn_ptr (gimple gs)
3612 {
3613 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3614 return &gs->gimple_omp_parallel.child_fn;
3615 }
3616
3617
3618 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3619
3620 static inline void
3621 gimple_omp_task_set_child_fn (gimple gs, tree child_fn)
3622 {
3623 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3624 gs->gimple_omp_parallel.child_fn = child_fn;
3625 }
3626
3627
3628 /* Return the artificial argument used to send variables and values
3629 from the parent to the children threads in OMP_TASK GS. */
3630
3631 static inline tree
3632 gimple_omp_task_data_arg (const_gimple gs)
3633 {
3634 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3635 return gs->gimple_omp_parallel.data_arg;
3636 }
3637
3638
3639 /* Return a pointer to the data argument for OMP_TASK GS. */
3640
3641 static inline tree *
3642 gimple_omp_task_data_arg_ptr (gimple gs)
3643 {
3644 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3645 return &gs->gimple_omp_parallel.data_arg;
3646 }
3647
3648
3649 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3650
3651 static inline void
3652 gimple_omp_task_set_data_arg (gimple gs, tree data_arg)
3653 {
3654 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3655 gs->gimple_omp_parallel.data_arg = data_arg;
3656 }
3657
3658
3659 /* Return the clauses associated with OMP_TASK GS. */
3660
3661 static inline tree
3662 gimple_omp_taskreg_clauses (const_gimple gs)
3663 {
3664 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3665 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3666 return gs->gimple_omp_parallel.clauses;
3667 }
3668
3669
3670 /* Return a pointer to the clauses associated with OMP_TASK GS. */
3671
3672 static inline tree *
3673 gimple_omp_taskreg_clauses_ptr (gimple gs)
3674 {
3675 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3676 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3677 return &gs->gimple_omp_parallel.clauses;
3678 }
3679
3680
3681 /* Set CLAUSES to be the list of clauses associated with OMP_TASK
3682 GS. */
3683
3684 static inline void
3685 gimple_omp_taskreg_set_clauses (gimple gs, tree clauses)
3686 {
3687 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3688 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3689 gs->gimple_omp_parallel.clauses = clauses;
3690 }
3691
3692
3693 /* Return the child function used to hold the body of OMP_TASK GS. */
3694
3695 static inline tree
3696 gimple_omp_taskreg_child_fn (const_gimple gs)
3697 {
3698 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3699 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3700 return gs->gimple_omp_parallel.child_fn;
3701 }
3702
3703 /* Return a pointer to the child function used to hold the body of
3704 OMP_TASK GS. */
3705
3706 static inline tree *
3707 gimple_omp_taskreg_child_fn_ptr (gimple gs)
3708 {
3709 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3710 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3711 return &gs->gimple_omp_parallel.child_fn;
3712 }
3713
3714
3715 /* Set CHILD_FN to be the child function for OMP_TASK GS. */
3716
3717 static inline void
3718 gimple_omp_taskreg_set_child_fn (gimple gs, tree child_fn)
3719 {
3720 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3721 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3722 gs->gimple_omp_parallel.child_fn = child_fn;
3723 }
3724
3725
3726 /* Return the artificial argument used to send variables and values
3727 from the parent to the children threads in OMP_TASK GS. */
3728
3729 static inline tree
3730 gimple_omp_taskreg_data_arg (const_gimple gs)
3731 {
3732 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3733 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3734 return gs->gimple_omp_parallel.data_arg;
3735 }
3736
3737
3738 /* Return a pointer to the data argument for OMP_TASK GS. */
3739
3740 static inline tree *
3741 gimple_omp_taskreg_data_arg_ptr (gimple gs)
3742 {
3743 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3744 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3745 return &gs->gimple_omp_parallel.data_arg;
3746 }
3747
3748
3749 /* Set DATA_ARG to be the data argument for OMP_TASK GS. */
3750
3751 static inline void
3752 gimple_omp_taskreg_set_data_arg (gimple gs, tree data_arg)
3753 {
3754 if (gimple_code (gs) != GIMPLE_OMP_PARALLEL)
3755 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3756 gs->gimple_omp_parallel.data_arg = data_arg;
3757 }
3758
3759
3760 /* Return the copy function used to hold the body of OMP_TASK GS. */
3761
3762 static inline tree
3763 gimple_omp_task_copy_fn (const_gimple gs)
3764 {
3765 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3766 return gs->gimple_omp_task.copy_fn;
3767 }
3768
3769 /* Return a pointer to the copy function used to hold the body of
3770 OMP_TASK GS. */
3771
3772 static inline tree *
3773 gimple_omp_task_copy_fn_ptr (gimple gs)
3774 {
3775 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3776 return &gs->gimple_omp_task.copy_fn;
3777 }
3778
3779
3780 /* Set CHILD_FN to be the copy function for OMP_TASK GS. */
3781
3782 static inline void
3783 gimple_omp_task_set_copy_fn (gimple gs, tree copy_fn)
3784 {
3785 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3786 gs->gimple_omp_task.copy_fn = copy_fn;
3787 }
3788
3789
3790 /* Return size of the data block in bytes in OMP_TASK GS. */
3791
3792 static inline tree
3793 gimple_omp_task_arg_size (const_gimple gs)
3794 {
3795 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3796 return gs->gimple_omp_task.arg_size;
3797 }
3798
3799
3800 /* Return a pointer to the data block size for OMP_TASK GS. */
3801
3802 static inline tree *
3803 gimple_omp_task_arg_size_ptr (gimple gs)
3804 {
3805 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3806 return &gs->gimple_omp_task.arg_size;
3807 }
3808
3809
3810 /* Set ARG_SIZE to be the data block size for OMP_TASK GS. */
3811
3812 static inline void
3813 gimple_omp_task_set_arg_size (gimple gs, tree arg_size)
3814 {
3815 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3816 gs->gimple_omp_task.arg_size = arg_size;
3817 }
3818
3819
3820 /* Return align of the data block in bytes in OMP_TASK GS. */
3821
3822 static inline tree
3823 gimple_omp_task_arg_align (const_gimple gs)
3824 {
3825 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3826 return gs->gimple_omp_task.arg_align;
3827 }
3828
3829
3830 /* Return a pointer to the data block align for OMP_TASK GS. */
3831
3832 static inline tree *
3833 gimple_omp_task_arg_align_ptr (gimple gs)
3834 {
3835 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3836 return &gs->gimple_omp_task.arg_align;
3837 }
3838
3839
3840 /* Set ARG_SIZE to be the data block align for OMP_TASK GS. */
3841
3842 static inline void
3843 gimple_omp_task_set_arg_align (gimple gs, tree arg_align)
3844 {
3845 GIMPLE_CHECK (gs, GIMPLE_OMP_TASK);
3846 gs->gimple_omp_task.arg_align = arg_align;
3847 }
3848
3849
3850 /* Return the clauses associated with OMP_SINGLE GS. */
3851
3852 static inline tree
3853 gimple_omp_single_clauses (const_gimple gs)
3854 {
3855 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3856 return gs->gimple_omp_single.clauses;
3857 }
3858
3859
3860 /* Return a pointer to the clauses associated with OMP_SINGLE GS. */
3861
3862 static inline tree *
3863 gimple_omp_single_clauses_ptr (gimple gs)
3864 {
3865 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3866 return &gs->gimple_omp_single.clauses;
3867 }
3868
3869
3870 /* Set CLAUSES to be the clauses associated with OMP_SINGLE GS. */
3871
3872 static inline void
3873 gimple_omp_single_set_clauses (gimple gs, tree clauses)
3874 {
3875 GIMPLE_CHECK (gs, GIMPLE_OMP_SINGLE);
3876 gs->gimple_omp_single.clauses = clauses;
3877 }
3878
3879
3880 /* Return the clauses associated with OMP_SECTIONS GS. */
3881
3882 static inline tree
3883 gimple_omp_sections_clauses (const_gimple gs)
3884 {
3885 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3886 return gs->gimple_omp_sections.clauses;
3887 }
3888
3889
3890 /* Return a pointer to the clauses associated with OMP_SECTIONS GS. */
3891
3892 static inline tree *
3893 gimple_omp_sections_clauses_ptr (gimple gs)
3894 {
3895 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3896 return &gs->gimple_omp_sections.clauses;
3897 }
3898
3899
3900 /* Set CLAUSES to be the set of clauses associated with OMP_SECTIONS
3901 GS. */
3902
3903 static inline void
3904 gimple_omp_sections_set_clauses (gimple gs, tree clauses)
3905 {
3906 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3907 gs->gimple_omp_sections.clauses = clauses;
3908 }
3909
3910
3911 /* Return the control variable associated with the GIMPLE_OMP_SECTIONS
3912 in GS. */
3913
3914 static inline tree
3915 gimple_omp_sections_control (const_gimple gs)
3916 {
3917 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3918 return gs->gimple_omp_sections.control;
3919 }
3920
3921
3922 /* Return a pointer to the clauses associated with the GIMPLE_OMP_SECTIONS
3923 GS. */
3924
3925 static inline tree *
3926 gimple_omp_sections_control_ptr (gimple gs)
3927 {
3928 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3929 return &gs->gimple_omp_sections.control;
3930 }
3931
3932
3933 /* Set CONTROL to be the set of clauses associated with the
3934 GIMPLE_OMP_SECTIONS in GS. */
3935
3936 static inline void
3937 gimple_omp_sections_set_control (gimple gs, tree control)
3938 {
3939 GIMPLE_CHECK (gs, GIMPLE_OMP_SECTIONS);
3940 gs->gimple_omp_sections.control = control;
3941 }
3942
3943
3944 /* Set COND to be the condition code for OMP_FOR GS. */
3945
3946 static inline void
3947 gimple_omp_for_set_cond (gimple gs, size_t i, enum tree_code cond)
3948 {
3949 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3950 gcc_assert (TREE_CODE_CLASS (cond) == tcc_comparison);
3951 gcc_assert (i < gs->gimple_omp_for.collapse);
3952 gs->gimple_omp_for.iter[i].cond = cond;
3953 }
3954
3955
3956 /* Return the condition code associated with OMP_FOR GS. */
3957
3958 static inline enum tree_code
3959 gimple_omp_for_cond (const_gimple gs, size_t i)
3960 {
3961 GIMPLE_CHECK (gs, GIMPLE_OMP_FOR);
3962 gcc_assert (i < gs->gimple_omp_for.collapse);
3963 return gs->gimple_omp_for.iter[i].cond;
3964 }
3965
3966
3967 /* Set the value being stored in an atomic store. */
3968
3969 static inline void
3970 gimple_omp_atomic_store_set_val (gimple g, tree val)
3971 {
3972 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3973 g->gimple_omp_atomic_store.val = val;
3974 }
3975
3976
3977 /* Return the value being stored in an atomic store. */
3978
3979 static inline tree
3980 gimple_omp_atomic_store_val (const_gimple g)
3981 {
3982 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3983 return g->gimple_omp_atomic_store.val;
3984 }
3985
3986
3987 /* Return a pointer to the value being stored in an atomic store. */
3988
3989 static inline tree *
3990 gimple_omp_atomic_store_val_ptr (gimple g)
3991 {
3992 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_STORE);
3993 return &g->gimple_omp_atomic_store.val;
3994 }
3995
3996
3997 /* Set the LHS of an atomic load. */
3998
3999 static inline void
4000 gimple_omp_atomic_load_set_lhs (gimple g, tree lhs)
4001 {
4002 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4003 g->gimple_omp_atomic_load.lhs = lhs;
4004 }
4005
4006
4007 /* Get the LHS of an atomic load. */
4008
4009 static inline tree
4010 gimple_omp_atomic_load_lhs (const_gimple g)
4011 {
4012 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4013 return g->gimple_omp_atomic_load.lhs;
4014 }
4015
4016
4017 /* Return a pointer to the LHS of an atomic load. */
4018
4019 static inline tree *
4020 gimple_omp_atomic_load_lhs_ptr (gimple g)
4021 {
4022 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4023 return &g->gimple_omp_atomic_load.lhs;
4024 }
4025
4026
4027 /* Set the RHS of an atomic load. */
4028
4029 static inline void
4030 gimple_omp_atomic_load_set_rhs (gimple g, tree rhs)
4031 {
4032 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4033 g->gimple_omp_atomic_load.rhs = rhs;
4034 }
4035
4036
4037 /* Get the RHS of an atomic load. */
4038
4039 static inline tree
4040 gimple_omp_atomic_load_rhs (const_gimple g)
4041 {
4042 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4043 return g->gimple_omp_atomic_load.rhs;
4044 }
4045
4046
4047 /* Return a pointer to the RHS of an atomic load. */
4048
4049 static inline tree *
4050 gimple_omp_atomic_load_rhs_ptr (gimple g)
4051 {
4052 GIMPLE_CHECK (g, GIMPLE_OMP_ATOMIC_LOAD);
4053 return &g->gimple_omp_atomic_load.rhs;
4054 }
4055
4056
4057 /* Get the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4058
4059 static inline tree
4060 gimple_omp_continue_control_def (const_gimple g)
4061 {
4062 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4063 return g->gimple_omp_continue.control_def;
4064 }
4065
4066 /* The same as above, but return the address. */
4067
4068 static inline tree *
4069 gimple_omp_continue_control_def_ptr (gimple g)
4070 {
4071 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4072 return &g->gimple_omp_continue.control_def;
4073 }
4074
4075 /* Set the definition of the control variable in a GIMPLE_OMP_CONTINUE. */
4076
4077 static inline void
4078 gimple_omp_continue_set_control_def (gimple g, tree def)
4079 {
4080 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4081 g->gimple_omp_continue.control_def = def;
4082 }
4083
4084
4085 /* Get the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4086
4087 static inline tree
4088 gimple_omp_continue_control_use (const_gimple g)
4089 {
4090 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4091 return g->gimple_omp_continue.control_use;
4092 }
4093
4094
4095 /* The same as above, but return the address. */
4096
4097 static inline tree *
4098 gimple_omp_continue_control_use_ptr (gimple g)
4099 {
4100 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4101 return &g->gimple_omp_continue.control_use;
4102 }
4103
4104
4105 /* Set the use of the control variable in a GIMPLE_OMP_CONTINUE. */
4106
4107 static inline void
4108 gimple_omp_continue_set_control_use (gimple g, tree use)
4109 {
4110 GIMPLE_CHECK (g, GIMPLE_OMP_CONTINUE);
4111 g->gimple_omp_continue.control_use = use;
4112 }
4113
4114
4115 /* Return a pointer to the return value for GIMPLE_RETURN GS. */
4116
4117 static inline tree *
4118 gimple_return_retval_ptr (const_gimple gs)
4119 {
4120 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4121 gcc_assert (gimple_num_ops (gs) == 1);
4122 return gimple_op_ptr (gs, 0);
4123 }
4124
4125 /* Return the return value for GIMPLE_RETURN GS. */
4126
4127 static inline tree
4128 gimple_return_retval (const_gimple gs)
4129 {
4130 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4131 gcc_assert (gimple_num_ops (gs) == 1);
4132 return gimple_op (gs, 0);
4133 }
4134
4135
4136 /* Set RETVAL to be the return value for GIMPLE_RETURN GS. */
4137
4138 static inline void
4139 gimple_return_set_retval (gimple gs, tree retval)
4140 {
4141 GIMPLE_CHECK (gs, GIMPLE_RETURN);
4142 gcc_assert (gimple_num_ops (gs) == 1);
4143 gcc_assert (retval == NULL_TREE
4144 || TREE_CODE (retval) == RESULT_DECL
4145 || is_gimple_val (retval));
4146 gimple_set_op (gs, 0, retval);
4147 }
4148
4149
4150 /* Returns true when the gimple statment STMT is any of the OpenMP types. */
4151
4152 static inline bool
4153 is_gimple_omp (const_gimple stmt)
4154 {
4155 return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL
4156 || gimple_code (stmt) == GIMPLE_OMP_TASK
4157 || gimple_code (stmt) == GIMPLE_OMP_FOR
4158 || gimple_code (stmt) == GIMPLE_OMP_SECTIONS
4159 || gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH
4160 || gimple_code (stmt) == GIMPLE_OMP_SINGLE
4161 || gimple_code (stmt) == GIMPLE_OMP_SECTION
4162 || gimple_code (stmt) == GIMPLE_OMP_MASTER
4163 || gimple_code (stmt) == GIMPLE_OMP_ORDERED
4164 || gimple_code (stmt) == GIMPLE_OMP_CRITICAL
4165 || gimple_code (stmt) == GIMPLE_OMP_RETURN
4166 || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
4167 || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
4168 || gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
4169 }
4170
4171
4172 /* Returns TRUE if statement G is a GIMPLE_NOP. */
4173
4174 static inline bool
4175 gimple_nop_p (const_gimple g)
4176 {
4177 return gimple_code (g) == GIMPLE_NOP;
4178 }
4179
4180
4181 /* Return the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
4182
4183 static inline tree
4184 gimple_cdt_new_type (gimple gs)
4185 {
4186 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4187 return gimple_op (gs, 1);
4188 }
4189
4190 /* Return a pointer to the new type set by GIMPLE_CHANGE_DYNAMIC_TYPE
4191 statement GS. */
4192
4193 static inline tree *
4194 gimple_cdt_new_type_ptr (gimple gs)
4195 {
4196 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4197 return gimple_op_ptr (gs, 1);
4198 }
4199
4200 /* Set NEW_TYPE to be the type returned by GIMPLE_CHANGE_DYNAMIC_TYPE
4201 statement GS. */
4202
4203 static inline void
4204 gimple_cdt_set_new_type (gimple gs, tree new_type)
4205 {
4206 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4207 gcc_assert (TREE_CODE_CLASS (TREE_CODE (new_type)) == tcc_type);
4208 gimple_set_op (gs, 1, new_type);
4209 }
4210
4211
4212 /* Return the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE statement GS. */
4213
4214 static inline tree
4215 gimple_cdt_location (gimple gs)
4216 {
4217 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4218 return gimple_op (gs, 0);
4219 }
4220
4221
4222 /* Return a pointer to the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
4223 statement GS. */
4224
4225 static inline tree *
4226 gimple_cdt_location_ptr (gimple gs)
4227 {
4228 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4229 return gimple_op_ptr (gs, 0);
4230 }
4231
4232
4233 /* Set PTR to be the location affected by GIMPLE_CHANGE_DYNAMIC_TYPE
4234 statement GS. */
4235
4236 static inline void
4237 gimple_cdt_set_location (gimple gs, tree ptr)
4238 {
4239 GIMPLE_CHECK (gs, GIMPLE_CHANGE_DYNAMIC_TYPE);
4240 gimple_set_op (gs, 0, ptr);
4241 }
4242
4243
4244 /* Return the predictor of GIMPLE_PREDICT statement GS. */
4245
4246 static inline enum br_predictor
4247 gimple_predict_predictor (gimple gs)
4248 {
4249 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4250 return (enum br_predictor) (gs->gsbase.subcode & ~GF_PREDICT_TAKEN);
4251 }
4252
4253
4254 /* Set the predictor of GIMPLE_PREDICT statement GS to PREDICT. */
4255
4256 static inline void
4257 gimple_predict_set_predictor (gimple gs, enum br_predictor predictor)
4258 {
4259 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4260 gs->gsbase.subcode = (gs->gsbase.subcode & GF_PREDICT_TAKEN)
4261 | (unsigned) predictor;
4262 }
4263
4264
4265 /* Return the outcome of GIMPLE_PREDICT statement GS. */
4266
4267 static inline enum prediction
4268 gimple_predict_outcome (gimple gs)
4269 {
4270 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4271 return (gs->gsbase.subcode & GF_PREDICT_TAKEN) ? TAKEN : NOT_TAKEN;
4272 }
4273
4274
4275 /* Set the outcome of GIMPLE_PREDICT statement GS to OUTCOME. */
4276
4277 static inline void
4278 gimple_predict_set_outcome (gimple gs, enum prediction outcome)
4279 {
4280 GIMPLE_CHECK (gs, GIMPLE_PREDICT);
4281 if (outcome == TAKEN)
4282 gs->gsbase.subcode |= GF_PREDICT_TAKEN;
4283 else
4284 gs->gsbase.subcode &= ~GF_PREDICT_TAKEN;
4285 } 4305 }
4286 4306
4287 4307
4288 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */ 4308 /* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
4289 4309