1 //
2 // Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
5 // This code is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
1021 }
1022 for ( idealIndex = _last_machine_leaf+1;
1023 idealIndex < _last_opcode; ++idealIndex) {
1024 const char *idealName = NodeClassNames[idealIndex];
1025 _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
1026 }
1027
1028 }
1029
1030
1031 //---------------------------addSUNcopyright-------------------------------
1032 // output SUN copyright info
1033 void ArchDesc::addSunCopyright(char* legal, int size, FILE *fp) {
1034 size_t count = fwrite(legal, 1, size, fp);
1035 assert(count == (size_t) size, "copyright info truncated");
1036 fprintf(fp,"\n");
1037 fprintf(fp,"// Machine Generated File. Do Not Edit!\n");
1038 fprintf(fp,"\n");
1039 }
1040
1041 //---------------------------machineDependentIncludes--------------------------
1042 // output #include declarations for machine specific files
1043 void ArchDesc::machineDependentIncludes(ADLFILE &adlfile) {
1044 const char *basename = adlfile._name;
1045 const char *cp;
1046 for (cp = basename; *cp; cp++)
1047 if (*cp == '/') basename = cp+1;
1048
1049 // Build #include lines
1050 fprintf(adlfile._fp, "\n");
1051 fprintf(adlfile._fp, "#include \"incls/_precompiled.incl\"\n");
1052 fprintf(adlfile._fp, "#include \"incls/_%s.incl\"\n",basename);
1053 fprintf(adlfile._fp, "\n");
1054
1055 }
1056
1057
1058 //---------------------------addPreprocessorChecks-----------------------------
1059 // Output C preprocessor code to verify the backend compilation environment.
1060 // The idea is to force code produced by "adlc -DHS64" to be compiled by a
1061 // command of the form "CC ... -DHS64 ...", so that any #ifdefs in the source
1062 // blocks select C code that is consistent with adlc's selections of AD code.
1063 void ArchDesc::addPreprocessorChecks(FILE *fp) {
1064 const char* flag;
1065 _preproc_list.reset();
1066 if (_preproc_list.count() > 0 && !_preproc_list.current_is_signal()) {
1067 fprintf(fp, "// Check consistency of C++ compilation with ADLC options:\n");
1068 }
1069 for (_preproc_list.reset(); (flag = _preproc_list.iter()) != NULL; ) {
1070 if (_preproc_list.current_is_signal()) break;
1071 char* def = get_preproc_def(flag);
1072 fprintf(fp, "// Check adlc ");
1073 if (def)
1074 fprintf(fp, "-D%s=%s\n", flag, def);
1075 else fprintf(fp, "-U%s\n", flag);
1076 fprintf(fp, "#%s %s\n",
|
1 //
2 // Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
3 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 //
5 // This code is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 only, as
7 // published by the Free Software Foundation.
8 //
9 // This code is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 // version 2 for more details (a copy is included in the LICENSE file that
13 // accompanied this code).
14 //
15 // You should have received a copy of the GNU General Public License version
16 // 2 along with this work; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 // or visit www.oracle.com if you need additional information or have any
21 // questions.
22 //
1021 }
1022 for ( idealIndex = _last_machine_leaf+1;
1023 idealIndex < _last_opcode; ++idealIndex) {
1024 const char *idealName = NodeClassNames[idealIndex];
1025 _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
1026 }
1027
1028 }
1029
1030
1031 //---------------------------addSUNcopyright-------------------------------
1032 // output SUN copyright info
1033 void ArchDesc::addSunCopyright(char* legal, int size, FILE *fp) {
1034 size_t count = fwrite(legal, 1, size, fp);
1035 assert(count == (size_t) size, "copyright info truncated");
1036 fprintf(fp,"\n");
1037 fprintf(fp,"// Machine Generated File. Do Not Edit!\n");
1038 fprintf(fp,"\n");
1039 }
1040
1041
1042 //---------------------------addIncludeGuardStart--------------------------
1043 // output the start of an include guard.
1044 void ArchDesc::addIncludeGuardStart(ADLFILE &adlfile, const char* guardString) {
1045 // Build #include lines
1046 fprintf(adlfile._fp, "\n");
1047 fprintf(adlfile._fp, "#ifndef %s\n", guardString);
1048 fprintf(adlfile._fp, "#define %s\n", guardString);
1049 fprintf(adlfile._fp, "\n");
1050
1051 }
1052
1053 //---------------------------addIncludeGuardEnd--------------------------
1054 // output the end of an include guard.
1055 void ArchDesc::addIncludeGuardEnd(ADLFILE &adlfile, const char* guardString) {
1056 // Build #include lines
1057 fprintf(adlfile._fp, "\n");
1058 fprintf(adlfile._fp, "#endif // %s\n", guardString);
1059
1060 }
1061
1062 //---------------------------addInclude--------------------------
1063 // output the #include line for this file.
1064 void ArchDesc::addInclude(ADLFILE &adlfile, const char* fileName) {
1065 fprintf(adlfile._fp, "#include \"%s\"\n", fileName);
1066
1067 }
1068
1069 void ArchDesc::addInclude(ADLFILE &adlfile, const char* includeDir, const char* fileName) {
1070 fprintf(adlfile._fp, "#include \"%s/%s\"\n", includeDir, fileName);
1071
1072 }
1073
1074 //---------------------------addPreprocessorChecks-----------------------------
1075 // Output C preprocessor code to verify the backend compilation environment.
1076 // The idea is to force code produced by "adlc -DHS64" to be compiled by a
1077 // command of the form "CC ... -DHS64 ...", so that any #ifdefs in the source
1078 // blocks select C code that is consistent with adlc's selections of AD code.
1079 void ArchDesc::addPreprocessorChecks(FILE *fp) {
1080 const char* flag;
1081 _preproc_list.reset();
1082 if (_preproc_list.count() > 0 && !_preproc_list.current_is_signal()) {
1083 fprintf(fp, "// Check consistency of C++ compilation with ADLC options:\n");
1084 }
1085 for (_preproc_list.reset(); (flag = _preproc_list.iter()) != NULL; ) {
1086 if (_preproc_list.current_is_signal()) break;
1087 char* def = get_preproc_def(flag);
1088 fprintf(fp, "// Check adlc ");
1089 if (def)
1090 fprintf(fp, "-D%s=%s\n", flag, def);
1091 else fprintf(fp, "-U%s\n", flag);
1092 fprintf(fp, "#%s %s\n",
|