diff libinterp/parse-tree/jit-ir.cc @ 29654:d13d090cb03a stable

use std::size_t and std::ptrdiff_t in C++ code (bug #60471) Files affected: make_int.cc, file-editor-tab.cc, octave-qscintilla.cc, Cell.cc, Cell.h, call-stack.cc, call-stack.h, cellfun.cc, data.cc, debug.cc, dlmread.cc, error.cc, event-queue.h, fcn-info.cc, fcn-info.h, file-io.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, help.cc, hex2num.cc, input.cc, latex-text-renderer.cc, load-path.cc, load-save.cc, load-save.h, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat5.cc, ls-oct-text.cc, mex.cc, mexproto.h, mxarray.h, oct-map.cc, oct-stream.cc, oct-stream.h, pager.cc, pager.h, pr-output.cc, regexp.cc, settings.h, stack-frame.cc, stack-frame.h, strfns.cc, syminfo.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, sysdep.cc, toplev.cc, utils.cc, utils.h, variables.cc, __fltk_uigetfile__.cc, __init_fltk__.cc, audioread.cc, gzip.cc, cdef-class.cc, cdef-manager.cc, cdef-method.cc, cdef-object.cc, cdef-object.h, ov-base-diag.cc, ov-base-diag.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-fcn-handle.cc, ov-java.cc, ov-lazy-idx.h, ov-perm.cc, ov-perm.h, ov-range.h, ov-str-mat.cc, ov-struct.cc, ov-struct.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, octave.cc, bp-table.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.h, lex.h, lex.ll, oct-lvalue.cc, oct-parse.yy, parse.h, profiler.h, pt-eval.cc, pt-eval.h, pt-jit.cc, pt-jit.h, pt-pr-code.cc, pt-tm-const.cc, pt-tm-const.h, Array.h, CMatrix.cc, DiagArray2.h, PermMatrix.h, Sparse.h, dMatrix.cc, fCMatrix.cc, fMatrix.cc, bsxfun-defs.cc, oct-fftw.cc, oct-fftw.h, randpoisson.cc, sparse-chol.cc, mx-inlines.cc, file-ops.cc, lo-sysdep.cc, oct-env.cc, oct-time.cc, action-container.cc, action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-hist.cc, data-conv.cc, data-conv.h, f77-fcn.h, file-info.cc, file-info.h, kpse.cc, kpse.h, lo-cutils.h, lo-hash.h, lo-regexp.cc, oct-base64.cc, oct-base64.h, oct-binmap.h, oct-glob.cc, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sparse.h, oct-string.cc, quit.cc, unwind-prot.h, url-transfer.cc, main.in.cc, mkoctfile.in.cc, and shared-fcns.h. (grafted from aef11bb4e6d1f303ad9de5688fcb7244ef48867e)
author John W. Eaton <jwe@octave.org>
date Wed, 28 Apr 2021 22:57:42 -0400
parents 0a5b15007766
children
line wrap: on
line diff
--- a/libinterp/parse-tree/jit-ir.cc	Wed Apr 28 22:23:39 2021 -0400
+++ b/libinterp/parse-tree/jit-ir.cc	Wed Apr 28 22:57:42 2021 -0400
@@ -173,7 +173,7 @@
     while (first_use ())
       {
         jit_instruction *user = first_use ()->user ();
-        size_t idx = first_use ()->index ();
+        std::size_t idx = first_use ()->index ();
         user->stash_argument (idx, value);
       }
   }
@@ -226,9 +226,9 @@
   }
 
   void
-  jit_instruction::do_construct_ssa (size_t start, size_t end)
+  jit_instruction::do_construct_ssa (std::size_t start, std::size_t end)
   {
-    for (size_t i = start; i < end; ++i)
+    for (std::size_t i = start; i < end; ++i)
       {
         jit_value *arg = argument (i);
         jit_variable *var = dynamic_cast<jit_variable *> (arg);
@@ -377,13 +377,13 @@
   }
 
   jit_block *
-  jit_block::successor (size_t i) const
+  jit_block::successor (std::size_t i) const
   {
     jit_terminator *term = terminator ();
     return term->successor (i);
   }
 
-  size_t
+  std::size_t
   jit_block::successor_count (void) const
   {
     jit_terminator *term = terminator ();
@@ -408,7 +408,7 @@
     os << std::endl;
 
     os << "  successors: ";
-    for (size_t i = 0; i < successor_count (); ++i)
+    for (std::size_t i = 0; i < successor_count (); ++i)
       os << *successor (i) << ' ';
     os << std::endl;
 
@@ -424,14 +424,14 @@
     os << std::endl;
 
     os << "  m_dom_succ: ";
-    for (size_t i = 0; i < m_dom_succ.size (); ++i)
+    for (std::size_t i = 0; i < m_dom_succ.size (); ++i)
       os << *m_dom_succ[i] << ' ';
 
     return os << std::endl;
   }
 
   void
-  jit_block::compute_df (size_t avisit_count)
+  jit_block::compute_df (std::size_t avisit_count)
   {
     if (visited (avisit_count))
       return;
@@ -449,12 +449,12 @@
           }
       }
 
-    for (size_t i = 0; i < successor_count (); ++i)
+    for (std::size_t i = 0; i < successor_count (); ++i)
       successor (i)->compute_df (avisit_count);
   }
 
   bool
-  jit_block::update_idom (size_t avisit_count)
+  jit_block::update_idom (std::size_t avisit_count)
   {
     if (visited (avisit_count) || ! use_count ())
       return false;
@@ -488,7 +488,7 @@
   }
 
   void
-  jit_block::label (size_t avisit_count, size_t& number)
+  jit_block::label (std::size_t avisit_count, std::size_t& number)
   {
     if (visited (avisit_count))
       return;
@@ -513,7 +513,7 @@
   }
 
   std::ostream&
-  jit_block::print (std::ostream& os, size_t indent) const
+  jit_block::print (std::ostream& os, std::size_t indent) const
   {
     print_indent (os, indent);
     short_print (os) << ":        %pred = ";
@@ -541,7 +541,7 @@
     if (successor_count () > 1)
       {
         jit_terminator *term = terminator ();
-        size_t idx = term->successor_index (asuccessor);
+        std::size_t idx = term->successor_index (asuccessor);
         jit_block *split = factory.create<jit_block> ("phi_split", m_visit_count);
 
         // place after this to ensure define before use in the blocks list
@@ -564,7 +564,7 @@
   }
 
   void
-  jit_block::create_dom_tree (size_t avisit_count)
+  jit_block::create_dom_tree (std::size_t avisit_count)
   {
     if (visited (avisit_count))
       return;
@@ -572,7 +572,7 @@
     if (m_idom != this)
       m_idom->m_dom_succ.push_back (this);
 
-    for (size_t i = 0; i < successor_count (); ++i)
+    for (std::size_t i = 0; i < successor_count (); ++i)
       successor (i)->create_dom_tree (avisit_count);
   }
 
@@ -602,10 +602,10 @@
   jit_phi::prune (void)
   {
     jit_block *p = parent ();
-    size_t new_idx = 0;
+    std::size_t new_idx = 0;
     jit_value *unique = argument (1);
 
-    for (size_t i = 0; i < argument_count (); ++i)
+    for (std::size_t i = 0; i < argument_count (); ++i)
       {
         jit_block *inc = incoming (i);
         if (inc->branch_alive (p))
@@ -647,7 +647,7 @@
       return false;
 
     jit_type *infered = nullptr;
-    for (size_t i = 0; i < argument_count (); ++i)
+    for (std::size_t i = 0; i < argument_count (); ++i)
       {
         jit_block *inc = incoming (i);
         if (inc->branch_alive (p))
@@ -670,11 +670,11 @@
   }
 
   // -------------------- jit_terminator --------------------
-  size_t
+  std::size_t
   jit_terminator::successor_index (const jit_block *asuccessor) const
   {
-    size_t scount = successor_count ();
-    for (size_t i = 0; i < scount; ++i)
+    std::size_t scount = successor_count ();
+    for (std::size_t i = 0; i < scount; ++i)
       if (successor (i) == asuccessor)
         return i;
 
@@ -688,7 +688,7 @@
       return false;
 
     bool changed = false;
-    for (size_t i = 0; i < m_alive.size (); ++i)
+    for (std::size_t i = 0; i < m_alive.size (); ++i)
       if (! m_alive[i] && check_alive (i))
         {
           changed = true;
@@ -727,7 +727,7 @@
   jit_call::infer (void)
   {
     // FIXME: explain algorithm
-    for (size_t i = 0; i < argument_count (); ++i)
+    for (std::size_t i = 0; i < argument_count (); ++i)
       {
         m_already_infered[i] = argument_type (i);
         if (! m_already_infered[i])
@@ -768,7 +768,7 @@
   }
 
   std::ostream&
-  jit_error_check::print (std::ostream& os, size_t indent) const
+  jit_error_check::print (std::ostream& os, std::size_t indent) const
   {
     print_indent (os, indent) << "error_check " << variable_to_string (m_variable)
                               << ", ";
@@ -781,7 +781,7 @@
 
   // -------------------- jit_magic_end --------------------
   jit_magic_end::context::context (jit_factory& factory, jit_value *avalue,
-                                   size_t aindex, size_t acount)
+                                   std::size_t aindex, std::size_t acount)
     : m_value (avalue), m_index (factory.create<jit_const_index> (aindex)),
       m_count (factory.create<jit_const_index> (acount))
   { }
@@ -791,7 +791,7 @@
   {
     resize_arguments (m_contexts.size ());
 
-    size_t i;
+    std::size_t i;
     std::vector<context>::const_iterator iter;
     for (iter = m_contexts.begin (), i = 0; iter != m_contexts.end (); ++iter, ++i)
       stash_argument (i, iter->m_value);
@@ -800,7 +800,7 @@
   jit_magic_end::context
   jit_magic_end::resolve_context (void) const
   {
-    size_t idx;
+    std::size_t idx;
     for (idx = 0; idx < m_contexts.size (); ++idx)
       {
         jit_type *ctx_type = m_contexts[idx].m_value->type ();
@@ -830,7 +830,7 @@
   }
 
   std::ostream&
-  jit_magic_end::print (std::ostream& os, size_t indent) const
+  jit_magic_end::print (std::ostream& os, std::size_t indent) const
   {
     context ctx = resolve_context ();
     short_print (print_indent (os, indent)) << " (" << *ctx.m_value << ", ";