@@ -1453,11 +1453,13 @@ MachNode *Matcher::match_tree( const Node *n ) {
1453
1453
uint mincost = max_juint;
1454
1454
uint cost = max_juint;
1455
1455
uint i;
1456
- for ( i = 0 ; i < NUM_OPERANDS; i++ ) {
1457
- if ( s->valid (i) && // valid entry and
1458
- s->_cost [i] < cost && // low cost and
1459
- s->_rule [i] >= NUM_OPERANDS ) // not an operand
1460
- cost = s->_cost [mincost=i];
1456
+ for (i = 0 ; i < NUM_OPERANDS; i++) {
1457
+ if (s->valid (i) && // valid entry and
1458
+ s->cost (i) < cost && // low cost and
1459
+ s->rule (i) >= NUM_OPERANDS) {// not an operand
1460
+ mincost = i;
1461
+ cost = s->cost (i);
1462
+ }
1461
1463
}
1462
1464
if (mincost == max_juint) {
1463
1465
#ifndef PRODUCT
@@ -1468,7 +1470,7 @@ MachNode *Matcher::match_tree( const Node *n ) {
1468
1470
return NULL ;
1469
1471
}
1470
1472
// Reduce input tree based upon the state labels to machine Nodes
1471
- MachNode *m = ReduceInst ( s, s->_rule [ mincost] , mem );
1473
+ MachNode *m = ReduceInst (s, s->rule ( mincost) , mem);
1472
1474
#ifdef ASSERT
1473
1475
_old2new_map.map (n->_idx , m);
1474
1476
_new2old_map.map (m->_idx , (Node*)n);
@@ -1836,29 +1838,28 @@ void Matcher::handle_precedence_edges(Node* n, MachNode *mach) {
1836
1838
}
1837
1839
}
1838
1840
1839
- void Matcher::ReduceInst_Chain_Rule ( State * s, int rule, Node * &mem, MachNode *mach ) {
1841
+ void Matcher::ReduceInst_Chain_Rule (State* s, int rule, Node* &mem, MachNode* mach ) {
1840
1842
// 'op' is what I am expecting to receive
1841
1843
int op = _leftOp[rule];
1842
1844
// Operand type to catch childs result
1843
1845
// This is what my child will give me.
1844
- int opnd_class_instance = s->_rule [op] ;
1846
+ unsigned int opnd_class_instance = s->rule (op) ;
1845
1847
// Choose between operand class or not.
1846
1848
// This is what I will receive.
1847
1849
int catch_op = (FIRST_OPERAND_CLASS <= op && op < NUM_OPERANDS) ? opnd_class_instance : op;
1848
1850
// New rule for child. Chase operand classes to get the actual rule.
1849
- int newrule = s->_rule [ catch_op] ;
1851
+ unsigned int newrule = s->rule ( catch_op) ;
1850
1852
1851
- if ( newrule < NUM_OPERANDS ) {
1853
+ if ( newrule < NUM_OPERANDS) {
1852
1854
// Chain from operand or operand class, may be output of shared node
1853
- assert ( 0 <= opnd_class_instance && opnd_class_instance < NUM_OPERANDS,
1854
- " Bad AD file: Instruction chain rule must chain from operand" );
1855
+ assert (opnd_class_instance < NUM_OPERANDS, " Bad AD file: Instruction chain rule must chain from operand" );
1855
1856
// Insert operand into array of operands for this instruction
1856
1857
mach->_opnds [1 ] = s->MachOperGenerator (opnd_class_instance);
1857
1858
1858
- ReduceOper ( s, newrule, mem, mach );
1859
+ ReduceOper (s, newrule, mem, mach);
1859
1860
} else {
1860
1861
// Chain from the result of an instruction
1861
- assert ( newrule >= _LAST_MACH_OPER, " Do NOT chain from internal operand" );
1862
+ assert (newrule >= _LAST_MACH_OPER, " Do NOT chain from internal operand" );
1862
1863
mach->_opnds [1 ] = s->MachOperGenerator (_reduceOp[catch_op]);
1863
1864
Node *mem1 = (Node*)1 ;
1864
1865
debug_only (Node *save_mem_node = _mem_node;)
@@ -1896,24 +1897,24 @@ uint Matcher::ReduceInst_Interior( State *s, int rule, Node *&mem, MachNode *mac
1896
1897
}
1897
1898
// Operand type to catch childs result
1898
1899
// This is what my child will give me.
1899
- int opnd_class_instance = newstate->_rule [op] ;
1900
+ int opnd_class_instance = newstate->rule (op) ;
1900
1901
// Choose between operand class or not.
1901
1902
// This is what I will receive.
1902
1903
int catch_op = (op >= FIRST_OPERAND_CLASS && op < NUM_OPERANDS) ? opnd_class_instance : op;
1903
1904
// New rule for child. Chase operand classes to get the actual rule.
1904
- int newrule = newstate->_rule [ catch_op] ;
1905
+ int newrule = newstate->rule ( catch_op) ;
1905
1906
1906
- if ( newrule < NUM_OPERANDS ) { // Operand/operandClass or internalOp/instruction?
1907
+ if ( newrule < NUM_OPERANDS) { // Operand/operandClass or internalOp/instruction?
1907
1908
// Operand/operandClass
1908
1909
// Insert operand into array of operands for this instruction
1909
1910
mach->_opnds [num_opnds++] = newstate->MachOperGenerator (opnd_class_instance);
1910
- ReduceOper ( newstate, newrule, mem, mach );
1911
+ ReduceOper (newstate, newrule, mem, mach);
1911
1912
1912
1913
} else { // Child is internal operand or new instruction
1913
- if ( newrule < _LAST_MACH_OPER ) { // internal operand or instruction?
1914
+ if ( newrule < _LAST_MACH_OPER) { // internal operand or instruction?
1914
1915
// internal operand --> call ReduceInst_Interior
1915
1916
// Interior of complex instruction. Do nothing but recurse.
1916
- num_opnds = ReduceInst_Interior ( newstate, newrule, mem, mach, num_opnds );
1917
+ num_opnds = ReduceInst_Interior (newstate, newrule, mem, mach, num_opnds);
1917
1918
} else {
1918
1919
// instruction --> call build operand( ) to catch result
1919
1920
// --> ReduceInst( newrule )
@@ -1965,16 +1966,17 @@ void Matcher::ReduceOper( State *s, int rule, Node *&mem, MachNode *mach ) {
1965
1966
}
1966
1967
}
1967
1968
1968
- for ( uint i= 0 ; kid != NULL && i< 2 ; kid = s->_kids [1 ], i++ ) { // binary tree
1969
+ for ( uint i = 0 ; kid != NULL && i < 2 ; kid = s->_kids [1 ], i++) { // binary tree
1969
1970
int newrule;
1970
- if ( i == 0 )
1971
- newrule = kid->_rule [_leftOp[rule]];
1972
- else
1973
- newrule = kid->_rule [_rightOp[rule]];
1971
+ if ( i == 0 ) {
1972
+ newrule = kid->rule (_leftOp[rule]);
1973
+ } else {
1974
+ newrule = kid->rule (_rightOp[rule]);
1975
+ }
1974
1976
1975
- if ( newrule < _LAST_MACH_OPER ) { // Operand or instruction?
1977
+ if ( newrule < _LAST_MACH_OPER) { // Operand or instruction?
1976
1978
// Internal operand; recurse but do nothing else
1977
- ReduceOper ( kid, newrule, mem, mach );
1979
+ ReduceOper (kid, newrule, mem, mach);
1978
1980
1979
1981
} else { // Child is a new instruction
1980
1982
// Reduce the instruction, and add a direct pointer from this
@@ -2808,15 +2810,12 @@ bool Matcher::branches_to_uncommon_trap(const Node *n) {
2808
2810
2809
2811
// =============================================================================
2810
2812
// ---------------------------State---------------------------------------------
2811
- State::State (void ) {
2813
+ State::State (void ) : _rule() {
2812
2814
#ifdef ASSERT
2813
2815
_id = 0 ;
2814
2816
_kids[0 ] = _kids[1 ] = (State*)(intptr_t ) CONST64 (0xcafebabecafebabe );
2815
2817
_leaf = (Node*)(intptr_t ) CONST64 (0xbaadf00dbaadf00d );
2816
- // memset(_cost, -1, sizeof(_cost));
2817
- // memset(_rule, -1, sizeof(_rule));
2818
2818
#endif
2819
- memset (_valid, 0 , sizeof (_valid));
2820
2819
}
2821
2820
2822
2821
#ifdef ASSERT
@@ -2837,25 +2836,30 @@ void State::dump() {
2837
2836
}
2838
2837
2839
2838
void State::dump (int depth) {
2840
- for ( int j = 0 ; j < depth; j++ )
2839
+ for ( int j = 0 ; j < depth; j++) {
2841
2840
tty->print (" " );
2841
+ }
2842
2842
tty->print (" --N: " );
2843
2843
_leaf->dump ();
2844
2844
uint i;
2845
- for ( i = 0 ; i < _LAST_MACH_OPER; i++ )
2845
+ for ( i = 0 ; i < _LAST_MACH_OPER; i++) {
2846
2846
// Check for valid entry
2847
- if ( valid (i) ) {
2848
- for ( int j = 0 ; j < depth; j++ )
2847
+ if ( valid (i)) {
2848
+ for ( int j = 0 ; j < depth; j++) {
2849
2849
tty->print (" " );
2850
- assert (_cost[i] != max_juint, " cost must be a valid value" );
2851
- assert (_rule[i] < _last_Mach_Node, " rule[i] must be valid rule" );
2852
- tty->print_cr (" %s %d %s" ,
2853
- ruleName[i], _cost[i], ruleName[_rule[i]] );
2854
2850
}
2851
+ assert (cost (i) != max_juint, " cost must be a valid value" );
2852
+ assert (rule (i) < _last_Mach_Node, " rule[i] must be valid rule" );
2853
+ tty->print_cr (" %s %d %s" ,
2854
+ ruleName[i], cost (i), ruleName[rule (i)] );
2855
+ }
2856
+ }
2855
2857
tty->cr ();
2856
2858
2857
- for ( i=0 ; i<2 ; i++ )
2858
- if ( _kids[i] )
2859
- _kids[i]->dump (depth+1 );
2859
+ for (i = 0 ; i < 2 ; i++) {
2860
+ if (_kids[i]) {
2861
+ _kids[i]->dump (depth + 1 );
2862
+ }
2863
+ }
2860
2864
}
2861
2865
#endif
0 commit comments