This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Make treelang work with TreeSSA and cgraph.
- From: ja2morri at csclub dot uwaterloo dot ca (James A. Morrison)
- To: Tim Josling <tej at melbpc dot org dot au>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 08 Aug 2004 01:01:46 -0400
- Subject: Re: [PATCH] Make treelang work with TreeSSA and cgraph.
- References: <kfhfz76czvv.fsf@csclub.uwaterloo.ca><4111446A.9040306@melbpc.org.au>
I've commited this change.
--
Thanks,
Jim
http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim
Tim Josling <tej@melbpc.org.au> writes:
> James
> Thanks. Do you have write authority - if so, approved, otherwise I
> will install in (maybe this weekend otherwise a week later).
> Tim Josling
>
> James A. Morrison wrote:
> > Hi,
> > The attached patch fixes some minor bugs in Treelang as well as
> > updating it
> > to be function/unit at a time. I've bootstraped and used make treelang.check
> > to test this patch. All tests including the new ones pass.
> > ------------------------------------------------------------------------
> > // { dg-do compile }
> > external_definition void bar ();
> > external_definition int gar (int arg0);
> > bar
> > {
> > return 0; // { dg-warning "return" }
> > }
> > gar
> > {
> > return; // { dg-error "return" }
> > }
> > ------------------------------------------------------------------------
> > // { dg-do compile }
> > external_definition void boring (int arg0);
> > external_definition char condition (char arg1, char arg2);
> > external_definition int first_nonzero (int arg5, int arg6);
> > boring
> > {
> > arg0 = +5 + +3; // Force 3 and 5 to be signed numbers.
> > arg0 = arg0 + +3;
> > }
> > condition
> > {
> > if (arg1)
> > {
> > automatic int i;
> > return arg1;
> > }
> > else
> > {
> > return 0;
> > }
> > }
> > first_nonzero
> > {
> > if (arg5)
> > {
> > return arg5;
> > }
> > else
> > {
> > automatic int j;
> > j = arg6;
> > return j;
> > }
> > return arg6;
> > }
> > ------------------------------------------------------------------------
> > // { dg-do compile }
> > // { dg-options "-funit-at-a-time" }
> > external_definition int add (int arga, int argb);
> > external_definition char sub (char argc, char argd);
> > add
> > {
> > return arga + argb + +3;
> > }
> > sub
> > {
> > return argd - argc + +2;
> > }
> > // { dg-final { scan-assembler "add" } }
> > // { dg-final { scan-assembler "sub" } }
> > ------------------------------------------------------------------------
> > Index: treelang/ChangeLog
> > 2004-08-01 James A. Morrison <phython@gcc.gnu.org>
> > * Make-lang.in (TREE_BE_LIBS): Remove.
> > (tree1): Depend on BACKEND and LIBDEPS. Use BACKEND and LIBS instead
> > of TREE_BE_LIBS.
> > * parse.y: Add variable_defs_opt before statements_opt.
> > Use tree_code_get_type instead of get_type_for_numeric_type.
> > Reformat long lines.
> > (parameters_opt): New rule.
> > (function_prototype): Use parameters_opt.
> > (return): Remove calls to print_token in error cases. Use VOID_TYPE.
> > (check_type_match): Use VOID_TYPE.
> > * lex.l (update_lineno_charno): Ensure INPUT_LINE starts at 1.
> > * tree1.c: Include version.h and cgraph.h
> > (treelang_parse_file): Call cgraph_finalize_compilation_unit and
> > cgraph_optimize.
> > * treelang.h (item): Remove extraneous GTY.
> > * treetree.h (get_type_for_numeric_type): Remove.
> > * treetree.c: Include tree-dump.h, tree-iterator.h, tree-gimple.h,
> > function.h, and cgraph.h. Don't include rtl.h
> > (keep_level_p): Remove.
> > (tree_push_atomic_type_decl): Remove.
> > (get_type_for_numeric_type): Remove.
> > (tree_code_get_numeric_type): Remove.
> > (global_bindings_p): Make static.
> > (getdecls): Likewise.
> > (insert_block): Likewise.
> > (tree_code_if_start): Create a COND_EXPR and add it to the tree
> > instead of creating rtl.
> > (tree_code_if_else): Create a BIND_EXPR if any variables were created
> > in the if statement.
> > (tree_code_end_if): Likewise.
> > (tree_code_create_function_prototype): Use tree_code_get_type.
> > Don't use SET_DECL_ASSEMBLER_NAME.
> > (tree_code_create_function_initial): Set DECL_ARTIFICIAL and
> > DECL_IGNORING_P on RESULT_DECL. Use tree_code_get_type. Don't call
> > layout_decl on RESULT_DECL. Don't call rtl expand functions.
> > (tree_code_create_function_wrapup): Don't call rtl expand functions.
> > Create a BIND_EXPR for each function. Dump original and gimplified
> > copies of the function tree. Gimplify function.
> > (tree_code_create_variable): Use tree_code_get_type. Don't call
> > layout_decl or expand_decl. Fold CONVERT_EXPRs.
> > (tree_code_generate_return): Fold CONVERT_EXPRs and MODIFY_EXPRs.
> > Add RETURN_EXPR to the current statement list. Don't call rtl expand
> > functions.
> > (tree_code_output_expression_statement): Append CODE to current
> > statement list.
> > (tree_code_get_expression): Fold expressions. Build a pointer to
> > a FUNCTION_TYPE intead of the called functions return type.
> > (struct binding_level): Add statement list STMTS.
> > (getstmtlist): New Function.
> > (pushlevel): Make static. Allocate an empty statement list.
> > (poplevel): Make static. Don't clear BLOCK_NODE's BLOCK_VARS.
> > Don't use DECL_ASSEMBLER_NAME.
> > (tree_push_type_decl): Set TYPE_NAME of TYPE_NODE to ID.
> > (treelang_init_decl_processing): Define basic types after unused types.
> > Don't call tree_push_atomic_type_decl.
> > (builtin_function): Don't call make_decl_rtl.
> > (treelang_expand_function). New Function.
> > testsuite/treelang/ChangeLog
> > 2004-07-31 James A. Morrison <phython@gcc.gnu.org>
> > * compile/vars_def.tree: New file.
> > * compile/badreturn.tree: New file.
> > * compile/full_unit.tree: New file.