Split print_rtx into subroutines
[official-gcc.git] / gcc / testsuite / gcc.dg / sms-10.c
blobd85e8e2a274c2c752662696c51e9b62758536e13
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */
5 typedef __SIZE_TYPE__ size_t;
6 extern void *malloc (size_t);
7 extern void free (void *);
8 extern void abort (void);
10 struct regstat_n_sets_and_refs_t
12 int sets;
13 int refs;
16 struct regstat_n_sets_and_refs_t *regstat_n_sets_and_refs;
18 struct df_reg_info
20 unsigned int n_refs;
23 struct df_d
25 struct df_reg_info **def_regs;
26 struct df_reg_info **use_regs;
28 struct df_d *df;
30 static inline int
31 REG_N_SETS (int regno)
33 return regstat_n_sets_and_refs[regno].sets;
36 __attribute__ ((noinline))
37 int max_reg_num (void)
39 return 100;
42 __attribute__ ((noinline))
43 void regstat_init_n_sets_and_refs (void)
45 unsigned int i;
46 unsigned int max_regno = max_reg_num ();
48 for (i = 0; i < max_regno; i++)
50 (regstat_n_sets_and_refs[i].sets = (df->def_regs[(i)]->n_refs));
51 (regstat_n_sets_and_refs[i].refs =
52 (df->use_regs[(i)]->n_refs) + REG_N_SETS (i));
56 int a_sets[100] =
57 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
58 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
59 40, 41, 42,
60 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
61 62, 63, 64,
62 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
63 84, 85, 86,
64 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
67 int a_refs[100] =
68 { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38,
69 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76,
70 78, 80, 82,
71 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116,
72 118, 120,
73 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150,
74 152, 154, 156,
75 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186,
76 188, 190, 192,
77 194, 196, 198
80 int
81 main ()
83 struct df_reg_info *b[100], *c[100];
84 struct df_d df1;
85 size_t s = sizeof (struct df_reg_info);
86 struct regstat_n_sets_and_refs_t a[100];
88 df = &df1;
89 regstat_n_sets_and_refs = a;
90 int i;
92 for (i = 0; i < 100; i++)
94 b[i] = (struct df_reg_info *) malloc (s);
95 b[i]->n_refs = i;
96 c[i] = (struct df_reg_info *) malloc (s);
97 c[i]->n_refs = i;
100 df1.def_regs = b;
101 df1.use_regs = c;
102 regstat_init_n_sets_and_refs ();
104 for (i = 0; i < 100; i++)
105 if ((a[i].sets != a_sets[i]) || (a[i].refs != a_refs[i]))
106 abort ();
108 for (i = 0; i < 100; i++)
110 free (b[i]);
111 free (c[i]);
114 return 0;
117 /* { dg-final { scan-rtl-dump-times "SMS succeeded" 1 "sms" { target powerpc*-*-* } } } */