Mercurial > hg > CbC > CbC_gcc
comparison gcc/function-tests.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Unit tests for function-handling. | 1 /* Unit tests for function-handling. |
2 Copyright (C) 2015-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2015-2020 Free Software Foundation, Inc. |
3 | 3 |
4 This file is part of GCC. | 4 This file is part of GCC. |
5 | 5 |
6 GCC is free software; you can redistribute it and/or modify it under | 6 GCC is free software; you can redistribute it and/or modify it under |
7 the terms of the GNU General Public License as published by the Free | 7 the terms of the GNU General Public License as published by the Free |
80 | 80 |
81 namespace selftest { | 81 namespace selftest { |
82 | 82 |
83 /* Helper function for selftests of function-creation. */ | 83 /* Helper function for selftests of function-creation. */ |
84 | 84 |
85 static tree | 85 tree |
86 make_fndecl (tree return_type, | 86 make_fndecl (tree return_type, |
87 const char *name, | 87 const char *name, |
88 vec <tree> ¶m_types, | 88 vec <tree> ¶m_types, |
89 bool is_variadic = false) | 89 bool is_variadic) |
90 { | 90 { |
91 tree fn_type; | 91 tree fn_type; |
92 if (is_variadic) | 92 if (is_variadic) |
93 fn_type = build_varargs_function_type_array (return_type, | 93 fn_type = build_varargs_function_type_array (return_type, |
94 param_types.length (), | 94 param_types.length (), |
566 ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt_b)); | 566 ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt_b)); |
567 ASSERT_EQ (NULL, stmt_b->next); | 567 ASSERT_EQ (NULL, stmt_b->next); |
568 | 568 |
569 greturn *return_stmt = as_a <greturn *> (stmt_b); | 569 greturn *return_stmt = as_a <greturn *> (stmt_b); |
570 ASSERT_EQ (SSA_NAME, TREE_CODE (gimple_return_retval (return_stmt))); | 570 ASSERT_EQ (SSA_NAME, TREE_CODE (gimple_return_retval (return_stmt))); |
571 } | |
572 | |
573 /* Test range folding. We must start this here because we need cfun | |
574 set. */ | |
575 | |
576 static void | |
577 test_ranges () | |
578 { | |
579 tree fndecl = build_trivial_high_gimple_function (); | |
580 function *fun = DECL_STRUCT_FUNCTION (fndecl); | |
581 push_cfun (fun); | |
582 range_tests (); | |
583 pop_cfun (); | |
571 } | 584 } |
572 | 585 |
573 /* Test of expansion from gimple-ssa to RTL. */ | 586 /* Test of expansion from gimple-ssa to RTL. */ |
574 | 587 |
575 static void | 588 static void |
672 test_fndecl_int_void (); | 685 test_fndecl_int_void (); |
673 test_fndecl_float_intchar (); | 686 test_fndecl_float_intchar (); |
674 test_gimplification (); | 687 test_gimplification (); |
675 test_building_cfg (); | 688 test_building_cfg (); |
676 test_conversion_to_ssa (); | 689 test_conversion_to_ssa (); |
690 test_ranges (); | |
677 test_expansion_to_rtl (); | 691 test_expansion_to_rtl (); |
678 } | 692 } |
679 | 693 |
680 } // namespace selftest | 694 } // namespace selftest |
681 | 695 |