rtl.def (PREFETCH): New rtx code.
authorJanis Johnson <janis@gcc.gnu.org>
Tue, 4 Dec 2001 00:47:14 +0000 (00:47 +0000)
committerJanis Johnson <janis@gcc.gnu.org>
Tue, 4 Dec 2001 00:47:14 +0000 (00:47 +0000)
* rtl.def (PREFETCH): New rtx code.
* doc/rtl.texi (PREFETCH): Add documentation.
* function.c (instantiate_virtual_regs_1): Handle PREFETCH rtx.
* rtlanal.c (reg_referenced_p): Ditto.
* sched-vis.c (print_exp):  Ditto.
* ssa-dce.c (find_inherently_necessary):  Ditto.

From-SVN: r47580

gcc/doc/rtl.texi
gcc/function.c
gcc/rtl.def
gcc/rtlanal.c
gcc/sched-vis.c
gcc/ssa-dce.c

index 8184894b29435bc7cc6026f9fd4f077794cfee2f..c0c2cda8c7f92522a4e1b00af883cadd9a46ccbc 100644 (file)
@@ -2326,6 +2326,20 @@ are set up by branch shortening and hold a label with a minimum and a
 maximum address, respectively.  @var{flags} indicates the relative
 position of @var{base}, @var{min} and @var{max} to the containing insn
 and of @var{min} and @var{max} to @var{base}.  See rtl.def for details.
+
+@findex prefetch
+@item (prefetch:@var{m} @var{addr} @var{rw} @var{locality})
+Represents prefetch of memory at address @var{addr}.
+Operand @var{rw} is 1 if the prefetch is for data to be written, 0 otherwise;
+targets that do not support write prefetches should treat this as a normal
+prefetch.
+Operand @var{locality} specifies the amount of temporal locality; 0 if there
+is none or 1, 2, or 3 for increasing levels of temporal locality;
+targets that do not support locality hints should ignore this.
+
+This insn is used to minimize cache-miss latency by moving data into a
+cache before it is accessed.  It should use only non-faulting data prefetch
+instructions.
 @end table
 
 @node Incdec
index 0891dd008f432fdf60ec1665483544c508ff3562..04f8ca62003b7b23208bbab81ec1a88803c204ee 100644 (file)
@@ -3979,6 +3979,7 @@ instantiate_virtual_regs_1 (loc, object, extra_insns)
        }
 
       /* Fall through to generic unary operation case.  */
+    case PREFETCH:
     case SUBREG:
     case STRICT_LOW_PART:
     case NEG:          case NOT:
index 6c887bce15c547cab34daa9fb916ca4760be190f..786b940003aa71e3fd0ee9217fe51c100d05ac2d 100644 (file)
@@ -514,6 +514,17 @@ DEF_RTL_EXPR(ADDR_VEC, "addr_vec", "E", 'x')
      
 DEF_RTL_EXPR(ADDR_DIFF_VEC, "addr_diff_vec", "eEee0", 'x')
 
+/* Memory prefetch, with attributes supported on some targets.
+   Operand 1 is the address of the memory to fetch.
+   Operand 2 is 1 for a write access, 0 otherwise.
+   Operand 3 is the level of temporal locality; 0 means there is no
+   temporal locality and 1, 2, and 3 are for increasing levels of temporal
+   locality.
+
+   The attributes specified by operands 2 and 3 are ignored for targets
+   whose prefetch instructions do not support them.  */
+DEF_RTL_EXPR(PREFETCH, "prefetch", "eee", 'x')
+
 /* ----------------------------------------------------------------------
    At the top level of an instruction (perhaps under PARALLEL).
    ---------------------------------------------------------------------- */
index eb79fe95476b6bc59be636b4f0c0c4908e847f78..07c467659cdb964ec6229216c1791979ff7d263a 100644 (file)
@@ -569,6 +569,9 @@ reg_referenced_p (x, body)
     case TRAP_IF:
       return reg_overlap_mentioned_p (x, TRAP_CONDITION (body));
 
+    case PREFETCH:
+      return reg_overlap_mentioned_p (x, XEXP (body, 0));
+
     case UNSPEC:
     case UNSPEC_VOLATILE:
       for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
@@ -1456,6 +1459,10 @@ note_uses (pbody, fun, data)
       (*fun) (&TRAP_CONDITION (body), data);
       return;
 
+    case PREFETCH:
+      (*fun) (&XEXP (body, 0), data);
+      return;
+
     case UNSPEC:
     case UNSPEC_VOLATILE:
       for (i = XVECLEN (body, 0) - 1; i >= 0; i--)
index 7c1134f5a0206a5b18492491102dbd2b46ec58ce..bf7f968f06d3fb9b831b9cdfaaf68ba83442af63 100644 (file)
@@ -474,6 +474,12 @@ print_exp (buf, x, verbose)
       fun = "trap_if";
       op[0] = TRAP_CONDITION (x);
       break;
+    case PREFETCH:
+      fun = "prefetch";
+      op[0] = XEXP (x, 0);
+      op[1] = XEXP (x, 1);
+      op[2] = XEXP (x, 2);
+      break;
     case UNSPEC:
     case UNSPEC_VOLATILE:
       {
index 62e59e80bfce4297d4bc1c2745cd2c4475af6bdf..cd37b2fc91032b7d064e1b01deeffb6a34a111d0 100644 (file)
@@ -373,6 +373,7 @@ find_inherently_necessary (x)
       {  
       case CALL_INSN:
       case BARRIER:
+      case PREFETCH:
        return !0;
       case CODE_LABEL:
       case NOTE: