changeset 113:bdf41c9fa0b7

remove RECTYPE
author mir3636
date Fri, 17 Nov 2017 06:33:55 +0900
parents ab0bcb71f44d
children e234ee7b7292
files gcc/c-family/c-common.c gcc/c-family/c-common.h gcc/c-family/c-pretty-print.c gcc/c/c-decl.c gcc/c/c-parser.c gcc/c/c-tree.h gcc/c/c-typeck.c gcc/c/cbc-tree.h gcc/tree.h
diffstat 9 files changed, 1 insertions(+), 202 deletions(-) [+]
line wrap: on
line diff
--- a/gcc/c-family/c-common.c	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c-family/c-common.c	Fri Nov 17 06:33:55 2017 +0900
@@ -367,21 +367,15 @@
   { "__asm__",		RID_ASM,	0 },
   { "__attribute",	RID_ATTRIBUTE,	0 },
   { "__attribute__",	RID_ATTRIBUTE,	0 },
-<<<<<<< local
   { "__auto_type",	RID_AUTO_TYPE,	D_CONLY },
   { "__bases",          RID_BASES, D_CXXONLY },
   { "__builtin_addressof", RID_ADDRESSOF, D_CXXONLY },
   { "__builtin_call_with_static_chain",
     RID_BUILTIN_CALL_WITH_STATIC_CHAIN, D_CONLY },
-=======
 #ifndef noCbC
   /* CbC project */
   { "__code",         RID_CbC_CODE,   0 },
-  //  { "code",         RID_CbC_CODE,   0 },
-  { "__rectype",       RID_CbC_REC,    0},
-  { "selftype",       RID_CbC_SELFTYPE,    0},
 #endif
->>>>>>> other
   { "__builtin_choose_expr", RID_CHOOSE_EXPR, D_CONLY },
   { "__builtin_complex", RID_BUILTIN_COMPLEX, D_CONLY },
   { "__builtin_launder", RID_BUILTIN_LAUNDER, D_CXXONLY },
--- a/gcc/c-family/c-common.h	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c-family/c-common.h	Fri Nov 17 06:33:55 2017 +0900
@@ -202,8 +202,6 @@
 #ifndef noCbC
   /* Continuation based C */
   RID_CbC_CODE, RID_CbC_ENV, RID_CbC_RET,
-  /* extention of construction : __rectype, selftype  */
-  RID_CbC_REC,RID_CbC_SELFTYPE,
 #endif
   /* Named address support, mapping the keyword to a particular named address
      number.  Named address space 0 is reserved for the generic address.  If
--- a/gcc/c-family/c-pretty-print.c	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c-family/c-pretty-print.c	Fri Nov 17 06:33:55 2017 +0900
@@ -28,17 +28,9 @@
 #include "attribs.h"
 #include "intl.h"
 #include "tree-pretty-print.h"
-<<<<<<< local
-=======
-#include "tree-iterator.h"
-#include "diagnostic.h"
 #ifndef noCbC
 #include "cbc-tree.h"
 #endif
-/* Translate if being used for diagnostics, but not for dump files or
-   __PRETTY_FUNCTION.  */
-#define M_(msgid) (pp_translate_identifiers (pp) ? _(msgid) : (msgid))
->>>>>>> other
 
 /* The pretty-printer code is primarily designed to closely follow
    (GNU) C and C++ grammars.  That is to be contrasted with spaghetti
@@ -552,15 +544,7 @@
     {
       if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
 	  || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
-<<<<<<< local
 	pp_c_right_paren (this);
-=======
-	pp_c_right_paren (pp);
-#ifndef noCbC
-      if(IS_RECTYPE(t)) 
-	return;
-#endif
->>>>>>> other
       t = TREE_TYPE (t);
     }
 
--- a/gcc/c/c-decl.c	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c/c-decl.c	Fri Nov 17 06:33:55 2017 +0900
@@ -5872,15 +5872,6 @@
 	}
     }
 
-#ifndef noCbC
-  if ( declspecs->typespec_word == cts_CbC_rec )
-    {
-      //      IS_RECTYPE(type) = 1;
-      //      type = build_code_segment_type (type, NULL_TREE);
-      IS_RECTYPE(type) = 1;
-    }
-#endif
-
   /* Now figure out the structure of the declarator proper.
      Descend through it, creating more complex types, until we reach
      the declared identifier (or NULL_TREE, in an absolute declarator).
@@ -6478,12 +6469,6 @@
 
 	    type = c_build_pointer_type (type);
 
-#ifndef noCbC
-            if ( declspecs->typespec_word == cts_CbC_rec ){
-              IS_RECTYPE(type) = 1;
-            }
-#endif
-
 	    /* Process type qualifiers (such as const or volatile)
 	       that were given inside the `*'.  */
 	    type_quals = declarator->u.pointer_quals;
@@ -8619,15 +8604,8 @@
 static void cbc_set_codesegment(tree fndecl){
   tree args;
   tree *nextp;
-//  tree itype;
-//  tree icst;
-//  tree padding_array;
-//  tree list;
   int padding_size = CbC_STACK_SIZE;
 
-  //CbC_IS_CODE_SEGMENT(TREE_TYPE(fndecl)) = 1;
-  //CbC_IS_CODE_SEGMENT(fndecl) = 1;
-
   nextp = & TYPE_ARG_TYPES (TREE_TYPE (fndecl));
   for (args = TYPE_ARG_TYPES (TREE_TYPE (fndecl)); args;
       args = TREE_CHAIN (args))
@@ -8715,28 +8693,6 @@
   if ( declspecs->typespec_word == cts_CbC_code )
   {
           cbc_set_codesegment(decl1);
-          //CbC_IS_CODE_SEGMENT(TREE_TYPE(decl1)) = 1;
-
-
-      /* implementation of rectype */
-      tree func_tree = TREE_TYPE(decl1);
-      // parm is PARM_DECL
-      tree parm = declarator->u.arg_info->parms;
-      while (parm) {
-                  tree tmptype = parm;
-                  if (!IS_RECTYPE(TREE_TYPE(tmptype))) {
-                          parm = TREE_CHAIN(parm);
-                          continue;
-                  }
-                  tree t = TREE_TYPE(tmptype);
-                  while (TREE_CODE(t) == POINTER_TYPE) {
-                          tmptype = t;
-                          t= TREE_TYPE(tmptype);
-                  }
-                  TREE_TYPE(tmptype) = func_tree;
-                  parm = TREE_CHAIN(parm);
-      }
-
   }
 
 #endif
@@ -10087,10 +10043,6 @@
         error_at (loc,
               ("both %<long%> and %<void%> in "
                "declaration specifiers"));
-          else if (specs->typespec_word == cts_CbC_rec)
-        error_at (loc,
-              ("both %<long%> and %<void%> in "
-               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_int_n)
 		  error_at (loc,
@@ -10154,10 +10106,6 @@
         error_at (loc,
               ("both %<short%> and %<void%> in "
                "declaration specifiers"));
-          else if (specs->typespec_word == cts_CbC_rec)
-        error_at (loc,
-              ("both %<short%> and %<void%> in "
-               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_int_n)
 		error_at (loc,
@@ -10225,10 +10173,6 @@
         error_at (loc,
               ("both %<signed%> and %<void%> in "
                "declaration specifiers"));
-          else if (specs->typespec_word == cts_CbC_rec)
-        error_at (loc,
-              ("both %<signed%> and %<void%> in "
-               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_bool)
 		error_at (loc,
@@ -10287,10 +10231,6 @@
         error_at (loc,
               ("both %<unsigned%> and %<void%> in "
                "declaration specifiers"));
-          else if (specs->typespec_word == cts_CbC_rec)
-        error_at (loc,
-              ("both %<unsigned%> and %<void%> in "
-               "declaration specifiers"));
 #endif
 	      else if (specs->typespec_word == cts_bool)
 		error_at (loc,
@@ -10348,10 +10288,6 @@
         error_at (loc,
               ("both %<complex%> and %<void%> in "
                "declaration specifiers"));
-          else if (specs->typespec_word == cts_CbC_rec)
-        error_at (loc,
-              ("both %<complex%> and %<void%> in "
-               "declaration specifiers"));
 #endif
 
 	      else if (specs->typespec_word == cts_bool)
@@ -10605,30 +10541,6 @@
           else
             specs->typespec_word = cts_CbC_code;
           return specs;
-        case RID_CbC_REC:
-          if (specs->long_p)
-            error_at (loc,
-                      ("both %<long%> and %<_Bool%> in "
-                       "declaration specifiers"));
-          else if (specs->short_p)
-            error_at (loc,
-                      ("both %<short%> and %<_Bool%> in "
-                       "declaration specifiers"));
-          else if (specs->signed_p)
-            error_at (loc,
-                      ("both %<signed%> and %<_Bool%> in "
-                       "declaration specifiers"));
-          else if (specs->unsigned_p)
-            error_at (loc,
-                      ("both %<unsigned%> and %<_Bool%> in "
-                       "declaration specifiers"));
-          else if (specs->complex_p)
-            error_at (loc,
-                      ("both %<complex%> and %<_Bool%> in "
-                       "declaration specifiers"));
-          else
-            specs->typespec_word = cts_CbC_rec;
-          return specs;
 #endif
 	    case RID_BOOL:
 	      if (!in_system_header_at (loc))
@@ -11204,7 +11116,6 @@
     case cts_void:
 #ifndef noCbC
     case cts_CbC_code:
-    case cts_CbC_rec:
 #endif
       gcc_assert (!specs->long_p && !specs->short_p
 		  && !specs->signed_p && !specs->unsigned_p
--- a/gcc/c/c-parser.c	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c/c-parser.c	Fri Nov 17 06:33:55 2017 +0900
@@ -512,7 +512,6 @@
     case RID_AUTO_TYPE:
 #ifndef noCbC
         case RID_CbC_CODE:
-        case RID_CbC_REC:
 #endif
       return true;
     default:
@@ -2106,41 +2105,6 @@
 		     its initializer is parsed.  */
 		  d = start_decl (declarator, specs, true,
 				  chainon (postfix_attrs, all_prefix_attrs));
-#ifndef noCbC
-              if (specs->typespec_word == cts_CbC_code) {
-                /* 
-                 * func_tree is TYPE_DECL or FUNCTION_DECL.
-                 * tmp is POINTER_TYPE or FUNCTION_TYPE.
-                 */
-                tree func_tree = TREE_TYPE(d);
-                // parm is PARM_DECL
-                tree parm = declarator->u.arg_info->parms;
-                while (parm) {
-                  tree tmptype = parm;
-                  if (!IS_RECTYPE(TREE_TYPE(tmptype))) {
-                    parm = TREE_CHAIN(parm);
-                    continue;
-                  }
-                  tree t = TREE_TYPE(tmptype);
-                  while (TREE_CODE(t) == POINTER_TYPE) {
-                    tmptype = t;
-                    t = TREE_TYPE(tmptype);
-                  }
-                  TREE_TYPE(tmptype) = func_tree;
-                  parm = TREE_CHAIN(parm);
-                }
-              }
-              if (specs->typespec_word == cts_CbC_rec) {
-                tree t = TREE_TYPE(d);
-                tree tmptype = t;
-                while (TREE_CODE(t) == POINTER_TYPE) {
-                  tmptype = t;
-                  t = TREE_TYPE(tmptype);
-                }
-                TREE_TYPE(tmptype) = TREE_TYPE(current_function_decl);
-              }
-
-#endif
 		  if (!d)
 		    d = error_mark_node;
 		  if (omp_declare_simd_clauses.exists ()
@@ -2795,7 +2759,6 @@
 	  break;
 #ifndef noCbC
         case RID_CbC_CODE:
-        case RID_CbC_REC:
           if (!typespec_ok)
             goto out;
           attrs_ok = true;
@@ -2806,38 +2769,13 @@
           t.spec = c_parser_peek_token (parser)->value;
           declspecs_add_type (loc, specs, t);
 
-          IS_RECTYPE(t.spec) = 1;
-          /*
-            attrs = get_identifier("fastcall");
-            attrs = build_tree_list(attrs, NULL_TREE);
-            declspecs_add_attrs(specs, attrs);
-          */
           if(!TARGET_64BIT) {
             attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE);
-            /*attrs = build_tree_list (get_identifier("noreturn"), attrs);*/
             declspecs_add_attrs(specs, attrs);
       }
 
           c_parser_consume_token (parser);
           break;
-        case RID_CbC_SELFTYPE:
-          if (!typespec_ok)
-            goto out;
-          attrs_ok = true;
-          seen_type = true;
-          enum tree_code code = RECORD_TYPE;
-          location_t loc = c_parser_peek_token (parser)->location;
-
-          c_parser_set_source_position_from_token (c_parser_peek_token (parser));
-          tree value;
-          struct c_typespec ret;
-          value = make_node (IDENTIFIER_NODE);
-          ret = parser_xref_tag (loc, code, value);
-
-          IS_SELFTYPE (ret.spec) = 1;
-          declspecs_add_type (loc, specs, ret);
-          c_parser_consume_token (parser);
-          break;
 #endif
 	case RID_ENUM:
 	  if (!typespec_ok)
@@ -3277,19 +3215,6 @@
 	  /* Parse some comma-separated declarations, but not the
 	     trailing semicolon if any.  */
 	  decls = c_parser_struct_declaration (parser);
-#ifndef noCbC
-          /*  If tree type of tmptype is selftype, tmptype modify to RECORD_TYPE of struct [CPP_NAME]. */
-          if(TREE_CODE(decls) == FIELD_DECL && TREE_CODE(type) == RECORD_TYPE) {
-            tree tmptype = decls;
-            while(TREE_CODE (TREE_TYPE (tmptype)) == POINTER_TYPE)
-              tmptype = TREE_TYPE(tmptype);
-            if(IS_SELFTYPE ( TREE_TYPE (tmptype))) TREE_TYPE(tmptype) = type;
-            //      if(IS_RECTYPE ( TREE_TYPE (tmptype))) 
-            if(IS_RECTYPE (tmptype))
-              TREE_TYPE(tmptype) = type;
-          }
-
-#endif
 	  contents = chainon (decls, contents);
 	  /* If no semicolon follows, either we have a parse error or
 	     are at the end of the struct or union and should
--- a/gcc/c/c-tree.h	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c/c-tree.h	Fri Nov 17 06:33:55 2017 +0900
@@ -240,7 +240,6 @@
   cts_double,
 #ifndef noCbC
   cts_CbC_code,
-  cts_CbC_rec,
 #endif
   cts_dfloat32,
   cts_dfloat64,
--- a/gcc/c/c-typeck.c	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c/c-typeck.c	Fri Nov 17 06:33:55 2017 +0900
@@ -3583,7 +3583,7 @@
     }
 
   gcc_assert (parmnum == vec_safe_length (values));
-fndef noCbC
+#ifndef noCbC
   if (typetail != 0 && TREE_VALUE (typetail) != void_type_node
       //&& !CbC_IS_CODE_SEGMENT(TREE_TYPE(fundecl)) )
       && !(fundecl&&CbC_IS_CODE_SEGMENT(fundecl)) )
--- a/gcc/c/cbc-tree.h	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/c/cbc-tree.h	Fri Nov 17 06:33:55 2017 +0900
@@ -12,12 +12,3 @@
 extern tree cbc_return_f;
 extern tree cbc_env;
 extern location_t cbc_return;
-
-/* flag of rectype and selftype is lang_flag_3. */
-#define IS_RECTYPE(NODE) ((NODE)->type.lang_flag_3)
-#define IS_SELFTYPE(NODE) ((NODE)->type.lang_flag_3)
-
-//#define CbC_TYPE_LANG_FLAG_3(NODE) (RECORD_OR_POINTER_CHECK (NODE)->type.lang_flag_3)
-//#define RECORD_OR_POINTER_CHECK(NODE) TYPE_CHECK2 (T, POINTER_TYPE, RECORD_TYPE)
-
-//#define TYPE_LANG_FLAG_3(NODE) (TYPE_CHECK (NODE)->type.lang_flag_3)
--- a/gcc/tree.h	Fri Nov 10 19:46:38 2017 +0900
+++ b/gcc/tree.h	Fri Nov 17 06:33:55 2017 +0900
@@ -4105,14 +4105,11 @@
 extern bool vec_member (const_tree, vec<tree, va_gc> *);
 extern tree chain_index (int, tree);
 
-<<<<<<< local
-=======
 #ifndef noCbC
 extern tree build_code_segment_type (tree, tree);
 #endif
 extern int attribute_list_equal (const_tree, const_tree);
 extern int attribute_list_contained (const_tree, const_tree);
->>>>>>> other
 extern int tree_int_cst_equal (const_tree, const_tree);
 
 extern bool tree_fits_shwi_p (const_tree)