/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
// MAIN.CPP - Entry point for the Architecture Description Language Compiler
#include "adlc.hpp"
//------------------------------Prototypes-------------------------------------
static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string
const char *cp;
if (*cp == '/') {
}
}
return basename;
}
//------------------------------main-------------------------------------------
{
// ResourceMark mark;
// Check for proper arguments
// Read command line arguments and file names
if( *s++ == '-' ) { // It's a flag? (not a filename)
if( !*s ) { // Stand-alone `-' means stdin
//********** INSERT CODE HERE **********
} else while (*s != '\0') { // While have flags on option
switch (*s++) { // Handle flag
case 'd': // Debug flag
break;
case 'g': // Debug ad location flag
break;
case 'o': // No Output Flag
break;
case 'q': // Quiet Mode Flag
break;
case 'w': // Disable Warnings Flag
break;
case 'T': // Option to make DFA as many subroutine calls.
break;
case 'c': { // Set C++ Output file name
s += strlen(s);
break;
}
case 'h': // Set C++ Output file name
break;
case 'v': // Set C++ Output file name
break;
case 'a': // Set C++ Output file name
s += strlen(s);
break;
case '#': // Special internal debug flag
break;
case 's': // Output which instructions are cisc-spillable
AD._cisc_spill_debug = true;
break;
case 'D': // Flag Definition
{
char* flag = s;
s += strlen(s);
else *def++ = '\0';
}
break;
case 'U': // Flag Un-Definition
{
char* flag = s;
s += strlen(s);
}
break;
default: // Unknown option
} // End of switch on options...
} // End of while have options...
} else { // Not an option; must be a filename
// // Files for storage, based on input file name
delete temp;
delete temp;
delete temp;
delete temp;
} // End of files vs options...
} // End of while have command line arguments
// Open files used to store the matcher and its components
// Build the File Buffer, Parse the input, & Generate Code
// Get pointer to legal text at the beginning of AD file.
// It will be used in generated ad files.
char* legal_text;
}
delete ADL_Parse; // Delete parser
// Verify that the results of the parse are consistent
// Prepare to generate the result files:
// Make sure every file starts with a copyright:
// Add include guards for all .hpp files
// Add includes
#ifdef TARGET_ARCH_x86
#endif
#ifdef TARGET_ARCH_sparc
#endif
#ifdef TARGET_ARCH_arm
#endif
// Make sure each .cpp file starts with include lines:
// files declaring and defining generators for Mach* Objects (hpp,cpp)
// Generate the result files:
// enumerations, class definitions, object generators, and the DFA
// file containing enumeration of machine operands & instructions (hpp)
// output definition of class "State"
// file declaring the Mach* classes derived from MachOper and MachNode
// declare and define maps: in the .hpp and .cpp files respectively
// build CISC_spilling oracle and MachNode::cisc_spill() methods
// define methods for machine dependent State, MachOper, and MachNode classes
// define methods for machine dependent instruction matching
// define methods for machine dependent frame management
// do this last:
// define the finite automata that selects lowest cost production
// Add include guards for all .hpp files
// Final printout and statistics
// cout << program;
// Timer t_stop;
// Timer t_total = t_stop - t_start; // Total running time
// cerr << "\n---Architecture Description Totals---\n";
// cerr << ", Total lines: " << TotalLines;
// float l = TotalLines;
// cerr << "\nTotal Compilation Time: " << t_total << "\n";
// float ft = (float)t_total;
}
}
//------------------------------usage------------------------------------------
{
printf("Architecture Description Language Compiler\n\n");
printf("Usage: adlc [-doqwTs] [-#]* [-D<FLAG>[=<DEF>]] [-U<FLAG>] [-c<CPP_FILE_NAME>] [-h<HPP_FILE_NAME>] [-a<DFA_FILE_NAME>] [-v<GLOBALS_FILE_NAME>] <ADL_FILE_NAME>\n");
printf(" d produce DFA debugging info\n");
printf(" o no output produced, syntax and semantic checking only\n");
printf(" q quiet mode, supresses all non-essential messages\n");
printf(" w suppress warning messages\n");
printf(" T make DFA as many subroutine calls\n");
printf(" s output which instructions are cisc-spillable\n");
printf(" D define preprocessor symbol\n");
printf(" U undefine preprocessor symbol\n");
printf(" a specify DFA output file name\n");
printf(" v specify adGlobals output file name\n");
printf(" # increment ADL debug level\n");
printf("\n");
}
//------------------------------open_file------------------------------------
{
if (required &&
close_files(1);
return 0;
}
return 1;
}
//------------------------------open_files-------------------------------------
{
{ printf("ERROR: No ADL input file specified\n"); return 0; }
return 1;
}
//------------------------------close_file------------------------------------
{
}
}
//------------------------------close_files------------------------------------
{
if (!_quiet_mode) {
printf("\n");
if (_no_output || delete_out) {
printf("No output produced");
}
else {
printf("%s, %s, %s, %s, %s, %s, %s, %s, %s, %s",
}
printf("\n");
}
}
//------------------------------strip_ext--------------------------------------
{
char *ep;
if (fname) {
}
return fname;
}
//------------------------------base_plus_suffix-------------------------------
// New concatenated string
{
return fname;
}
//------------------------------get_legal_text---------------------------------
// Get pointer to legal text at the beginning of AD file.
// This code assumes that a legal text starts at the beginning of .ad files,
// is commented by "//" at each line and ends with empty line.
//
{
}
return (int) (legal_end - legal_start);
}
// VS2005 has its own definition, identical to this one.
return ::operator new( size );
}
#endif