comparison src/share/vm/adlc/adlparse.cpp @ 4120:f03a3c8bd5e5

7077312: Provide a CALL effect for instruct declaration in the ad file Summary: abstracted way to declare that the MachNode has the effect of a call (kills caller save registers, preserves callee save registers) Reviewed-by: twisti, never
author roland
date Wed, 14 Sep 2011 09:22:51 +0200
parents 6729bbc1fcd6
children db2e64ca2d5a
comparison
equal deleted inserted replaced
4119:7793051af7d6 4120:f03a3c8bd5e5
3816 if (_curchar != '(') { 3816 if (_curchar != '(') {
3817 parse_err(SYNERR, "missing '(' in effect definition\n"); 3817 parse_err(SYNERR, "missing '(' in effect definition\n");
3818 return; 3818 return;
3819 } 3819 }
3820 // Get list of effect-operand pairs and insert into dictionary 3820 // Get list of effect-operand pairs and insert into dictionary
3821 else get_effectlist(instr->_effects, instr->_localNames); 3821 else get_effectlist(instr->_effects, instr->_localNames, instr->_has_call);
3822 3822
3823 // Debug Stuff 3823 // Debug Stuff
3824 if (_AD._adl_debug > 1) fprintf(stderr,"Effect description: %s\n", desc); 3824 if (_AD._adl_debug > 1) fprintf(stderr,"Effect description: %s\n", desc);
3825 if (_curchar != ';') { 3825 if (_curchar != ';') {
3826 parse_err(SYNERR, "missing ';' in Effect definition\n"); 3826 parse_err(SYNERR, "missing ';' in Effect definition\n");
4594 //------------------------------get_effectlist--------------------------------- 4594 //------------------------------get_effectlist---------------------------------
4595 // Looks for identifier pairs where first must be the name of a pre-defined, 4595 // Looks for identifier pairs where first must be the name of a pre-defined,
4596 // effect, and the second must be the name of an operand defined in the 4596 // effect, and the second must be the name of an operand defined in the
4597 // operand list of this instruction. Stores the names with a pointer to the 4597 // operand list of this instruction. Stores the names with a pointer to the
4598 // effect form in a local effects table. 4598 // effect form in a local effects table.
4599 void ADLParser::get_effectlist(FormDict &effects, FormDict &operands) { 4599 void ADLParser::get_effectlist(FormDict &effects, FormDict &operands, bool& has_call) {
4600 OperandForm *opForm; 4600 OperandForm *opForm;
4601 Effect *eForm; 4601 Effect *eForm;
4602 char *ident; 4602 char *ident;
4603 4603
4604 do { 4604 do {
4627 } 4627 }
4628 } 4628 }
4629 // Debugging Stuff 4629 // Debugging Stuff
4630 if (_AD._adl_debug > 1) fprintf(stderr, "\tEffect Type: %s\t", ident); 4630 if (_AD._adl_debug > 1) fprintf(stderr, "\tEffect Type: %s\t", ident);
4631 skipws(); 4631 skipws();
4632 // Get name of operand and check that it is in the local name table 4632 if (eForm->is(Component::CALL)) {
4633 if( (ident = get_unique_ident(effects, "effect")) == NULL) { 4633 if (_AD._adl_debug > 1) fprintf(stderr, "\n");
4634 parse_err(SYNERR, "missing operand identifier in effect list\n"); 4634 has_call = true;
4635 return; 4635 } else {
4636 } 4636 // Get name of operand and check that it is in the local name table
4637 const Form *form = operands[ident]; 4637 if( (ident = get_unique_ident(effects, "effect")) == NULL) {
4638 opForm = form ? form->is_operand() : NULL; 4638 parse_err(SYNERR, "missing operand identifier in effect list\n");
4639 if( opForm == NULL ) { 4639 return;
4640 if( form && form->is_opclass() ) { 4640 }
4641 const char* cname = form->is_opclass()->_ident; 4641 const Form *form = operands[ident];
4642 parse_err(SYNERR, "operand classes are illegal in effect lists (found %s %s)\n", cname, ident); 4642 opForm = form ? form->is_operand() : NULL;
4643 } else { 4643 if( opForm == NULL ) {
4644 parse_err(SYNERR, "undefined operand %s in effect list\n", ident); 4644 if( form && form->is_opclass() ) {
4645 } 4645 const char* cname = form->is_opclass()->_ident;
4646 return; 4646 parse_err(SYNERR, "operand classes are illegal in effect lists (found %s %s)\n", cname, ident);
4647 } 4647 } else {
4648 // Add the pair to the effects table 4648 parse_err(SYNERR, "undefined operand %s in effect list\n", ident);
4649 effects.Insert(ident, eForm); 4649 }
4650 // Debugging Stuff 4650 return;
4651 if (_AD._adl_debug > 1) fprintf(stderr, "\tOperand Name: %s\n", ident); 4651 }
4652 // Add the pair to the effects table
4653 effects.Insert(ident, eForm);
4654 // Debugging Stuff
4655 if (_AD._adl_debug > 1) fprintf(stderr, "\tOperand Name: %s\n", ident);
4656 }
4652 skipws(); 4657 skipws();
4653 } while(_curchar == ','); 4658 } while(_curchar == ',');
4654 4659
4655 if (_curchar != ')') parse_err(SYNERR, "missing ')'\n"); 4660 if (_curchar != ')') parse_err(SYNERR, "missing ')'\n");
4656 else { 4661 else {