comparison src/share/vm/adlc/output_c.cpp @ 17797:2fcab8ba885a

8033168: PPC64: gcc 4.8 warning in output_c.cpp Summary: fix warnings Reviewed-by: kvn
author goetz
date Thu, 30 Jan 2014 14:30:01 +0100
parents a9becfeecd1b
children 62c54fcc0a35
comparison
equal deleted inserted replaced
17796:3f3c97187f82 17797:2fcab8ba885a
2517 2517
2518 // (3) and (4) 2518 // (3) and (4)
2519 fprintf(fp,"}\n\n"); 2519 fprintf(fp,"}\n\n");
2520 } 2520 }
2521 2521
2522 // Emit late expand function. 2522 // Emit postalloc expand function.
2523 void ArchDesc::define_postalloc_expand(FILE *fp, InstructForm &inst) { 2523 void ArchDesc::define_postalloc_expand(FILE *fp, InstructForm &inst) {
2524 InsEncode *ins_encode = inst._insencode; 2524 InsEncode *ins_encode = inst._insencode;
2525 2525
2526 // Output instruction's postalloc_expand prototype. 2526 // Output instruction's postalloc_expand prototype.
2527 fprintf(fp, "void %sNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) {\n", 2527 fprintf(fp, "void %sNode::postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_) {\n",
2534 2534
2535 // Output variables "unsigned idx_<par_name>", Node *n_<par_name> and "MachOpnd *op_<par_name>" 2535 // Output variables "unsigned idx_<par_name>", Node *n_<par_name> and "MachOpnd *op_<par_name>"
2536 // for each parameter <par_name> specified in the encoding. 2536 // for each parameter <par_name> specified in the encoding.
2537 ins_encode->reset(); 2537 ins_encode->reset();
2538 const char *ec_name = ins_encode->encode_class_iter(); 2538 const char *ec_name = ins_encode->encode_class_iter();
2539 assert(ec_name != NULL, "late expand must specify an encoding"); 2539 assert(ec_name != NULL, "Postalloc expand must specify an encoding.");
2540 2540
2541 EncClass *encoding = _encode->encClass(ec_name); 2541 EncClass *encoding = _encode->encClass(ec_name);
2542 if (encoding == NULL) { 2542 if (encoding == NULL) {
2543 fprintf(stderr, "User did not define contents of this encode_class: %s\n", ec_name); 2543 fprintf(stderr, "User did not define contents of this encode_class: %s\n", ec_name);
2544 abort(); 2544 abort();
2547 globalAD->syntax_err(ins_encode->_linenum, "In %s: passing %d arguments to %s but expecting %d", 2547 globalAD->syntax_err(ins_encode->_linenum, "In %s: passing %d arguments to %s but expecting %d",
2548 inst._ident, ins_encode->current_encoding_num_args(), 2548 inst._ident, ins_encode->current_encoding_num_args(),
2549 ec_name, encoding->num_args()); 2549 ec_name, encoding->num_args());
2550 } 2550 }
2551 2551
2552 fprintf(fp, " // Access to ins and operands for late expand.\n"); 2552 fprintf(fp, " // Access to ins and operands for postalloc expand.\n");
2553 const int buflen = 2000; 2553 const int buflen = 2000;
2554 char idxbuf[buflen]; char *ib = idxbuf; sprintf(ib, ""); 2554 char idxbuf[buflen]; char *ib = idxbuf; idxbuf[0] = '\0';
2555 char nbuf [buflen]; char *nb = nbuf; sprintf(nb, ""); 2555 char nbuf [buflen]; char *nb = nbuf; nbuf[0] = '\0';
2556 char opbuf [buflen]; char *ob = opbuf; sprintf(ob, ""); 2556 char opbuf [buflen]; char *ob = opbuf; opbuf[0] = '\0';
2557 2557
2558 encoding->_parameter_type.reset(); 2558 encoding->_parameter_type.reset();
2559 encoding->_parameter_name.reset(); 2559 encoding->_parameter_name.reset();
2560 const char *type = encoding->_parameter_type.iter(); 2560 const char *type = encoding->_parameter_type.iter();
2561 const char *name = encoding->_parameter_name.iter(); 2561 const char *name = encoding->_parameter_name.iter();
2569 name, type, arg_name); 2569 name, type, arg_name);
2570 nb += sprintf(nb, " Node *n_%-7s = lookup(idx_%s);\n", name, name); 2570 nb += sprintf(nb, " Node *n_%-7s = lookup(idx_%s);\n", name, name);
2571 // There is no operand for the constanttablebase. 2571 // There is no operand for the constanttablebase.
2572 } else if (inst.is_noninput_operand(idx)) { 2572 } else if (inst.is_noninput_operand(idx)) {
2573 globalAD->syntax_err(inst._linenum, 2573 globalAD->syntax_err(inst._linenum,
2574 "In %s: you can not pass the non-input %s to a late expand encoding.\n", 2574 "In %s: you can not pass the non-input %s to a postalloc expand encoding.\n",
2575 inst._ident, arg_name); 2575 inst._ident, arg_name);
2576 } else { 2576 } else {
2577 ib += sprintf(ib, " unsigned idx_%-5s = idx%d; \t// %s, \t%s\n", 2577 ib += sprintf(ib, " unsigned idx_%-5s = idx%d; \t// %s, \t%s\n",
2578 name, idx, type, arg_name); 2578 name, idx, type, arg_name);
2579 nb += sprintf(nb, " Node *n_%-7s = lookup(idx_%s);\n", name, name); 2579 nb += sprintf(nb, " Node *n_%-7s = lookup(idx_%s);\n", name, name);
2620 fprintf(fp, " }\n"); 2620 fprintf(fp, " }\n");
2621 2621
2622 fprintf(fp, "}\n\n"); 2622 fprintf(fp, "}\n\n");
2623 2623
2624 ec_name = ins_encode->encode_class_iter(); 2624 ec_name = ins_encode->encode_class_iter();
2625 assert(ec_name == NULL, "Late expand may only have one encoding."); 2625 assert(ec_name == NULL, "Postalloc expand may only have one encoding.");
2626 } 2626 }
2627 2627
2628 // defineEmit ----------------------------------------------------------------- 2628 // defineEmit -----------------------------------------------------------------
2629 void ArchDesc::defineEmit(FILE* fp, InstructForm& inst) { 2629 void ArchDesc::defineEmit(FILE* fp, InstructForm& inst) {
2630 InsEncode* encode = inst._insencode; 2630 InsEncode* encode = inst._insencode;