/*
* 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_FORMSOPT_HPP
#define SHARE_VM_ADLC_FORMSOPT_HPP
// FORMSOPT.HPP - ADL Parser Target Specific Optimization Forms Classes
// Class List
class Form;
class InstructForm;
class OperandForm;
class OpClassForm;
class AttributeForm;
class RegisterForm;
class PipelineForm;
class SourceForm;
class EncodeForm;
class Component;
class Constraint;
class Predicate;
class MatchRule;
class Attribute;
class Effect;
class ExpandRule;
class RewriteRule;
class ConstructRule;
class FormatRule;
class Peephole;
class PeepMatch;
class PeepConstraint;
class EncClass;
class Interface;
class RegInterface;
class ConstInterface;
class MemInterface;
class CondInterface;
class Opcode;
class InsEncode;
class RegDef;
class RegClass;
class AllocClass;
class ResourceForm;
class PipeClassForm;
class PipeClassOperandForm;
class PipeClassResourceForm;
class PeepMatch;
class PeepConstraint;
class PeepReplace;
class MatchList;
class ArchDesc;
//==============================Register Allocation============================
//------------------------------RegisterForm-----------------------------------
private:
public:
// Public Data
static int RegMask_Size(); // Compute RegMask size
// Public Methods
RegisterForm();
~RegisterForm();
void addSpillRegClass();
// Provide iteration over all register definitions
// in the order used by the register allocator
void reset_RegDefs();
RegDef *iter_RegDefs();
// Return register mask, compressed chunk and register #
// Check that register classes are compatible with chunks
bool verify();
void dump(); // Debug printer
};
//------------------------------RegDef-----------------------------------------
public:
// Public Data
private:
// The chunk and register mask bits define info for register allocation
public:
// Public Methods
~RegDef(); // Destructor
// Bit pattern used for generating machine code
const char *register_encode() const;
// Register number used in machine-independent code
uint32 register_num() const;
void dump(); // Debug printer
};
//------------------------------RegClass---------------------------------------
public:
// Public Data
char* _user_defined;
// Public Methods
// Returns the lowest numbered register in the mask.
const RegDef* find_first_elem();
// Iteration support
void reset(); // Reset the following two iterators
const char *rd_name_iter(); // invoking either advances both.
void dump(); // Debug printer
};
//------------------------------AllocClass-------------------------------------
private:
public:
// Public Data
// Public Methods
void dump(); // Debug printer
};
//==============================Frame Handling================================
//------------------------------FrameForm-------------------------------------
private:
public:
// Public Data
char *_sync_stack_slots;
char *_inline_cache_reg;
char *_interpreter_method_oop_reg;
char *_cisc_spilling_operand_name;
char *_frame_pointer;
char *_c_frame_pointer;
char *_alignment;
bool _return_addr_loc;
bool _c_return_addr_loc;
char *_return_addr;
char *_c_return_addr;
char *_in_preserve_slots;
char *_varargs_C_out_slots_killed;
char *_calling_convention;
char *_c_calling_convention;
char *_return_value;
char *_c_return_value;
// Public Methods
FrameForm();
~FrameForm();
void dump(); // Debug printer
};
//==============================Scheduling=====================================
//------------------------------PipelineForm-----------------------------------
private:
public:
// Public Data
// Public Methods
PipelineForm();
~PipelineForm();
void dump(); // Debug printer
};
//------------------------------ResourceForm-----------------------------------
public:
private:
// Public Data
public:
// Virtual Methods
virtual ResourceForm *is_resource() const;
// Public Methods
~ResourceForm(); // Destructor
void dump(); // Debug printer
};
//------------------------------PipeClassOperandForm-----------------------------
private:
public:
// Public Data
// Public Methods
{};
~PipeClassOperandForm() {}; // Destructor
void dump(); // Debug printer
};
//------------------------------PipeClassResourceForm--------------------------
private:
public:
// Public Data
// Public Methods
// Constructor
{};
~PipeClassResourceForm() {}; // Destructor
void dump(); // Debug printer
};
//------------------------------PipeClassForm----------------------------------
private:
public:
// Public Data
// Virtual Methods
virtual PipeClassForm *is_pipeclass() const;
// Public Methods
// Constructor
~PipeClassForm(); // Destructor
void dump(); // Debug printer
};
//==============================Peephole Optimization==========================
//------------------------------Peephole---------------------------------------
private:
public:
// Public Methods
Peephole();
~Peephole();
// Append a peephole rule with the same root instruction
// Store the components of this peephole rule
// Access the components of this peephole rule
void dump(); // Debug printer
};
private:
char *_rule;
// NameList _depth; // Depth of this instruction
int _max_position;
public:
// Public Methods
~PeepMatch();
// Insert info into the match-rule
// Access info about instructions in the peep-match rule
int max_position();
const char *instruction_name(int position);
// Iterate through all info on matched instructions
void reset();
// 'true' if current position in iteration is a placeholder, not matched.
bool is_placeholder();
void dump();
};
private:
public:
const int _left_inst;
const char* _left_op;
const char* _relation;
const int _right_inst;
const char* _right_op;
public:
// Public Methods
int right_inst, char* right_op);
~PeepConstraint();
// Check if constraints use instruction at position
bool constrains_instruction(int position);
// Add another constraint
// Access the next constraint in the list
PeepConstraint *next();
void dump();
};
private:
char *_rule;
public:
// Public Methods
PeepReplace(char *rule);
~PeepReplace();
// Add contents of peepreplace
void add_instruction(char *root);
// Access contents of peepreplace
void reset();
void next_instruction(const char * &root);
// Utilities
void dump();
};
public:
public:
~PeepChild();
void dump();
};
#endif // SHARE_VM_ADLC_FORMSOPT_HPP