8234387: C2: Better support of operands with multiple match rules in AD files

Reviewed-by: vlivanov, sviswanathan, thartmann, dlong
This commit is contained in:
Jatin Bhateja 2019-11-26 16:09:23 +03:00
parent b89d2fd169
commit fb0b8f1d0c
3 changed files with 30 additions and 7 deletions

View File

@ -3917,6 +3917,13 @@ operand eCXRegP(eRegP reg) %{
interface(REG_INTER);
%}
operand eDXRegP(eRegP reg) %{
constraint(ALLOC_IN_RC(edx_reg));
match(reg);
format %{ "EDX" %}
interface(REG_INTER);
%}
operand eSIRegP(eRegP reg) %{
constraint(ALLOC_IN_RC(esi_reg));
match(reg);
@ -8977,7 +8984,7 @@ instruct absI_rReg(rRegI dst, rRegI src, rRegI tmp, eFlagsReg cr)
%}
ins_pipe(ialu_reg_reg);
%}
%}
//----------Long Instructions------------------------------------------------
// Add Long Register with Register

View File

@ -267,6 +267,9 @@ reg_class ptr_rbx_reg(RBX, RBX_H);
// Singleton class for RSI pointer register
reg_class ptr_rsi_reg(RSI, RSI_H);
// Singleton class for RBP pointer register
reg_class ptr_rbp_reg(RBP, RBP_H);
// Singleton class for RDI pointer register
reg_class ptr_rdi_reg(RDI, RDI_H);
@ -3530,6 +3533,16 @@ operand rsi_RegP()
interface(REG_INTER);
%}
operand rbp_RegP()
%{
constraint(ALLOC_IN_RC(ptr_rbp_reg));
match(RegP);
match(rRegP);
format %{ %}
interface(REG_INTER);
%}
// Used in rep stosq
operand rdi_RegP()
%{

View File

@ -245,12 +245,12 @@ void ArchDesc::inspectOperands() {
// Construct chain rules
build_chain_rule(op);
MatchRule &mrule = *op->_matrule;
Predicate *pred = op->_predicate;
MatchRule *mrule = op->_matrule;
Predicate *pred = op->_predicate;
// Grab the machine type of the operand
const char *rootOp = op->_ident;
mrule._machType = rootOp;
mrule->_machType = rootOp;
// Check for special cases
if (strcmp(rootOp,"Universe")==0) continue;
@ -271,10 +271,13 @@ void ArchDesc::inspectOperands() {
// Find result type for match.
const char *result = op->reduce_result();
bool has_root = false;
// Construct a MatchList for this entry
buildMatchList(op->_matrule, result, rootOp, pred, cost);
// Construct a MatchList for this entry.
// Iterate over the list to enumerate all match cases for operands with multiple match rules.
for (; mrule != NULL; mrule = mrule->_next) {
mrule->_machType = rootOp;
buildMatchList(mrule, result, rootOp, pred, cost);
}
}
}