Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/hotspot/share/adlc/formssel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class InstructForm : public Form {
void set_cisc_reg_mask_name(const char *rm_name) { _cisc_reg_mask_name = rm_name; }
// Output cisc-method prototypes and method bodies
void declare_cisc_version(ArchDesc &AD, FILE *fp_cpp);
bool define_cisc_version (ArchDesc &AD, FILE *fp_cpp);
void define_cisc_version(ArchDesc& AD, FILE* fp_cpp);

bool check_branch_variant(ArchDesc &AD, InstructForm *short_branch);

Expand All @@ -273,7 +273,7 @@ class InstructForm : public Form {
bool has_short_branch_form() { return _short_branch_form != nullptr; }
// Output short branch prototypes and method bodies
void declare_short_branch_methods(FILE *fp_cpp);
bool define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp);
void define_short_branch_methods(ArchDesc& AD, FILE* fp_cpp);

uint alignment() { return _alignment; }
void set_alignment(uint val) { _alignment = val; }
Expand Down
52 changes: 4 additions & 48 deletions src/hotspot/share/adlc/output_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3099,42 +3099,6 @@ void ArchDesc::define_oper_interface(FILE *fp, OperandForm &oper, FormDict &glob
}
}

//
// Construct the method to copy _idx, inputs and operands to new node.
static void define_fill_new_machnode(bool used, FILE *fp_cpp) {
fprintf(fp_cpp, "\n");
fprintf(fp_cpp, "// Copy _idx, inputs and operands to new node\n");
fprintf(fp_cpp, "void MachNode::fill_new_machnode(MachNode* node) const {\n");
if( !used ) {
fprintf(fp_cpp, " // This architecture does not have cisc or short branch instructions\n");
fprintf(fp_cpp, " ShouldNotCallThis();\n");
fprintf(fp_cpp, "}\n");
} else {
// New node must use same node index for access through allocator's tables
fprintf(fp_cpp, " // New node must use same node index\n");
fprintf(fp_cpp, " node->set_idx( _idx );\n");
// Copy machine-independent inputs
fprintf(fp_cpp, " // Copy machine-independent inputs\n");
fprintf(fp_cpp, " for( uint j = 0; j < req(); j++ ) {\n");
fprintf(fp_cpp, " node->add_req(in(j));\n");
fprintf(fp_cpp, " }\n");
// Copy machine operands to new MachNode
fprintf(fp_cpp, " // Copy my operands, except for cisc position\n");
fprintf(fp_cpp, " int nopnds = num_opnds();\n");
fprintf(fp_cpp, " assert( node->num_opnds() == (uint)nopnds, \"Must have same number of operands\");\n");
fprintf(fp_cpp, " MachOper **to = node->_opnds;\n");
fprintf(fp_cpp, " for( int i = 0; i < nopnds; i++ ) {\n");
fprintf(fp_cpp, " if( i != cisc_operand() ) \n");
fprintf(fp_cpp, " to[i] = _opnds[i]->clone();\n");
fprintf(fp_cpp, " }\n");
fprintf(fp_cpp, " // Do not increment node index counter, since node reuses my index\n");
fprintf(fp_cpp, " Compile* C = Compile::current();\n");
fprintf(fp_cpp, " C->set_unique(C->unique() - 1);\n");
fprintf(fp_cpp, "}\n");
}
fprintf(fp_cpp, "\n");
}

//------------------------------defineClasses----------------------------------
// Define members of MachNode and MachOper classes based on
// operand and instruction lists
Expand Down Expand Up @@ -3230,7 +3194,6 @@ void ArchDesc::defineClasses(FILE *fp) {
defineOut_RegMask(_CPP_MISC_file._fp, instr->_ident, reg_mask(*instr));
}

bool used = false;
// Output the definitions for expand rules & peephole rules
_instructions.reset();
for( ; (instr = (InstructForm*)_instructions.iter()) != nullptr; ) {
Expand All @@ -3249,15 +3212,12 @@ void ArchDesc::defineClasses(FILE *fp) {
definePeephole(_CPP_PEEPHOLE_file._fp, instr);

// Output code to convert to the cisc version, if applicable
used |= instr->define_cisc_version(*this, fp);
instr->define_cisc_version(*this, fp);

// Output code to convert to the short branch version, if applicable
used |= instr->define_short_branch_methods(*this, fp);
instr->define_short_branch_methods(*this, fp);
}

// Construct the method called by cisc_version() to copy inputs and operands.
define_fill_new_machnode(used, fp);

// Output the definitions for labels
_instructions.reset();
while( (instr = (InstructForm*)_instructions.iter()) != nullptr ) {
Expand Down Expand Up @@ -4074,7 +4034,7 @@ void InstructForm::declare_cisc_version(ArchDesc &AD, FILE *fp_hpp) {

//---------------------------define_cisc_version-------------------------------
// Build CISC version of this instruction
bool InstructForm::define_cisc_version(ArchDesc &AD, FILE *fp_cpp) {
void InstructForm::define_cisc_version(ArchDesc& AD, FILE* fp_cpp) {
InstructForm *inst_cisc = this->cisc_spill_alternate();
if( AD.can_cisc_spill() && (inst_cisc != nullptr) ) {
const char *name = inst_cisc->_ident;
Expand Down Expand Up @@ -4120,9 +4080,7 @@ bool InstructForm::define_cisc_version(ArchDesc &AD, FILE *fp_cpp) {
fprintf(fp_cpp, " return node;\n");
fprintf(fp_cpp, "}\n");
fprintf(fp_cpp, "\n");
return true;
}
return false;
}

//---------------------------declare_short_branch_methods----------------------
Expand All @@ -4135,7 +4093,7 @@ void InstructForm::declare_short_branch_methods(FILE *fp_hpp) {

//---------------------------define_short_branch_methods-----------------------
// Build definitions for short branch methods
bool InstructForm::define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp) {
void InstructForm::define_short_branch_methods(ArchDesc& AD, FILE* fp_cpp) {
if (has_short_branch_form()) {
InstructForm *short_branch = short_branch_form();
const char *name = short_branch->_ident;
Expand Down Expand Up @@ -4164,9 +4122,7 @@ bool InstructForm::define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp) {
fprintf(fp_cpp, " return node;\n");
fprintf(fp_cpp, "}\n");
fprintf(fp_cpp,"\n");
return true;
}
return false;
}


Expand Down
21 changes: 21 additions & 0 deletions src/hotspot/share/opto/machnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,27 @@ bool MachNode::cmp( const Node &node ) const {
return true; // match
}

void MachNode::fill_new_machnode(MachNode* node) const {
// New node must use same node index
node->set_idx(_idx);
// Copy machine-independent inputs
for (uint j = 0; j < req(); j++) {
node->add_req(in(j));
}
// Copy my operands, except for cisc position
int nopnds = num_opnds();
assert(node->num_opnds() == (uint)nopnds, "Must have same number of operands");
MachOper** to = node->_opnds;
for (int i = 0; i < nopnds; i++) {
if (i != cisc_operand()) {
to[i] = _opnds[i]->clone();
}
}
// Do not increment node index counter, since node reuses my index
Compile* C = Compile::current();
C->set_unique(C->unique() - 1);
}

// Return an equivalent instruction using memory for cisc_operand position
MachNode *MachNode::cisc_version(int offset) {
ShouldNotCallThis();
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/opto/machnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,8 @@ class MachNode : public Node {
uint8_t barrier_data() const { return _barrier; }
void set_barrier_data(uint8_t data) { _barrier = data; }

// Copy inputs and operands to new node of instruction.
// Copy index, inputs, and operands to a new version of the instruction.
// Called from cisc_version() and short_branch_version().
// !!!! The method's body is defined in ad_<arch>.cpp file.
void fill_new_machnode(MachNode *n) const;

// Return an equivalent instruction using memory for cisc_operand position
Expand Down