GCC Wikia
Advertisement

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

概要[]

引数[]

実装[]

1661 /* Combine operands OP1 and OP2 with arithmetic operation CODE.  CODE
1662    is a tree code.  The type of the result is taken from the operands.
1663    Both must be the same type integer type and it must be a size type.
1664    If the operands are constant, so is the result.  */
1665 
1666 tree
1667 size_binop (enum tree_code code, tree arg0, tree arg1)
1668 {
1669   tree type = TREE_TYPE (arg0);
1670 
1671   gcc_assert (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type)
1672               && type == TREE_TYPE (arg1));
1673 
1674   /* Handle the special case of two integer constants faster.  */
1675   if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
1676     {
1677       /* And some specific cases even faster than that.  */
1678       if (code == PLUS_EXPR && integer_zerop (arg0))
1679         return arg1;
1680       else if ((code == MINUS_EXPR || code == PLUS_EXPR)
1681                && integer_zerop (arg1))
1682         return arg0;
1683       else if (code == MULT_EXPR && integer_onep (arg0))
1684         return arg1;
1685 
1686       /* Handle general case of two integer constants.  */
1687       return int_const_binop (code, arg0, arg1, 0);
1688     }
1689 
1690   if (arg0 == error_mark_node || arg1 == error_mark_node)
1691     return error_mark_node;
1692 
1693   return fold_build2 (code, type, arg0, arg1);
1694 }



リンク元

Advertisement