/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "precompiled.hpp"
#include "compiler/compileLog.hpp"
#include "libadt/vectset.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/addnode.hpp"
#include "opto/callnode.hpp"
#include "opto/divnode.hpp"
#include "opto/matcher.hpp"
#include "opto/memnode.hpp"
#include "opto/mulnode.hpp"
#include "opto/opcodes.hpp"
#include "opto/superword.hpp"
#include "opto/vectornode.hpp"
//
// S U P E R W O R D T R A N S F O R M
//=============================================================================
//------------------------------SuperWord---------------------------
{}
//------------------------------transform_loop---------------------------
// Do vectors exist on this architecture?
// Check for no control flow in body (other than exit)
// Make sure the are no extra control users of the loop backedge
return;
}
// Check for pre-loop ending with CountedLoopEnd(Bool(Cmp(x,Opaque1(limit))))
init(); // initialize data structures
// For now, define one block which is the entire loop body
SLP_extract();
}
//------------------------------SLP_extract---------------------------
// Extract the superword level parallelism
//
// 1) A reverse post-order of nodes in the block is constructed. By scanning
// this list from first to last, all definitions are visited before their uses.
//
// 2) A point-to-point dependence graph is constructed between memory references.
// This simplies the upcoming "independence" checker.
//
// 3) The maximum depth in the node graph from the beginning of the block
// to each node is computed. This is used to prune the graph search
// in the independence checker.
//
// 4) For integer types, the necessary bit width is propagated backwards
// from stores to allow packed operations on byte, char, and short
// integers. This reverses the promotion to type "int" that javac
// did for operations like: char c1,c2,c3; c1 = c2 + c3.
//
// 5) One of the memory references is picked to be an aligned vector reference.
// The pre-loop trip count is adjusted to align this reference in the
// unrolled body.
//
// 6) The initial set of pack pairs is seeded with memory references.
//
// 7) The set of pack pairs is extended by following use->def and def->use links.
//
// 8) The pairs are combined into vector sized packs.
//
// 9) Reorder the memory slices to co-locate members of the memory packs.
//
// 10) Generate ideal vector nodes for the final set of packs and where necessary,
// inserting scalar promotion, vector creation from multiple scalars, and
// extraction of scalar values from vectors.
//
// Ready the block
if (!construct_bb())
return; // Exit if no interesting nodes or complex graph.
// Attempt vectorization
filter_packs();
schedule();
output();
}
//------------------------------find_adjacent_refs---------------------------
// Find the adjacent memory references and create pack pairs for them.
// This is the initial set of packs that will then be extended by
// following use->def and def->use links. The align positions are
// assigned relative to the reference "align_to_ref"
// Get list of memory operations
if (align != bottom_align) {
}
}
}
int best_iv_adjustment = 0;
// Find a memory reference to align to.
if (best_align_to_mem_ref == NULL) {
// Set memory reference which is the best from all memory operations
// to be used for alignment. The pre-loop trip count is modified to align
// this reference to a vector-aligned address.
}
// Set alignment relative to "align_to_ref" for all related memory operations.
if (isomorphic(s, mem_ref)) {
set_alignment(s, align);
}
}
}
// Create initial pack pairs of memory operations for which
// alignment is set and vectors will be aligned.
bool create_pack = true;
if (!Matcher::misaligned_vectors_ok()) {
// Do not vectorize a memory access with more elements per vector
// if unaligned memory access is not allowed because number of
// iterations in pre-loop will be not enough to align it.
create_pack = false;
}
}
} else {
// Can't allow vectorization of unaligned memory accesses with the
// same type since it could be overlapped accesses to the same array.
create_pack = false;
} else {
// Allow independent (different type) unaligned memory operations
// if HW supports them.
if (!Matcher::misaligned_vectors_ok()) {
create_pack = false;
} else {
// Check if packs of the same memory type but
// with a different alignment were created before.
create_pack = false;
}
}
}
}
if (create_pack) {
}
}
}
}
} else { // Don't create unaligned pack
// First, remove remaining memory ops of the same type from the list.
if (same_velt_type(s, mem_ref)) {
}
}
// Second, remove already constructed packs of the same type.
if (same_velt_type(s, mem_ref)) {
remove_pack_at(i);
}
}
// If needed find the best memory reference for loop alignment again.
// Put memory ops from remaining packs back on memops list for
// the best alignment search.
}
if (best_align_to_mem_ref == NULL) break;
// Restore list.
}
} // unaligned memory accesses
// Remove used mem nodes.
}
}
} // while (memops.size() != 0
#ifndef PRODUCT
if (TraceSuperWord) {
}
#endif
}
//------------------------------find_align_to_ref---------------------------
// Find a memory reference to align the loop induction variable to.
// Looks first at stores then at loads, looking for a memory reference
// with the largest number of references similar to it.
// Count number of comparable memory ops
// Discard if pre loop can't align this reference
if (!ref_is_alignable(p1)) {
continue;
}
}
}
}
}
// Find Store (or Load) with the greatest number of "comparable" references,
// biggest vector size, smallest data size and smallest iv offset.
int max_ct = 0;
int max_vw = 0;
if (s->is_Store()) {
SWPointer p(s, this);
(p.offset_in_bytes() < min_iv_offset)))) {
max_idx = j;
min_iv_offset = p.offset_in_bytes();
}
}
}
// If no stores, look at loads
if (max_ct == 0) {
if (s->is_Load()) {
SWPointer p(s, this);
(p.offset_in_bytes() < min_iv_offset)))) {
max_idx = j;
min_iv_offset = p.offset_in_bytes();
}
}
}
}
#ifdef ASSERT
if (TraceSuperWord && Verbose) {
s->dump();
}
}
#endif
if (max_ct > 0) {
#ifdef ASSERT
if (TraceSuperWord) {
}
#endif
}
return NULL;
}
//------------------------------ref_is_alignable---------------------------
// Can the preloop align the reference to position zero in the vector?
if (!p.has_iv()) {
return true; // no induction variable
}
// Stride one accesses are alignable.
return true;
// If initial offset from start of object is computable,
// compute alignment within the vector.
if (span > 0) {
} else {
}
}
}
return false;
}
//---------------------------get_iv_adjustment---------------------------
// Calculate loop's iv adjustment for this memory ops.
// At least one iteration is executed in pre-loop by default. As result
// several iterations are needed to align memory operations in main-loop even
// if offset is 0.
#ifndef PRODUCT
if (TraceSuperWord)
#endif
return iv_adjustment;
}
//---------------------------dependence_graph---------------------------
// Construct dependency graph.
// A.out()->DependNode.in(1) and DependNode.out()->B.prec(x)
// First, assign a dependence node to each memory node
}
}
// For each memory slice, create the dependences
for (int i = 0; i < _mem_slice_head.length(); i++) {
// Get slice in predecessor order (last is first)
// Make the slice dependent on the root
// Create a sink for the slice
// Now visit each pair of memory ops, creating the edges
// If no dependency yet, use slice
}
bool sink_dependent = true;
for (int k = j - 1; k >= 0; k--) {
continue;
if (SuperWordRTDepCheck &&
// Create a runtime check to disambiguate
// Possibly same address
sink_dependent = false;
}
}
if (sink_dependent) {
}
}
#ifndef PRODUCT
if (TraceSuperWord) {
}
}
#endif
}
#ifndef PRODUCT
if (TraceSuperWord) {
for (int r = 0; r < _disjoint_ptrs.length(); r++) {
}
}
#endif
}
//---------------------------mem_slice_preds---------------------------
// Return a memory slice (node list) in predecessor order starting at "start"
while (true) {
}
} else {
// FIXME
// Either unrolling is causing a memory edge not to disappear,
// or need to run igvn.optimize() again before SLP
// Ditto. Not sure what else to check further.
// StoreCM has an input edge used as a precedence edge.
// Maybe an issue when oop stores are vectorized.
} else {
}
}
}
if (n == stop) break;
prev = n;
}
}
//------------------------------stmts_can_pack---------------------------
// Can s1 and s2 be in a pack with s1 immediately preceding s2 and
// s1 aligned at "align"
// Do not use superword for non-primitives
return false;
return false; // No vectors for this type
}
return true;
}
}
}
}
}
}
return false;
}
//------------------------------exists_at---------------------------
// Does s exist in a pack at position pos?
return true;
}
}
return false;
}
//------------------------------are_adjacent_refs---------------------------
// Is s1 immediately before s2 in memory?
// Do not use superword for non-primitives
return false;
}
// FIXME - co_locate_pack fails on Stores in different mem-slices, so
// only pack memops that are in the same alias set until that's fixed.
return false;
}
//------------------------------isomorphic---------------------------
// Are s1 and s2 similar?
return true;
}
//------------------------------independent---------------------------
// Is there no data path from s1 to s2 or s2 to s1?
// assert(s1->Opcode() == s2->Opcode(), "check isomorphic first");
}
//------------------------------independent_path------------------------------
// Helper for independent
return false;
}
return false;
}
}
}
return true;
}
//------------------------------set_alignment---------------------------
} else {
}
}
//------------------------------data_size---------------------------
return bsize;
}
//------------------------------extend_packlist---------------------------
// Extend packset by following use->def and def->use links from pack members.
bool changed;
do {
changed = false;
changed |= follow_use_defs(p);
changed |= follow_def_uses(p);
}
} while (changed);
#ifndef PRODUCT
if (TraceSuperWord) {
}
#endif
}
//------------------------------follow_use_defs---------------------------
// Extend the packset by visiting operand definitions of nodes in pack p
bool changed = false;
continue;
changed = true;
}
}
}
return changed;
}
//------------------------------follow_def_uses---------------------------
// Extend the packset by visiting uses of nodes in pack p
bool changed = false;
continue;
if (my_savings > savings) {
}
}
}
}
if (savings >= 0) {
changed = true;
}
return changed;
}
//---------------------------opnd_positions_match-------------------------
// Is the use of d1 in u1 at the same operand position as d2 in u2?
do {
// Further analysis relies on operands position matching.
} else {
return false;
}
}
return true;
}
//------------------------------est_savings---------------------------
// Estimate the savings from executing s1 and s2 as a pack
// inputs
} else {
}
}
}
// uses of result
int save_use = 0;
ct++;
}
}
}
}
}
}
}
//------------------------------costs---------------------------
//------------------------------combine_packs---------------------------
// Combine packs A and B with A.last == B.first into A.first..,A.last,B.second,..B.last
bool changed = true;
// Combine packs regardless max vector size.
while (changed) {
changed = false;
if (i == j) continue;
}
changed = true;
}
}
}
}
// Split packs which have size greater then max vector size.
if (!is_power_of_2(psize)) {
// Skip pack which can't be vector.
// case1: for(...) { a[i] = i; } elements values are different (i+x)
// case2: for(...) { a[i] = b[i+1]; } can't align both, load and store
continue;
}
}
}
}
}
}
// Compress list.
}
}
#ifndef PRODUCT
if (TraceSuperWord) {
}
#endif
}
//-----------------------------construct_my_pack_map--------------------------
// Construct the map from nodes to packs. Only valid after the
// point where a node is only in one pack (after combine_packs).
set_my_pack(s, p);
}
}
}
//------------------------------filter_packs---------------------------
// Remove packs that are not implemented or not profitable.
// Remove packs that are not implemented
if (!impl) {
#ifndef PRODUCT
if (TraceSuperWord && Verbose) {
}
#endif
remove_pack_at(i);
}
}
// Remove packs that are not profitable
bool changed;
do {
changed = false;
if (!prof) {
#ifndef PRODUCT
if (TraceSuperWord && Verbose) {
}
#endif
remove_pack_at(i);
changed = true;
}
}
} while (changed);
#ifndef PRODUCT
if (TraceSuperWord) {
}
#endif
}
//------------------------------implemented---------------------------
// Can code be generated for pack p?
}
//------------------------------same_inputs--------------------------
// For pack p, are all idx operands the same?
return false;
}
return true;
}
//------------------------------profitable---------------------------
// For pack p, are all operands and all uses (with in the block) vector?
// Return false if some inputs are not vectors or vectors with different
// size or alignment.
// Also, for now, return false if not scalar promotion case when inputs are
// the same. Later, implement PackNode and allow differing, non-vector inputs
// (maybe just the ones from outside the block.)
if (!is_vector_use(p0, i))
return false;
}
// For now, return false if shift count is vector or not scalar promotion
// case (different shift counts) because it is not supported yet.
return false;
if (!same_inputs(p, 2))
return false;
}
// For now, return false if not all uses are vector.
// Later, implement ExtractNode and allow non-vector uses (maybe
// just the ones outside the block.)
if (def == n) {
if (!is_vector_use(use, k)) {
return false;
}
}
}
}
}
}
return true;
}
//------------------------------schedule---------------------------
// Adjust the memory graph for the packed operations
// Co-locate in the memory graph the members of each memory pack
}
}
//-------------------------------remove_and_insert-------------------
// Remove "current" from its current position in the memory graph and insert
// it after the appropriate insertion point (lip or uip).
// remove current_store from its current position in the memmory graph
--i; //deleted this edge; rescan position
if (!sched_up) { // Will be moved together with current
--i; //deleted this edge; rescan position
}
} else {
if (sched_up) { // Will be moved together with current
--i; //deleted this edge; rescan position
}
}
}
}
// all uses of insert_pt's memory state should use current's instead
--i; //deleted this edge; rescan position
}
--i;
}
}
//connect current to insert_pt
}
//------------------------------co_locate_pack----------------------------------
// To schedule a store pack, we need to move any sandwiched memory ops either before
// or after the pack, based upon dependence information:
// (1) If any store in the pack depends on the sandwiched memory op, the
// sandwiched memory op must be scheduled BEFORE the pack;
// (2) If a sandwiched memory op depends on any store in the pack, the
// sandwiched memory op must be scheduled AFTER the pack;
// (3) If a sandwiched memory op (say, memA) depends on another sandwiched
// memory op (say memB), memB must be scheduled before memA. So, if memA is
// scheduled before the pack, memB must also be scheduled before the pack;
// (4) If there is no dependence restriction for a sandwiched memory op, we simply
// schedule this store AFTER the pack
// (5) We know there is no dependence cycle, so there in no other case;
// (6) Finally, all memory ops in another single pack should be moved in the same direction.
//
// To schedule a load pack, we use the memory state of either the first or the last load in
// the pack, based on the dependence constraint.
while (true) {
}
}
// determine which memory operations should be scheduled before the pack
for (uint j = 0; j< i; j++) {
}
}
break;
}
}
}
}
}
// Following code moves loads connected to upper_insert_pt below aliased stores.
// Collect such loads here and reconnect them back to upper_insert_pt later.
}
// start scheduling from "last" to "first"
while (true) {
// Forward users of my memory state (except "previous) to my input memory state
} else {
}
--i; // deleted this edge; rescan position
}
}
} else { // !in_pack(current, pk) ==> a sandwiched store
}
} // end while
// Reconnect loads back to upper_insert_pt.
}
}
// all loads in the pack should have the same memory state. By default,
// we use the memory state of the last load. However, if any load could
// not be moved down due to the dependence constraint, we use the memory
// state of the first load.
bool schedule_last = true;
schedule_last = false; // a later store depends on this load
break;
}
}
}
// Give each load the same memory state
}
}
}
//------------------------------output---------------------------
// Convert packs into vector node operations
#ifndef PRODUCT
if (TraceLoopOpts) {
}
#endif
// MUST ENSURE main loop's initial value is properly aligned:
// (iv_initial_value + min_iv_offset) % vector_width_in_bytes() == 0
// Insert extract (unpack) operations for scalar uses
}
if (p && n == executed_last(p)) {
if (n->is_Load()) {
} else if (n->is_Store()) {
// Promote value to be stored to vector
} else if (n->req() == 3) {
// Promote operands to vector
// Move invariant vector input into second position to avoid register spilling.
}
} else {
}
}
if (vlen_in_bytes > max_vlen_in_bytes) {
}
#ifdef ASSERT
if (TraceNewVectors) {
}
#endif
}
}
}
//------------------------------vector_opd---------------------------
// Create a vector operand for the nodes in pack p for operand: in(opd_idx)
if (same_inputs(p, opd_idx)) {
return opd; // input is matching vector
}
// Vector instructions do not mask shift count, do it here.
}
} else {
}
// Move non constant shift count into vector register.
}
}
return cnt;
}
// Convert scalar input to vector with the same number of elements as
// p0's vector. Use p0's type because size of operand's container in
// vector should match p0's size regardless operand's size.
#ifdef ASSERT
if (TraceNewVectors) {
}
#endif
return vn;
}
// Insert pack operation
}
#ifdef ASSERT
if (TraceNewVectors) {
}
#endif
return pk;
}
//------------------------------insert_extracts---------------------------
// If a use of pack p is not a vector use, then replace the
// use with an extract operation.
// Inspect each use of each pack member. For each use that is
// not a vector use, replace the use with an extract operation.
if (def == n) {
if (!is_vector_use(use, k)) {
}
}
}
}
}
while (_n_idx_list.is_nonempty()) {
_n_idx_list.pop();
// Insert extract operation
}
}
//------------------------------is_vector_use---------------------------
// Is use->in(u_idx) a vector use?
// check for scalar promotion
}
return true;
}
return false;
return false;
}
return true;
}
//------------------------------construct_bb---------------------------
// Construct reverse postorder list of block members
// Find non-control nodes with no inputs from within block,
// create a temporary map from node _idx to bb_idx for use
// by the visited and post_visited sets,
// and count number of nodes in block.
int bb_ct = 0;
set_bb_idx(n, i); // Create a temporary map
if (in_bb(n)) {
if (n->is_LoadStore() || n->is_MergeMem() ||
// Bailout if the loop has LoadStore, MergeMem or data Proj
// nodes. Superword optimization does not work with them.
return false;
}
bb_ct++;
if (!n->is_CFG()) {
bool found = false;
found = true;
break;
}
}
if (!found) {
_data_entry.push(n);
}
}
}
}
// Find memory slices (head and tail)
return false; // Bailout
}
_mem_slice_head.push(n);
}
}
}
// Create an RPO list of nodes in block
// Push all non-control nodes with no inputs from within block, then control entry
for (int j = 0; j < _data_entry.length(); j++) {
visited_set(n);
}
// Do a depth first walk over out edges
int size;
if (!visited_test_set(n)) {
// forward arc in graph
} else if (!post_visited_test(n)) {
// cross or back arc
// Don't go around backedge
}
}
// There were no additional uses, post visit node now
rpo_idx--;
post_visited_set(n);
}
} else {
}
}
// Create real map of block indices for nodes
set_bb_idx(n, j);
}
initialize_bb(); // Ensure extra info is allocated.
#ifndef PRODUCT
if (TraceSuperWord) {
print_bb();
for (int m = 0; m < _data_entry.length(); m++) {
}
for (int m = 0; m < _mem_slice_head.length(); m++) {
}
}
#endif
}
//------------------------------initialize_bb---------------------------
// Initialize per node info
}
//------------------------------bb_insert_after---------------------------
// Insert n into block after pos
// Make room
}
}
// Set value
// Adjust map from node->_idx to _block index
}
}
//------------------------------compute_max_depth---------------------------
// Compute max depth for expressions from beginning of block
// Use to prune search paths during test for independence.
int ct = 0;
bool again;
do {
again = false;
if (!n->is_Phi()) {
int d_in = 0;
}
}
again = true;
}
}
}
ct++;
} while (again);
#ifndef PRODUCT
if (TraceSuperWord && Verbose)
#endif
}
//-------------------------compute_vector_element_type-----------------------
// Compute necessary vector element type for expressions
// This propagates backwards a narrower integer type when the
// upper bits of the value are not needed.
// Example: char a,b,c; a = b + c;
// Normally the type of the add is integer, but for packed character
// operations the type of the add needs to be char.
#ifndef PRODUCT
if (TraceSuperWord && Verbose)
#endif
// Initial type
set_velt_type(n, container_type(n));
}
// Propagate integer narrowed type backwards through operations
// that don't depend on higher order bits
// Only integer types need be examined
// Don't propagate through a memory
bool same_type = true;
same_type = false;
break;
}
}
if (same_type) {
// For right shifts of small integer types (bool, byte, char, short)
// we need precise information about sign-ness. Only Load nodes have
// this information because Store nodes are the same for signed and
// unsigned values. And any arithmetic operation after a load may
// expand a value to signed Int so such right shifts can't be used
// because vector elements do not have upper bits of Int.
// Widen type to Int to avoid creation of right shift vector
// (align + data_size(s1) check in stmts_can_pack() will fail).
// Note, left shifts work regardless type.
}
}
}
}
}
}
}
#ifndef PRODUCT
if (TraceSuperWord && Verbose) {
n->dump();
}
}
#endif
}
//------------------------------memory_alignment---------------------------
// Alignment within a vector memory reference
SWPointer p(s, this);
if (!p.valid()) {
return bottom_align;
}
if (vw < 2) {
return bottom_align; // No vectors for this type
}
return off_mod;
}
//---------------------------container_type---------------------------
// Smallest type containing range of values
if (n->is_Mem()) {
// Use T_SHORT type instead of T_CHAR for stored values because any
// preceding arithmetic operation extends values to signed Int.
}
// Adjust type for unsigned byte loads, it is important for right shifts.
// T_BOOLEAN is used because there is no basic type representing type
// TypeInt::UBYTE. Use of T_BOOLEAN for vectors is fine because only
// size (one byte) and sign is important.
}
}
if (t->basic_type() == T_INT) {
// A narrow type of arithmetic operations will be determined by
// propagating the type of memory operations.
}
return t;
}
// Compare vectors element sizes for integer types.
}
}
//------------------------------in_packset---------------------------
// Are s1 and s2 in a pack pair and ordered as s1,s2?
return true;
}
}
return false;
}
//------------------------------in_pack---------------------------
// Is s in pack p?
if (p->at(i) == s) {
return p;
}
}
return NULL;
}
//------------------------------remove_pack_at---------------------------
// Remove the pack at position pos in the packset
set_my_pack(s, NULL);
}
}
//------------------------------executed_first---------------------------
// Return the node executed first in pack p. Uses the RPO block list
// to determine order.
n = s;
}
}
return n;
}
//------------------------------executed_last---------------------------
// Return the node executed last in pack p.
n = s;
}
}
return n;
}
//----------------------------align_initial_loop_index---------------------------
// to align_to_ref will be a position zero in the vector.
// (iv + k) mod vector_align == 0
// Where we put new limit calculations
// Ensure the original loop limit is available from the
// pre-loop Opaque1 node.
// Given:
// lim0 == original pre loop limit
// V == v_align (power of 2)
// invar == extra invariant piece of the address expression
// e == offset [ +/- invar ]
//
// When reassociating expressions involving '%' the basic rules are:
// (a - b) % k == 0 => a % k == b % k
// and:
// (a + b) % k == 0 => a % k == (k - b) % k
//
// For stride > 0 && scale > 0,
// Derive the new pre-loop limit "lim" such that the two constraints:
// (1) lim = lim0 + N (where N is some positive integer < V)
// (2) (e + lim) % V == 0
// are true.
//
// Substituting (1) into (2),
// (e + lim0 + N) % V == 0
// solve for N:
// N = (V - (e + lim0)) % V
// substitute back into (1), so that new limit
// lim = lim0 + (V - (e + lim0)) % V
//
// For stride > 0 && scale < 0
// Constraints:
// lim = lim0 + N
// (e - lim) % V == 0
// Solving for lim:
// (e - lim0 - N) % V == 0
// N = (e - lim0) % V
// lim = lim0 + (e - lim0) % V
//
// For stride < 0 && scale > 0
// Constraints:
// lim = lim0 - N
// (e + lim) % V == 0
// Solving for lim:
// (e + lim0 - N) % V == 0
// N = (e + lim0) % V
// lim = lim0 - (e + lim0) % V
//
// For stride < 0 && scale < 0
// Constraints:
// lim = lim0 - N
// (e - lim) % V == 0
// Solving for lim:
// (e - lim0 + N) % V == 0
// N = (V - (e - lim0)) % V
// lim = lim0 - (V - (e - lim0)) % V
// incorporate any extra invariant piece producing (offset +/- invar) >>> log2(elt)
if (align_to_ref_p.negate_invar()) {
} else {
}
}
if (vw > ObjectAlignmentInBytes) {
// incorporate base e +/- base && Mask >>> log2(elt)
#ifdef _LP64
#endif
}
// compute e +/- lim0
if (scale < 0) {
} else {
}
// compute V - (e +/- lim0)
}
// compute N = (exp) % V
// substitute back into (1), so that new limit
// lim = lim0 + N
if (stride < 0) {
} else {
}
}
//----------------------------get_pre_loop_end---------------------------
// Find pre loop end from main loop. Returns null if none.
return pre_end;
}
//------------------------------init---------------------------
_data_entry.clear();
_node_info.clear();
}
//------------------------------print_packset---------------------------
#ifndef PRODUCT
print_pack(p);
}
#endif
}
//------------------------------print_pack---------------------------
print_stmt(p->at(i));
}
}
//------------------------------print_bb---------------------------
#ifndef PRODUCT
if (n) {
n->dump();
}
}
#endif
}
//------------------------------print_stmt---------------------------
#ifndef PRODUCT
s->dump();
#endif
}
//------------------------------blank---------------------------
return blanks;
}
//==============================SWPointer===========================
//----------------------------SWPointer------------------------
return;
}
// Match AddP(base, AddP(ptr, k*iv [+ invariant]), constant)
//unsafe reference could not be aligned appropriately without runtime checking
return;
}
for (int i = 0; i < 3; i++) {
return;
}
break; // stop looking at addp's
}
}
}
// Following is used to create a temporary object during
// the pattern match of an address expression.
//------------------------scaled_iv_plus_offset--------------------
// Match: k*iv + offset
// where: k is a constant that maybe zero, and
// offset is (k2 [+/- invariant]) where k2 maybe zero and invariant is optional
if (scaled_iv(n)) {
return true;
}
if (offset_plus_k(n)) {
return true;
}
return true;
}
return true;
}
return true;
}
_scale *= -1;
return true;
}
}
return false;
}
//----------------------------scaled_iv------------------------
// Match: k*iv where k is a constant that's not zero
if (_scale != 0) {
return false; // already found a scale
}
if (n == iv()) {
_scale = 1;
return true;
}
return true;
return true;
}
} else if (opc == Op_LShiftI) {
return true;
}
} else if (opc == Op_ConvI2L) {
return true;
}
} else if (opc == Op_LShiftL) {
// Need to preserve the current _offset value, so
// create a temporary object for this expression subtree.
// Hacky, so should re-engineer the address pattern match.
return true;
}
}
}
}
return false;
}
//----------------------------offset_plus_k------------------------
// Match: offset is (k [+/- invariant])
// where k maybe zero and invariant is optional, but not both.
return true;
// Okay if value fits into an int
const TypeLong* t = n->find_long_type();
return true;
}
return false;
}
return true;
return true;
}
}
return true;
_negate_invar = !negate;
return true;
}
}
if (invariant(n)) {
_invar = n;
return true;
}
return false;
}
//----------------------------print------------------------
#ifndef PRODUCT
#endif
}
// ========================= OrderedPair =====================
// ========================= SWNodeInfo =====================
// ============================ DepGraph ===========================
//------------------------------make_node---------------------------
// Make a new dependence graph node for an ideal node.
}
return m;
}
//------------------------------make_edge---------------------------
// Make a new dependence graph edge from dpred -> dsucc
dpred->set_out_head(e);
dsucc->set_in_head(e);
return e;
}
// ========================== DepMem ========================
//------------------------------in_cnt---------------------------
int ct = 0;
return ct;
}
//------------------------------out_cnt---------------------------
int ct = 0;
return ct;
}
//------------------------------print-----------------------------
#ifndef PRODUCT
}
}
#endif
}
// =========================== DepEdge =========================
//------------------------------DepPreds---------------------------
#ifndef PRODUCT
#endif
}
// =========================== DepPreds =========================
// Iterator over predecessor edges in the dependence graph.
//------------------------------DepPreds---------------------------
_n = n;
_done = false;
_next_idx = 0;
_end_idx = 0;
} else {
_next_idx = 1;
}
next();
}
//------------------------------next---------------------------
} else {
_done = true;
}
}
// =========================== DepSuccs =========================
// Iterator over successor edges in the dependence graph.
//------------------------------DepSuccs---------------------------
_n = n;
_done = false;
_next_idx = 0;
_next_idx = 0;
_end_idx = 0;
} else {
_next_idx = 0;
}
next();
}
//-------------------------------next---------------------------
} else {
_done = true;
}
}