/*
* 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.
*
*/
#ifndef SHARE_VM_ADLC_ARCHDESC_HPP
#define SHARE_VM_ADLC_ARCHDESC_HPP
// Definitions for Error Flags
#define WARN 0
// Minimal declarations for include files
class OutputMap;
class ProductionState;
class Expr;
// STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
//---------------------------ChainList-----------------------------------------
class ChainList {
public:
void reset();
void dump();
ChainList();
~ChainList();
};
//---------------------------MatchList-----------------------------------------
class MatchList {
private:
const char *_cost;
public:
const char *_opcode;
const char *_resultStr;
const char *_lchild;
const char *_rchild;
const char *rchild)
void dump();
};
//---------------------------ArchDesc------------------------------------------
class ArchDesc {
private:
// The Architecture Description identifies which user-defined operand can be used
// to access [stack_pointer + offset]
// Methods for outputting the DFA
// Helper function that outputs code to generate an instruction in MachNodeGenerator
public:
ArchDesc();
~ArchDesc();
// Option flags which control miscellaneous behaviors throughout the code
// Accessor for private data.
// I/O Files
// Machine dependent files, built from architecture definition
// I/O helper methods
int open_files(void);
void close_files(int delete_out);
char* get_preproc_def(const char* flag);
void initBaseOpTypes(); // Import predefined base types.
int operandFormCount(); // Count number of OperandForms defined
int opclassFormCount(); // Count number of OpClassForms defined
int instructFormCount(); // Count number of InstructForms defined
bool verify();
void dump();
// Helper utility that gets MatchList components from inside MatchRule
const char *result);
void generateMatchLists(); // Build MatchList array and populate it
void inspectOperands(); // Build MatchLists for all operands
void inspectOpClasses(); // Build MatchLists for all operands
void inspectInstructions(); // Build MatchLists for all operands
void gen_dfa_state_body(FILE *fp, Dict &minmize, ProductionState &status, Dict &chained, int i); // Driver for constructing the DFA state bodies
// Helper utilities to generate reduction maps for internal operands
const char *reduceLeft (char *internalName);
const char *reduceRight(char *internalName);
// Build enumerations, (1) dense operand index, (2) operands and opcodes
// Helper utilities to generate Register Masks
const char *reg_class_to_reg_mask(const char *reg_class);
// This register class should also generate a stack_or_reg_mask
// Generate an enumeration of register mask names and the RegMask objects.
// Generate enumeration of machine register numbers
// Generate enumeration of machine register encodings
// Generate Regsiter Size Array
// Generate Pipeline Class information
// Generate Pipeline definitions
// Generate Pipeline Class information
// Declare and define mappings from rules to result and input types
// build flags for signaling that our machine needs this instruction cloned
// output SUN copyright info
// output the start of an include guard.
// output the end of an include guard.
// output the #include line for this file.
// Output C preprocessor code to verify the backend compilation environment.
// Output C source and header (source_hpp) blocks.
// output declaration of class State
// Generator for MachOper objects given integer type
// Generator for MachNode objects given integer type
// Generator for Expand methods for instructions with expand rules
// Generator for Peephole methods for instructions with peephole rules
// Generator for Size methods for instructions
public:
// Generator for EvalConstantValue methods for instructions
// Generator for Emit methods for instructions
// Define a MachOper encode method
// Methods to construct the MachNode class hierarchy
// Return the type signature for the ideal operation
const char *getIdealType(const char *idealOp);
// Declare and define the classes derived from MachOper and MachNode
// Emit an ADLC message
void internal_err( const char *fmt, ...);
// Generator for has_match_rule methods
// Generator for Frame Methods
// Generate CISC_spilling oracle and MachNode::cisc_spill() methods
void identify_cisc_spill_instructions();
void identify_short_branches();
void identify_unique_operands();
protected:
// build MatchList from MatchRule
friend class ADLParser;
};
// -------------------------------- maps ------------------------------------
// Base class for generating a mapping from rule number to value.
// Used with ArchDesc::build_map() for all maps except "enum MachOperands"
// A derived class defines the appropriate output for a specific mapping.
class OutputMap {
protected:
const char *_name;
public:
// Access files used by this routine
// Positions in iteration that derived class will be told about
};
// Output routines specific to the derived class
virtual void declaration() {}
virtual void definition() {}
// Allow enum-MachOperands to turn-off instructions
virtual bool do_instructions() { return true; }
// Allow derived class to output name and position specific info
};
#endif // SHARE_VM_ADLC_ARCHDESC_HPP