8299974: Replace NULL with nullptr in share/adlc/
Reviewed-by: dlong, kvn
This commit is contained in:
parent
f09345b3a4
commit
62537d200f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
void* AdlAllocateHeap(size_t size) {
|
||||
unsigned char* ptr = (unsigned char*) malloc(size);
|
||||
if (ptr == NULL && size != 0) {
|
||||
if (ptr == nullptr && size != 0) {
|
||||
fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash!
|
||||
fflush(stderr);
|
||||
exit(1);
|
||||
@ -36,7 +36,7 @@ void* AdlAllocateHeap(size_t size) {
|
||||
|
||||
void* AdlReAllocateHeap(void* old_ptr, size_t size) {
|
||||
unsigned char* ptr = (unsigned char*) realloc(old_ptr, size);
|
||||
if (ptr == NULL && size != 0) {
|
||||
if (ptr == nullptr && size != 0) {
|
||||
fprintf(stderr, "Error: Out of memory in ADLC\n"); // logging can cause crash!
|
||||
fflush(stderr);
|
||||
exit(1);
|
||||
@ -53,7 +53,7 @@ void AdlChunk::operator delete(void* p, size_t length) {
|
||||
}
|
||||
|
||||
AdlChunk::AdlChunk(size_t length) {
|
||||
_next = NULL; // Chain on the linked list
|
||||
_next = nullptr; // Chain on the linked list
|
||||
_len = length; // Save actual size
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void AdlChunk::chop() {
|
||||
|
||||
void AdlChunk::next_chop() {
|
||||
_next->chop();
|
||||
_next = NULL;
|
||||
_next = nullptr;
|
||||
}
|
||||
|
||||
//------------------------------AdlArena------------------------------------------
|
||||
@ -164,8 +164,8 @@ void *AdlArena::Arealloc( void *old_ptr, size_t old_size, size_t new_size ) {
|
||||
// Reset this AdlArena to empty, and return this AdlArenas guts in a new AdlArena.
|
||||
AdlArena *AdlArena::reset(void) {
|
||||
AdlArena *a = new AdlArena(this); // New empty arena
|
||||
_first = _chunk = NULL; // Normal, new-arena initialization
|
||||
_hwm = _max = NULL;
|
||||
_first = _chunk = nullptr; // Normal, new-arena initialization
|
||||
_hwm = _max = nullptr;
|
||||
return a; // Return AdlArena with guts
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -172,7 +172,7 @@ protected:
|
||||
Interface *interface_parse(); // Parse operand interface rule
|
||||
Interface *mem_interface_parse(); // Parse memory interface rule
|
||||
Interface *cond_interface_parse(); // Parse conditional interface rule
|
||||
char *interface_field_parse(const char** format = NULL);// Parse field contents
|
||||
char *interface_field_parse(const char** format = nullptr);// Parse field contents
|
||||
|
||||
FormatRule *format_parse(void); // Parse format rule
|
||||
FormatRule *template_parse(void); // Parse format rule
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
// Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
//
|
||||
// This code is free software; you can redistribute it and/or modify it
|
||||
@ -85,9 +85,9 @@ void ChainList::dump() {
|
||||
|
||||
void ChainList::output(FILE *fp) {
|
||||
fprintf(fp, "\nChain Rules: output resets iterator\n");
|
||||
const char *cost = NULL;
|
||||
const char *name = NULL;
|
||||
const char *rule = NULL;
|
||||
const char *cost = nullptr;
|
||||
const char *name = nullptr;
|
||||
const char *rule = nullptr;
|
||||
bool chains_exist = false;
|
||||
for(reset(); (iter(name,cost,rule)) == true; ) {
|
||||
fprintf(fp, "Chain to <%s> at cost #%s using %s_rule\n",name, cost ? cost : "0", rule);
|
||||
@ -113,7 +113,7 @@ bool MatchList::search(const char *opc, const char *res, const char *lch,
|
||||
if ((lch == _lchild) || (lch && _lchild && !strcmp(lch, _lchild))) {
|
||||
if ((rch == _rchild) || (rch && _rchild && !strcmp(rch, _rchild))) {
|
||||
char * predStr = get_pred();
|
||||
char * prStr = pr?pr->_pred:NULL;
|
||||
char * prStr = pr?pr->_pred:nullptr;
|
||||
if (ADLParser::equivalent_expressions(prStr, predStr)) {
|
||||
return true;
|
||||
}
|
||||
@ -146,12 +146,12 @@ ArchDesc::ArchDesc()
|
||||
_internalOps(cmpstr,hashstr, Form::arena),
|
||||
_internalMatch(cmpstr,hashstr, Form::arena),
|
||||
_chainRules(cmpstr,hashstr, Form::arena),
|
||||
_cisc_spill_operand(NULL),
|
||||
_cisc_spill_operand(nullptr),
|
||||
_needs_deep_clone_jvms(false) {
|
||||
|
||||
// Initialize the opcode to MatchList table with NULLs
|
||||
// Initialize the opcode to MatchList table with nulls
|
||||
for( int i=0; i<_last_opcode; ++i ) {
|
||||
_mlistab[i] = NULL;
|
||||
_mlistab[i] = nullptr;
|
||||
}
|
||||
|
||||
// Set-up the global tables
|
||||
@ -185,18 +185,18 @@ ArchDesc::ArchDesc()
|
||||
_internal_errs = 0;
|
||||
|
||||
// Initialize I/O Files
|
||||
_ADL_file._name = NULL; _ADL_file._fp = NULL;
|
||||
_ADL_file._name = nullptr; _ADL_file._fp = nullptr;
|
||||
// Machine dependent output files
|
||||
_DFA_file._name = NULL; _DFA_file._fp = NULL;
|
||||
_HPP_file._name = NULL; _HPP_file._fp = NULL;
|
||||
_CPP_file._name = NULL; _CPP_file._fp = NULL;
|
||||
_bug_file._name = "bugs.out"; _bug_file._fp = NULL;
|
||||
_DFA_file._name = nullptr; _DFA_file._fp = nullptr;
|
||||
_HPP_file._name = nullptr; _HPP_file._fp = nullptr;
|
||||
_CPP_file._name = nullptr; _CPP_file._fp = nullptr;
|
||||
_bug_file._name = "bugs.out"; _bug_file._fp = nullptr;
|
||||
|
||||
// Initialize Register & Pipeline Form Pointers
|
||||
_register = NULL;
|
||||
_encode = NULL;
|
||||
_pipeline = NULL;
|
||||
_frame = NULL;
|
||||
_register = nullptr;
|
||||
_encode = nullptr;
|
||||
_pipeline = nullptr;
|
||||
_frame = nullptr;
|
||||
}
|
||||
|
||||
ArchDesc::~ArchDesc() {
|
||||
@ -232,12 +232,12 @@ void ArchDesc::inspectOperands() {
|
||||
// Iterate through all operands
|
||||
_operands.reset();
|
||||
OperandForm *op;
|
||||
for( ; (op = (OperandForm*)_operands.iter()) != NULL;) {
|
||||
for( ; (op = (OperandForm*)_operands.iter()) != nullptr;) {
|
||||
// Construct list of top-level operands (components)
|
||||
op->build_components();
|
||||
|
||||
// Ensure that match field is defined.
|
||||
if ( op->_matrule == NULL ) continue;
|
||||
if ( op->_matrule == nullptr ) continue;
|
||||
|
||||
// Type check match rules
|
||||
check_optype(op->_matrule);
|
||||
@ -274,7 +274,7 @@ void ArchDesc::inspectOperands() {
|
||||
|
||||
// Construct a MatchList for this entry.
|
||||
// Iterate over the list to enumerate all match cases for operands with multiple match rules.
|
||||
for (; mrule != NULL; mrule = mrule->_next) {
|
||||
for (; mrule != nullptr; mrule = mrule->_next) {
|
||||
mrule->_machType = rootOp;
|
||||
buildMatchList(mrule, result, rootOp, pred, cost);
|
||||
}
|
||||
@ -287,12 +287,12 @@ void ArchDesc::inspectInstructions() {
|
||||
// Iterate through all instructions
|
||||
_instructions.reset();
|
||||
InstructForm *instr;
|
||||
for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
|
||||
for( ; (instr = (InstructForm*)_instructions.iter()) != nullptr; ) {
|
||||
// Construct list of top-level operands (components)
|
||||
instr->build_components();
|
||||
|
||||
// Ensure that match field is defined.
|
||||
if ( instr->_matrule == NULL ) continue;
|
||||
if ( instr->_matrule == nullptr ) continue;
|
||||
|
||||
MatchRule &mrule = *instr->_matrule;
|
||||
Predicate *pred = instr->build_predicate();
|
||||
@ -316,7 +316,7 @@ void ArchDesc::inspectInstructions() {
|
||||
}
|
||||
|
||||
Attribute *attr = instr->_attribs;
|
||||
while (attr != NULL) {
|
||||
while (attr != nullptr) {
|
||||
if (strcmp(attr->_ident,"ins_short_branch") == 0 &&
|
||||
attr->int_val(*this) != 0) {
|
||||
if (!instr->is_ideal_branch() || instr->label_position() == -1) {
|
||||
@ -358,7 +358,7 @@ const char *ArchDesc::getMatchListIndex(MatchRule &mrule) {
|
||||
//------------------------------left reduction---------------------------------
|
||||
// Return the left reduction associated with an internal name
|
||||
const char *ArchDesc::reduceLeft(char *internalName) {
|
||||
const char *left = NULL;
|
||||
const char *left = nullptr;
|
||||
MatchNode *mnode = (MatchNode*)_internalMatch[internalName];
|
||||
if (mnode->_lChild) {
|
||||
mnode = mnode->_lChild;
|
||||
@ -370,7 +370,7 @@ const char *ArchDesc::reduceLeft(char *internalName) {
|
||||
|
||||
//------------------------------right reduction--------------------------------
|
||||
const char *ArchDesc::reduceRight(char *internalName) {
|
||||
const char *right = NULL;
|
||||
const char *right = nullptr;
|
||||
MatchNode *mnode = (MatchNode*)_internalMatch[internalName];
|
||||
if (mnode->_rChild) {
|
||||
mnode = mnode->_rChild;
|
||||
@ -388,10 +388,10 @@ void ArchDesc::check_optype(MatchRule *mrule) {
|
||||
// // Cycle through the list of match rules
|
||||
// while(mrule) {
|
||||
// // Check for a filled in type field
|
||||
// if (mrule->_opType == NULL) {
|
||||
// if (mrule->_opType == nullptr) {
|
||||
// const Form *form = operands[_result];
|
||||
// OpClassForm *opcForm = form ? form->is_opclass() : NULL;
|
||||
// assert(opcForm != NULL, "Match Rule contains invalid operand name.");
|
||||
// OpClassForm *opcForm = form ? form->is_opclass() : nullptr;
|
||||
// assert(opcForm != nullptr, "Match Rule contains invalid operand name.");
|
||||
// }
|
||||
// char *opType = opcForm->_ident;
|
||||
// }
|
||||
@ -402,12 +402,12 @@ void ArchDesc::add_chain_rule_entry(const char *src, const char *cost,
|
||||
const char *result) {
|
||||
// Look-up the operation in chain rule table
|
||||
ChainList *lst = (ChainList *)_chainRules[src];
|
||||
if (lst == NULL) {
|
||||
if (lst == nullptr) {
|
||||
lst = new ChainList();
|
||||
_chainRules.Insert(src, lst);
|
||||
}
|
||||
if (!lst->search(result)) {
|
||||
if (cost == NULL) {
|
||||
if (cost == nullptr) {
|
||||
cost = ((AttributeForm*)_globalNames[AttributeForm::_op_cost])->_attrdef;
|
||||
}
|
||||
lst->insert(result, cost, result);
|
||||
@ -420,8 +420,8 @@ void ArchDesc::build_chain_rule(OperandForm *oper) {
|
||||
|
||||
// Check for chain rules here
|
||||
// If this is only a chain rule
|
||||
if ((oper->_matrule) && (oper->_matrule->_lChild == NULL) &&
|
||||
(oper->_matrule->_rChild == NULL)) {
|
||||
if ((oper->_matrule) && (oper->_matrule->_lChild == nullptr) &&
|
||||
(oper->_matrule->_rChild == nullptr)) {
|
||||
|
||||
{
|
||||
const Form *form = _globalNames[oper->_matrule->_opType];
|
||||
@ -441,7 +441,7 @@ void ArchDesc::build_chain_rule(OperandForm *oper) {
|
||||
(form->ideal_only() == false)) {
|
||||
add_chain_rule_entry(rule->_opType, oper->cost(), oper->_ident);
|
||||
}
|
||||
} while(rule->_next != NULL);
|
||||
} while(rule->_next != nullptr);
|
||||
}
|
||||
}
|
||||
else if ((oper->_matrule) && (oper->_matrule->_next)) {
|
||||
@ -453,10 +453,10 @@ void ArchDesc::build_chain_rule(OperandForm *oper) {
|
||||
const Form *form = _globalNames[rule->_opType];
|
||||
if ((form) && form->is_operand() &&
|
||||
(form->ideal_only() == false)) {
|
||||
assert( oper->cost(), "This case expects NULL cost, not default cost");
|
||||
assert( oper->cost(), "This case expects null cost, not default cost");
|
||||
add_chain_rule_entry(rule->_opType, oper->cost(), oper->_ident);
|
||||
}
|
||||
} while(rule->_next != NULL);
|
||||
} while(rule->_next != nullptr);
|
||||
}
|
||||
|
||||
}
|
||||
@ -469,7 +469,7 @@ void ArchDesc::buildMatchList(MatchRule *mrule, const char *resultStr,
|
||||
const char *leftstr, *rightstr;
|
||||
MatchNode *mnode;
|
||||
|
||||
leftstr = rightstr = NULL;
|
||||
leftstr = rightstr = nullptr;
|
||||
// Check for chain rule, and do not generate a match list for it
|
||||
if ( mrule->is_chain_rule(_globalNames) ) {
|
||||
return;
|
||||
@ -507,16 +507,16 @@ void ArchDesc::buildMatchList(MatchRule *mrule, const char *resultStr,
|
||||
// for the parent's matchlist entry if it exists
|
||||
mnode = mrule->_lChild;
|
||||
if (mnode) {
|
||||
buildMList(mnode, NULL, NULL, NULL, NULL);
|
||||
buildMList(mnode, nullptr, nullptr, nullptr, nullptr);
|
||||
leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
|
||||
}
|
||||
mnode = mrule->_rChild;
|
||||
if (mnode) {
|
||||
buildMList(mnode, NULL, NULL, NULL, NULL);
|
||||
buildMList(mnode, nullptr, nullptr, nullptr, nullptr);
|
||||
rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
|
||||
}
|
||||
// Search for an identical matchlist entry already on the list
|
||||
if ((_mlistab[index] == NULL) ||
|
||||
if ((_mlistab[index] == nullptr) ||
|
||||
(_mlistab[index] &&
|
||||
!_mlistab[index]->search(rootOp, resultStr, leftstr, rightstr, pred))) {
|
||||
// Place this match rule at front of list
|
||||
@ -537,10 +537,10 @@ void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
|
||||
MatchNode *mnode;
|
||||
Form *form;
|
||||
|
||||
leftstr = rightstr = NULL;
|
||||
leftstr = rightstr = nullptr;
|
||||
// Do not process leaves of the Match Tree if they are not ideal
|
||||
if ((node) && (node->_lChild == NULL) && (node->_rChild == NULL) &&
|
||||
((form = (Form *)_globalNames[node->_opType]) != NULL) &&
|
||||
if ((node) && (node->_lChild == nullptr) && (node->_rChild == nullptr) &&
|
||||
((form = (Form *)_globalNames[node->_opType]) != nullptr) &&
|
||||
(!form->ideal_only())) {
|
||||
return;
|
||||
}
|
||||
@ -554,8 +554,8 @@ void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
|
||||
assert(0, "fatal error");
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
fprintf(stderr, "error: node is NULL\n");
|
||||
if (node == nullptr) {
|
||||
fprintf(stderr, "error: node is null\n");
|
||||
assert(0, "fatal error");
|
||||
}
|
||||
// Build MatchLists for children
|
||||
@ -563,27 +563,27 @@ void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
|
||||
// for the parent's matchlist entry if it exists
|
||||
mnode = node->_lChild;
|
||||
if (mnode) {
|
||||
buildMList(mnode, NULL, NULL, NULL, NULL);
|
||||
buildMList(mnode, nullptr, nullptr, nullptr, nullptr);
|
||||
leftstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
|
||||
}
|
||||
mnode = node->_rChild;
|
||||
if (mnode) {
|
||||
buildMList(mnode, NULL, NULL, NULL, NULL);
|
||||
buildMList(mnode, nullptr, nullptr, nullptr, nullptr);
|
||||
rightstr = mnode->_internalop ? mnode->_internalop : mnode->_opType;
|
||||
}
|
||||
// Grab the string for the opcode of this list entry
|
||||
if (rootOp == NULL) {
|
||||
if (rootOp == nullptr) {
|
||||
opcode = (node->_internalop) ? node->_internalop : node->_opType;
|
||||
} else {
|
||||
opcode = rootOp;
|
||||
}
|
||||
// Grab the string for the result of this list entry
|
||||
if (resultOp == NULL) {
|
||||
if (resultOp == nullptr) {
|
||||
resultop = (node->_internalop) ? node->_internalop : node->_opType;
|
||||
}
|
||||
else resultop = resultOp;
|
||||
// Search for an identical matchlist entry already on the list
|
||||
if ((_mlistab[index] == NULL) || (_mlistab[index] &&
|
||||
if ((_mlistab[index] == nullptr) || (_mlistab[index] &&
|
||||
!_mlistab[index]->search(opcode, resultop, leftstr, rightstr, pred))) {
|
||||
// Place this match rule at front of list
|
||||
MatchList *mList =
|
||||
@ -595,21 +595,21 @@ void ArchDesc::buildMList(MatchNode *node, const char *rootOp,
|
||||
|
||||
// Count number of OperandForms defined
|
||||
int ArchDesc::operandFormCount() {
|
||||
// Only interested in ones with non-NULL match rule
|
||||
// Only interested in ones with non-null match rule
|
||||
int count = 0; _operands.reset();
|
||||
OperandForm *cur;
|
||||
for( ; (cur = (OperandForm*)_operands.iter()) != NULL; ) {
|
||||
if (cur->_matrule != NULL) ++count;
|
||||
for( ; (cur = (OperandForm*)_operands.iter()) != nullptr; ) {
|
||||
if (cur->_matrule != nullptr) ++count;
|
||||
};
|
||||
return count;
|
||||
}
|
||||
|
||||
// Count number of OpClassForms defined
|
||||
int ArchDesc::opclassFormCount() {
|
||||
// Only interested in ones with non-NULL match rule
|
||||
// Only interested in ones with non-null match rule
|
||||
int count = 0; _operands.reset();
|
||||
OpClassForm *cur;
|
||||
for( ; (cur = (OpClassForm*)_opclass.iter()) != NULL; ) {
|
||||
for( ; (cur = (OpClassForm*)_opclass.iter()) != nullptr; ) {
|
||||
++count;
|
||||
};
|
||||
return count;
|
||||
@ -617,11 +617,11 @@ int ArchDesc::opclassFormCount() {
|
||||
|
||||
// Count number of InstructForms defined
|
||||
int ArchDesc::instructFormCount() {
|
||||
// Only interested in ones with non-NULL match rule
|
||||
// Only interested in ones with non-null match rule
|
||||
int count = 0; _instructions.reset();
|
||||
InstructForm *cur;
|
||||
for( ; (cur = (InstructForm*)_instructions.iter()) != NULL; ) {
|
||||
if (cur->_matrule != NULL) ++count;
|
||||
for( ; (cur = (InstructForm*)_instructions.iter()) != nullptr; ) {
|
||||
if (cur->_matrule != nullptr) ++count;
|
||||
};
|
||||
return count;
|
||||
}
|
||||
@ -629,24 +629,24 @@ int ArchDesc::instructFormCount() {
|
||||
|
||||
//------------------------------get_preproc_def--------------------------------
|
||||
// Return the textual binding for a given CPP flag name.
|
||||
// Return NULL if there is no binding, or it has been #undef-ed.
|
||||
// Return null if there is no binding, or it has been #undef-ed.
|
||||
char* ArchDesc::get_preproc_def(const char* flag) {
|
||||
// In case of syntax errors, flag may take the value NULL.
|
||||
SourceForm* deff = NULL;
|
||||
if (flag != NULL)
|
||||
// In case of syntax errors, flag may take the value null.
|
||||
SourceForm* deff = nullptr;
|
||||
if (flag != nullptr)
|
||||
deff = (SourceForm*) _preproc_table[flag];
|
||||
return (deff == NULL) ? NULL : deff->_code;
|
||||
return (deff == nullptr) ? nullptr : deff->_code;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------set_preproc_def--------------------------------
|
||||
// Change or create a textual binding for a given CPP flag name.
|
||||
// Giving NULL means the flag name is to be #undef-ed.
|
||||
// Giving null means the flag name is to be #undef-ed.
|
||||
// In any case, _preproc_list collects all names either #defined or #undef-ed.
|
||||
void ArchDesc::set_preproc_def(const char* flag, const char* def) {
|
||||
SourceForm* deff = (SourceForm*) _preproc_table[flag];
|
||||
if (deff == NULL) {
|
||||
deff = new SourceForm(NULL);
|
||||
if (deff == nullptr) {
|
||||
deff = new SourceForm(nullptr);
|
||||
_preproc_table.Insert(flag, deff);
|
||||
_preproc_list.addName(flag); // this supports iteration
|
||||
}
|
||||
@ -713,31 +713,31 @@ void ArchDesc::dump() {
|
||||
//------------------------------init_keywords----------------------------------
|
||||
// Load the keywords into the global name table
|
||||
void ArchDesc::initKeywords(FormDict& names) {
|
||||
// Insert keyword strings into Global Name Table. Keywords have a NULL value
|
||||
// Insert keyword strings into Global Name Table. Keywords have a null value
|
||||
// field for quick easy identification when checking identifiers.
|
||||
names.Insert("instruct", NULL);
|
||||
names.Insert("operand", NULL);
|
||||
names.Insert("attribute", NULL);
|
||||
names.Insert("source", NULL);
|
||||
names.Insert("register", NULL);
|
||||
names.Insert("pipeline", NULL);
|
||||
names.Insert("constraint", NULL);
|
||||
names.Insert("predicate", NULL);
|
||||
names.Insert("encode", NULL);
|
||||
names.Insert("enc_class", NULL);
|
||||
names.Insert("interface", NULL);
|
||||
names.Insert("opcode", NULL);
|
||||
names.Insert("ins_encode", NULL);
|
||||
names.Insert("match", NULL);
|
||||
names.Insert("effect", NULL);
|
||||
names.Insert("expand", NULL);
|
||||
names.Insert("rewrite", NULL);
|
||||
names.Insert("reg_def", NULL);
|
||||
names.Insert("reg_class", NULL);
|
||||
names.Insert("alloc_class", NULL);
|
||||
names.Insert("resource", NULL);
|
||||
names.Insert("pipe_class", NULL);
|
||||
names.Insert("pipe_desc", NULL);
|
||||
names.Insert("instruct", nullptr);
|
||||
names.Insert("operand", nullptr);
|
||||
names.Insert("attribute", nullptr);
|
||||
names.Insert("source", nullptr);
|
||||
names.Insert("register", nullptr);
|
||||
names.Insert("pipeline", nullptr);
|
||||
names.Insert("constraint", nullptr);
|
||||
names.Insert("predicate", nullptr);
|
||||
names.Insert("encode", nullptr);
|
||||
names.Insert("enc_class", nullptr);
|
||||
names.Insert("interface", nullptr);
|
||||
names.Insert("opcode", nullptr);
|
||||
names.Insert("ins_encode", nullptr);
|
||||
names.Insert("match", nullptr);
|
||||
names.Insert("effect", nullptr);
|
||||
names.Insert("expand", nullptr);
|
||||
names.Insert("rewrite", nullptr);
|
||||
names.Insert("reg_def", nullptr);
|
||||
names.Insert("reg_class", nullptr);
|
||||
names.Insert("alloc_class", nullptr);
|
||||
names.Insert("resource", nullptr);
|
||||
names.Insert("pipe_class", nullptr);
|
||||
names.Insert("pipe_desc", nullptr);
|
||||
}
|
||||
|
||||
|
||||
@ -802,7 +802,7 @@ int ArchDesc::emit_msg(int quiet, int flag, int line, const char *fmt,
|
||||
|
||||
// Construct the name of the register mask.
|
||||
static const char *getRegMask(const char *reg_class_name) {
|
||||
if( reg_class_name == NULL ) return "RegMask::Empty";
|
||||
if( reg_class_name == nullptr ) return "RegMask::Empty";
|
||||
|
||||
if (strcmp(reg_class_name,"Universe")==0) {
|
||||
return "RegMask::Empty";
|
||||
@ -827,7 +827,7 @@ const char *ArchDesc::reg_class_to_reg_mask(const char *rc_name) {
|
||||
|
||||
if( _register ) {
|
||||
RegClass *reg_class = _register->getRegClass(rc_name);
|
||||
if (reg_class == NULL) {
|
||||
if (reg_class == nullptr) {
|
||||
syntax_err(0, "Use of an undefined register class %s", rc_name);
|
||||
return reg_mask;
|
||||
}
|
||||
@ -846,7 +846,7 @@ 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 == NULL) {
|
||||
if (result_class == nullptr) {
|
||||
opForm.dump();
|
||||
syntax_err(opForm._linenum,
|
||||
"Use of an undefined result class for operand: %s",
|
||||
@ -863,7 +863,7 @@ const char *ArchDesc::reg_mask(OperandForm &opForm) {
|
||||
const char *ArchDesc::reg_mask(InstructForm &inForm) {
|
||||
const char *result = inForm.reduce_result();
|
||||
|
||||
if (result == NULL) {
|
||||
if (result == nullptr) {
|
||||
syntax_err(inForm._linenum,
|
||||
"Did not find result operand or RegMask"
|
||||
" for this instruction: %s",
|
||||
@ -878,13 +878,13 @@ const char *ArchDesc::reg_mask(InstructForm &inForm) {
|
||||
|
||||
// Lookup this result operand and get its register class
|
||||
Form *form = (Form*)_globalNames[result];
|
||||
if (form == NULL) {
|
||||
if (form == nullptr) {
|
||||
syntax_err(inForm._linenum,
|
||||
"Did not find result operand for result: %s", result);
|
||||
abort();
|
||||
}
|
||||
OperandForm *oper = form->is_operand();
|
||||
if (oper == NULL) {
|
||||
if (oper == nullptr) {
|
||||
syntax_err(inForm._linenum, "Form is not an OperandForm:");
|
||||
form->dump();
|
||||
abort();
|
||||
@ -898,7 +898,7 @@ char *ArchDesc::stack_or_reg_mask(OperandForm &opForm) {
|
||||
// name of cisc_spillable version
|
||||
const char *reg_mask_name = reg_mask(opForm);
|
||||
|
||||
if (reg_mask_name == NULL) {
|
||||
if (reg_mask_name == nullptr) {
|
||||
syntax_err(opForm._linenum,
|
||||
"Did not find reg_mask for opForm: %s",
|
||||
opForm._ident);
|
||||
@ -959,13 +959,13 @@ const char *ArchDesc::getIdealType(const char *idealOp) {
|
||||
case 'L': return "TypeLong::LONG";
|
||||
case 's': return "TypeInt::CC /*flags*/";
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
// !!!!!
|
||||
// internal_err("Ideal type %s with unrecognized type\n",idealOp);
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -1130,7 +1130,7 @@ void ArchDesc::addPreprocessorChecks(FILE *fp) {
|
||||
if (_preproc_list.count() > 0 && !_preproc_list.current_is_signal()) {
|
||||
fprintf(fp, "// Check consistency of C++ compilation with ADLC options:\n");
|
||||
}
|
||||
for (_preproc_list.reset(); (flag = _preproc_list.iter()) != NULL; ) {
|
||||
for (_preproc_list.reset(); (flag = _preproc_list.iter()) != nullptr; ) {
|
||||
if (_preproc_list.current_is_signal()) break;
|
||||
char* def = get_preproc_def(flag);
|
||||
fprintf(fp, "// Check adlc ");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -72,8 +72,8 @@ public:
|
||||
const char *_lchild;
|
||||
const char *_rchild;
|
||||
|
||||
MatchList(MatchList *nxt, Predicate *prd): _next(nxt), _pred(prd), _cost(NULL){
|
||||
_resultStr = _lchild = _rchild = _opcode = NULL; }
|
||||
MatchList(MatchList *nxt, Predicate *prd): _next(nxt), _pred(prd), _cost(nullptr){
|
||||
_resultStr = _lchild = _rchild = _opcode = nullptr; }
|
||||
|
||||
MatchList(MatchList *nxt, Predicate *prd, const char *cost,
|
||||
const char *opcode, const char *resultStr, const char *lchild,
|
||||
@ -82,9 +82,9 @@ public:
|
||||
_resultStr(resultStr), _lchild(lchild), _rchild(rchild) { }
|
||||
|
||||
MatchList *get_next(void) { return _next; }
|
||||
char *get_pred(void) { return (_pred?_pred->_pred:NULL); }
|
||||
char *get_pred(void) { return (_pred?_pred->_pred:nullptr); }
|
||||
Predicate *get_pred_obj(void) { return _pred; }
|
||||
const char *get_cost(void) { return _cost == NULL ? "0" :_cost; }
|
||||
const char *get_cost(void) { return _cost == nullptr ? "0" :_cost; }
|
||||
bool search(const char *opc, const char *res, const char *lch,
|
||||
const char *rch, Predicate *pr);
|
||||
|
||||
@ -352,7 +352,7 @@ public:
|
||||
void identify_unique_operands();
|
||||
void set_cisc_spill_operand(OperandForm *opForm) { _cisc_spill_operand = opForm; }
|
||||
OperandForm *cisc_spill_operand() { return _cisc_spill_operand; }
|
||||
bool can_cisc_spill() { return _cisc_spill_operand != NULL; }
|
||||
bool can_cisc_spill() { return _cisc_spill_operand != nullptr; }
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -67,7 +67,7 @@ public:
|
||||
// Reset for each root opcode (e.g., Op_RegI, Op_AddI, ...)
|
||||
class ProductionState {
|
||||
private:
|
||||
Dict _production; // map result of production, char*, to information or NULL
|
||||
Dict _production; // map result of production, char*, to information or null
|
||||
const char *_constraint;
|
||||
|
||||
public:
|
||||
@ -192,8 +192,8 @@ static void child_test(FILE *fp, MatchList &mList, bool is_vector_unary_op) {
|
||||
fprintf(fp, " && ");
|
||||
} else if (is_vector_unary_op) {
|
||||
// If unpredicated vector unary operation, add one extra check, i.e. right
|
||||
// child should be NULL, to distinguish from the predicated version.
|
||||
fprintf(fp, " && _kids[1] == NULL");
|
||||
// child should be null, to distinguish from the predicated version.
|
||||
fprintf(fp, " && _kids[1] == nullptr");
|
||||
}
|
||||
}
|
||||
if (mList._rchild) { // If right child, check it
|
||||
@ -291,14 +291,14 @@ void ArchDesc::gen_match(FILE *fp, MatchList &mList, ProductionState &status,
|
||||
void ArchDesc::expand_opclass(FILE *fp, const char *indent, const Expr *cost,
|
||||
const char *result_type, ProductionState &status) {
|
||||
const Form *form = _globalNames[result_type];
|
||||
OperandForm *op = form ? form->is_operand() : NULL;
|
||||
OperandForm *op = form ? form->is_operand() : nullptr;
|
||||
if( op && op->_classes.count() > 0 ) {
|
||||
if( debug_output ) { fprintf(fp, "// expand operand classes for operand: %s \n", (char *)op->_ident ); } // %%%%% Explanation
|
||||
// Iterate through all operand classes which include this operand
|
||||
op->_classes.reset();
|
||||
const char *oclass;
|
||||
// Expr *cCost = new Expr(cost);
|
||||
while( (oclass = op->_classes.iter()) != NULL )
|
||||
while( (oclass = op->_classes.iter()) != nullptr )
|
||||
// Check against other match costs, and update cost & rule vectors
|
||||
cost_check(fp, indent, ArchDesc::getMachOperEnum(oclass), cost, result_type, status);
|
||||
}
|
||||
@ -310,7 +310,7 @@ void ArchDesc::chain_rule(FILE *fp, const char *indent, const char *operand,
|
||||
const Expr *icost, const char *irule, Dict &operands_chained_from, ProductionState &status) {
|
||||
|
||||
// Check if we have already generated chains from this starting point
|
||||
if( operands_chained_from[operand] != NULL ) {
|
||||
if( operands_chained_from[operand] != nullptr ) {
|
||||
return;
|
||||
} else {
|
||||
operands_chained_from.Insert( operand, operand);
|
||||
@ -323,7 +323,7 @@ void ArchDesc::chain_rule(FILE *fp, const char *indent, const char *operand,
|
||||
const char *result, *cost, *rule;
|
||||
for(lst->reset(); (lst->iter(result,cost,rule)) == true; ) {
|
||||
// Do not generate operands that are already available
|
||||
if( operands_chained_from[result] != NULL ) {
|
||||
if( operands_chained_from[result] != nullptr ) {
|
||||
continue;
|
||||
} else {
|
||||
// Compute the cost for previous match + chain_rule_cost
|
||||
@ -415,7 +415,7 @@ void ArchDesc::buildDFA(FILE* fp) {
|
||||
// Now build the individual routines just like the switch entries in large version
|
||||
// Iterate over the table of MatchLists, start at first valid opcode of 1
|
||||
for (i = 1; i < _last_opcode; i++) {
|
||||
if (_mlistab[i] == NULL) continue;
|
||||
if (_mlistab[i] == nullptr) continue;
|
||||
// Generate the routine header statement for this opcode
|
||||
fprintf(fp, "void State::_sub_Op_%s(const Node *n){\n", NodeClassNames[i]);
|
||||
// Generate body. Shared for both inline and out-of-line version
|
||||
@ -430,7 +430,7 @@ void ArchDesc::buildDFA(FILE* fp) {
|
||||
|
||||
// Iterate over the table of MatchLists, start at first valid opcode of 1
|
||||
for (i = 1; i < _last_opcode; i++) {
|
||||
if (_mlistab[i] == NULL) continue;
|
||||
if (_mlistab[i] == nullptr) continue;
|
||||
// Generate the case statement for this opcode
|
||||
if (_dfa_small) {
|
||||
fprintf(fp, " case Op_%s: { _sub_Op_%s(n);\n", NodeClassNames[i], NodeClassNames[i]);
|
||||
@ -518,10 +518,10 @@ public:
|
||||
|
||||
// Check each predicate in the MatchList for common sub-expressions
|
||||
static void cse_matchlist(MatchList *matchList) {
|
||||
for( MatchList *mList = matchList; mList != NULL; mList = mList->get_next() ) {
|
||||
for( MatchList *mList = matchList; mList != nullptr; mList = mList->get_next() ) {
|
||||
Predicate* predicate = mList->get_pred_obj();
|
||||
char* pred = mList->get_pred();
|
||||
if( pred != NULL ) {
|
||||
if( pred != nullptr ) {
|
||||
for(int index = 0; index < count; ++index ) {
|
||||
const char *shared_pred = dfa_shared_preds::pred(index);
|
||||
const char *shared_pred_var = dfa_shared_preds::var(index);
|
||||
@ -537,10 +537,10 @@ public:
|
||||
static bool cse_predicate(Predicate* predicate, const char *shared_pred, const char *shared_pred_var) {
|
||||
bool result = false;
|
||||
char *pred = predicate->_pred;
|
||||
if( pred != NULL ) {
|
||||
if( pred != nullptr ) {
|
||||
char *new_pred = pred;
|
||||
for( char *shared_pred_loc = strstr(new_pred, shared_pred);
|
||||
shared_pred_loc != NULL && dfa_shared_preds::valid_loc(new_pred,shared_pred_loc);
|
||||
shared_pred_loc != nullptr && dfa_shared_preds::valid_loc(new_pred,shared_pred_loc);
|
||||
shared_pred_loc = strstr(new_pred, shared_pred) ) {
|
||||
// Do not modify the original predicate string, it is shared
|
||||
if( new_pred == pred ) {
|
||||
@ -610,7 +610,7 @@ void ArchDesc::gen_dfa_state_body(FILE* fp, Dict &minimize, ProductionState &sta
|
||||
prune_matchlist(minimize, *mList);
|
||||
// Iterate
|
||||
mList = mList->get_next();
|
||||
} while(mList != NULL);
|
||||
} while(mList != nullptr);
|
||||
|
||||
// Hoist previously specified common sub-expressions out of predicates
|
||||
dfa_shared_preds::reset_found();
|
||||
@ -626,7 +626,7 @@ void ArchDesc::gen_dfa_state_body(FILE* fp, Dict &minimize, ProductionState &sta
|
||||
operands_chained_from.Clear();
|
||||
gen_match(fp, *mList, status, operands_chained_from, is_vector_unary_op);
|
||||
mList = mList->get_next();
|
||||
} while(mList != NULL);
|
||||
} while(mList != nullptr);
|
||||
// Fill in any chain rules which add instructions
|
||||
// These can generate their own chains as well.
|
||||
operands_chained_from.Clear(); //
|
||||
@ -639,22 +639,22 @@ void ArchDesc::gen_dfa_state_body(FILE* fp, Dict &minimize, ProductionState &sta
|
||||
|
||||
|
||||
//------------------------------Expr------------------------------------------
|
||||
Expr *Expr::_unknown_expr = NULL;
|
||||
Expr *Expr::_unknown_expr = nullptr;
|
||||
char Expr::string_buffer[STRING_BUFFER_LENGTH];
|
||||
char Expr::external_buffer[STRING_BUFFER_LENGTH];
|
||||
bool Expr::_init_buffers = Expr::init_buffers();
|
||||
|
||||
Expr::Expr() {
|
||||
_external_name = NULL;
|
||||
_external_name = nullptr;
|
||||
_expr = "Invalid_Expr";
|
||||
_min_value = Expr::Max;
|
||||
_max_value = Expr::Zero;
|
||||
}
|
||||
Expr::Expr(const char *cost) {
|
||||
_external_name = NULL;
|
||||
_external_name = nullptr;
|
||||
|
||||
int intval = 0;
|
||||
if( cost == NULL ) {
|
||||
if( cost == nullptr ) {
|
||||
_expr = "0";
|
||||
_min_value = Expr::Zero;
|
||||
_max_value = Expr::Zero;
|
||||
@ -711,7 +711,7 @@ void Expr::add(const char *c) {
|
||||
|
||||
void Expr::add(const char *c, ArchDesc &AD) {
|
||||
const Expr *e = AD.globalDefs()[c];
|
||||
if( e != NULL ) {
|
||||
if( e != nullptr ) {
|
||||
// use the value of 'c' defined in <arch>.ad
|
||||
add(e);
|
||||
} else {
|
||||
@ -721,10 +721,10 @@ void Expr::add(const char *c, ArchDesc &AD) {
|
||||
}
|
||||
|
||||
const char *Expr::compute_external(const Expr *c1, const Expr *c2) {
|
||||
const char * result = NULL;
|
||||
const char * result = nullptr;
|
||||
|
||||
// Preserve use of external name which has a zero value
|
||||
if( c1->_external_name != NULL ) {
|
||||
if( c1->_external_name != nullptr ) {
|
||||
if( c2->is_zero() ) {
|
||||
snprintf(string_buffer, STRING_BUFFER_LENGTH, "%s", c1->as_string());
|
||||
} else {
|
||||
@ -733,7 +733,7 @@ const char *Expr::compute_external(const Expr *c1, const Expr *c2) {
|
||||
string_buffer[STRING_BUFFER_LENGTH - 1] = '\0';
|
||||
result = strdup(string_buffer);
|
||||
}
|
||||
else if( c2->_external_name != NULL ) {
|
||||
else if( c2->_external_name != nullptr ) {
|
||||
if( c1->is_zero() ) {
|
||||
snprintf(string_buffer, STRING_BUFFER_LENGTH, "%s", c2->_external_name);
|
||||
} else {
|
||||
@ -790,7 +790,7 @@ int Expr::compute_max(const Expr *c1, const Expr *c2) {
|
||||
}
|
||||
|
||||
void Expr::print() const {
|
||||
if( _external_name != NULL ) {
|
||||
if( _external_name != nullptr ) {
|
||||
printf(" %s == (%s) === [%d, %d]\n", _external_name, _expr, _min_value, _max_value);
|
||||
} else {
|
||||
printf(" %s === [%d, %d]\n", _expr, _min_value, _max_value);
|
||||
@ -798,20 +798,20 @@ void Expr::print() const {
|
||||
}
|
||||
|
||||
void Expr::print_define(FILE *fp) const {
|
||||
assert( _external_name != NULL, "definition does not have a name");
|
||||
assert( _external_name != nullptr, "definition does not have a name");
|
||||
assert( _min_value == _max_value, "Expect user definitions to have constant value");
|
||||
fprintf(fp, "#define %s (%s) \n", _external_name, _expr);
|
||||
fprintf(fp, "// value == %d \n", _min_value);
|
||||
}
|
||||
|
||||
void Expr::print_assert(FILE *fp) const {
|
||||
assert( _external_name != NULL, "definition does not have a name");
|
||||
assert( _external_name != nullptr, "definition does not have a name");
|
||||
assert( _min_value == _max_value, "Expect user definitions to have constant value");
|
||||
fprintf(fp, " assert( %s == %d, \"Expect (%s) to equal %d\");\n", _external_name, _min_value, _expr, _min_value);
|
||||
}
|
||||
|
||||
Expr *Expr::get_unknown() {
|
||||
if( Expr::_unknown_expr == NULL ) {
|
||||
if( Expr::_unknown_expr == nullptr ) {
|
||||
Expr::_unknown_expr = new Expr();
|
||||
}
|
||||
|
||||
@ -859,7 +859,7 @@ int ExprDict::Size(void) const {
|
||||
// and records the name in order for later output, ...
|
||||
const Expr *ExprDict::define(const char *name, Expr *expr) {
|
||||
const Expr *old_expr = (*this)[name];
|
||||
assert(old_expr == NULL, "Implementation does not support redefinition");
|
||||
assert(old_expr == nullptr, "Implementation does not support redefinition");
|
||||
|
||||
_expr.Insert(name, expr);
|
||||
_defines.addName(name);
|
||||
@ -868,12 +868,12 @@ const Expr *ExprDict::define(const char *name, Expr *expr) {
|
||||
}
|
||||
|
||||
// Insert inserts the given key-value pair into the dictionary. The prior
|
||||
// value of the key is returned; NULL if the key was not previously defined.
|
||||
// value of the key is returned; null if the key was not previously defined.
|
||||
const Expr *ExprDict::Insert(const char *name, Expr *expr) {
|
||||
return (Expr*)_expr.Insert((void*)name, (void*)expr);
|
||||
}
|
||||
|
||||
// Finds the value of a given key; or NULL if not found.
|
||||
// Finds the value of a given key; or null if not found.
|
||||
// The dictionary is NOT changed.
|
||||
const Expr *ExprDict::operator [](const char *name) const {
|
||||
return (Expr*)_expr[name];
|
||||
@ -881,20 +881,20 @@ const Expr *ExprDict::operator [](const char *name) const {
|
||||
|
||||
void ExprDict::print_defines(FILE *fp) {
|
||||
fprintf(fp, "\n");
|
||||
const char *name = NULL;
|
||||
for( _defines.reset(); (name = _defines.iter()) != NULL; ) {
|
||||
const char *name = nullptr;
|
||||
for( _defines.reset(); (name = _defines.iter()) != nullptr; ) {
|
||||
const Expr *expr = (const Expr*)_expr[name];
|
||||
assert( expr != NULL, "name in ExprDict without matching Expr in dictionary");
|
||||
assert( expr != nullptr, "name in ExprDict without matching Expr in dictionary");
|
||||
expr->print_define(fp);
|
||||
}
|
||||
}
|
||||
void ExprDict::print_asserts(FILE *fp) {
|
||||
fprintf(fp, "\n");
|
||||
fprintf(fp, " // Following assertions generated from definition section\n");
|
||||
const char *name = NULL;
|
||||
for( _defines.reset(); (name = _defines.iter()) != NULL; ) {
|
||||
const char *name = nullptr;
|
||||
for( _defines.reset(); (name = _defines.iter()) != nullptr; ) {
|
||||
const Expr *expr = (const Expr*)_expr[name];
|
||||
assert( expr != NULL, "name in ExprDict without matching Expr in dictionary");
|
||||
assert( expr != nullptr, "name in ExprDict without matching Expr in dictionary");
|
||||
expr->print_assert(fp);
|
||||
}
|
||||
}
|
||||
@ -939,17 +939,17 @@ Production::Production(const char *result, const char *constraint, const char *v
|
||||
}
|
||||
|
||||
void Production::initialize() {
|
||||
_result = NULL;
|
||||
_constraint = NULL;
|
||||
_result = nullptr;
|
||||
_constraint = nullptr;
|
||||
_valid = knownInvalid;
|
||||
_cost_lb = Expr::get_unknown();
|
||||
_cost_ub = Expr::get_unknown();
|
||||
}
|
||||
|
||||
void Production::print() {
|
||||
printf("%s", (_result == NULL ? "NULL" : _result ) );
|
||||
printf("%s", (_constraint == NULL ? "NULL" : _constraint ) );
|
||||
printf("%s", (_valid == NULL ? "NULL" : _valid ) );
|
||||
printf("%s", (_result == nullptr ? "nullptr" : _result ) );
|
||||
printf("%s", (_constraint == nullptr ? "nullptr" : _constraint ) );
|
||||
printf("%s", (_valid == nullptr ? "nullptr" : _valid ) );
|
||||
_cost_lb->print();
|
||||
_cost_ub->print();
|
||||
}
|
||||
@ -961,12 +961,12 @@ void ProductionState::initialize() {
|
||||
|
||||
// reset each Production currently in the dictionary
|
||||
DictI iter( &_production );
|
||||
const void *x, *y = NULL;
|
||||
const void *x, *y = nullptr;
|
||||
for( ; iter.test(); ++iter) {
|
||||
x = iter._key;
|
||||
y = iter._value;
|
||||
Production *p = (Production*)y;
|
||||
if( p != NULL ) {
|
||||
if( p != nullptr ) {
|
||||
p->initialize();
|
||||
}
|
||||
}
|
||||
@ -974,7 +974,7 @@ void ProductionState::initialize() {
|
||||
|
||||
Production *ProductionState::getProduction(const char *result) {
|
||||
Production *p = (Production *)_production[result];
|
||||
if( p == NULL ) {
|
||||
if( p == nullptr ) {
|
||||
p = new Production(result, _constraint, knownInvalid);
|
||||
_production.Insert(result, p);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -52,7 +52,7 @@ public:
|
||||
// doubled in size; the total amount of EXTRA times all hash functions are
|
||||
// computed for the doubling is no more than the current size - thus the
|
||||
// doubling in size costs no more than a constant factor in speed.
|
||||
Dict::Dict(CmpKey initcmp, Hash inithash) : _hash(inithash), _cmp(initcmp), _arena(NULL) {
|
||||
Dict::Dict(CmpKey initcmp, Hash inithash) : _hash(inithash), _cmp(initcmp), _arena(nullptr) {
|
||||
init();
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ Dict &Dict::operator =( const Dict &d ) {
|
||||
//------------------------------Insert---------------------------------------
|
||||
// Insert or replace a key/value pair in the given dictionary. If the
|
||||
// dictionary is too full, it's size is doubled. The prior value being
|
||||
// replaced is returned (NULL if this is a 1st insertion of that key). If
|
||||
// replaced is returned (null if this is a 1st insertion of that key). If
|
||||
// an old value is found, it's swapped with the prior key-value pair on the
|
||||
// list. This moves a commonly searched-for value towards the list head.
|
||||
const void *Dict::Insert(const void *key, const void *val) {
|
||||
@ -204,7 +204,7 @@ const void *Dict::Insert(const void *key, const void *val) {
|
||||
b->_keyvals[b->_cnt+b->_cnt ] = key;
|
||||
b->_keyvals[b->_cnt+b->_cnt+1] = val;
|
||||
b->_cnt++;
|
||||
return NULL; // Nothing found prior
|
||||
return nullptr; // Nothing found prior
|
||||
}
|
||||
|
||||
//------------------------------Delete---------------------------------------
|
||||
@ -221,11 +221,11 @@ const void *Dict::Delete(void *key) {
|
||||
_cnt--; // One less thing in table
|
||||
return prior;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//------------------------------FindDict-------------------------------------
|
||||
// Find a key-value pair in the given dictionary. If not found, return NULL.
|
||||
// Find a key-value pair in the given dictionary. If not found, return null.
|
||||
// If found, move key-value pair towards head of list.
|
||||
const void *Dict::operator [](const void *key) const {
|
||||
int i = _hash( key ) & (_size-1); // Get hash key, corrected for size
|
||||
@ -233,7 +233,7 @@ const void *Dict::operator [](const void *key) const {
|
||||
for( int j=0; j<b->_cnt; j++ )
|
||||
if( !_cmp(key,b->_keyvals[j+j]) )
|
||||
return b->_keyvals[j+j+1];
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//------------------------------CmpDict--------------------------------------
|
||||
@ -335,7 +335,7 @@ void DictI::reset( const Dict *dict ) {
|
||||
}
|
||||
|
||||
//------------------------------next-------------------------------------------
|
||||
// Find the next key-value pair in the dictionary, or return a NULL key and
|
||||
// Find the next key-value pair in the dictionary, or return a null key and
|
||||
// value.
|
||||
void DictI::operator ++(void) {
|
||||
if( _j-- ) { // Still working in current bin?
|
||||
@ -352,5 +352,5 @@ void DictI::operator ++(void) {
|
||||
_value = _d->_bin[_i]._keyvals[_j+_j+1];
|
||||
return;
|
||||
}
|
||||
_key = _value = NULL;
|
||||
_key = _value = nullptr;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -70,11 +70,11 @@ class Dict { // Dictionary structure
|
||||
int Size(void) const { return _cnt; }
|
||||
|
||||
// Insert inserts the given key-value pair into the dictionary. The prior
|
||||
// value of the key is returned; NULL if the key was not previously defined.
|
||||
// value of the key is returned; null if the key was not previously defined.
|
||||
const void *Insert(const void *key, const void *val); // A new key-value
|
||||
const void *Delete(void *key); // Delete & return old
|
||||
|
||||
// Find finds the value of a given key; or NULL if not found.
|
||||
// Find finds the value of a given key; or null if not found.
|
||||
// The dictionary is NOT changed.
|
||||
const void *operator [](const void *key) const; // Do a lookup
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -61,7 +61,7 @@ FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(arc
|
||||
exit(1); // Exit on read error
|
||||
}
|
||||
*_bufmax = '\n'; // End with a sentinel new-line
|
||||
*(_bufmax+1) = '\0'; // Then end with a sentinel NULL
|
||||
*(_bufmax+1) = '\0'; // Then end with a sentinel null
|
||||
}
|
||||
|
||||
//------------------------------~FileBuff--------------------------------------
|
||||
@ -74,12 +74,12 @@ FileBuff::~FileBuff() {
|
||||
char *FileBuff::get_line(void) {
|
||||
char *retval;
|
||||
|
||||
// Check for end of file & return NULL
|
||||
if (_bufeol >= _bufmax) return NULL;
|
||||
// Check for end of file & return null
|
||||
if (_bufeol >= _bufmax) return nullptr;
|
||||
|
||||
_linenum++;
|
||||
retval = ++_bufeol; // return character following end of previous line
|
||||
if (*retval == '\0') return NULL; // Check for EOF sentinel
|
||||
if (*retval == '\0') return nullptr; // Check for EOF sentinel
|
||||
// Search for newline character which must end each line
|
||||
for(_filepos++; *_bufeol != '\n'; _bufeol++)
|
||||
_filepos++; // keep filepos in sync with _bufeol
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,7 +33,7 @@ class BufferedFile {
|
||||
public:
|
||||
const char *_name;
|
||||
FILE *_fp;
|
||||
inline BufferedFile() { _name = NULL; _fp = NULL; };
|
||||
inline BufferedFile() { _name = nullptr; _fp = nullptr; };
|
||||
inline ~BufferedFile() {};
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -68,11 +68,11 @@ int NameList::count() const { return _cur; }
|
||||
|
||||
void NameList::reset() { _iter = 0; _justReset = true;}
|
||||
const char *NameList::iter() {
|
||||
if (_justReset) {_justReset=false; return (_iter < _cur ? _names[_iter] : NULL);}
|
||||
else return (_iter <_cur-1 ? _names[++_iter] : NULL);
|
||||
if (_justReset) {_justReset=false; return (_iter < _cur ? _names[_iter] : nullptr);}
|
||||
else return (_iter <_cur-1 ? _names[++_iter] : nullptr);
|
||||
}
|
||||
const char *NameList::current() { return (_iter < _cur ? _names[_iter] : NULL); }
|
||||
const char *NameList::peek(int skip) { return (_iter + skip < _cur ? _names[_iter + skip] : NULL); }
|
||||
const char *NameList::current() { return (_iter < _cur ? _names[_iter] : nullptr); }
|
||||
const char *NameList::peek(int skip) { return (_iter + skip < _cur ? _names[_iter + skip] : nullptr); }
|
||||
|
||||
// Return 'true' if current entry is signal
|
||||
bool NameList::current_is_signal() {
|
||||
@ -88,7 +88,7 @@ bool NameList::is_signal(const char *entry) {
|
||||
// Search for a name in the list
|
||||
bool NameList::search(const char *name) {
|
||||
const char *entry;
|
||||
for(reset(); (entry = iter()) != NULL; ) {
|
||||
for(reset(); (entry = iter()) != nullptr; ) {
|
||||
if(!strcmp(entry,name)) return true;
|
||||
}
|
||||
return false;
|
||||
@ -98,7 +98,7 @@ bool NameList::search(const char *name) {
|
||||
int NameList::index(const char *name) {
|
||||
int cnt = 0;
|
||||
const char *entry;
|
||||
for(reset(); (entry = iter()) != NULL; ) {
|
||||
for(reset(); (entry = iter()) != nullptr; ) {
|
||||
if(!strcmp(entry,name)) return cnt;
|
||||
cnt++;
|
||||
}
|
||||
@ -107,7 +107,7 @@ int NameList::index(const char *name) {
|
||||
|
||||
// Return name at index in list
|
||||
const char *NameList::name(intptr_t index) {
|
||||
return ( index < _cur ? _names[index] : NULL);
|
||||
return ( index < _cur ? _names[index] : nullptr);
|
||||
}
|
||||
|
||||
void NameList::dump() { output(stderr); }
|
||||
@ -116,14 +116,14 @@ void NameList::output(FILE *fp) {
|
||||
fprintf(fp, "\n");
|
||||
|
||||
// Run iteration over all entries, independent of position of iterator.
|
||||
const char *name = NULL;
|
||||
const char *name = nullptr;
|
||||
int iter = 0;
|
||||
bool justReset = true;
|
||||
|
||||
while( ( name = (justReset ?
|
||||
(justReset=false, (iter < _cur ? _names[iter] : NULL)) :
|
||||
(iter < _cur-1 ? _names[++iter] : NULL)) )
|
||||
!= NULL ) {
|
||||
(justReset=false, (iter < _cur ? _names[iter] : nullptr)) :
|
||||
(iter < _cur-1 ? _names[++iter] : nullptr)) )
|
||||
!= nullptr ) {
|
||||
fprintf( fp, " %s,\n", name);
|
||||
}
|
||||
fprintf(fp, "\n");
|
||||
@ -171,7 +171,7 @@ void NameAndList::output(FILE *fp) {
|
||||
// Output the associated list of names
|
||||
const char *name;
|
||||
fprintf(fp, " (");
|
||||
for (reset(); (name = iter()) != NULL;) {
|
||||
for (reset(); (name = iter()) != nullptr;) {
|
||||
fprintf(fp, " %s,\n", name);
|
||||
}
|
||||
fprintf(fp, ")");
|
||||
@ -180,39 +180,39 @@ void NameAndList::output(FILE *fp) {
|
||||
|
||||
//------------------------------Form-------------------------------------------
|
||||
OpClassForm *Form::is_opclass() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
OperandForm *Form::is_operand() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
InstructForm *Form::is_instruction() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MachNodeForm *Form::is_machnode() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AttributeForm *Form::is_attribute() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Effect *Form::is_effect() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ResourceForm *Form::is_resource() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PipeClassForm *Form::is_pipeclass() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Form::DataType Form::ideal_to_const_type(const char *name) const {
|
||||
if( name == NULL ) { return Form::none; }
|
||||
if( name == nullptr ) { return Form::none; }
|
||||
|
||||
if (strcmp(name,"ConI")==0) return Form::idealI;
|
||||
if (strcmp(name,"ConP")==0) return Form::idealP;
|
||||
@ -227,7 +227,7 @@ Form::DataType Form::ideal_to_const_type(const char *name) const {
|
||||
}
|
||||
|
||||
Form::DataType Form::ideal_to_sReg_type(const char *name) const {
|
||||
if( name == NULL ) { return Form::none; }
|
||||
if( name == nullptr ) { return Form::none; }
|
||||
|
||||
if (strcmp(name,"sRegI")==0) return Form::idealI;
|
||||
if (strcmp(name,"sRegP")==0) return Form::idealP;
|
||||
@ -238,7 +238,7 @@ Form::DataType Form::ideal_to_sReg_type(const char *name) const {
|
||||
}
|
||||
|
||||
Form::DataType Form::ideal_to_Reg_type(const char *name) const {
|
||||
if( name == NULL ) { return Form::none; }
|
||||
if( name == nullptr ) { return Form::none; }
|
||||
|
||||
if (strcmp(name,"RegI")==0) return Form::idealI;
|
||||
if (strcmp(name,"RegP")==0) return Form::idealP;
|
||||
@ -302,8 +302,8 @@ Form::InterfaceType Form::interface_type(FormDict &globals) const {
|
||||
FormList::~FormList() {
|
||||
// // This list may not own its elements
|
||||
// Form *cur = _root;
|
||||
// Form *next = NULL;
|
||||
// for( ; (cur = next) != NULL; ) {
|
||||
// Form *next = nullptr;
|
||||
// for( ; (cur = next) != nullptr; ) {
|
||||
// next = (Form *)cur->_next;
|
||||
// delete cur;
|
||||
// }
|
||||
@ -323,12 +323,12 @@ int FormDict::Size(void) const {
|
||||
}
|
||||
|
||||
// Insert inserts the given key-value pair into the dictionary. The prior
|
||||
// value of the key is returned; NULL if the key was not previously defined.
|
||||
// value of the key is returned; null if the key was not previously defined.
|
||||
const Form *FormDict::Insert(const char *name, Form *form) {
|
||||
return (Form*)_form.Insert((void*)name, (void*)form);
|
||||
}
|
||||
|
||||
// Finds the value of a given key; or NULL if not found.
|
||||
// Finds the value of a given key; or null if not found.
|
||||
// The dictionary is NOT changed.
|
||||
const Form *FormDict::operator [](const char *name) const {
|
||||
return (Form*)_form[name];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -84,7 +84,7 @@ class ArchDesc;
|
||||
// Dictionary containing Forms, and objects derived from forms
|
||||
class FormDict {
|
||||
private:
|
||||
Dict _form; // map names, char*, to their Form* or NULL
|
||||
Dict _form; // map names, char*, to their Form* or null
|
||||
|
||||
// Disable public use of constructor, copy-ctor, operator =, operator ==
|
||||
FormDict( );
|
||||
@ -105,10 +105,10 @@ public:
|
||||
int Size(void) const;
|
||||
|
||||
// Insert inserts the given key-value pair into the dictionary. The prior
|
||||
// value of the key is returned; NULL if the key was not previously defined.
|
||||
// value of the key is returned; null if the key was not previously defined.
|
||||
const Form *Insert(const char *name, Form *form); // A new key-value
|
||||
|
||||
// Find finds the value of a given key; or NULL if not found.
|
||||
// Find finds the value of a given key; or null if not found.
|
||||
// The dictionary is NOT changed.
|
||||
const Form *operator [](const char *name) const; // Do a lookup
|
||||
|
||||
@ -147,7 +147,7 @@ public:
|
||||
|
||||
// Public Methods
|
||||
Form(int formType=0, int line=0)
|
||||
: _next(NULL), _linenum(line), _ftype(formType) { };
|
||||
: _next(nullptr), _linenum(line), _ftype(formType) { };
|
||||
virtual ~Form() {};
|
||||
|
||||
virtual bool ideal_only() const {
|
||||
@ -265,7 +265,7 @@ private:
|
||||
|
||||
public:
|
||||
void addForm(Form * entry) {
|
||||
if (_tail==NULL) { _root = _tail = _cur = entry;}
|
||||
if (_tail==nullptr) { _root = _tail = _cur = entry;}
|
||||
else { _tail->_next = entry; _tail = entry;}
|
||||
};
|
||||
Form * current() { return _cur; };
|
||||
@ -283,14 +283,14 @@ public:
|
||||
|
||||
int count() {
|
||||
int count = 0; reset();
|
||||
for( Form *cur; (cur = iter()) != NULL; ) { ++count; };
|
||||
for( Form *cur; (cur = iter()) != nullptr; ) { ++count; };
|
||||
return count;
|
||||
}
|
||||
|
||||
void dump() {
|
||||
reset();
|
||||
Form *cur;
|
||||
for(; (cur = iter()) != NULL; ) {
|
||||
for(; (cur = iter()) != nullptr; ) {
|
||||
cur->dump();
|
||||
};
|
||||
}
|
||||
@ -300,7 +300,7 @@ public:
|
||||
|
||||
reset();
|
||||
Form *cur;
|
||||
for(; (cur = iter()) != NULL; ) {
|
||||
for(; (cur = iter()) != nullptr; ) {
|
||||
if ( ! cur->verify() ) verified = false;
|
||||
};
|
||||
|
||||
@ -310,12 +310,12 @@ public:
|
||||
void output(FILE* fp) {
|
||||
reset();
|
||||
Form *cur;
|
||||
for( ; (cur = iter()) != NULL; ) {
|
||||
for( ; (cur = iter()) != nullptr; ) {
|
||||
cur->output(fp);
|
||||
};
|
||||
}
|
||||
|
||||
FormList() { _justReset = 1; _justReset2 = 1; _root = NULL; _tail = NULL; _cur = NULL; _cur2 = NULL;};
|
||||
FormList() { _justReset = 1; _justReset2 = 1; _root = nullptr; _tail = nullptr; _cur = nullptr; _cur2 = nullptr;};
|
||||
~FormList();
|
||||
};
|
||||
|
||||
@ -441,7 +441,7 @@ public:
|
||||
void reset(); // Reset iteration
|
||||
Component *current(); // return current element in iteration.
|
||||
|
||||
// Return element at "position", else NULL
|
||||
// Return element at "position", else null
|
||||
Component *operator[](int position);
|
||||
Component *at(int position) { return (*this)[position]; }
|
||||
|
||||
@ -514,7 +514,7 @@ public:
|
||||
Zero = 0,
|
||||
Max = 0x7fffffff
|
||||
};
|
||||
const char *_external_name; // if !NULL, then print this instead of _expr
|
||||
const char *_external_name; // if not null, then print this instead of _expr
|
||||
const char *_expr;
|
||||
int _min_value;
|
||||
int _max_value;
|
||||
@ -533,7 +533,7 @@ public:
|
||||
void add(const char *c, ArchDesc &AD); // check if 'c' is defined in <arch>.ad
|
||||
void set_external_name(const char *name) { _external_name = name; }
|
||||
|
||||
const char *as_string() const { return (_external_name != NULL ? _external_name : _expr); }
|
||||
const char *as_string() const { return (_external_name != nullptr ? _external_name : _expr); }
|
||||
void print() const;
|
||||
void print_define(FILE *fp) const;
|
||||
void print_assert(FILE *fp) const;
|
||||
@ -559,7 +559,7 @@ private:
|
||||
// Dictionary containing Exprs
|
||||
class ExprDict {
|
||||
private:
|
||||
Dict _expr; // map names, char*, to their Expr* or NULL
|
||||
Dict _expr; // map names, char*, to their Expr* or null
|
||||
NameList _defines; // record the order of definitions entered with define call
|
||||
|
||||
// Disable public use of constructor, copy-ctor, operator =, operator ==
|
||||
@ -584,10 +584,10 @@ public:
|
||||
const Expr *define(const char *name, Expr *expr);
|
||||
|
||||
// Insert inserts the given key-value pair into the dictionary. The prior
|
||||
// value of the key is returned; NULL if the key was not previously defined.
|
||||
// value of the key is returned; null if the key was not previously defined.
|
||||
const Expr *Insert(const char *name, Expr *expr); // A new key-value
|
||||
|
||||
// Find finds the value of a given key; or NULL if not found.
|
||||
// Find finds the value of a given key; or null if not found.
|
||||
// The dictionary is NOT changed.
|
||||
const Expr *operator [](const char *name) const; // Do a lookup
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -93,28 +93,28 @@ void RegisterForm::addDynamicRegClass() {
|
||||
// Provide iteration over all register definitions
|
||||
// in the order used by the register allocator
|
||||
void RegisterForm::reset_RegDefs() {
|
||||
_current_ac = NULL;
|
||||
_current_ac = nullptr;
|
||||
_aclasses.reset();
|
||||
}
|
||||
|
||||
RegDef *RegisterForm::iter_RegDefs() {
|
||||
// Check if we need to get the next AllocClass
|
||||
if ( _current_ac == NULL ) {
|
||||
if ( _current_ac == nullptr ) {
|
||||
const char *ac_name = _aclasses.iter();
|
||||
if( ac_name == NULL ) return NULL; // No more allocation classes
|
||||
if( ac_name == nullptr ) return nullptr; // No more allocation classes
|
||||
_current_ac = (AllocClass*)_allocClass[ac_name];
|
||||
_current_ac->_regDefs.reset();
|
||||
assert( _current_ac != NULL, "Name must match an allocation class");
|
||||
assert( _current_ac != nullptr, "Name must match an allocation class");
|
||||
}
|
||||
|
||||
const char *rd_name = _current_ac->_regDefs.iter();
|
||||
if( rd_name == NULL ) {
|
||||
if( rd_name == nullptr ) {
|
||||
// At end of this allocation class, check the next
|
||||
_current_ac = NULL;
|
||||
_current_ac = nullptr;
|
||||
return iter_RegDefs();
|
||||
}
|
||||
RegDef *reg_def = (RegDef*)_current_ac->_regDef[rd_name];
|
||||
assert( reg_def != NULL, "Name must match a register definition");
|
||||
assert( reg_def != nullptr, "Name must match a register definition");
|
||||
return reg_def;
|
||||
}
|
||||
|
||||
@ -137,19 +137,19 @@ bool RegisterForm::verify() {
|
||||
|
||||
// Verify Register Classes
|
||||
// check that each register class contains registers from one chunk
|
||||
const char *rc_name = NULL;
|
||||
const char *rc_name = nullptr;
|
||||
_rclasses.reset();
|
||||
while ( (rc_name = _rclasses.iter()) != NULL ) {
|
||||
while ( (rc_name = _rclasses.iter()) != nullptr ) {
|
||||
// Check the chunk value for all registers in this class
|
||||
RegClass *reg_class = getRegClass(rc_name);
|
||||
assert( reg_class != NULL, "InternalError() no matching register class");
|
||||
assert( reg_class != nullptr, "InternalError() no matching register class");
|
||||
} // end of RegClasses
|
||||
|
||||
// Verify that every register has been placed into an allocation class
|
||||
RegDef *reg_def = NULL;
|
||||
RegDef *reg_def = nullptr;
|
||||
reset_RegDefs();
|
||||
uint num_register_zero = 0;
|
||||
while ( (reg_def = iter_RegDefs()) != NULL ) {
|
||||
while ( (reg_def = iter_RegDefs()) != nullptr ) {
|
||||
if( reg_def->register_num() == 0 ) ++num_register_zero;
|
||||
}
|
||||
if( num_register_zero > 1 ) {
|
||||
@ -183,15 +183,15 @@ void RegisterForm::output(FILE *fp) { // Write info to output files
|
||||
const char *name;
|
||||
fprintf(fp,"\n");
|
||||
fprintf(fp,"-------------------- Dump RegisterForm --------------------\n");
|
||||
for(_rdefs.reset(); (name = _rdefs.iter()) != NULL;) {
|
||||
for(_rdefs.reset(); (name = _rdefs.iter()) != nullptr;) {
|
||||
((RegDef*)_regDef[name])->output(fp);
|
||||
}
|
||||
fprintf(fp,"\n");
|
||||
for (_rclasses.reset(); (name = _rclasses.iter()) != NULL;) {
|
||||
for (_rclasses.reset(); (name = _rclasses.iter()) != nullptr;) {
|
||||
((RegClass*)_regClass[name])->output(fp);
|
||||
}
|
||||
fprintf(fp,"\n");
|
||||
for (_aclasses.reset(); (name = _aclasses.iter()) != NULL;) {
|
||||
for (_aclasses.reset(); (name = _aclasses.iter()) != nullptr;) {
|
||||
((AllocClass*)_allocClass[name])->output(fp);
|
||||
}
|
||||
fprintf(fp,"-------------------- end RegisterForm --------------------\n");
|
||||
@ -270,22 +270,22 @@ const char *RegClass::rd_name_iter() {
|
||||
|
||||
RegDef *RegClass::RegDef_iter() {
|
||||
const char *rd_name = rd_name_iter();
|
||||
RegDef *reg_def = rd_name ? (RegDef*)_regDef[rd_name] : NULL;
|
||||
RegDef *reg_def = rd_name ? (RegDef*)_regDef[rd_name] : nullptr;
|
||||
return reg_def;
|
||||
}
|
||||
|
||||
const RegDef* RegClass::find_first_elem() {
|
||||
const RegDef* first = NULL;
|
||||
const RegDef* def = NULL;
|
||||
const RegDef* first = nullptr;
|
||||
const RegDef* def = nullptr;
|
||||
|
||||
reset();
|
||||
while ((def = RegDef_iter()) != NULL) {
|
||||
if (first == NULL || def->register_num() < first->register_num()) {
|
||||
while ((def = RegDef_iter()) != nullptr) {
|
||||
if (first == nullptr || def->register_num() < first->register_num()) {
|
||||
first = def;
|
||||
}
|
||||
}
|
||||
|
||||
assert(first != NULL, "empty mask?");
|
||||
assert(first != nullptr, "empty mask?");
|
||||
return first;;
|
||||
}
|
||||
|
||||
@ -293,7 +293,7 @@ const RegDef* RegClass::find_first_elem() {
|
||||
int RegClass::regs_in_word( int wordnum, bool stack_also ) {
|
||||
int word = 0;
|
||||
const char *name;
|
||||
for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
|
||||
for(_regDefs.reset(); (name = _regDefs.iter()) != nullptr;) {
|
||||
int rnum = ((RegDef*)_regDef[name])->register_num();
|
||||
if( (rnum >> 5) == wordnum )
|
||||
word |= (1 << (rnum & 31));
|
||||
@ -315,7 +315,7 @@ void RegClass::dump() {
|
||||
void RegClass::output(FILE *fp) { // Write info to output files
|
||||
fprintf(fp,"RegClass: %s\n",_classid);
|
||||
const char *name;
|
||||
for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
|
||||
for(_regDefs.reset(); (name = _regDefs.iter()) != nullptr;) {
|
||||
((RegDef*)_regDef[name])->output(fp);
|
||||
}
|
||||
fprintf(fp,"--- done with entries for reg_class %s\n\n",_classid);
|
||||
@ -356,7 +356,7 @@ void RegClass::build_register_masks(FILE* fp) {
|
||||
}
|
||||
|
||||
//------------------------------CodeSnippetRegClass---------------------------
|
||||
CodeSnippetRegClass::CodeSnippetRegClass(const char* classid) : RegClass(classid), _code_snippet(NULL) {
|
||||
CodeSnippetRegClass::CodeSnippetRegClass(const char* classid) : RegClass(classid), _code_snippet(nullptr) {
|
||||
}
|
||||
|
||||
CodeSnippetRegClass::~CodeSnippetRegClass() {
|
||||
@ -371,7 +371,7 @@ void CodeSnippetRegClass::declare_register_masks(FILE* fp) {
|
||||
}
|
||||
|
||||
//------------------------------ConditionalRegClass---------------------------
|
||||
ConditionalRegClass::ConditionalRegClass(const char *classid) : RegClass(classid), _condition_code(NULL) {
|
||||
ConditionalRegClass::ConditionalRegClass(const char *classid) : RegClass(classid), _condition_code(nullptr) {
|
||||
}
|
||||
|
||||
ConditionalRegClass::~ConditionalRegClass() {
|
||||
@ -413,7 +413,7 @@ AllocClass::AllocClass(char *classid) : _classid(classid), _regDef(cmpstr,hashst
|
||||
|
||||
// record a register in this class
|
||||
void AllocClass::addReg(RegDef *regDef) {
|
||||
assert( regDef != NULL, "Can not add a NULL to an allocation class");
|
||||
assert( regDef != nullptr, "Can not add a null to an allocation class");
|
||||
regDef->set_register_num( RegisterForm::_reg_ctr++ );
|
||||
// Add regDef to this allocation class
|
||||
_regDefs.addName(regDef->_regname);
|
||||
@ -427,7 +427,7 @@ void AllocClass::dump() {
|
||||
void AllocClass::output(FILE *fp) { // Write info to output files
|
||||
fprintf(fp,"AllocClass: %s \n",_classid);
|
||||
const char *name;
|
||||
for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
|
||||
for(_regDefs.reset(); (name = _regDefs.iter()) != nullptr;) {
|
||||
((RegDef*)_regDef[name])->output(fp);
|
||||
}
|
||||
fprintf(fp,"--- done with entries for alloc_class %s\n\n",_classid);
|
||||
@ -436,15 +436,15 @@ void AllocClass::output(FILE *fp) { // Write info to output files
|
||||
//==============================Frame Handling=================================
|
||||
//------------------------------FrameForm--------------------------------------
|
||||
FrameForm::FrameForm() {
|
||||
_frame_pointer = NULL;
|
||||
_c_frame_pointer = NULL;
|
||||
_alignment = NULL;
|
||||
_return_addr = NULL;
|
||||
_c_return_addr = NULL;
|
||||
_varargs_C_out_slots_killed = NULL;
|
||||
_return_value = NULL;
|
||||
_c_return_value = NULL;
|
||||
_interpreter_frame_pointer_reg = NULL;
|
||||
_frame_pointer = nullptr;
|
||||
_c_frame_pointer = nullptr;
|
||||
_alignment = nullptr;
|
||||
_return_addr = nullptr;
|
||||
_c_return_addr = nullptr;
|
||||
_varargs_C_out_slots_killed = nullptr;
|
||||
_return_value = nullptr;
|
||||
_c_return_value = nullptr;
|
||||
_interpreter_frame_pointer_reg = nullptr;
|
||||
}
|
||||
|
||||
FrameForm::~FrameForm() {
|
||||
@ -520,21 +520,21 @@ void PipelineForm::output(FILE *fp) { // Write info to output files
|
||||
fprintf(fp, ", fetch %d x % d bytes per cycle", _instrFetchUnits, _instrFetchUnitSize);
|
||||
|
||||
fprintf(fp,"\nResource:");
|
||||
for ( _reslist.reset(); (res = _reslist.iter()) != NULL; )
|
||||
for ( _reslist.reset(); (res = _reslist.iter()) != nullptr; )
|
||||
fprintf(fp," %s(0x%08x)", res, _resdict[res]->is_resource()->mask());
|
||||
fprintf(fp,"\n");
|
||||
|
||||
fprintf(fp,"\nDescription:\n");
|
||||
for ( _stages.reset(); (stage = _stages.iter()) != NULL; )
|
||||
for ( _stages.reset(); (stage = _stages.iter()) != nullptr; )
|
||||
fprintf(fp," %s(%d)", stage, count++);
|
||||
fprintf(fp,"\n");
|
||||
|
||||
fprintf(fp,"\nClasses:\n");
|
||||
for ( _classlist.reset(); (cls = _classlist.iter()) != NULL; )
|
||||
for ( _classlist.reset(); (cls = _classlist.iter()) != nullptr; )
|
||||
_classdict[cls]->is_pipeclass()->output(fp);
|
||||
|
||||
fprintf(fp,"\nNop Instructions:");
|
||||
for ( _noplist.reset(); (nop = _noplist.iter()) != NULL; )
|
||||
for ( _noplist.reset(); (nop = _noplist.iter()) != nullptr; )
|
||||
fprintf(fp, " \"%s\"", nop);
|
||||
fprintf(fp,"\n");
|
||||
}
|
||||
@ -635,8 +635,8 @@ void PipeClassForm::output(FILE *fp) { // Write info to output files
|
||||
//==============================Peephole Optimization==========================
|
||||
int Peephole::_peephole_counter = 0;
|
||||
//------------------------------Peephole---------------------------------------
|
||||
Peephole::Peephole() : _predicate(NULL), _match(NULL), _procedure(NULL),
|
||||
_constraint(NULL), _replace(NULL), _next(NULL) {
|
||||
Peephole::Peephole() : _predicate(nullptr), _match(nullptr), _procedure(nullptr),
|
||||
_constraint(nullptr), _replace(nullptr), _next(nullptr) {
|
||||
_peephole_number = _peephole_counter++;
|
||||
}
|
||||
Peephole::~Peephole() {
|
||||
@ -644,7 +644,7 @@ Peephole::~Peephole() {
|
||||
|
||||
// Append a peephole rule with the same root instruction
|
||||
void Peephole::append_peephole(Peephole *next_peephole) {
|
||||
if( _next == NULL ) {
|
||||
if( _next == nullptr ) {
|
||||
_next = next_peephole;
|
||||
} else {
|
||||
_next->append_peephole( next_peephole );
|
||||
@ -653,24 +653,24 @@ void Peephole::append_peephole(Peephole *next_peephole) {
|
||||
|
||||
// Add a predicate to this peephole rule
|
||||
void Peephole::add_predicate(PeepPredicate* predicate) {
|
||||
assert( _predicate == NULL, "fatal()" );
|
||||
assert( _predicate == nullptr, "fatal()" );
|
||||
_predicate = predicate;
|
||||
}
|
||||
|
||||
// Store the components of this peephole rule
|
||||
void Peephole::add_match(PeepMatch *match) {
|
||||
assert( _match == NULL, "fatal()" );
|
||||
assert( _match == nullptr, "fatal()" );
|
||||
_match = match;
|
||||
}
|
||||
|
||||
// Add a procedure to this peephole rule
|
||||
void Peephole::add_procedure(PeepProcedure* procedure) {
|
||||
assert( _procedure == NULL, "fatal()" );
|
||||
assert( _procedure == nullptr, "fatal()" );
|
||||
_procedure = procedure;
|
||||
}
|
||||
|
||||
void Peephole::append_constraint(PeepConstraint *next_constraint) {
|
||||
if( _constraint == NULL ) {
|
||||
if( _constraint == nullptr ) {
|
||||
_constraint = next_constraint;
|
||||
} else {
|
||||
_constraint->append( next_constraint );
|
||||
@ -678,7 +678,7 @@ void Peephole::append_constraint(PeepConstraint *next_constraint) {
|
||||
}
|
||||
|
||||
void Peephole::add_replace(PeepReplace *replace) {
|
||||
assert( _replace == NULL, "fatal()" );
|
||||
assert( _replace == nullptr, "fatal()" );
|
||||
_replace = replace;
|
||||
}
|
||||
|
||||
@ -691,9 +691,9 @@ void Peephole::dump() {
|
||||
|
||||
void Peephole::output(FILE *fp) { // Write info to output files
|
||||
fprintf(fp,"Peephole:\n");
|
||||
if( _match != NULL ) _match->output(fp);
|
||||
if( _constraint != NULL ) _constraint->output(fp);
|
||||
if( _replace != NULL ) _replace->output(fp);
|
||||
if( _match != nullptr ) _match->output(fp);
|
||||
if( _constraint != nullptr ) _constraint->output(fp);
|
||||
if( _replace != nullptr ) _replace->output(fp);
|
||||
// Output the next entry
|
||||
if( _next ) _next->output(fp);
|
||||
}
|
||||
@ -793,7 +793,7 @@ void PeepProcedure::output(FILE* fp) {
|
||||
PeepConstraint::PeepConstraint(int left_inst, char* left_op, char* relation,
|
||||
int right_inst, char* right_op)
|
||||
: _left_inst(left_inst), _left_op(left_op), _relation(relation),
|
||||
_right_inst(right_inst), _right_op(right_op), _next(NULL) {}
|
||||
_right_inst(right_inst), _right_op(right_op), _next(nullptr) {}
|
||||
PeepConstraint::~PeepConstraint() {
|
||||
}
|
||||
|
||||
@ -804,13 +804,13 @@ bool PeepConstraint::constrains_instruction(int position) {
|
||||
if( _right_inst == position ) return true;
|
||||
|
||||
// Check remaining constraints in list
|
||||
if( _next == NULL ) return false;
|
||||
if( _next == nullptr ) return false;
|
||||
else return _next->constrains_instruction(position);
|
||||
}
|
||||
|
||||
// Add another constraint
|
||||
void PeepConstraint::append(PeepConstraint *next_constraint) {
|
||||
if( _next == NULL ) {
|
||||
if( _next == nullptr ) {
|
||||
_next = next_constraint;
|
||||
} else {
|
||||
_next->append( next_constraint );
|
||||
|
@ -283,8 +283,8 @@ public:
|
||||
|
||||
virtual void set_stack_version(bool flag) {
|
||||
RegClass::set_stack_version(flag);
|
||||
assert((_rclasses[0] != NULL), "Register class NULL for condition code == true");
|
||||
assert((_rclasses[1] != NULL), "Register class NULL for condition code == false");
|
||||
assert((_rclasses[0] != nullptr), "Register class null for condition code == true");
|
||||
assert((_rclasses[1] != nullptr), "Register class null for condition code == false");
|
||||
_rclasses[0]->set_stack_version(flag);
|
||||
_rclasses[1]->set_stack_version(flag);
|
||||
}
|
||||
@ -689,12 +689,12 @@ public:
|
||||
class PeepChild : public Form {
|
||||
public:
|
||||
const int _inst_num; // Number of instruction (-1 if only named)
|
||||
const char *_inst_op; // Instruction's operand, NULL if number == -1
|
||||
const char *_inst_op; // Instruction's operand, null if number == -1
|
||||
const char *_inst_name; // Name of the instruction
|
||||
|
||||
public:
|
||||
PeepChild(char *inst_name)
|
||||
: _inst_num(-1), _inst_op(NULL), _inst_name(inst_name) {};
|
||||
: _inst_num(-1), _inst_op(nullptr), _inst_name(inst_name) {};
|
||||
PeepChild(int inst_num, char *inst_op, char *inst_name)
|
||||
: _inst_num(inst_num), _inst_op(inst_op), _inst_name(inst_name) {};
|
||||
~PeepChild();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -139,7 +139,7 @@ public:
|
||||
virtual bool expands() const ;
|
||||
// This instruction has a late expand rule?
|
||||
virtual bool postalloc_expands() const;
|
||||
// Return this instruction's first peephole rule, or NULL
|
||||
// Return this instruction's first peephole rule, or null
|
||||
virtual Peephole *peepholes() const;
|
||||
// Add a peephole rule to this instruction
|
||||
virtual void append_peephole(Peephole *peep);
|
||||
@ -238,7 +238,7 @@ public:
|
||||
const char *opnd_ident(int idx); // Name of operand #idx.
|
||||
const char *reduce_result();
|
||||
// Return the name of the operand on the right hand side of the binary match
|
||||
// Return NULL if there is no right hand side
|
||||
// Return null if there is no right hand side
|
||||
const char *reduce_right(FormDict &globals) const;
|
||||
const char *reduce_left(FormDict &globals) const;
|
||||
|
||||
@ -268,7 +268,7 @@ public:
|
||||
void set_needs_constant_base(bool x) { _needs_constant_base = x; }
|
||||
|
||||
InstructForm *short_branch_form() { return _short_branch_form; }
|
||||
bool has_short_branch_form() { return _short_branch_form != NULL; }
|
||||
bool has_short_branch_form() { return _short_branch_form != nullptr; }
|
||||
// Output short branch prototypes and method bodies
|
||||
void declare_short_branch_methods(FILE *fp_cpp);
|
||||
bool define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp);
|
||||
@ -280,7 +280,7 @@ public:
|
||||
void set_unique_opnds();
|
||||
uint num_unique_opnds() { return _num_uniq; }
|
||||
uint unique_opnds_idx(int idx) {
|
||||
if (_uniq_idx != NULL && idx > 0) {
|
||||
if (_uniq_idx != nullptr && idx > 0) {
|
||||
assert((uint)idx < _uniq_idx_length, "out of bounds");
|
||||
return _uniq_idx[idx];
|
||||
} else {
|
||||
@ -341,7 +341,7 @@ public:
|
||||
NameList _parameter_name;
|
||||
|
||||
// Breakdown the encoding into strings separated by $replacement_variables
|
||||
// There is an entry in _strings, perhaps NULL, that precedes each _rep_vars
|
||||
// There is an entry in _strings, perhaps null, that precedes each _rep_vars
|
||||
NameList _code; // Strings passed through to tty->print
|
||||
NameList _rep_vars; // replacement variables
|
||||
|
||||
@ -623,7 +623,7 @@ public:
|
||||
virtual Form::DataType is_user_name_for_sReg() const;
|
||||
|
||||
// Return ideal type, if there is a single ideal type for this operand
|
||||
virtual const char *ideal_type(FormDict &globals, RegisterForm *registers = NULL) const;
|
||||
virtual const char *ideal_type(FormDict &globals, RegisterForm *registers = nullptr) const;
|
||||
// If there is a single ideal type for this interface field, return it.
|
||||
virtual const char *interface_ideal_type(FormDict &globals,
|
||||
const char *field_name) const;
|
||||
@ -631,7 +631,7 @@ public:
|
||||
// Return true if this operand represents a bound register class
|
||||
bool is_bound_register() const;
|
||||
|
||||
// Return the Register class for this operand. Returns NULL if
|
||||
// Return the Register class for this operand. Returns null if
|
||||
// operand isn't a register form.
|
||||
RegClass* get_RegClass() const;
|
||||
|
||||
@ -660,7 +660,7 @@ public:
|
||||
// Return zero-based position in component list; -1 if not in list.
|
||||
virtual int constant_position(FormDict &globals, const Component *comp);
|
||||
virtual int constant_position(FormDict &globals, const char *local_name);
|
||||
// Return the operand form corresponding to the given index, else NULL.
|
||||
// Return the operand form corresponding to the given index, else null.
|
||||
virtual OperandForm *constant_operand(FormDict &globals, uint const_index);
|
||||
|
||||
// Return zero-based position in component list; -1 if not in list.
|
||||
@ -668,7 +668,7 @@ public:
|
||||
|
||||
const char *reduce_result() const;
|
||||
// Return the name of the operand on the right hand side of the binary match
|
||||
// Return NULL if there is no right hand side
|
||||
// Return null if there is no right hand side
|
||||
const char *reduce_right(FormDict &globals) const;
|
||||
const char *reduce_left(FormDict &globals) const;
|
||||
|
||||
@ -943,8 +943,8 @@ public:
|
||||
|
||||
// Public Methods
|
||||
MatchNode(ArchDesc &ad, const char *result = 0, const char *expr = 0,
|
||||
const char *opType=0, MatchNode *lChild=NULL,
|
||||
MatchNode *rChild=NULL);
|
||||
const char *opType=0, MatchNode *lChild=nullptr,
|
||||
MatchNode *rChild=nullptr);
|
||||
MatchNode(ArchDesc &ad, MatchNode& mNode); // Shallow copy constructor;
|
||||
MatchNode(ArchDesc &ad, MatchNode& mNode, int clone); // Construct clone
|
||||
~MatchNode();
|
||||
@ -974,7 +974,7 @@ public:
|
||||
|
||||
// Return the name of the operands associated with reducing to this operand:
|
||||
// The result type, plus the left and right sides of the binary match
|
||||
// Return NULL if there is no left or right hand side
|
||||
// Return null if there is no left or right hand side
|
||||
bool sets_result() const; // rule "Set"s result of match
|
||||
const char *reduce_right(FormDict &globals) const;
|
||||
const char *reduce_left (FormDict &globals) const;
|
||||
@ -1080,7 +1080,7 @@ private:
|
||||
|
||||
public:
|
||||
// Public Data
|
||||
// There is an entry in _strings, perhaps NULL, that precedes each _rep_vars
|
||||
// There is an entry in _strings, perhaps null, that precedes each _rep_vars
|
||||
NameList _strings; // Strings passed through to tty->print
|
||||
NameList _rep_vars; // replacement variables
|
||||
char *_temp; // String representing the assembly code
|
||||
|
@ -31,7 +31,7 @@ static char *strip_ext(char *fname); // Strip off name extension
|
||||
static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string
|
||||
static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text
|
||||
|
||||
ArchDesc* globalAD = NULL; // global reference to Architecture Description object
|
||||
ArchDesc* globalAD = nullptr; // global reference to Architecture Description object
|
||||
|
||||
const char* get_basename(const char* filename) {
|
||||
const char *basename = filename;
|
||||
@ -118,7 +118,7 @@ int main(int argc, char *argv[])
|
||||
char* flag = s;
|
||||
s += strlen(s);
|
||||
char* def = strchr(flag, '=');
|
||||
if (def == NULL) def = (char*)"1";
|
||||
if (def == nullptr) def = (char*)"1";
|
||||
else *def++ = '\0';
|
||||
AD.set_preproc_def(flag, def);
|
||||
}
|
||||
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
char* flag = s;
|
||||
s += strlen(s);
|
||||
AD.set_preproc_def(flag, NULL);
|
||||
AD.set_preproc_def(flag, nullptr);
|
||||
}
|
||||
break;
|
||||
default: // Unknown option
|
||||
@ -366,7 +366,7 @@ static void usage(ArchDesc& AD)
|
||||
int ArchDesc::open_file(bool required, ADLFILE & ADF, const char *action)
|
||||
{
|
||||
if (required &&
|
||||
(ADF._fp = fopen(ADF._name, action)) == NULL) {
|
||||
(ADF._fp = fopen(ADF._name, action)) == nullptr) {
|
||||
printf("ERROR: Cannot open file for %s: %s\n", action, ADF._name);
|
||||
close_files(1);
|
||||
return 0;
|
||||
@ -377,7 +377,7 @@ int ArchDesc::open_file(bool required, ADLFILE & ADF, const char *action)
|
||||
//------------------------------open_files-------------------------------------
|
||||
int ArchDesc::open_files(void)
|
||||
{
|
||||
if (_ADL_file._name == NULL)
|
||||
if (_ADL_file._name == nullptr)
|
||||
{ printf("ERROR: No ADL input file specified\n"); return 0; }
|
||||
|
||||
if (!open_file(true , _ADL_file, "r")) { return 0; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@ static void defineRegCount(FILE *fp, RegisterForm *registers) {
|
||||
// }
|
||||
void ArchDesc::buildMachRegisterNumbers(FILE *fp_hpp) {
|
||||
if (_register) {
|
||||
RegDef *reg_def = NULL;
|
||||
RegDef *reg_def = nullptr;
|
||||
|
||||
// Output a #define for the number of machine registers
|
||||
defineRegCount(fp_hpp, _register);
|
||||
@ -62,7 +62,7 @@ void ArchDesc::buildMachRegisterNumbers(FILE *fp_hpp) {
|
||||
int saved_on_entry = 0;
|
||||
int c_saved_on_entry = 0;
|
||||
_register->reset_RegDefs();
|
||||
while( (reg_def = _register->iter_RegDefs()) != NULL ) {
|
||||
while( (reg_def = _register->iter_RegDefs()) != nullptr ) {
|
||||
if( strcmp(reg_def->_callconv,"SOE") == 0 ||
|
||||
strcmp(reg_def->_callconv,"AS") == 0 ) ++saved_on_entry;
|
||||
if( strcmp(reg_def->_c_conv,"SOE") == 0 ||
|
||||
@ -84,7 +84,7 @@ void ArchDesc::buildMachRegisterNumbers(FILE *fp_hpp) {
|
||||
// Output the register number for each register in the allocation classes
|
||||
_register->reset_RegDefs();
|
||||
int i = 0;
|
||||
while( (reg_def = _register->iter_RegDefs()) != NULL ) {
|
||||
while( (reg_def = _register->iter_RegDefs()) != nullptr ) {
|
||||
fprintf(fp_hpp," %s_num,", reg_def->_regname);
|
||||
for (int j = 0; j < 20-(int)strlen(reg_def->_regname); j++) fprintf(fp_hpp, " ");
|
||||
fprintf(fp_hpp," // enum %3d, regnum %3d, reg encode %3s\n",
|
||||
@ -122,8 +122,8 @@ void ArchDesc::buildMachRegisterNumbers(FILE *fp_hpp) {
|
||||
// }
|
||||
void ArchDesc::buildMachRegisterEncodes(FILE *fp_hpp) {
|
||||
if (_register) {
|
||||
RegDef *reg_def = NULL;
|
||||
RegDef *reg_def_next = NULL;
|
||||
RegDef *reg_def = nullptr;
|
||||
RegDef *reg_def_next = nullptr;
|
||||
|
||||
// (2)
|
||||
// Build definition for enumeration of encode values
|
||||
@ -136,7 +136,7 @@ void ArchDesc::buildMachRegisterEncodes(FILE *fp_hpp) {
|
||||
size_t maxlen = 0;
|
||||
_register->reset_RegDefs();
|
||||
reg_def = _register->iter_RegDefs();
|
||||
while (reg_def != NULL) {
|
||||
while (reg_def != nullptr) {
|
||||
size_t len = strlen(reg_def->_regname);
|
||||
if (len > maxlen) maxlen = len;
|
||||
reg_def = _register->iter_RegDefs();
|
||||
@ -145,11 +145,11 @@ void ArchDesc::buildMachRegisterEncodes(FILE *fp_hpp) {
|
||||
// Output the register encoding for each register in the allocation classes
|
||||
_register->reset_RegDefs();
|
||||
reg_def_next = _register->iter_RegDefs();
|
||||
while( (reg_def = reg_def_next) != NULL ) {
|
||||
while( (reg_def = reg_def_next) != nullptr ) {
|
||||
reg_def_next = _register->iter_RegDefs();
|
||||
fprintf(fp_hpp," %s_enc", reg_def->_regname);
|
||||
for (size_t i = strlen(reg_def->_regname); i < maxlen; i++) fprintf(fp_hpp, " ");
|
||||
fprintf(fp_hpp," = %3s%s\n", reg_def->register_encode(), reg_def_next == NULL? "" : "," );
|
||||
fprintf(fp_hpp," = %3s%s\n", reg_def->register_encode(), reg_def_next == nullptr? "" : "," );
|
||||
}
|
||||
// Finish defining enumeration
|
||||
fprintf(fp_hpp, "};\n");
|
||||
@ -206,7 +206,7 @@ static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper)
|
||||
if (oper->num_consts(globals) == 0) return;
|
||||
// Iterate over the component list looking for constants
|
||||
oper->_components.reset();
|
||||
if ((comp = oper->_components.iter()) == NULL) {
|
||||
if ((comp = oper->_components.iter()) == nullptr) {
|
||||
assert(oper->num_consts(globals) == 1, "Bad component list detected.\n");
|
||||
const char *type = oper->ideal_type(globals);
|
||||
if (!strcmp(type, "ConI")) {
|
||||
@ -245,10 +245,10 @@ static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper)
|
||||
else {
|
||||
assert(0, "Non-constant operand lacks component list.");
|
||||
}
|
||||
} // end if NULL
|
||||
} // end if null
|
||||
else {
|
||||
oper->_components.reset();
|
||||
while ((comp = oper->_components.iter()) != NULL) {
|
||||
while ((comp = oper->_components.iter()) != nullptr) {
|
||||
if (!strcmp(comp->base_type(globals), "ConI")) {
|
||||
fprintf(fp," jint _c%d;\n", i);
|
||||
i++;
|
||||
@ -303,7 +303,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts,
|
||||
uint i = 0;
|
||||
Component *comp;
|
||||
lst.reset();
|
||||
if ((comp = lst.iter()) == NULL) {
|
||||
if ((comp = lst.iter()) == nullptr) {
|
||||
assert(num_consts == 1, "Bad component list detected.\n");
|
||||
switch( constant_type ) {
|
||||
case Form::idealI : {
|
||||
@ -320,10 +320,10 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts,
|
||||
assert(!is_ideal_bool, "Non-constant operand lacks component list.");
|
||||
break;
|
||||
}
|
||||
} // end if NULL
|
||||
} // end if null
|
||||
else {
|
||||
lst.reset();
|
||||
while((comp = lst.iter()) != NULL) {
|
||||
while((comp = lst.iter()) != nullptr) {
|
||||
if (!strcmp(comp->base_type(globals), "ConI")) {
|
||||
if (i > 0) fprintf(fp,", ");
|
||||
fprintf(fp,"int32_t c%d", i);
|
||||
@ -384,7 +384,7 @@ static void defineConstructor(FILE *fp, const char *name, uint num_consts,
|
||||
|
||||
// Generate the format rule for condition codes
|
||||
static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
|
||||
assert(oper != NULL, "what");
|
||||
assert(oper != nullptr, "what");
|
||||
CondInterface* cond = oper->_interface->is_CondInterface();
|
||||
fprintf(fp, " if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format);
|
||||
fprintf(fp, " else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format);
|
||||
@ -462,10 +462,10 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
// No initialization code for int_format
|
||||
|
||||
// Build the format from the entries in strings and rep_vars
|
||||
const char *string = NULL;
|
||||
const char *string = nullptr;
|
||||
oper._format->_rep_vars.reset();
|
||||
oper._format->_strings.reset();
|
||||
while ( (string = oper._format->_strings.iter()) != NULL ) {
|
||||
while ( (string = oper._format->_strings.iter()) != nullptr ) {
|
||||
|
||||
// Check if this is a standard string or a replacement variable
|
||||
if ( string != NameList::_signal ) {
|
||||
@ -477,7 +477,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
const char *rep_var = oper._format->_rep_vars.iter();
|
||||
// Check that it is a local name, and an operand
|
||||
const Form* form = oper._localNames[rep_var];
|
||||
if (form == NULL) {
|
||||
if (form == nullptr) {
|
||||
globalAD->syntax_err(oper._linenum,
|
||||
"\'%s\' not found in format for %s\n", rep_var, oper._ident);
|
||||
assert(form, "replacement variable was not found in local names");
|
||||
@ -494,7 +494,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
}
|
||||
|
||||
// output invocation of "$..."s format function
|
||||
if ( op != NULL ) op->int_format(fp, globals, idx);
|
||||
if ( op != nullptr ) op->int_format(fp, globals, idx);
|
||||
|
||||
if ( idx == -1 ) {
|
||||
fprintf(stderr,
|
||||
@ -508,7 +508,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
oper.int_format(fp, globals, 0);
|
||||
}
|
||||
|
||||
} else { // oper._format == NULL
|
||||
} else { // oper._format == null
|
||||
// Provide a few special case formats where the AD writer cannot.
|
||||
if ( strcmp(oper._ident,"Universe")==0 ) {
|
||||
fprintf(fp, " st->print(\"$$univ\");\n");
|
||||
@ -533,10 +533,10 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
}
|
||||
|
||||
// Build the format from the entries in strings and rep_vars
|
||||
const char *string = NULL;
|
||||
const char *string = nullptr;
|
||||
oper._format->_rep_vars.reset();
|
||||
oper._format->_strings.reset();
|
||||
while ( (string = oper._format->_strings.iter()) != NULL ) {
|
||||
while ( (string = oper._format->_strings.iter()) != nullptr ) {
|
||||
|
||||
// Check if this is a standard string or a replacement variable
|
||||
if ( string != NameList::_signal ) {
|
||||
@ -548,7 +548,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
const char *rep_var = oper._format->_rep_vars.iter();
|
||||
// Check that it is a local name, and an operand
|
||||
const Form* form = oper._localNames[rep_var];
|
||||
if (form == NULL) {
|
||||
if (form == nullptr) {
|
||||
globalAD->syntax_err(oper._linenum,
|
||||
"\'%s\' not found in format for %s\n", rep_var, oper._ident);
|
||||
assert(form, "replacement variable was not found in local names");
|
||||
@ -564,7 +564,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
idx = 0;
|
||||
}
|
||||
// output invocation of "$..."s format function
|
||||
if ( op != NULL ) op->ext_format(fp, globals, idx);
|
||||
if ( op != nullptr ) op->ext_format(fp, globals, idx);
|
||||
|
||||
// Lookup the index position of the replacement variable
|
||||
idx = oper._components.operand_position_format(rep_var, &oper);
|
||||
@ -580,7 +580,7 @@ void gen_oper_format(FILE *fp, FormDict &globals, OperandForm &oper, bool for_c_
|
||||
// Default formats for base operands (RegI, RegP, ConI, ConP, ...)
|
||||
oper.ext_format(fp, globals, 0);
|
||||
}
|
||||
} else { // oper._format == NULL
|
||||
} else { // oper._format is null
|
||||
// Provide a few special case formats where the AD writer cannot.
|
||||
if ( strcmp(oper._ident,"Universe")==0 ) {
|
||||
fprintf(fp, " st->print(\"$$univ\");\n");
|
||||
@ -617,10 +617,10 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c
|
||||
inst.index_temps(fp, globals);
|
||||
|
||||
// Build the format from the entries in strings and rep_vars
|
||||
const char *string = NULL;
|
||||
const char *string = nullptr;
|
||||
inst._format->_rep_vars.reset();
|
||||
inst._format->_strings.reset();
|
||||
while( (string = inst._format->_strings.iter()) != NULL ) {
|
||||
while( (string = inst._format->_strings.iter()) != nullptr ) {
|
||||
fprintf(fp," ");
|
||||
// Check if this is a standard string or a replacement variable
|
||||
if( string == NameList::_signal ) { // Replacement variable
|
||||
@ -629,7 +629,7 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c
|
||||
} else if( string == NameList::_signal3 ) { // Replacement variable in raw text
|
||||
const char* rep_var = inst._format->_rep_vars.iter();
|
||||
const Form *form = inst._localNames[rep_var];
|
||||
if (form == NULL) {
|
||||
if (form == nullptr) {
|
||||
fprintf(stderr, "unknown replacement variable in format statement: '%s'\n", rep_var);
|
||||
assert(false, "ShouldNotReachHere()");
|
||||
}
|
||||
@ -712,7 +712,7 @@ void gen_inst_format(FILE *fp, FormDict &globals, InstructForm &inst, bool for_c
|
||||
}
|
||||
else if( inst.is_ideal_mem() ) {
|
||||
// Print out the field name if available to improve readability
|
||||
fprintf(fp, " if (ra->C->alias_type(adr_type())->field() != NULL) {\n");
|
||||
fprintf(fp, " if (ra->C->alias_type(adr_type())->field() != nullptr) {\n");
|
||||
fprintf(fp, " ciField* f = ra->C->alias_type(adr_type())->field();\n");
|
||||
fprintf(fp, " st->print(\" %s Field: \");\n", commentSeperator);
|
||||
fprintf(fp, " if (f->is_volatile())\n");
|
||||
@ -825,7 +825,7 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
|
||||
uint rescount = 0;
|
||||
const char *resource;
|
||||
|
||||
for (_pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != NULL;) {
|
||||
for (_pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != nullptr;) {
|
||||
if (_pipeline->_resdict[resource]->is_resource()->is_discrete()) {
|
||||
rescount++;
|
||||
}
|
||||
@ -1112,7 +1112,7 @@ void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
|
||||
fprintf(fp_hpp, "};\n\n");
|
||||
|
||||
// const char *classname;
|
||||
// for (_pipeline->_classlist.reset(); (classname = _pipeline->_classlist.iter()) != NULL; ) {
|
||||
// for (_pipeline->_classlist.reset(); (classname = _pipeline->_classlist.iter()) != nullptr; ) {
|
||||
// PipeClassForm *pipeclass = _pipeline->_classdict[classname]->is_pipeclass();
|
||||
// fprintf(fp_hpp, "// Pipeline Class Instance for \"%s\"\n", classname);
|
||||
// }
|
||||
@ -1134,7 +1134,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
fprintf(fp,"// Total number of operands defined in architecture definition\n");
|
||||
int num_operands = 0;
|
||||
OperandForm *op;
|
||||
for (_operands.reset(); (op = (OperandForm*)_operands.iter()) != NULL; ) {
|
||||
for (_operands.reset(); (op = (OperandForm*)_operands.iter()) != nullptr; ) {
|
||||
// Ensure this is a machine-world instruction
|
||||
if (op->ideal_only()) continue;
|
||||
|
||||
@ -1142,7 +1142,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
}
|
||||
int first_operand_class = num_operands;
|
||||
OpClassForm *opc;
|
||||
for (_opclass.reset(); (opc = (OpClassForm*)_opclass.iter()) != NULL; ) {
|
||||
for (_opclass.reset(); (opc = (OpClassForm*)_opclass.iter()) != nullptr; ) {
|
||||
// Ensure this is a machine-world instruction
|
||||
if (opc->ideal_only()) continue;
|
||||
|
||||
@ -1162,7 +1162,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
// Iterate through all operands
|
||||
_operands.reset();
|
||||
OperandForm *oper;
|
||||
for( ; (oper = (OperandForm*)_operands.iter()) != NULL;) {
|
||||
for( ; (oper = (OperandForm*)_operands.iter()) != nullptr;) {
|
||||
// Ensure this is a machine-world instruction
|
||||
if (oper->ideal_only() ) continue;
|
||||
// The declaration of labelOper is in machine-independent file: machnode
|
||||
@ -1249,14 +1249,14 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
//
|
||||
// (1) virtual const Type *type() const { return .....; }
|
||||
//
|
||||
if ((oper->_matrule) && (oper->_matrule->_lChild == NULL) &&
|
||||
(oper->_matrule->_rChild == NULL)) {
|
||||
if ((oper->_matrule) && (oper->_matrule->_lChild == nullptr) &&
|
||||
(oper->_matrule->_rChild == nullptr)) {
|
||||
unsigned int position = 0;
|
||||
const char *opret, *opname, *optype;
|
||||
oper->_matrule->base_operand(position,_globalNames,opret,opname,optype);
|
||||
fprintf(fp," virtual const Type *type() const {");
|
||||
const char *type = getIdealType(optype);
|
||||
if( type != NULL ) {
|
||||
if( type != nullptr ) {
|
||||
Form::DataType data_type = oper->is_base_constant(_globalNames);
|
||||
// Check if we are an ideal pointer type
|
||||
if( data_type == Form::idealP || data_type == Form::idealN || data_type == Form::idealNKlass ) {
|
||||
@ -1274,7 +1274,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
// Check for user-defined stack slots, based upon sRegX
|
||||
Form::DataType data_type = oper->is_user_name_for_sReg();
|
||||
if( data_type != Form::none ){
|
||||
const char *type = NULL;
|
||||
const char *type = nullptr;
|
||||
switch( data_type ) {
|
||||
case Form::idealI: type = "TypeInt::INT"; break;
|
||||
case Form::idealP: type = "TypePtr::BOTTOM";break;
|
||||
@ -1310,73 +1310,73 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
|
||||
// Output the operand specific access functions used by an enc_class
|
||||
// These are only defined when we want to override the default virtual func
|
||||
if (oper->_interface != NULL) {
|
||||
if (oper->_interface != nullptr) {
|
||||
fprintf(fp,"\n");
|
||||
// Check if it is a Memory Interface
|
||||
if ( oper->_interface->is_MemInterface() != NULL ) {
|
||||
if ( oper->_interface->is_MemInterface() != nullptr ) {
|
||||
MemInterface *mem_interface = oper->_interface->is_MemInterface();
|
||||
const char *base = mem_interface->_base;
|
||||
if( base != NULL ) {
|
||||
if( base != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "base", base);
|
||||
}
|
||||
char *index = mem_interface->_index;
|
||||
if( index != NULL ) {
|
||||
if( index != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "index", index);
|
||||
}
|
||||
const char *scale = mem_interface->_scale;
|
||||
if( scale != NULL ) {
|
||||
if( scale != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "scale", scale);
|
||||
}
|
||||
const char *disp = mem_interface->_disp;
|
||||
if( disp != NULL ) {
|
||||
if( disp != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "disp", disp);
|
||||
oper->disp_is_oop(fp, _globalNames);
|
||||
}
|
||||
if( oper->stack_slots_only(_globalNames) ) {
|
||||
// should not call this:
|
||||
fprintf(fp," virtual int constant_disp() const { return Type::OffsetBot; }");
|
||||
} else if ( disp != NULL ) {
|
||||
} else if ( disp != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "constant_disp", disp);
|
||||
}
|
||||
} // end Memory Interface
|
||||
// Check if it is a Conditional Interface
|
||||
else if (oper->_interface->is_CondInterface() != NULL) {
|
||||
else if (oper->_interface->is_CondInterface() != nullptr) {
|
||||
CondInterface *cInterface = oper->_interface->is_CondInterface();
|
||||
const char *equal = cInterface->_equal;
|
||||
if( equal != NULL ) {
|
||||
if( equal != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "equal", equal);
|
||||
}
|
||||
const char *not_equal = cInterface->_not_equal;
|
||||
if( not_equal != NULL ) {
|
||||
if( not_equal != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "not_equal", not_equal);
|
||||
}
|
||||
const char *less = cInterface->_less;
|
||||
if( less != NULL ) {
|
||||
if( less != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "less", less);
|
||||
}
|
||||
const char *greater_equal = cInterface->_greater_equal;
|
||||
if( greater_equal != NULL ) {
|
||||
if( greater_equal != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "greater_equal", greater_equal);
|
||||
}
|
||||
const char *less_equal = cInterface->_less_equal;
|
||||
if( less_equal != NULL ) {
|
||||
if( less_equal != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "less_equal", less_equal);
|
||||
}
|
||||
const char *greater = cInterface->_greater;
|
||||
if( greater != NULL ) {
|
||||
if( greater != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "greater", greater);
|
||||
}
|
||||
const char *overflow = cInterface->_overflow;
|
||||
if( overflow != NULL ) {
|
||||
if( overflow != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "overflow", overflow);
|
||||
}
|
||||
const char *no_overflow = cInterface->_no_overflow;
|
||||
if( no_overflow != NULL ) {
|
||||
if( no_overflow != nullptr ) {
|
||||
define_oper_interface(fp, *oper, _globalNames, "no_overflow", no_overflow);
|
||||
}
|
||||
} // end Conditional Interface
|
||||
// Check if it is a Constant Interface
|
||||
else if (oper->_interface->is_ConstInterface() != NULL ) {
|
||||
else if (oper->_interface->is_ConstInterface() != nullptr ) {
|
||||
assert( oper->num_consts(_globalNames) == 1,
|
||||
"Must have one constant when using CONST_INTER encoding");
|
||||
if (!strcmp(oper->ideal_type(_globalNames), "ConI")) {
|
||||
@ -1442,7 +1442,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
fprintf(fp, " }\n");
|
||||
}
|
||||
}
|
||||
else if (oper->_interface->is_RegInterface() != NULL) {
|
||||
else if (oper->_interface->is_RegInterface() != nullptr) {
|
||||
// make sure that a fixed format string isn't used for an
|
||||
// operand which might be assigned to multiple registers.
|
||||
// Otherwise the opto assembly output could be misleading.
|
||||
@ -1488,19 +1488,19 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
const char *type = oper->ideal_type(_globalNames);
|
||||
Component *comp;
|
||||
oper->_components.reset();
|
||||
if ((comp = oper->_components.iter()) == NULL) {
|
||||
if ((comp = oper->_components.iter()) == nullptr) {
|
||||
assert(num_consts == 1, "Bad component list detected.\n");
|
||||
i = dump_spec_constant( fp, type, i, oper );
|
||||
// Check that type actually matched
|
||||
assert( i != 0, "Non-constant operand lacks component list.");
|
||||
} // end if NULL
|
||||
} // end if null
|
||||
else {
|
||||
// line (2)
|
||||
// dump all components
|
||||
oper->_components.reset();
|
||||
while((comp = oper->_components.iter()) != NULL) {
|
||||
while((comp = oper->_components.iter()) != nullptr) {
|
||||
type = comp->base_type(_globalNames);
|
||||
i = dump_spec_constant( fp, type, i, NULL );
|
||||
i = dump_spec_constant( fp, type, i, nullptr );
|
||||
}
|
||||
}
|
||||
// finish line (3)
|
||||
@ -1527,7 +1527,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
fprintf(fp,"//----------------------------Declare classes derived from MachNode----------\n");
|
||||
_instructions.reset();
|
||||
InstructForm *instr;
|
||||
for( ; (instr = (InstructForm*)_instructions.iter()) != NULL; ) {
|
||||
for( ; (instr = (InstructForm*)_instructions.iter()) != nullptr; ) {
|
||||
// Ensure this is a machine-world instruction
|
||||
if ( instr->ideal_only() ) continue;
|
||||
|
||||
@ -1545,7 +1545,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
|
||||
Attribute *att = instr->_attribs;
|
||||
// Fields of the node specified in the ad file.
|
||||
while (att != NULL) {
|
||||
while (att != nullptr) {
|
||||
if (strncmp(att->_ident, "ins_field_", 10) == 0) {
|
||||
const char *field_name = att->_ident+10;
|
||||
const char *field_type = att->_val;
|
||||
@ -1570,7 +1570,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
fprintf(fp," _index2label.at_put_grow(index_num, blockLabel);\n");
|
||||
fprintf(fp," }\n");
|
||||
}
|
||||
if( can_cisc_spill() && (instr->cisc_spill_alternate() != NULL) ) {
|
||||
if( can_cisc_spill() && (instr->cisc_spill_alternate() != nullptr) ) {
|
||||
fprintf(fp," const RegMask *_cisc_RegMask;\n");
|
||||
}
|
||||
|
||||
@ -1598,8 +1598,8 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
// Each instruction attribute results in a virtual call of same name.
|
||||
// The ins_cost is not handled here.
|
||||
Attribute *attr = instr->_attribs;
|
||||
Attribute *avoid_back_to_back_attr = NULL;
|
||||
while (attr != NULL) {
|
||||
Attribute *avoid_back_to_back_attr = nullptr;
|
||||
while (attr != nullptr) {
|
||||
if (strcmp (attr->_ident, "ins_is_TrapBasedCheckNode") == 0) {
|
||||
fprintf(fp, " virtual bool is_TrapBasedCheckNode() const { return %s; }\n", attr->_val);
|
||||
} else if (strcmp (attr->_ident, "ins_cost") != 0 &&
|
||||
@ -1666,11 +1666,11 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
// Identify which operand contains the negate(able) ideal condition code
|
||||
int idx = 0;
|
||||
instr->_components.reset();
|
||||
for( Component *comp; (comp = instr->_components.iter()) != NULL; ) {
|
||||
for( Component *comp; (comp = instr->_components.iter()) != nullptr; ) {
|
||||
// Check that component is an operand
|
||||
Form *form = (Form*)_globalNames[comp->_type];
|
||||
OperandForm *opForm = form ? form->is_operand() : NULL;
|
||||
if( opForm == NULL ) continue;
|
||||
OperandForm *opForm = form ? form->is_operand() : nullptr;
|
||||
if( opForm == nullptr ) continue;
|
||||
|
||||
// Lookup the position of the operand in the instruction.
|
||||
if( opForm->is_ideal_bool() ) {
|
||||
@ -1702,7 +1702,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
instr->declare_cisc_version(*this, fp);
|
||||
|
||||
// If there is an explicit peephole rule, build it
|
||||
if ( instr->peepholes() != NULL ) {
|
||||
if ( instr->peepholes() != nullptr ) {
|
||||
fprintf(fp," virtual int peephole(Block* block, int block_index, PhaseCFG* cfg_, PhaseRegAlloc* ra_);\n");
|
||||
}
|
||||
|
||||
@ -1733,8 +1733,8 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
fprintf(fp," %sNode() : _index2label(MinJumpTableSize*2) { ", instr->_ident);
|
||||
} else {
|
||||
fprintf(fp," %sNode() { ", instr->_ident);
|
||||
if( can_cisc_spill() && (instr->cisc_spill_alternate() != NULL) ) {
|
||||
fprintf(fp,"_cisc_RegMask = NULL; ");
|
||||
if( can_cisc_spill() && (instr->cisc_spill_alternate() != nullptr) ) {
|
||||
fprintf(fp,"_cisc_RegMask = nullptr; ");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1749,8 +1749,8 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
|
||||
// Is an instruction is a constant? If so, get its type
|
||||
Form::DataType data_type;
|
||||
const char *opType = NULL;
|
||||
const char *result = NULL;
|
||||
const char *opType = nullptr;
|
||||
const char *result = nullptr;
|
||||
data_type = instr->is_chain_of_constant(_globalNames, opType, result);
|
||||
// Check if this instruction is a constant
|
||||
if ( data_type != Form::none ) {
|
||||
@ -1783,7 +1783,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
}
|
||||
|
||||
// flag: if this instruction should not be generated back to back.
|
||||
if (avoid_back_to_back_attr != NULL) {
|
||||
if (avoid_back_to_back_attr != nullptr) {
|
||||
if (node_flags_set) {
|
||||
fprintf(fp," | (%s)", avoid_back_to_back_attr->_val);
|
||||
} else {
|
||||
@ -1829,7 +1829,7 @@ void ArchDesc::declareClasses(FILE *fp) {
|
||||
instr->has_temps() ||
|
||||
instr->is_mach_constant() ||
|
||||
instr->needs_constant_base() ||
|
||||
(instr->_matrule != NULL &&
|
||||
(instr->_matrule != nullptr &&
|
||||
instr->num_opnds() != instr->num_unique_opnds()) ) {
|
||||
fprintf(fp," virtual MachNode *Expand(State *state, Node_List &proj_list, Node* mem);\n");
|
||||
}
|
||||
@ -2057,7 +2057,7 @@ void ArchDesc::defineStateClass(FILE *fp) {
|
||||
if (_dfa_small) {
|
||||
// Generate the routine name we'll need
|
||||
for (int i = 1; i < _last_opcode; i++) {
|
||||
if (_mlistab[i] == NULL) continue;
|
||||
if (_mlistab[i] == nullptr) continue;
|
||||
fprintf(fp, " void _sub_Op_%s(const Node *n);\n", NodeClassNames[i]);
|
||||
}
|
||||
}
|
||||
@ -2191,7 +2191,7 @@ void ArchDesc::build_pipeline_enums(FILE *fp_hpp) {
|
||||
|
||||
if (_pipeline) { // Find max enum string length
|
||||
const char *stage;
|
||||
for ( _pipeline->_stages.reset(); (stage = _pipeline->_stages.iter()) != NULL; ) {
|
||||
for ( _pipeline->_stages.reset(); (stage = _pipeline->_stages.iter()) != nullptr; ) {
|
||||
int len = (int)strlen(stage);
|
||||
if (stagelen < len) stagelen = len;
|
||||
}
|
||||
@ -2205,7 +2205,7 @@ void ArchDesc::build_pipeline_enums(FILE *fp_hpp) {
|
||||
|
||||
if( _pipeline ) {
|
||||
const char *stage;
|
||||
for ( _pipeline->_stages.reset(); (stage = _pipeline->_stages.iter()) != NULL; )
|
||||
for ( _pipeline->_stages.reset(); (stage = _pipeline->_stages.iter()) != nullptr; )
|
||||
fprintf(fp_hpp, " stage_%-*s = %d,\n", stagelen, stage, ++stagenum);
|
||||
}
|
||||
|
||||
@ -2222,20 +2222,20 @@ void ArchDesc::build_pipeline_enums(FILE *fp_hpp) {
|
||||
int reslen = 0;
|
||||
|
||||
// Generate a list of resources, and masks
|
||||
for ( _pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != NULL; ) {
|
||||
for ( _pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != nullptr; ) {
|
||||
int len = (int)strlen(resource);
|
||||
if (reslen < len)
|
||||
reslen = len;
|
||||
}
|
||||
|
||||
for ( _pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != NULL; ) {
|
||||
for ( _pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != nullptr; ) {
|
||||
const ResourceForm *resform = _pipeline->_resdict[resource]->is_resource();
|
||||
if (resform->is_discrete()) {
|
||||
fprintf(fp_hpp, " resource_%-*s = %d,\n", reslen, resource, rescount++);
|
||||
}
|
||||
}
|
||||
fprintf(fp_hpp, "\n");
|
||||
for ( _pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != NULL; ) {
|
||||
for ( _pipeline->_reslist.reset(); (resource = _pipeline->_reslist.iter()) != nullptr; ) {
|
||||
const ResourceForm *resform = _pipeline->_resdict[resource]->is_resource();
|
||||
fprintf(fp_hpp, " res_mask_%-*s = 0x%08x,\n", reslen, resource, resform->mask());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user