/* * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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. *
*/
// ValueMap implements nested hash tables for value numbering. It // maintains a set _killed_values which represents the instructions // which have been killed so far and an array of linked lists of // ValueMapEntries names _entries. Each ValueMapEntry has a nesting // which indicates what ValueMap nesting it belongs to. Higher // nesting values are always before lower values in the linked list. // This allows cloning of parent ValueMaps by simply copying the heads // of the list. _entry_count represents the number of reachable // entries in the ValueMap. A ValueMap is only allowed to mutate // ValueMapEntries with the same nesting level. Adding or removing // entries at the current nesting level requires updating // _entry_count. Elements in the parent's list that get killed can be // skipped if they are at the head of the list by simply moving to the // next element in the list and decrementing _entry_count.
class ValueMap: public CompilationResourceObj { private: int _nesting;
ValueMapEntryArray _entries;
ValueSet _killed_values; int _entry_count;
int entry_count() { return _entry_count; } int size() { return _entries.length(); }
ValueMapEntry* entry_at(int i) { return _entries.at(i); }
// calculates the index of a hash value in a hash table of size n int entry_index(intx hash, int n) { return (unsignedint)hash % n; }
// if entry_count > size_threshold, the size of the hash table is increased int size_threshold() { return size(); }
// management of the killed-bitset for global value numbering void kill_value(Value v) { if (is_global_value_numbering()) _killed_values.put(v); } bool is_killed(Value v) { if (is_global_value_numbering()) return _killed_values.contains(v); elsereturnfalse; }
class GlobalValueNumbering: public ValueNumberingVisitor { private:
Compilation* _compilation; // compilation data
ValueMap* _current_map; // value map of current block
ValueMapArray _value_maps; // list of value maps for all blocks
ValueSet _processed_values; // marker for instructions that were already processed bool _has_substitutions; // set to true when substitutions must be resolved
// main entry point that performs global value numbering
GlobalValueNumbering(IR* ir); void substitute(Instruction* instr); // substitute instruction if it is contained in current value map
};
#endif// SHARE_C1_C1_VALUEMAP_HPP
¤ Dauer der Verarbeitung: 0.18 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.