mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8000592: Improve adlc usability
Several changes to adlc to improve its usability Reviewed-by: kvn
This commit is contained in:
parent
6674423523
commit
f28ac57f94
11 changed files with 352 additions and 283 deletions
|
@ -221,6 +221,7 @@ ArchDesc::ArchDesc()
|
|||
_register = NULL;
|
||||
_encode = NULL;
|
||||
_pipeline = NULL;
|
||||
_frame = NULL;
|
||||
}
|
||||
|
||||
ArchDesc::~ArchDesc() {
|
||||
|
@ -648,7 +649,10 @@ int ArchDesc::instructFormCount() {
|
|||
// Return the textual binding for a given CPP flag name.
|
||||
// Return NULL if there is no binding, or it has been #undef-ed.
|
||||
char* ArchDesc::get_preproc_def(const char* flag) {
|
||||
SourceForm* deff = (SourceForm*) _preproc_table[flag];
|
||||
// In case of syntax errors, flag may take the value NULL.
|
||||
SourceForm* deff = NULL;
|
||||
if (flag != NULL)
|
||||
deff = (SourceForm*) _preproc_table[flag];
|
||||
return (deff == NULL) ? NULL : deff->_code;
|
||||
}
|
||||
|
||||
|
@ -803,7 +807,9 @@ int ArchDesc::emit_msg(int quiet, int flag, int line, const char *fmt,
|
|||
while (i++ <= 15) fputc(' ', errfile);
|
||||
fprintf(errfile, "%-8s:", pref);
|
||||
vfprintf(errfile, fmt, args);
|
||||
fprintf(errfile, "\n"); }
|
||||
fprintf(errfile, "\n");
|
||||
fflush(errfile);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -855,8 +861,14 @@ const char *ArchDesc::reg_mask(OperandForm &opForm) {
|
|||
|
||||
// Check constraints on result's register class
|
||||
const char *result_class = opForm.constrained_reg_class();
|
||||
if (!result_class) opForm.dump();
|
||||
assert( result_class, "Resulting register class was not defined for operand");
|
||||
if (result_class == NULL) {
|
||||
opForm.dump();
|
||||
syntax_err(opForm._linenum,
|
||||
"Use of an undefined result class for operand: %s",
|
||||
opForm._ident);
|
||||
abort();
|
||||
}
|
||||
|
||||
regMask = reg_class_to_reg_mask( result_class );
|
||||
|
||||
return regMask;
|
||||
|
@ -865,8 +877,14 @@ const char *ArchDesc::reg_mask(OperandForm &opForm) {
|
|||
// Obtain the name of the RegMask for an InstructForm
|
||||
const char *ArchDesc::reg_mask(InstructForm &inForm) {
|
||||
const char *result = inForm.reduce_result();
|
||||
assert( result,
|
||||
"Did not find result operand or RegMask for this instruction");
|
||||
|
||||
if (result == NULL) {
|
||||
syntax_err(inForm._linenum,
|
||||
"Did not find result operand or RegMask"
|
||||
" for this instruction: %s",
|
||||
inForm._ident);
|
||||
abort();
|
||||
}
|
||||
|
||||
// Instructions producing 'Universe' use RegMask::Empty
|
||||
if( strcmp(result,"Universe")==0 ) {
|
||||
|
@ -875,10 +893,17 @@ const char *ArchDesc::reg_mask(InstructForm &inForm) {
|
|||
|
||||
// Lookup this result operand and get its register class
|
||||
Form *form = (Form*)_globalNames[result];
|
||||
assert( form, "Result operand must be defined");
|
||||
if (form == NULL) {
|
||||
syntax_err(inForm._linenum,
|
||||
"Did not find result operand for result: %s", result);
|
||||
abort();
|
||||
}
|
||||
OperandForm *oper = form->is_operand();
|
||||
if (oper == NULL) form->dump();
|
||||
assert( oper, "Result must be an OperandForm");
|
||||
if (oper == NULL) {
|
||||
syntax_err(inForm._linenum, "Form is not an OperandForm:");
|
||||
form->dump();
|
||||
abort();
|
||||
}
|
||||
return reg_mask( *oper );
|
||||
}
|
||||
|
||||
|
@ -887,7 +912,13 @@ const char *ArchDesc::reg_mask(InstructForm &inForm) {
|
|||
char *ArchDesc::stack_or_reg_mask(OperandForm &opForm) {
|
||||
// name of cisc_spillable version
|
||||
const char *reg_mask_name = reg_mask(opForm);
|
||||
assert( reg_mask_name != NULL, "called with incorrect opForm");
|
||||
|
||||
if (reg_mask_name == NULL) {
|
||||
syntax_err(opForm._linenum,
|
||||
"Did not find reg_mask for opForm: %s",
|
||||
opForm._ident);
|
||||
abort();
|
||||
}
|
||||
|
||||
const char *stack_or = "STACK_OR_";
|
||||
int length = (int)strlen(stack_or) + (int)strlen(reg_mask_name) + 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue