This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

treelang patch part 6 of 6


+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ tree
+ add_stmt (tree t ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ tree
+ build_return_stmt (tree expr ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* C warning, ignore.  */
+
+ void
+ pedwarn_c99 VPARAMS ((const char *msgid ATTRIBUTE_UNUSED, ...))
+ {
+   return;
+ }
+
+ /* Should not be called for treelang.   */
+
+ tree
+ build_case_label (tree low_value ATTRIBUTE_UNUSED,
+                   tree high_value ATTRIBUTE_UNUSED,
+                   tree label_decl ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ emit_local_var (tree decl ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ expand_stmt (tree t ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ cpp_reader *
+ cpp_create_reader (enum c_lang lang ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ cpp_post_options (cpp_reader *pfile ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ cpp_preprocess_file (cpp_reader *pfile ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ const char *
+ init_c_lex (const char *filename ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void init_pragma (void);
+
+ void
+ init_pragma ()
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ cpp_finish (cpp_reader *pfile ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ unsigned int
+ cpp_errors (cpp_reader *pfile ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ tree
+ handle_format_attribute (tree *node ATTRIBUTE_UNUSED,
+                          tree name ATTRIBUTE_UNUSED,
+                          tree args ATTRIBUTE_UNUSED,
+                          int flags ATTRIBUTE_UNUSED,
+                          bool *no_add_attrs ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ tree
+ handle_format_arg_attribute (tree *node ATTRIBUTE_UNUSED,
+      tree name ATTRIBUTE_UNUSED,
+      tree args ATTRIBUTE_UNUSED,
+      int flags ATTRIBUTE_UNUSED,
+      bool *no_add_attrs ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ int
+ cpp_handle_option (cpp_reader *pfile ATTRIBUTE_UNUSED,
+      int argc ATTRIBUTE_UNUSED,
+      char **argv ATTRIBUTE_UNUSED,
+      int ignore ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ set_Wformat (int setting ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ maybe_objc_check_decl (tree decl ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ gen_aux_info_record (tree fndecl ATTRIBUTE_UNUSED,
+                      int is_definition ATTRIBUTE_UNUSED,
+                      int is_implicit ATTRIBUTE_UNUSED,
+                      int is_prototyped ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang, but it is.   */
+
+ void
+ c_parse_init ()
+ {
+   return;
+ }
+
+ /* Should not be called for treelang.   */
+
+ void maybe_apply_pragma_weak (tree decl);
+
+ void
+ maybe_apply_pragma_weak (tree decl ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ add_decl_stmt (tree decl ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ tree
+ maybe_apply_renaming_pragma (tree decl, tree asmname);
+
+ /* Should not be called for treelang.   */
+
+ tree
+ maybe_apply_renaming_pragma (tree decl ATTRIBUTE_UNUSED, tree asmname
ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ begin_stmt_tree (tree *t ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ void
+ finish_stmt_tree (tree *t ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+ /* Should not be called for treelang.   */
+
+ int
+ defer_fn (tree fn ATTRIBUTE_UNUSED)
+ {
+   abort ();
+ }
+
+
+ /* Create the predefined scalar types of C,
+    and some nodes representing standard constants (0, 1, (void *) 0).
+    Initialize the global binding level.
+    Make definitions for built-in primitive functions.  */
+
+   /* `unsigned long' is the standard type for sizeof.
+      Note that stddef.h uses `unsigned long',
+      and this must agree, even if long and int are the same size.  */
+
+ /* This variable keeps a table for types for each precision so that we

+    only allocate each of them once.  Signed and unsigned types are
+    kept separate.  */
+
+ tree integer_types[itk_none] = { NULL_TREE};
+
+ /* The reserved keyword table.  */
+ struct resword
+ {
+   const char *word;
+   ENUM_BITFIELD(rid) rid : 16;
+   unsigned int disable   : 16;
+ };
+
+ static const struct resword reswords[] =
+ {
+   { "_Bool",          RID_BOOL,       0 },
+   { "_Complex",               RID_COMPLEX,    0 },
+   { "__FUNCTION__",   RID_FUNCTION_NAME, 0 },
+   { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
+   { "__alignof",      RID_ALIGNOF,    0 },
+   { "__alignof__",    RID_ALIGNOF,    0 },
+   { "__asm",          RID_ASM,        0 },
+   { "__asm__",                RID_ASM,        0 },
+   { "__attribute",    RID_ATTRIBUTE,  0 },
+   { "__attribute__",  RID_ATTRIBUTE,  0 },
+   { "__bounded",      RID_BOUNDED,    0 },
+   { "__bounded__",    RID_BOUNDED,    0 },
+   { "__builtin_choose_expr", RID_CHOOSE_EXPR, 0 },
+   { "__builtin_types_compatible_p", RID_TYPES_COMPATIBLE_P, 0 },
+   { "__builtin_va_arg",       RID_VA_ARG,     0 },
+   { "__complex",      RID_COMPLEX,    0 },
+   { "__complex__",    RID_COMPLEX,    0 },
+   { "__const",                RID_CONST,      0 },
+   { "__const__",      RID_CONST,      0 },
+   { "__extension__",  RID_EXTENSION,  0 },
+   { "__func__",               RID_C99_FUNCTION_NAME, 0 },
+   { "__imag",         RID_IMAGPART,   0 },
+   { "__imag__",               RID_IMAGPART,   0 },
+   { "__inline",               RID_INLINE,     0 },
+   { "__inline__",     RID_INLINE,     0 },
+   { "__label__",      RID_LABEL,      0 },
+   { "__ptrbase",      RID_PTRBASE,    0 },
+   { "__ptrbase__",    RID_PTRBASE,    0 },
+   { "__ptrextent",    RID_PTREXTENT,  0 },
+   { "__ptrextent__",  RID_PTREXTENT,  0 },
+   { "__ptrvalue",     RID_PTRVALUE,   0 },
+   { "__ptrvalue__",   RID_PTRVALUE,   0 },
+   { "__real",         RID_REALPART,   0 },
+   { "__real__",               RID_REALPART,   0 },
+   { "__restrict",     RID_RESTRICT,   0 },
+   { "__restrict__",   RID_RESTRICT,   0 },
+   { "__signed",               RID_SIGNED,     0 },
+   { "__signed__",     RID_SIGNED,     0 },
+   { "__typeof",               RID_TYPEOF,     0 },
+   { "__typeof__",     RID_TYPEOF,     0 },
+   { "__unbounded",    RID_UNBOUNDED,  0 },
+   { "__unbounded__",  RID_UNBOUNDED,  0 },
+   { "__volatile",     RID_VOLATILE,   0 },
+   { "__volatile__",   RID_VOLATILE,   0 },
+   { "asm",            RID_ASM,        0 },
+   { "auto",           RID_AUTO,       0 },
+   { "break",          RID_BREAK,      0 },
+   { "case",           RID_CASE,       0 },
+   { "char",           RID_CHAR,       0 },
+   { "const",          RID_CONST,      0 },
+   { "continue",               RID_CONTINUE,   0 },
+   { "default",                RID_DEFAULT,    0 },
+   { "do",             RID_DO,         0 },
+   { "double",         RID_DOUBLE,     0 },
+   { "else",           RID_ELSE,       0 },
+   { "enum",           RID_ENUM,       0 },
+   { "extern",         RID_EXTERN,     0 },
+   { "float",          RID_FLOAT,      0 },
+   { "for",            RID_FOR,        0 },
+   { "goto",           RID_GOTO,       0 },
+   { "if",             RID_IF,         0 },
+   { "inline",         RID_INLINE,     0 },
+   { "int",            RID_INT,        0 },
+   { "long",           RID_LONG,       0 },
+   { "register",               RID_REGISTER,   0 },
+   { "restrict",               RID_RESTRICT,   0 },
+   { "return",         RID_RETURN,     0 },
+   { "short",          RID_SHORT,      0 },
+   { "signed",         RID_SIGNED,     0 },
+   { "sizeof",         RID_SIZEOF,     0 },
+   { "static",         RID_STATIC,     0 },
+   { "struct",         RID_STRUCT,     0 },
+   { "switch",         RID_SWITCH,     0 },
+   { "typedef",                RID_TYPEDEF,    0 },
+   { "typeof",         RID_TYPEOF,     0 },
+   { "union",          RID_UNION,      0 },
+   { "unsigned",               RID_UNSIGNED,   0 },
+   { "void",           RID_VOID,       0 },
+   { "volatile",               RID_VOLATILE,   0 },
+   { "while",          RID_WHILE,      0 },
+ };
+ #define N_reswords (sizeof reswords / sizeof (struct resword))
+
+ /* Init enough to allow the C decl code to work, then clean up
+    afterwards.  */
+
+ void
+ treelang_init_decl_processing ()
+ {
+   unsigned int i;
+   tree id;
+
+   /* It is not necessary to register ridpointers as a GC root, because

+      all the trees it points to are permanently interned in the
+      get_identifier hash anyway.  */
+   ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
+
+   for (i = 0; i < N_reswords; i++)
+     {
+       id = get_identifier (reswords[i].word);
+       C_RID_CODE (id) = reswords[i].rid;
+       C_IS_RESERVED_WORD (id) = 1;
+       ridpointers [(int) reswords[i].rid] = id;
+     }
+
+   c_init_decl_processing ();
+
+   /* ix86_return_pops_args takes the type of these so need to patch
+      their own type as themselves.  */
+
+   for (i = 0; i < itk_none; i++)
+     {
+       if (integer_types[i])
+         TREE_TYPE (integer_types [i]) = integer_types[i];
+     }
+
+   /* Probably these ones too.  */
+   TREE_TYPE (float_type_node) = float_type_node;
+   TREE_TYPE (double_type_node) = double_type_node;
+   TREE_TYPE (long_double_type_node) = long_double_type_node;
+
+ }
+
+ /* Save typing debug_tree all the time. Dump a tree T pretty and
+    concise.  */
+
+ void dt (tree t);
+
+ void
+ dt (tree t)
+ {
+   debug_tree (t);
+ }
diff -c -r -p -N -X treelang.diff.excl cvs/gcc/gcc/treelang/treetree.h
cvscopy/gcc/gcc/treelang/treetree.h
*** cvs/gcc/gcc/treelang/treetree.h     Thu Jan  1 10:00:00 1970
--- cvscopy/gcc/gcc/treelang/treetree.h Sat May  4 15:47:28 2002
***************
*** 0 ****
--- 1,101 ----
+ /*
+
+     TREELANG Compiler definitions for interfacing to treetree.c
+     (compiler back end interface).
+
+     Copyright (C) 1986, 87, 89, 92-96, 1997, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
+
+     This program is free software; you can redistribute it and/or
modify it
+     under the terms of the GNU General Public License as published by
the
+     Free Software Foundation; either version 2, or (at your option)
any
+     later version.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with this program; if not, write to the Free Software
+     Foundation, 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+
+     In other words, you are welcome to use, share and improve this
program.
+     You are forbidden to forbid anyone else to use, share and improve
+     what you give them.   Help stamp out software-hoarding!
+
+
---------------------------------------------------------------------------

+
+     Written by Tim Josling 1999, 2000, 2001, based in part on other
+     parts of the GCC compiler.
+
+  */
+
+ /* Parameter list passed to back end.  */
+ struct tree_parameter_list
+ {
+   struct tree_parameter_list* next; /* Next entry.  */
+   int   type; /* See numeric types below.  */
+   unsigned char* variable_name; /* Name. */
+   tree* where_to_put_var_tree; /* Where to save decl.  */
+ };
+
+ tree tree_code_init_parameters (void);
+ tree tree_code_add_parameter (tree list, tree proto_exp, tree exp);
+ tree tree_code_get_integer_value (unsigned char *chars, unsigned int
length);
+ void tree_code_generate_return (tree type, tree exp);
+ void tree_ggc_storage_always_used  (void *m);
+ tree tree_code_get_expression (unsigned int exp_type, tree type, tree
op1, tree op2, tree op3);
+ tree tree_code_get_numeric_type (unsigned int size1, unsigned int
sign1);
+ void tree_code_create_function_initial (tree prev_saved,
+                                        unsigned char* filename, int
lineno,
+                                        struct tree_parameter_list*
parms);
+ void tree_code_create_function_wrapup (unsigned char* filename, int
lineno);
+ tree tree_code_create_function_prototype (unsigned char* chars,
+                                          unsigned int storage_class,
+                                          unsigned int ret_type,
+                                          struct tree_parameter_list*
parms,
+                                          unsigned char* filename,
+                                          int lineno);
+ tree tree_code_create_variable (unsigned int storage_class,
+                                unsigned char* chars,
+                                unsigned int length,
+                                unsigned int expression_type,
+                                tree init,
+                                unsigned char* filename,
+                                int lineno);
+ void tree_code_output_expression_statement (tree code, unsigned char*
filename, int lineno);
+ tree get_type_for_numeric_type (unsigned int numeric_type);
+ void tree_code_if_start (tree exp, unsigned char* filename, int
lineno);
+ void tree_code_if_else (unsigned char* filename, int lineno);
+ void tree_code_if_end (unsigned char* filename, int lineno);
+ tree tree_code_get_type (int type_num);
+ void treelang_init_decl_processing (void);
+ void treelang_finish (void);
+ const char * treelang_init (const char* filename);
+ int treelang_decode_option (int, char **);
+ void treelang_parse_file (int debug_flag);
+ void push_var_level (void);
+ void pop_var_level (void);
+
+ /* Storage modes.  */
+ #define STATIC_STORAGE 0
+ #define AUTOMATIC_STORAGE 1
+ #define EXTERNAL_REFERENCE_STORAGE 2
+ #define EXTERNAL_DEFINITION_STORAGE 3
+
+
+ /* Numeric types.  */
+ #define SIGNED_CHAR 1
+ #define UNSIGNED_CHAR 2
+ #define SIGNED_INT 3
+ #define UNSIGNED_INT 4
+ #define VOID_TYPE 5
+
+
+ #define EXP_PLUS 0 /* Addition expression.  */
+ #define EXP_REFERENCE 1 /* Variable reference.  */
+ #define EXP_ASSIGN 2 /* Assignment.  */
+ #define EXP_FUNCTION_INVOCATION 3  /* Call function.  */
+ #define EXP_MINUS 4  /* Subtraction.  */
+ #define EXP_EQUALS 5  /* Equality test.  */



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]