comparison gcc/c-parser.c @ 11:8f2e43f937f3

add cbc_make_lebeled_return function.
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Wed, 09 Sep 2009 18:47:06 +0900
parents 26e357f6275f
children ab98828ce7a7
comparison
equal deleted inserted replaced
10:26e357f6275f 11:8f2e43f937f3
58 #include "target.h" 58 #include "target.h"
59 #include "cgraph.h" 59 #include "cgraph.h"
60 #ifndef noCbC 60 #ifndef noCbC
61 #include "cbc-tree.h" 61 #include "cbc-tree.h"
62 static tree cbc_make_nested_function (location_t); 62 static tree cbc_make_nested_function (location_t);
63 static void cbc_make_labeled_goto (location_t loc);
63 #endif 64 #endif
64 65
65 66
66 /* Initialization routine for this file. */ 67 /* Initialization routine for this file. */
67 68
5720 5721
5721 //add_stmt (cbc_make_nested_function (location)); 5722 //add_stmt (cbc_make_nested_function (location));
5722 tree nested_func = cbc_make_nested_function (location); 5723 tree nested_func = cbc_make_nested_function (location);
5723 add_stmt (build_stmt (DECL_EXPR, nested_func)); 5724 add_stmt (build_stmt (DECL_EXPR, nested_func));
5724 5725
5726 cbc_make_labeled_goto (location);
5727
5725 tree value = build_addr (nested_func , current_function_decl); 5728 tree value = build_addr (nested_func , current_function_decl);
5726 SET_EXPR_LOCATION (value, location); 5729 SET_EXPR_LOCATION (value, location);
5727 add_stmt (value); 5730 add_stmt (value);
5728 5731
5729 TREE_SIDE_EFFECTS (stmt) = 1; 5732 TREE_SIDE_EFFECTS (stmt) = 1;
5761 expr.value = error_mark_node; 5764 expr.value = error_mark_node;
5762 expr.original_code = ERROR_MARK; 5765 expr.original_code = ERROR_MARK;
5763 break; 5766 break;
5764 } 5767 }
5765 return c_parser_postfix_expression_after_primary (parser, expr); 5768 return c_parser_postfix_expression_after_primary (parser, expr);
5769 }
5770
5771 static void
5772 cbc_make_labeled_goto (location_t loc)
5773 {
5774 tree name;
5775 tree tlab;
5776 tree cond;
5777 tree retval;
5778 //tree fwlabel = create_artificial_label ();
5779
5780 tree cstmt = c_begin_compound_stmt (true);
5781 name = get_identifier("_cbc_exit0");
5782
5783 tlab = define_label (loc, name);
5784 gcc_assert (tlab);
5785 decl_attributes (&tlab, NULL_TREE, 0);
5786 add_stmt (build_stmt (LABEL_EXPR, tlab));
5787 //TREE_USED(decl) = 1;
5788
5789 retval = build_external_ref (get_identifier("retval"), false, loc);
5790 tree ret = c_finish_return (retval);
5791 TREE_USED(ret) = 1;
5792
5793 cond = integer_zero_node;
5794 tree if_body = c_end_compound_stmt (cstmt, true);
5795 TREE_SIDE_EFFECTS (cstmt) = 1;
5796 c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false);
5766 } 5797 }
5767 5798
5768 static tree 5799 static tree
5769 cbc_make_nested_function (location_t loc) 5800 cbc_make_nested_function (location_t loc)
5770 { 5801 {