File: pr69062.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (89 lines) | stat: -rw-r--r-- 2,226 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-parallelize-loops=2" } */

#include <stdbool.h>

typedef unsigned long HARD_REG_ELT_TYPE;
typedef HARD_REG_ELT_TYPE HARD_REG_SET[1];
struct target_ira
{
  HARD_REG_SET x_ira_prohibited_class_mode_regs[1][1];
};
extern struct target_ira *this_target_ira;
static inline bool
ira_object_conflict_iter_cond ()
{
}

static inline bool
check_hard_reg_p (int num_objects, int hard_regno,
		  HARD_REG_SET * conflict_regs, HARD_REG_SET profitable_regs)
{
  int j, nwords, nregs;
  if ((! !
       (((this_target_ira->
	  x_ira_prohibited_class_mode_regs)[0][0])[(hard_regno) /
						   ((unsigned) (8 * 8))] &
	(((HARD_REG_ELT_TYPE) (1)) <<
	 ((hard_regno) % ((unsigned) (8 * 8)))))))
    return false;
  nwords = num_objects;
  for (j = 0; j < nregs; j++)
    {
      int k;
      int set_to_test_start = 0, set_to_test_end = nwords;
      if (nregs == nwords)
	{
	  if (0)
	    set_to_test_start = nwords - j - 1;
	  else
	    set_to_test_start = j;
	}
      for (k = set_to_test_start; k < set_to_test_end; k++)
	if ((! !
	     ((conflict_regs[k])[(hard_regno + j) / ((unsigned) (8 * 8))] &
	      (((HARD_REG_ELT_TYPE) (1)) <<
	       ((hard_regno + j) % ((unsigned) (8 * 8)))))))
	  break;
      if (k != set_to_test_end)
	break;
    }
  return j == nregs;
}

void
improve_allocation (void)
{
  int j, k, n, hregno, conflict_hregno, base_cost, class_size, word, nwords;
  int check, spill_cost, min_cost, nregs, conflict_nregs, r, best;
  int costs[81];
  HARD_REG_SET conflicting_regs[2], profitable_hard_regs;
  int a;
  for (;;)
    {
      nwords = a;
      for (word = 0; word < nwords; word++)
	{
	  for (; ira_object_conflict_iter_cond ();)
	    {
	      for (r = conflict_hregno;
		   r < conflict_hregno + conflict_nregs; r++)
		if (check_hard_reg_p
		    (a, r, conflicting_regs, profitable_hard_regs))
		  costs[r] += spill_cost;
	    }
	  if (check_hard_reg_p
	      (a, hregno, conflicting_regs, profitable_hard_regs)
	      && min_cost > costs[hregno])
	    {
	      best = hregno;
	    }
	  for (; ira_object_conflict_iter_cond ();)
	    {
	      if (best + nregs <= conflict_hregno
		  || conflict_hregno + conflict_nregs <= best)
		continue;
	    }
	}
    }
}