Mercurial > hg > CbC > CbC_gcc
comparison gcc/c-parser.c @ 90:99e7b6776dd1
implemeted __rectype expression. add CbC-exanples/fact-rectype.s
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 25 Dec 2011 04:04:42 +0900 |
parents | 3356a4c26abc |
children | 0a063106bba9 |
comparison
equal
deleted
inserted
replaced
89:3356a4c26abc | 90:99e7b6776dd1 |
---|---|
652 case RID_ATTRIBUTE: | 652 case RID_ATTRIBUTE: |
653 case RID_FRACT: | 653 case RID_FRACT: |
654 case RID_ACCUM: | 654 case RID_ACCUM: |
655 case RID_SAT: | 655 case RID_SAT: |
656 #ifndef noCbC | 656 #ifndef noCbC |
657 case RID_CbC_CODE: | 657 case RID_CbC_CODE: |
658 case RID_CbC_REC: | |
658 #endif | 659 #endif |
659 return true; | 660 return true; |
660 default: | 661 default: |
661 return false; | 662 return false; |
662 } | 663 } |
2095 t.expr_const_operands = true; | 2096 t.expr_const_operands = true; |
2096 declspecs_add_type (loc, specs, t); | 2097 declspecs_add_type (loc, specs, t); |
2097 c_parser_consume_token (parser); | 2098 c_parser_consume_token (parser); |
2098 break; | 2099 break; |
2099 #ifndef noCbC | 2100 #ifndef noCbC |
2100 case RID_CbC_CODE: | 2101 case RID_CbC_CODE: |
2101 if (!typespec_ok) | 2102 case RID_CbC_REC: |
2102 goto out; | 2103 if (!typespec_ok) |
2103 attrs_ok = true; | 2104 goto out; |
2104 seen_type = true; | 2105 attrs_ok = true; |
2105 if (c_dialect_objc ()) | 2106 seen_type = true; |
2106 parser->objc_need_raw_identifier = true; | 2107 if (c_dialect_objc ()) |
2107 t.kind = ctsk_resword; | 2108 parser->objc_need_raw_identifier = true; |
2108 t.spec = c_parser_peek_token (parser)->value; | 2109 t.kind = ctsk_resword; |
2109 declspecs_add_type (loc, specs, t); | 2110 t.spec = c_parser_peek_token (parser)->value; |
2110 | 2111 declspecs_add_type (loc, specs, t); |
2111 /* | 2112 |
2112 attrs = get_identifier("fastcall"); | 2113 /* |
2113 attrs = build_tree_list(attrs, NULL_TREE); | 2114 attrs = get_identifier("fastcall"); |
2114 declspecs_add_attrs(specs, attrs); | 2115 attrs = build_tree_list(attrs, NULL_TREE); |
2115 */ | 2116 declspecs_add_attrs(specs, attrs); |
2116 if(!TARGET_64BIT) { | 2117 */ |
2117 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); | 2118 if(!TARGET_64BIT) { |
2118 /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/ | 2119 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); |
2119 declspecs_add_attrs(specs, attrs); | 2120 /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/ |
2121 declspecs_add_attrs(specs, attrs); | |
2120 } | 2122 } |
2121 | 2123 |
2122 c_parser_consume_token (parser); | 2124 c_parser_consume_token (parser); |
2123 break; | 2125 break; |
2124 #endif | 2126 #endif |
2125 case RID_ENUM: | 2127 case RID_ENUM: |
2126 if (!typespec_ok) | 2128 if (!typespec_ok) |
2127 goto out; | 2129 goto out; |
2128 attrs_ok = true; | 2130 attrs_ok = true; |
6165 tlab = define_label (loc, label); | 6167 tlab = define_label (loc, label); |
6166 gcc_assert (tlab); | 6168 gcc_assert (tlab); |
6167 decl_attributes (&tlab, NULL_TREE, 0); | 6169 decl_attributes (&tlab, NULL_TREE, 0); |
6168 add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); | 6170 add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); |
6169 | 6171 |
6170 tree ret = c_finish_return (loc, retval, retval); /*tree ret = c_finish_return (retval);*/ | 6172 tree ret = c_finish_return (loc, retval, retval); //tree ret = c_finish_return (retval); |
6171 /* | |
6172 TREE_USED(ret) = 1; | 6173 TREE_USED(ret) = 1; |
6173 tree if_body = c_end_compound_stmt (loc, cstmt, true); | 6174 tree if_body = c_end_compound_stmt (loc, cstmt, true); |
6174 TREE_SIDE_EFFECTS (cstmt) = 1; | 6175 TREE_SIDE_EFFECTS (cstmt) = 1; |
6175 c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false); | 6176 c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false); |
6177 | |
6176 */ | 6178 */ |
6177 | 6179 |
6178 cond = integer_zero_node; | 6180 cond = integer_zero_node; |
6179 tree block_outside = c_begin_compound_stmt (false); | 6181 tree block_outside = c_begin_compound_stmt (false); |
6180 tree block_inside = c_begin_compound_stmt (false); | 6182 tree block_inside = c_begin_compound_stmt (false); |
6773 /* declare retval. (int retval;) */ | 6775 /* declare retval. (int retval;) */ |
6774 tree decl_cond = | 6776 tree decl_cond = |
6775 build_decl (location, VAR_DECL, get_identifier ("retval"), | 6777 build_decl (location, VAR_DECL, get_identifier ("retval"), |
6776 TREE_TYPE (TREE_TYPE (current_function_decl))); | 6778 TREE_TYPE (TREE_TYPE (current_function_decl))); |
6777 TREE_STATIC (decl_cond) = 1; | 6779 TREE_STATIC (decl_cond) = 1; |
6778 | 6780 TREE_USED (decl_cond) = 1; |
6779 /* use thread-local */ | 6781 |
6780 //DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond); | 6782 /* Use thread-local */ |
6781 // DECL_TLS_MODEL (decl_cond) = TLS_MODEL_REAL; | 6783 DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond); |
6782 | 6784 DECL_NONLOCAL (decl_cond) = 1; |
6783 /* Linux: TLS_MODEL_LOCAL_EXEC OS X: TlS_MODE_REAL */ | 6785 // DECL_READ_P (decl_cond) = 1; |
6784 DECL_TLS_MODEL (decl_cond) = TLS_MODEL_LOCAL_EXEC; | |
6785 //DECL_ARTIFICIAL (decl_cond) = 1; | 6786 //DECL_ARTIFICIAL (decl_cond) = 1; |
6786 // pushdecl (decl_cond); | 6787 // pushdecl (decl_cond); |
6787 add_stmt (build_stmt(location, DECL_EXPR, pushdecl (decl_cond))); | 6788 add_stmt (build_stmt(location, DECL_EXPR, pushdecl (decl_cond))); |
6788 | 6789 |
6789 /* define nested function. */ | 6790 /* define nested function. */ |
6790 decl = | 6791 decl = |
6791 cbc_finish_nested_function (location, label, decl_cond); | 6792 cbc_finish_nested_function (location, label, decl_cond); |
6793 TREE_USED(decl) = 1; | |
6792 | 6794 |
6793 /* define if-ed goto label and return statement. */ | 6795 /* define if-ed goto label and return statement. */ |
6794 cbc_finish_labeled_goto (location, label, decl_cond); | 6796 cbc_finish_labeled_goto (location, label, decl_cond); |
6795 | 6797 |
6796 /* get pointer to nested function. */ | 6798 /* get pointer to nested function. */ |