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