forms.hpp revision 0
0N/A * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A// DEFINITIONS OF LEGAL ATTRIBUTE TYPES 0N/A// DEFINITIONS OF LEGAL CONSTRAINT TYPES 0N/A//------------------------------FormDict--------------------------------------- 0N/A// Dictionary containing Forms, and objects derived from forms 0N/A // Disable public use of constructor, copy-ctor, operator =, operator == 0N/A // == compares two dictionaries; they must have the same keys (their keys 0N/A // must match using CmpKey) and they must have the same values (pointer 0N/A // comparison). If so 1 is returned, if not 0 is returned. 0N/A bool operator ==(
const FormDict &d)
const;
// Compare dictionaries for equal 0N/A // cmp is a key comparision routine. hash is a routine to hash a key. 0N/A // FormDict( CmpKey cmp, Hash hash ); 0N/A // Return # of key-value pairs in dict 0N/A // Insert inserts the given key-value pair into the dictionary. The prior 0N/A // value of the key is returned; NULL if the key was not previously defined. 0N/A // Find finds the value of a given key; or NULL if not found. 0N/A // The dictionary is NOT changed. 0N/A const Form *
operator [](
const char *
name)
const;
// Do a lookup 0N/A// ***** Master Class for ADL Parser Forms ***** 0N/A//------------------------------Form------------------------------------------- 0N/A int _ftype;
// Indicator for derived class type 0N/A // Dynamic type check for common forms. 0N/A // Check if this form is an operand usable for cisc-spilling 0N/A // Check constraints after parsing 0N/A // Write info to output files 0N/A // ADLC types, match the last character on ideal operands and instructions 0N/A // Convert ideal name to a DataType, return DataType::none if not a 'ConX' 0N/A // Convert ideal name to a DataType, return DataType::none if not a 'sRegX 0N/A // Convert ideal name to a DataType, return DataType::none if not a 'RegX 0N/A // Convert ideal name to a DataType, return DataType::none if not a 'LoadX 0N/A // Convert ideal name to a DataType, return DataType::none if not a 'StoreX 0N/A // ADLC call types, matched with ideal world 0N/A // Interface types for operands and operand classes 0N/A//------------------------------FormList--------------------------------------- 0N/A // Second iterator, state is internal 0N/A//------------------------------NameList--------------------------------------- 0N/A// Extendable list of pointers, <char *> 0N/A int _cur;
// Insert next entry here; count of entries 0N/A int _max;
// Number of spaces allocated 0N/A static const char *
_signal;
// reserved user-defined string 0N/A const char *
iter();
// after reset(), first element : else next 0N/A const char *
current();
// return current element in iteration. 0N/A bool search(
const char *);
// Search for a name in the list 0N/A int index(
const char *);
// Return index of name in list 0N/A// Convenience class to preserve iteration state since iterators are 0N/A// internal instead of being external. 0N/A//------------------------------NameAndList------------------------------------ 0N/A// Storage for a name and an associated list of names 0N/A // Add to entries in list 0N/A // Access the name and its associated list. 0N/A // Return the "index" entry in the list, zero-based 0N/A//------------------------------ComponentList--------------------------------- 0N/A// Component lists always have match rule operands first, followed by parameter 0N/A// operands which do not appear in the match list (in order of declaration). 0N/A // This is a batch program. (And I have a destructor bug!) 0N/A void operator delete(
void *
ptr ) {}
0N/A // Return element at "position", else NULL 0N/A // Return first component having this name. 0N/A // Return number of USEs + number of DEFs 0N/A // Return zero-based position in list; -1 if not in list. 0N/A // Find position for this name, regardless of use/def information 0N/A // Find position for this name when looked up for output via "format" 0N/A // Find position for the Label when looked up for output via "format" 0N/A // Find position for the Method when looked up for output via "format" 0N/A//------------------------------SourceForm------------------------------------- 0N/A char *
_code;
// Buffer for storing code text 0N/A//------------------------------Expr------------------------------------------ 0N/A// class Expr represents integer expressions containing constants and addition 0N/A// Value must be in range zero through maximum positive integer. 32bits. 0N/A// Expected use: instruction and operand costs 0N/A//------------------------------ExprDict--------------------------------------- 0N/A// Dictionary containing Exprs 0N/A // Disable public use of constructor, copy-ctor, operator =, operator == 0N/A // == compares two dictionaries; they must have the same keys (their keys 0N/A // must match using CmpKey) and they must have the same values (pointer 0N/A // comparison). If so 1 is returned, if not 0 is returned. 0N/A bool operator ==(
const ExprDict &d)
const;
// Compare dictionaries for equal 0N/A // cmp is a key comparision routine. hash is a routine to hash a key. 0N/A // Return # of key-value pairs in dict 0N/A // define inserts the given key-value pair into the dictionary, 0N/A // and records the name in order for later output, ... 0N/A // Insert inserts the given key-value pair into the dictionary. The prior 0N/A // value of the key is returned; NULL if the key was not previously defined. 0N/A // Find finds the value of a given key; or NULL if not found. 0N/A // The dictionary is NOT changed. 0N/A const Expr *
operator [](
const char *
name)
const;
// Do a lookup