Mercurial > hg > CbC > CbC_gcc
comparison gcc/c-parser.c @ 87:4a89a0a804df
modify c-parser.c:RID_CbC_RET
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 20 Dec 2011 18:51:07 +0900 |
parents | dbfc0d2dde36 |
children | f214c1d5b862 |
comparison
equal
deleted
inserted
replaced
81:dbfc0d2dde36 | 87:4a89a0a804df |
---|---|
2111 /* | 2111 /* |
2112 attrs = get_identifier("fastcall"); | 2112 attrs = get_identifier("fastcall"); |
2113 attrs = build_tree_list(attrs, NULL_TREE); | 2113 attrs = build_tree_list(attrs, NULL_TREE); |
2114 declspecs_add_attrs(specs, attrs); | 2114 declspecs_add_attrs(specs, attrs); |
2115 */ | 2115 */ |
2116 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); | 2116 if(!TARGET_64BIT) { |
2117 /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/ | 2117 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); |
2118 declspecs_add_attrs(specs, attrs); | 2118 /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/ |
2119 declspecs_add_attrs(specs, attrs); | |
2120 } | |
2119 | 2121 |
2120 c_parser_consume_token (parser); | 2122 c_parser_consume_token (parser); |
2121 break; | 2123 break; |
2122 #endif | 2124 #endif |
2123 case RID_ENUM: | 2125 case RID_ENUM: |
6156 * } | 6158 * } |
6157 */ | 6159 */ |
6158 tree tlab; | 6160 tree tlab; |
6159 tree cond; | 6161 tree cond; |
6160 | 6162 |
6163 /* | |
6161 tree cstmt = c_begin_compound_stmt (true); | 6164 tree cstmt = c_begin_compound_stmt (true); |
6162 | |
6163 tlab = define_label (loc, label); | 6165 tlab = define_label (loc, label); |
6164 gcc_assert (tlab); | 6166 gcc_assert (tlab); |
6165 decl_attributes (&tlab, NULL_TREE, 0); | 6167 decl_attributes (&tlab, NULL_TREE, 0); |
6166 add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); | 6168 add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); |
6167 | 6169 |
6168 tree ret = c_finish_return (loc, retval, retval); /*tree ret = c_finish_return (retval);*/ | 6170 tree ret = c_finish_return (loc, retval, retval); //tree ret = c_finish_return (retval); |
6169 TREE_USED(ret) = 1; | 6171 TREE_USED(ret) = 1; |
6170 | 6172 |
6171 cond = integer_zero_node; | 6173 |
6172 tree if_body = c_end_compound_stmt (loc, cstmt, true); | 6174 tree if_body = c_end_compound_stmt (loc, cstmt, true); |
6173 TREE_SIDE_EFFECTS (cstmt) = 1; | 6175 TREE_SIDE_EFFECTS (cstmt) = 1; |
6174 c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false); | 6176 c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false); |
6177 */ | |
6178 | |
6179 cond = integer_zero_node; | |
6180 tree block_outside = c_begin_compound_stmt (false); | |
6181 tree block_inside = c_begin_compound_stmt (false); | |
6182 | |
6183 tree stmt = c_begin_compound_stmt (true); | |
6184 tlab = define_label (loc, label); | |
6185 gcc_assert (tlab); | |
6186 decl_attributes (&tlab, NULL_TREE, 0); | |
6187 TREE_USED (tlab) = 1; | |
6188 /* add_stmt (LABEL_EXPR) */ | |
6189 add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); | |
6190 | |
6191 /* add_stmt (RETURN_EXPR) */ | |
6192 tree ret = c_finish_return (loc, retval, retval); | |
6193 // TREE_USED(ret) = 1; | |
6194 tree stmt_body = c_end_compound_stmt (loc, stmt, true); | |
6195 | |
6196 /* add_stmt (STATEMENT_LIST) : STATEMENT_LIST -> LABEL_EXPR -> RETURN_EXPR */ | |
6197 add_stmt (stmt_body); | |
6198 | |
6199 tree body = c_end_compound_stmt (loc, block_inside, false); | |
6200 | |
6201 /* add_stmt (COND_EXPR) */ | |
6202 c_finish_if_stmt (loc, cond, body, NULL_TREE, false); | |
6203 | |
6204 /* add_stmt (BIND_EXPR) : BIND_EXPR -> COND_EXPR -> STATEMENT_LIST */ | |
6205 tree bind = c_end_compound_stmt (loc, block_outside, false); | |
6206 TREE_SIDE_EFFECTS (bind) = 1; | |
6207 add_stmt (bind); | |
6208 | |
6209 TREE_USED (retval) = 1; | |
6210 | |
6175 } | 6211 } |
6176 | 6212 |
6177 static tree | 6213 static tree |
6178 cbc_finish_nested_function (location_t loc, tree label, tree retval_decl) | 6214 cbc_finish_nested_function (location_t loc, tree label, tree retval_decl) |
6179 { | 6215 { |
6737 | 6773 |
6738 /* declare retval. (int retval;) */ | 6774 /* declare retval. (int retval;) */ |
6739 tree decl_cond = | 6775 tree decl_cond = |
6740 build_decl (location, VAR_DECL, get_identifier ("retval"), | 6776 build_decl (location, VAR_DECL, get_identifier ("retval"), |
6741 TREE_TYPE (TREE_TYPE (current_function_decl))); | 6777 TREE_TYPE (TREE_TYPE (current_function_decl))); |
6742 TREE_STATIC (decl_cond) = 1; | 6778 TREE_STATIC (decl_cond) = 1; |
6743 DECL_ARTIFICIAL (decl_cond) = 1; | 6779 |
6744 pushdecl (decl_cond); | 6780 /* use thread-local */ |
6781 //DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond); | |
6782 // DECL_TLS_MODEL (decl_cond) = TLS_MODEL_REAL; | |
6783 | |
6784 /* Linux: TLS_MODEL_LOCAL_EXEC OS X: TlS_MODE_REAL */ | |
6785 DECL_TLS_MODEL (decl_cond) = TLS_MODEL_LOCAL_EXEC; | |
6786 //DECL_ARTIFICIAL (decl_cond) = 1; | |
6787 // pushdecl (decl_cond); | |
6788 add_stmt (build_stmt(location, DECL_EXPR, pushdecl (decl_cond))); | |
6745 | 6789 |
6746 /* define nested function. */ | 6790 /* define nested function. */ |
6747 decl = | 6791 decl = |
6748 cbc_finish_nested_function (location, label, decl_cond); | 6792 cbc_finish_nested_function (location, label, decl_cond); |
6749 | 6793 |
6750 /* define if-ed goto label and return statement. */ | 6794 /* define if-ed goto label and return statement. */ |
6751 cbc_finish_labeled_goto (location, label, decl_cond); | 6795 cbc_finish_labeled_goto (location, label, decl_cond); |
6752 | 6796 |
6753 /* get pointer to nested function. */ | 6797 /* get pointer to nested function. */ |
6754 value = build_addr (decl , current_function_decl); | 6798 value = build_addr (decl , current_function_decl); |
6799 TREE_USED (current_function_decl) = 1; | |
6755 SET_EXPR_LOCATION (value, location); | 6800 SET_EXPR_LOCATION (value, location); |
6756 add_stmt (value); | 6801 add_stmt (value); |
6757 | 6802 |
6758 TREE_SIDE_EFFECTS (stmt) = 1; | 6803 TREE_SIDE_EFFECTS (stmt) = 1; |
6759 expr.value = c_finish_stmt_expr (location, stmt); | 6804 expr.value = c_finish_stmt_expr (location, stmt); |