1 /* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-O2 -fselective-scheduling -fsel-sched-pipelining -fsched-pressure" } */
3
4 struct s_linked_f_pointer
5 {
6 struct s_linked_f_pointer *next;
7 float *fptr;
8 };
9 struct s_trace
10 {
11 int index;
12 };
13 struct s_rr_cost
14 {
15 float base_cost;
16 float acc_cost;
17 };
18 extern int num_nets;
19 extern struct s_trace **trace_head;
20 extern struct s_rr_cost *rr_cost;
21 struct s_rr_route
22 {
23 float cost;
24 };
25 static int heap_tail;
26 extern struct s_linked_f_pointer *rr_modified_head;
27 extern struct s_rr_route *rr_route;
28
29 void
empty_heap(void)30 empty_heap (void)
31 {
32 heap_tail = 1;
33 }
34
35 void
reset_path_costs(void)36 reset_path_costs (void)
37 {
38 struct s_linked_f_pointer *mod_ptr;
39 if (rr_modified_head != ((void *) 0))
40 {
41 mod_ptr = rr_modified_head;
42 while (mod_ptr->next != ((void *) 0))
43 {
44 *(mod_ptr->fptr) = 1.e30;
45 mod_ptr = mod_ptr->next;
46 }
47 rr_modified_head = ((void *) 0);
48 }
49 }
50
51 static void
route_net(int inet)52 route_net (int inet)
53 {
54 int i;
55 for (i = 1; i < inet; i++)
56 reset_path_costs ();
57 empty_heap ();
58 reset_path_costs ();
59 }
60
61 void
pathfinder_update_one_cost(int inet,float pres_fac,float acc_fac)62 pathfinder_update_one_cost (int inet, float pres_fac, float acc_fac)
63 {
64 struct s_trace *tptr;
65 int inode = 0;
66
67 tptr = trace_head[inet];
68 inode = tptr->index;
69 rr_route[inode].cost = rr_cost[inode].base_cost + rr_cost[inode].acc_cost;
70 }
71
72 int
try_route(int n,float x,float y)73 try_route (int n, float x, float y)
74 {
75 int inet, itry;
76 float pres_fac;
77 for (itry = 1; itry <= n; itry++)
78 {
79 for (inet = 0; inet < num_nets; inet++)
80 {
81 route_net (inet);
82 pathfinder_update_one_cost (inet, pres_fac, x);
83 }
84 pres_fac *= y;
85 }
86 }
87
88