src/share/vm/adlc/output_c.cpp

changeset 1038
dbbe28fc66b5
parent 850
4d9884b01ba6
child 1059
337400e7a5dd
     1.1 --- a/src/share/vm/adlc/output_c.cpp	Thu Feb 26 16:57:21 2009 -0800
     1.2 +++ b/src/share/vm/adlc/output_c.cpp	Fri Feb 27 03:35:40 2009 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -225,11 +225,11 @@
    1.11      pipeclass->_parameters.reset();
    1.12  
    1.13    while ( (paramname = pipeclass->_parameters.iter()) != NULL ) {
    1.14 -    const PipeClassOperandForm *pipeopnd =
    1.15 +    const PipeClassOperandForm *tmppipeopnd =
    1.16          (const PipeClassOperandForm *)pipeclass->_localUsage[paramname];
    1.17  
    1.18 -    if (pipeopnd)
    1.19 -      templen += 10 + (int)strlen(pipeopnd->_stage);
    1.20 +    if (tmppipeopnd)
    1.21 +      templen += 10 + (int)strlen(tmppipeopnd->_stage);
    1.22      else
    1.23        templen += 19;
    1.24  
    1.25 @@ -253,10 +253,10 @@
    1.26      pipeclass->_parameters.reset();
    1.27  
    1.28    while ( (paramname = pipeclass->_parameters.iter()) != NULL ) {
    1.29 -    const PipeClassOperandForm *pipeopnd =
    1.30 +    const PipeClassOperandForm *tmppipeopnd =
    1.31          (const PipeClassOperandForm *)pipeclass->_localUsage[paramname];
    1.32      templen += sprintf(&operand_stages[templen], "  stage_%s%c\n",
    1.33 -      pipeopnd ? pipeopnd->_stage : "undefined",
    1.34 +      tmppipeopnd ? tmppipeopnd->_stage : "undefined",
    1.35        (++i < paramcount ? ',' : ' ') );
    1.36    }
    1.37  
    1.38 @@ -1042,10 +1042,10 @@
    1.39  
    1.40  // Scan the peepmatch and output a test for each instruction
    1.41  static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) {
    1.42 -  intptr_t   parent        = -1;
    1.43 -  intptr_t   inst_position = 0;
    1.44 -  const char *inst_name    = NULL;
    1.45 -  intptr_t   input         = 0;
    1.46 +  int         parent        = -1;
    1.47 +  int         inst_position = 0;
    1.48 +  const char* inst_name     = NULL;
    1.49 +  int         input         = 0;
    1.50    fprintf(fp, "      // Check instruction sub-tree\n");
    1.51    pmatch->reset();
    1.52    for( pmatch->next_instruction( parent, inst_position, inst_name, input );
    1.53 @@ -1055,14 +1055,14 @@
    1.54      if( ! pmatch->is_placeholder() ) {
    1.55        // Define temporaries 'inst#', based on parent and parent's input index
    1.56        if( parent != -1 ) {                // root was initialized
    1.57 -        fprintf(fp, "  inst%ld = inst%ld->in(%ld);\n",
    1.58 +        fprintf(fp, "  inst%d = inst%d->in(%d);\n",
    1.59                  inst_position, parent, input);
    1.60        }
    1.61  
    1.62        // When not the root
    1.63        // Test we have the correct instruction by comparing the rule
    1.64        if( parent != -1 ) {
    1.65 -        fprintf(fp, "  matches = matches &&  ( inst%ld->rule() == %s_rule );",
    1.66 +        fprintf(fp, "  matches = matches &&  ( inst%d->rule() == %s_rule );",
    1.67                  inst_position, inst_name);
    1.68        }
    1.69      } else {
    1.70 @@ -1073,20 +1073,20 @@
    1.71    }
    1.72  }
    1.73  
    1.74 -static void print_block_index(FILE *fp, intptr_t inst_position) {
    1.75 +static void print_block_index(FILE *fp, int inst_position) {
    1.76    assert( inst_position >= 0, "Instruction number less than zero");
    1.77    fprintf(fp, "block_index");
    1.78    if( inst_position != 0 ) {
    1.79 -    fprintf(fp, " - %ld", inst_position);
    1.80 +    fprintf(fp, " - %d", inst_position);
    1.81    }
    1.82  }
    1.83  
    1.84  // Scan the peepmatch and output a test for each instruction
    1.85  static void check_peepmatch_instruction_sequence(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) {
    1.86 -  intptr_t   parent        = -1;
    1.87 -  intptr_t   inst_position = 0;
    1.88 -  const char *inst_name    = NULL;
    1.89 -  intptr_t   input         = 0;
    1.90 +  int         parent        = -1;
    1.91 +  int         inst_position = 0;
    1.92 +  const char* inst_name     = NULL;
    1.93 +  int         input         = 0;
    1.94    fprintf(fp, "  // Check instruction sub-tree\n");
    1.95    pmatch->reset();
    1.96    for( pmatch->next_instruction( parent, inst_position, inst_name, input );
    1.97 @@ -1101,14 +1101,14 @@
    1.98          print_block_index(fp, inst_position);
    1.99          fprintf(fp, " > 0 ) {\n    Node *n = block->_nodes.at(");
   1.100          print_block_index(fp, inst_position);
   1.101 -        fprintf(fp, ");\n    inst%ld = (n->is_Mach()) ? ", inst_position);
   1.102 +        fprintf(fp, ");\n    inst%d = (n->is_Mach()) ? ", inst_position);
   1.103          fprintf(fp, "n->as_Mach() : NULL;\n  }\n");
   1.104        }
   1.105  
   1.106        // When not the root
   1.107        // Test we have the correct instruction by comparing the rule.
   1.108        if( parent != -1 ) {
   1.109 -        fprintf(fp, "  matches = matches && (inst%ld != NULL) && (inst%ld->rule() == %s_rule);\n",
   1.110 +        fprintf(fp, "  matches = matches && (inst%d != NULL) && (inst%d->rule() == %s_rule);\n",
   1.111                  inst_position, inst_position, inst_name);
   1.112        }
   1.113      } else {
   1.114 @@ -1121,10 +1121,10 @@
   1.115  
   1.116  // Build mapping for register indices, num_edges to input
   1.117  static void build_instruction_index_mapping( FILE *fp, FormDict &globals, PeepMatch *pmatch ) {
   1.118 -  intptr_t   parent        = -1;
   1.119 -  intptr_t   inst_position = 0;
   1.120 -  const char *inst_name    = NULL;
   1.121 -  intptr_t   input         = 0;
   1.122 +  int         parent        = -1;
   1.123 +  int         inst_position = 0;
   1.124 +  const char* inst_name     = NULL;
   1.125 +  int         input         = 0;
   1.126    fprintf(fp, "      // Build map to register info\n");
   1.127    pmatch->reset();
   1.128    for( pmatch->next_instruction( parent, inst_position, inst_name, input );
   1.129 @@ -1136,9 +1136,9 @@
   1.130        InstructForm *inst = globals[inst_name]->is_instruction();
   1.131        if( inst != NULL ) {
   1.132          char inst_prefix[]  = "instXXXX_";
   1.133 -        sprintf(inst_prefix, "inst%ld_",   inst_position);
   1.134 +        sprintf(inst_prefix, "inst%d_",   inst_position);
   1.135          char receiver[]     = "instXXXX->";
   1.136 -        sprintf(receiver,    "inst%ld->", inst_position);
   1.137 +        sprintf(receiver,    "inst%d->", inst_position);
   1.138          inst->index_temps( fp, globals, inst_prefix, receiver );
   1.139        }
   1.140      }
   1.141 @@ -1168,7 +1168,7 @@
   1.142        }
   1.143  
   1.144        // LEFT
   1.145 -      intptr_t left_index  = pconstraint->_left_inst;
   1.146 +      int left_index       = pconstraint->_left_inst;
   1.147        const char *left_op  = pconstraint->_left_op;
   1.148        // Access info on the instructions whose operands are compared
   1.149        InstructForm *inst_left = globals[pmatch->instruction_name(left_index)]->is_instruction();
   1.150 @@ -1191,7 +1191,7 @@
   1.151  
   1.152        // RIGHT
   1.153        int right_op_index = -1;
   1.154 -      intptr_t right_index = pconstraint->_right_inst;
   1.155 +      int right_index      = pconstraint->_right_inst;
   1.156        const char *right_op = pconstraint->_right_op;
   1.157        if( right_index != -1 ) { // Match operand
   1.158          // Access info on the instructions whose operands are compared
   1.159 @@ -1351,7 +1351,7 @@
   1.160      assert( root_form != NULL, "Replacement instruction was not previously defined");
   1.161      fprintf(fp, "        %sNode *root = new (C) %sNode();\n", root_inst, root_inst);
   1.162  
   1.163 -    intptr_t    inst_num;
   1.164 +    int         inst_num;
   1.165      const char *op_name;
   1.166      int         opnds_index = 0;            // define result operand
   1.167      // Then install the use-operands for the new sub-tree
   1.168 @@ -1362,7 +1362,6 @@
   1.169        InstructForm *inst_form;
   1.170        inst_form  = globals[pmatch->instruction_name(inst_num)]->is_instruction();
   1.171        assert( inst_form, "Parser should guaranty this is an instruction");
   1.172 -      int op_base     = inst_form->oper_input_base(globals);
   1.173        int inst_op_num = inst_form->operand_position(op_name, Component::USE);
   1.174        if( inst_op_num == NameList::Not_in_list )
   1.175          inst_op_num = inst_form->operand_position(op_name, Component::USE_DEF);
   1.176 @@ -1379,32 +1378,32 @@
   1.177          // Add unmatched edges from root of match tree
   1.178          int op_base = root_form->oper_input_base(globals);
   1.179          for( int unmatched_edge = 1; unmatched_edge < op_base; ++unmatched_edge ) {
   1.180 -          fprintf(fp, "        root->add_req(inst%ld->in(%d));        // unmatched ideal edge\n",
   1.181 +          fprintf(fp, "        root->add_req(inst%d->in(%d));        // unmatched ideal edge\n",
   1.182                                            inst_num, unmatched_edge);
   1.183          }
   1.184          // If new instruction captures bottom type
   1.185          if( root_form->captures_bottom_type() ) {
   1.186            // Get bottom type from instruction whose result we are replacing
   1.187 -          fprintf(fp, "        root->_bottom_type = inst%ld->bottom_type();\n", inst_num);
   1.188 +          fprintf(fp, "        root->_bottom_type = inst%d->bottom_type();\n", inst_num);
   1.189          }
   1.190          // Define result register and result operand
   1.191 -        fprintf(fp, "        ra_->add_reference(root, inst%ld);\n", inst_num);
   1.192 -        fprintf(fp, "        ra_->set_oop (root, ra_->is_oop(inst%ld));\n", inst_num);
   1.193 -        fprintf(fp, "        ra_->set_pair(root->_idx, ra_->get_reg_second(inst%ld), ra_->get_reg_first(inst%ld));\n", inst_num, inst_num);
   1.194 -        fprintf(fp, "        root->_opnds[0] = inst%ld->_opnds[0]->clone(C); // result\n", inst_num);
   1.195 +        fprintf(fp, "        ra_->add_reference(root, inst%d);\n", inst_num);
   1.196 +        fprintf(fp, "        ra_->set_oop (root, ra_->is_oop(inst%d));\n", inst_num);
   1.197 +        fprintf(fp, "        ra_->set_pair(root->_idx, ra_->get_reg_second(inst%d), ra_->get_reg_first(inst%d));\n", inst_num, inst_num);
   1.198 +        fprintf(fp, "        root->_opnds[0] = inst%d->_opnds[0]->clone(C); // result\n", inst_num);
   1.199          fprintf(fp, "        // ----- Done with initial setup -----\n");
   1.200        } else {
   1.201          if( (op_form == NULL) || (op_form->is_base_constant(globals) == Form::none) ) {
   1.202            // Do not have ideal edges for constants after matching
   1.203 -          fprintf(fp, "        for( unsigned x%d = inst%ld_idx%d; x%d < inst%ld_idx%d; x%d++ )\n",
   1.204 +          fprintf(fp, "        for( unsigned x%d = inst%d_idx%d; x%d < inst%d_idx%d; x%d++ )\n",
   1.205                    inst_op_num, inst_num, inst_op_num,
   1.206                    inst_op_num, inst_num, inst_op_num+1, inst_op_num );
   1.207 -          fprintf(fp, "          root->add_req( inst%ld->in(x%d) );\n",
   1.208 +          fprintf(fp, "          root->add_req( inst%d->in(x%d) );\n",
   1.209                    inst_num, inst_op_num );
   1.210          } else {
   1.211            fprintf(fp, "        // no ideal edge for constants after matching\n");
   1.212          }
   1.213 -        fprintf(fp, "        root->_opnds[%d] = inst%ld->_opnds[%d]->clone(C);\n",
   1.214 +        fprintf(fp, "        root->_opnds[%d] = inst%d->_opnds[%d]->clone(C);\n",
   1.215                  opnds_index, inst_num, inst_op_num );
   1.216        }
   1.217        ++opnds_index;
   1.218 @@ -1443,7 +1442,7 @@
   1.219    }
   1.220    for( int i = 0; i <= max_position; ++i ) {
   1.221      if( i == 0 ) {
   1.222 -      fprintf(fp, "  MachNode *inst0 = this;\n", i);
   1.223 +      fprintf(fp, "  MachNode *inst0 = this;\n");
   1.224      } else {
   1.225        fprintf(fp, "  MachNode *inst%d = NULL;\n", i);
   1.226      }
   1.227 @@ -1743,7 +1742,7 @@
   1.228        }
   1.229        // delete the rest of edges
   1.230        fprintf(fp,"  for(int i = idx%d - 1; i >= (int)idx%d; i--) {\n", cur_num_opnds, new_num_opnds);
   1.231 -      fprintf(fp,"    del_req(i);\n", i);
   1.232 +      fprintf(fp,"    del_req(i);\n");
   1.233        fprintf(fp,"  }\n");
   1.234        fprintf(fp,"  _num_opnds = %d;\n", new_num_opnds);
   1.235      }
   1.236 @@ -1817,7 +1816,7 @@
   1.237  
   1.238    fprintf(fp,"\n");
   1.239    if( node->expands() ) {
   1.240 -    fprintf(fp,"  return result;\n",cnt-1);
   1.241 +    fprintf(fp,"  return result;\n");
   1.242    } else {
   1.243      fprintf(fp,"  return this;\n");
   1.244    }

mercurial