]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/function-tests.c
2016-07-21 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
[thirdparty/gcc.git] / gcc / function-tests.c
CommitLineData
99b4f3a2 1/* Unit tests for function-handling.
2 Copyright (C) 2015-2016 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#include "config.h"
21#include "system.h"
22#include "coretypes.h"
23#include "tm.h"
24#include "opts.h"
25#include "signop.h"
26#include "hash-set.h"
27#include "fixed-value.h"
28#include "alias.h"
29#include "flags.h"
30#include "symtab.h"
31#include "tree-core.h"
32#include "stor-layout.h"
33#include "tree.h"
34#include "stringpool.h"
35#include "stor-layout.h"
36#include "rtl.h"
37#include "predict.h"
38#include "vec.h"
39#include "hashtab.h"
40#include "hash-set.h"
41#include "machmode.h"
42#include "hard-reg-set.h"
43#include "input.h"
44#include "function.h"
45#include "dominance.h"
46#include "cfg.h"
47#include "cfganal.h"
48#include "basic-block.h"
49#include "tree-ssa-alias.h"
50#include "internal-fn.h"
51#include "gimple-fold.h"
52#include "gimple-expr.h"
53#include "toplev.h"
54#include "print-tree.h"
55#include "tree-iterator.h"
56#include "gimplify.h"
57#include "tree-cfg.h"
58#include "basic-block.h"
59#include "double-int.h"
60#include "alias.h"
61#include "symtab.h"
62#include "wide-int.h"
63#include "inchash.h"
64#include "tree.h"
65#include "fold-const.h"
66#include "stor-layout.h"
67#include "stmt.h"
68#include "hash-table.h"
69#include "tree-ssa-alias.h"
70#include "internal-fn.h"
71#include "gimple-expr.h"
72#include "is-a.h"
73#include "gimple.h"
74#include "tree-pass.h"
75#include "context.h"
76#include "hash-map.h"
77#include "plugin-api.h"
78#include "ipa-ref.h"
79#include "cgraph.h"
80#include "selftest.h"
81
82#if CHECKING_P
83
84namespace selftest {
85
86/* Helper function for selftests of function-creation. */
87
88static tree
89make_fndecl (tree return_type,
90 const char *name,
91 vec <tree> &param_types,
92 bool is_variadic = false)
93{
94 tree fn_type;
95 if (is_variadic)
96 fn_type = build_varargs_function_type_array (return_type,
97 param_types.length (),
98 param_types.address ());
99 else
100 fn_type = build_function_type_array (return_type,
101 param_types.length (),
102 param_types.address ());
103 /* FIXME: this uses input_location: */
104 tree fndecl = build_fn_decl (name, fn_type);
105
106 return fndecl;
107}
108
109/* Verify creating a function declaration equivalent to the following
110 int test_fndecl_int_void (void);
111 C declaration. */
112
113static void
114test_fndecl_int_void ()
115{
116 auto_vec <tree> param_types;
117 const char *name = "test_fndecl_int_void";
118 tree fndecl = make_fndecl (integer_type_node,
119 name,
120 param_types);
121 ASSERT_TRUE (fndecl != NULL);
122
123 /* Verify name of decl. */
124 tree declname = DECL_NAME (fndecl);
125 ASSERT_TRUE (declname != NULL);
126 ASSERT_EQ (IDENTIFIER_NODE, TREE_CODE (declname));
127 /* We expect it to use a *copy* of the string we passed in. */
128 const char *identifier_ptr = IDENTIFIER_POINTER (declname);
129 ASSERT_NE (name, identifier_ptr);
130 ASSERT_EQ (0, strcmp ("test_fndecl_int_void", identifier_ptr));
131
132 /* Verify type of fndecl. */
133 ASSERT_EQ (FUNCTION_DECL, TREE_CODE (fndecl));
134 tree fntype = TREE_TYPE (fndecl);
135 ASSERT_EQ (FUNCTION_TYPE, TREE_CODE (fntype));
136
137 /* Verify return type. */
138 ASSERT_EQ (integer_type_node, TREE_TYPE (fntype));
139
140 /* Verify "void" args. */
141 tree argtypes = TYPE_ARG_TYPES (fntype);
142 ASSERT_EQ (TREE_LIST, TREE_CODE (argtypes));
143 ASSERT_EQ (void_type_node, TREE_VALUE (argtypes));
144 ASSERT_EQ (NULL, TREE_CHAIN (argtypes));
145}
146
147/* Verify creating a function declaration equivalent to the following
148 float test_fndecl_float_intchar (int, char);
149 C declaration. */
150
151static void
152test_fndecl_float_intchar ()
153{
154 auto_vec <tree> param_types;
155 param_types.safe_push (integer_type_node);
156 param_types.safe_push (char_type_node);
157 const char *name = "test_fndecl_float_intchar";
158 tree fndecl = make_fndecl (float_type_node,
159 name,
160 param_types);
161 ASSERT_TRUE (fndecl != NULL);
162
163 /* Verify name of decl. */
164 tree declname = DECL_NAME (fndecl);
165 ASSERT_TRUE (declname != NULL);
166 ASSERT_EQ (IDENTIFIER_NODE, TREE_CODE (declname));
167 /* We expect it to use a *copy* of the string we passed in. */
168 const char *identifier_ptr = IDENTIFIER_POINTER (declname);
169 ASSERT_NE (name, identifier_ptr);
170 ASSERT_EQ (0, strcmp (name, identifier_ptr));
171
172 /* Verify type of fndecl. */
173 ASSERT_EQ (FUNCTION_DECL, TREE_CODE (fndecl));
174 tree fntype = TREE_TYPE (fndecl);
175 ASSERT_EQ (FUNCTION_TYPE, TREE_CODE (fntype));
176
177 /* Verify return type. */
178 ASSERT_EQ (float_type_node, TREE_TYPE (fntype));
179
180 /* Verify "(int, char)" args. */
181 tree arg0 = TYPE_ARG_TYPES (fntype);
182 ASSERT_EQ (TREE_LIST, TREE_CODE (arg0));
183 ASSERT_EQ (integer_type_node, TREE_VALUE (arg0));
184 tree arg1 = TREE_CHAIN (arg0);
185 ASSERT_TRUE (arg1 != NULL);
186 ASSERT_EQ (TREE_LIST, TREE_CODE (arg1));
187 ASSERT_EQ (char_type_node, TREE_VALUE (arg1));
188 tree argterm = TREE_CHAIN (arg1);
189 ASSERT_TRUE (argterm != NULL);
190 ASSERT_EQ (TREE_LIST, TREE_CODE (argterm));
191 ASSERT_EQ (void_type_node, TREE_VALUE (argterm));
192 ASSERT_EQ (NULL, TREE_CHAIN (argterm));
193}
194
195/* The test cases using these helper functions take a trivial function:
196
197 int test_fn (void) { return 42; }
198
199 and test various conversions done to it:
200
201 - gimplification
202 - construction of the CFG
203 - conversion to SSA form
204 - expansion to RTL form
205
206 In avoid having one overlong test case, this is broken
207 up into separate test cases for each stage, with helper functions
208 to minimize code duplication.
209
210 Another approach would be to attempt to directly construct a function
211 in the appropriate representation at each stage, though presumably
212 that would exhibit different kinds of failure compared to this
213 approach. */
214
215/* Construct this function:
216 int test_fn (void) { return 42; }
217 in generic tree form. Return the fndecl. */
218
219static tree
220build_trivial_generic_function ()
221{
222 auto_vec <tree> param_types;
223 tree fndecl = make_fndecl (integer_type_node,
224 "test_fn",
225 param_types);
226 ASSERT_TRUE (fndecl != NULL);
227
228 /* Populate the function. */
229 tree retval = build_decl (UNKNOWN_LOCATION, RESULT_DECL,
230 NULL_TREE, integer_type_node);
231 DECL_ARTIFICIAL (retval) = 1;
232 DECL_IGNORED_P (retval) = 1;
233 DECL_RESULT (fndecl) = retval;
234
235 /* Create a BIND_EXPR, and within it, a statement list. */
236 tree stmt_list = alloc_stmt_list ();
237 tree_stmt_iterator stmt_iter = tsi_start (stmt_list);
238 tree block = make_node (BLOCK);
239 tree bind_expr
240 = build3 (BIND_EXPR, void_type_node, NULL, stmt_list, block);
241
242 tree modify_retval = build2 (MODIFY_EXPR,
243 integer_type_node,
244 retval,
245 build_int_cst (integer_type_node, 42));
246 tree return_stmt = build1 (RETURN_EXPR,
247 integer_type_node,
248 modify_retval);
249 tsi_link_after (&stmt_iter, return_stmt, TSI_CONTINUE_LINKING);
250
251 DECL_INITIAL (fndecl) = block;
252
253 /* how to add to function? the following appears to be how to
254 set the body of a fndecl: */
255 DECL_SAVED_TREE(fndecl) = bind_expr;
256
257 /* Ensure that locals appear in the debuginfo. */
258 BLOCK_VARS (block) = BIND_EXPR_VARS (bind_expr);
259
260 return fndecl;
261}
262
263/* Construct this function:
264 int test_fn (void) { return 42; }
265 in "high gimple" form. Return the fndecl. */
266
267static tree
268build_trivial_high_gimple_function ()
269{
270 /* Construct a trivial function, and gimplify it: */
271 tree fndecl = build_trivial_generic_function ();
272 gimplify_function_tree (fndecl);
273 return fndecl;
274}
275
276/* Build a CFG for a function in gimple form. */
277
278static void
279build_cfg (tree fndecl)
280{
281 function *fun = DECL_STRUCT_FUNCTION (fndecl);
282 ASSERT_TRUE (fun != NULL);
283 ASSERT_EQ (fndecl, fun->decl);
284
285 /* We first have to lower control flow; for our trivial test function
286 this gives us:
287 test_fn ()
288 {
289 D.56 = 42;
290 goto <D.57>;
291 <D.57>:
292 return D.56;
293 }
294 */
295 gimple_opt_pass *lower_cf_pass = make_pass_lower_cf (g);
296 push_cfun (fun);
297 lower_cf_pass->execute (fun);
298 pop_cfun ();
60be9705 299 delete lower_cf_pass;
99b4f3a2 300
301 /* We can now convert to CFG form; for our trivial test function this
302 gives us:
303 test_fn ()
304 {
305 <bb 2>:
306 D.56 = 42;
307 return D.56;
308 }
309 */
310 gimple_opt_pass *build_cfg_pass = make_pass_build_cfg (g);
311 push_cfun (fun);
312 build_cfg_pass->execute (fun);
313 pop_cfun ();
60be9705 314 delete build_cfg_pass;
99b4f3a2 315}
316
317/* Convert a gimple+CFG function to SSA form. */
318
319static void
320convert_to_ssa (tree fndecl)
321{
322 function *fun = DECL_STRUCT_FUNCTION (fndecl);
323 ASSERT_TRUE (fun != NULL);
324 ASSERT_EQ (fndecl, fun->decl);
325
326 gimple_opt_pass *build_ssa_pass = make_pass_build_ssa (g);
327 push_cfun (fun);
328 build_ssa_pass->execute (fun);
329 pop_cfun ();
60be9705 330 delete build_ssa_pass;
99b4f3a2 331}
332
333/* Assuming we have a simple 3-block CFG like this:
334 [ENTRY] -> [block2] -> [EXIT]
335 get the "real" basic block (block 2). */
336
337static basic_block
338get_real_block (function *fun)
339{
340 ASSERT_TRUE (fun->cfg != NULL);
341 ASSERT_EQ (3, n_basic_blocks_for_fn (fun));
342 basic_block bb2 = (*fun->cfg->x_basic_block_info)[2];
343 ASSERT_TRUE (bb2 != NULL);
344 return bb2;
345}
346
347/* Verify that we have a simple 3-block CFG: the two "fake" ones, and
348 a "real" one:
349 [ENTRY] -> [block2] -> [EXIT]. */
350
351static void
352verify_three_block_cfg (function *fun)
353{
354 ASSERT_TRUE (fun->cfg != NULL);
355 ASSERT_EQ (3, n_basic_blocks_for_fn (fun));
356 ASSERT_EQ (2, n_edges_for_fn (fun));
357
358 /* The "fake" basic blocks. */
359 basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (fun);
360 ASSERT_TRUE (entry != NULL);
361 ASSERT_EQ (ENTRY_BLOCK, entry->index);
362
363 basic_block exit = EXIT_BLOCK_PTR_FOR_FN (fun);
364 ASSERT_TRUE (exit != NULL);
365 ASSERT_EQ (EXIT_BLOCK, exit->index);
366
367 /* The "real" basic block. */
368 basic_block bb2 = get_real_block (fun);
369 ASSERT_TRUE (bb2 != NULL);
370 ASSERT_EQ (2, bb2->index);
371
372 /* Verify connectivity. */
373 ASSERT_EQ (NULL, entry->preds);
374 ASSERT_EQ (1, entry->succs->length ());
375
376 edge from_entry_to_bb2 = (*entry->succs)[0];
377 ASSERT_EQ (entry, from_entry_to_bb2->src);
378 ASSERT_EQ (bb2, from_entry_to_bb2->dest);
379
380 ASSERT_EQ (1, bb2->preds->length ());
381 ASSERT_EQ (from_entry_to_bb2, (*bb2->preds)[0]);
382 ASSERT_EQ (1, bb2->succs->length ());
383
384 edge from_bb2_to_exit = (*bb2->succs)[0];
385 ASSERT_EQ (bb2, from_bb2_to_exit->src);
386 ASSERT_EQ (exit, from_bb2_to_exit->dest);
387
388 ASSERT_EQ (1, exit->preds->length ());
389 ASSERT_EQ (from_bb2_to_exit, (*exit->preds)[0]);
390 ASSERT_EQ (NULL, exit->succs);
391}
392
393/* As above, but additionally verify the gimple statements are sane. */
394
395static void
396verify_three_block_gimple_cfg (function *fun)
397{
398 verify_three_block_cfg (fun);
399
400 /* The "fake" basic blocks should be flagged as gimple, but with have no
401 statements. */
402 basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (fun);
403 ASSERT_TRUE (entry != NULL);
404 ASSERT_EQ (0, entry->flags & BB_RTL);
405 ASSERT_EQ (NULL, bb_seq (entry));
406
407 basic_block exit = EXIT_BLOCK_PTR_FOR_FN (fun);
408 ASSERT_TRUE (exit != NULL);
409 ASSERT_EQ (0, entry->flags & BB_RTL);
410 ASSERT_EQ (NULL, bb_seq (exit));
411
412 /* The "real" basic block should be flagged as gimple, and have one
413 or more statements. */
414 basic_block bb2 = get_real_block (fun);
415 ASSERT_TRUE (bb2 != NULL);
416 ASSERT_EQ (0, entry->flags & BB_RTL);
417 ASSERT_TRUE (bb_seq (bb2) != NULL);
418}
419
420/* As above, but additionally verify the RTL insns are sane. */
421
422static void
423verify_three_block_rtl_cfg (function *fun)
424{
425 verify_three_block_cfg (fun);
426
427 /* The "fake" basic blocks should be flagged as RTL, but with no
428 insns. */
429 basic_block entry = ENTRY_BLOCK_PTR_FOR_FN (fun);
430 ASSERT_TRUE (entry != NULL);
431 ASSERT_EQ (BB_RTL, entry->flags & BB_RTL);
432 ASSERT_EQ (NULL, BB_HEAD (entry));
433
434 basic_block exit = EXIT_BLOCK_PTR_FOR_FN (fun);
435 ASSERT_TRUE (exit != NULL);
8140d4af 436 ASSERT_EQ (BB_RTL, exit->flags & BB_RTL);
99b4f3a2 437 ASSERT_EQ (NULL, BB_HEAD (exit));
438
439 /* The "real" basic block should be flagged as RTL, and have one
440 or more insns. */
441 basic_block bb2 = get_real_block (fun);
442 ASSERT_TRUE (bb2 != NULL);
8140d4af 443 ASSERT_EQ (BB_RTL, bb2->flags & BB_RTL);
99b4f3a2 444 ASSERT_TRUE (BB_HEAD (bb2) != NULL);
445}
446
447/* Test converting our trivial function:
448 int test_fn (void) { return 42; }
449 to gimple form. */
450
451static void
452test_gimplification ()
453{
454 tree fndecl = build_trivial_generic_function ();
455
456 /* Convert to gimple: */
457 gimplify_function_tree (fndecl);
458
459 /* Verify that we got gimple out of it. */
460
461 /* The function is now in GIMPLE form but the CFG has not been
462 built yet. */
463
464 /* We should have a struct function for the decl. */
465 function *fun = DECL_STRUCT_FUNCTION (fndecl);
466 ASSERT_TRUE (fun != NULL);
467 ASSERT_EQ (fndecl, fun->decl);
468
469 /* We expect a GIMPLE_BIND, with two gimple statements within it:
470 tmp = 42;
471 return tmp; */
472
473 gimple_seq seq_fn_body = gimple_body (fndecl);
474 ASSERT_TRUE (seq_fn_body != NULL);
475 gimple *bind_stmt = gimple_seq_first_stmt (seq_fn_body);
476 ASSERT_EQ (GIMPLE_BIND, gimple_code (bind_stmt));
477 ASSERT_EQ (NULL, bind_stmt->next);
478
479 gimple_seq seq_bind_body = gimple_bind_body (as_a <gbind *> (bind_stmt));
480
481 /* Verify that we have the 2 statements we expect. */
482 ASSERT_TRUE (seq_bind_body != NULL);
483 gimple *stmt1 = gimple_seq_first_stmt (seq_bind_body);
484 ASSERT_TRUE (stmt1 != NULL);
485 ASSERT_EQ (GIMPLE_ASSIGN, gimple_code (stmt1));
486 gimple *stmt2 = stmt1->next;
487 ASSERT_TRUE (stmt2 != NULL);
488 ASSERT_EQ (stmt1, stmt2->prev);
489 ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt2));
490}
491
492/* Test of building a CFG for a function in high gimple form. */
493
494static void
495test_building_cfg ()
496{
497 /* Construct a trivial function, and gimplify it: */
498 tree fndecl = build_trivial_high_gimple_function ();
499 function *fun = DECL_STRUCT_FUNCTION (fndecl);
500 ASSERT_TRUE (fun != NULL);
501
502 /* Build a CFG. */
503 build_cfg (fndecl);
504
505 /* The CFG-building code constructs a 4-block cfg (with
506 ENTRY and EXIT):
507 test_fn ()
508 {
509 <bb 2>:
510 D.65 = 42;
511
512 <bb 3>:
513 return D.65;
514 }
515 and then ought to merge blocks 2 and 3 in cleanup_tree_cfg.
516
517 Hence we should end up with a simple 3-block cfg, the two "fake" ones,
518 and a "real" one:
519 [ENTRY] -> [block2] -> [EXIT]
520 with code like this:
521 test_fn ()
522 {
523 <bb 2>:
524 D.56 = 42;
525 return D.56;
526 }
527 */
528 verify_three_block_gimple_cfg (fun);
529
530 /* Verify the statements within the "real" block. */
531 basic_block bb2 = get_real_block (fun);
532 gimple *stmt_a = gimple_seq_first_stmt (bb_seq (bb2));
533 ASSERT_EQ (GIMPLE_ASSIGN, gimple_code (stmt_a));
534 gimple *stmt_b = stmt_a->next;
535 ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt_b));
536 ASSERT_EQ (NULL, stmt_b->next);
537}
538
539/* Test of conversion of gimple to SSA form. */
540
541static void
542test_conversion_to_ssa ()
543{
544 /* As above, construct a trivial function, gimplify it, and build a CFG: */
545 tree fndecl = build_trivial_high_gimple_function ();
546 function *fun = DECL_STRUCT_FUNCTION (fndecl);
547 ASSERT_TRUE (fun != NULL);
548 build_cfg (fndecl);
549
550 convert_to_ssa (fndecl);
551
552 verify_three_block_gimple_cfg (fun);
553
554 /* For out trivial test function we should now have something like
555 this:
556 test_fn ()
557 {
558 <bb 2>:
559 _1 = 42;
560 return _1;
561 }
562 */
563 basic_block bb2 = get_real_block (fun);
564 gimple *stmt_a = gimple_seq_first_stmt (bb_seq (bb2));
565 ASSERT_EQ (GIMPLE_ASSIGN, gimple_code (stmt_a));
566
567 gimple *stmt_b = stmt_a->next;
568 ASSERT_EQ (GIMPLE_RETURN, gimple_code (stmt_b));
569 ASSERT_EQ (NULL, stmt_b->next);
570
571 greturn *return_stmt = as_a <greturn *> (stmt_b);
572 ASSERT_EQ (SSA_NAME, TREE_CODE (gimple_return_retval (return_stmt)));
573}
574
575/* Test of expansion from gimple-ssa to RTL. */
576
577static void
578test_expansion_to_rtl ()
579{
580 /* As above, construct a trivial function, gimplify it, build a CFG,
581 and convert to SSA: */
582 tree fndecl = build_trivial_high_gimple_function ();
583 function *fun = DECL_STRUCT_FUNCTION (fndecl);
584 ASSERT_TRUE (fun != NULL);
585 build_cfg (fndecl);
586 convert_to_ssa (fndecl);
587
588 /* We need a cgraph_node for it. */
589 cgraph_node::get_create (fndecl);
590 /* Normally, cgraph_node::expand () would call
591 init_function_start (and a bunch of other stuff),
592 and invoke the expand pass, but it also runs
593 all of the other passes. So just do the minimum
594 needed to get from gimple-SSA to RTL. */
595 rtl_opt_pass *expand_pass = make_pass_expand (g);
596 push_cfun (fun);
597 init_function_start (fndecl);
598 expand_pass->execute (fun);
599 pop_cfun ();
60be9705 600 delete expand_pass;
99b4f3a2 601
602 /* On x86_64, I get this:
603 (note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
604 (note 2 3 5 2 NOTE_INSN_FUNCTION_BEG)
605 (insn 5 2 6 2 (set (reg:SI 87 [ D.59 ])
606 (const_int 42 [0x2a])) -1 (nil))
607 (insn 6 5 10 2 (set (reg:SI 88 [ <retval> ])
608 (reg:SI 87 [ D.59 ])) -1 (nil))
609 (insn 10 6 11 2 (set (reg/i:SI 0 ax)
610 (reg:SI 88 [ <retval> ])) -1 (nil))
611 (insn 11 10 0 2 (use (reg/i:SI 0 ax)) -1 (nil))
612
613 On cr16-elf I get this:
614 (note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
615 (insn 2 4 3 2 (set (reg:SI 24)
616 (reg/f:SI 16 virtual-incoming-args)) -1
617 (nil))
618 (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG)
619 (insn 6 3 7 2 (set (reg:HI 22 [ _1 ])
620 (const_int 42 [0x2a])) -1
621 (nil))
622 (insn 7 6 11 2 (set (reg:HI 23 [ <retval> ])
623 (reg:HI 22 [ _1 ])) -1
624 (nil))
625 (insn 11 7 12 2 (set (reg/i:HI 0 r0)
626 (reg:HI 23 [ <retval> ])) -1
627 (nil))
628 (insn 12 11 0 2 (use (reg/i:HI 0 r0)) -1
629 (nil)). */
630 verify_three_block_rtl_cfg (fun);
631
632 /* Verify as much of the RTL as we can whilst avoiding
633 target-specific behavior. */
634 basic_block bb2 = get_real_block (fun);
635
636 /* Expect a NOTE_INSN_BASIC_BLOCK... */
637 rtx_insn *insn = BB_HEAD (bb2);
638 ASSERT_TRUE (insn != NULL);
639 ASSERT_EQ (NOTE, insn->code);
640 ASSERT_EQ (NOTE_INSN_BASIC_BLOCK, NOTE_KIND (insn));
641 ASSERT_EQ (bb2, NOTE_BASIC_BLOCK (insn));
642
643 /* ...etc; any further checks are likely to over-specify things
644 and run us into target dependencies. */
645}
646
647/* Run all of the selftests within this file. */
648
649void
650function_tests_c_tests ()
651{
652 test_fndecl_int_void ();
653 test_fndecl_float_intchar ();
654 test_gimplification ();
655 test_building_cfg ();
656 test_conversion_to_ssa ();
657 test_expansion_to_rtl ();
658}
659
660} // namespace selftest
661
662#endif /* #if CHECKING_P */