comparison src/share/vm/adlc/main.cpp @ 1972:f95d63e2154a

6989984: Use standard include model for Hospot Summary: Replaced MakeDeps and the includeDB files with more standardized solutions. Reviewed-by: coleenp, kvn, kamg
author stefank
date Tue, 23 Nov 2010 13:22:55 -0800
parents c18cbe5936b8
children 7e88bdae86ec
comparison
equal deleted inserted replaced
1971:e33f46fc48ed 1972:f95d63e2154a
1 /* 1 /*
2 * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved. 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. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
31 static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string 31 static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string
32 static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string 32 static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string
33 static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text 33 static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text
34 34
35 ArchDesc* globalAD = NULL; // global reference to Architecture Description object 35 ArchDesc* globalAD = NULL; // global reference to Architecture Description object
36
37 const char* get_basename(const char* filename) {
38 const char *basename = filename;
39 const char *cp;
40 for (cp = basename; *cp; cp++) {
41 if (*cp == '/') {
42 basename = cp+1;
43 }
44 }
45 return basename;
46 }
36 47
37 //------------------------------main------------------------------------------- 48 //------------------------------main-------------------------------------------
38 int main(int argc, char *argv[]) 49 int main(int argc, char *argv[])
39 { 50 {
40 ArchDesc AD; // Architecture Description object 51 ArchDesc AD; // Architecture Description object
191 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_MISC_file._fp); // .cpp 202 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_MISC_file._fp); // .cpp
192 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_PEEPHOLE_file._fp); // .cpp 203 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_PEEPHOLE_file._fp); // .cpp
193 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_PIPELINE_file._fp); // .cpp 204 AD.addSunCopyright(legal_text, legal_sz, AD._CPP_PIPELINE_file._fp); // .cpp
194 AD.addSunCopyright(legal_text, legal_sz, AD._VM_file._fp); // .hpp 205 AD.addSunCopyright(legal_text, legal_sz, AD._VM_file._fp); // .hpp
195 AD.addSunCopyright(legal_text, legal_sz, AD._DFA_file._fp); // .cpp 206 AD.addSunCopyright(legal_text, legal_sz, AD._DFA_file._fp); // .cpp
207 // Add include guards for all .hpp files
208 AD.addIncludeGuardStart(AD._HPP_file, "GENERATED_ADFILES_AD_HPP"); // .hpp
209 AD.addIncludeGuardStart(AD._VM_file, "GENERATED_ADFILES_ADGLOBALS_HPP"); // .hpp
210 // Add includes
211 AD.addInclude(AD._CPP_file, "precompiled.hpp");
212 AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._VM_file._name));
213 AD.addInclude(AD._CPP_file, "adfiles", get_basename(AD._HPP_file._name));
214 AD.addInclude(AD._CPP_file, "memory/allocation.inline.hpp");
215 AD.addInclude(AD._CPP_file, "asm/assembler.hpp");
216 AD.addInclude(AD._CPP_file, "code/vmreg.hpp");
217 AD.addInclude(AD._CPP_file, "gc_interface/collectedHeap.inline.hpp");
218 AD.addInclude(AD._CPP_file, "oops/compiledICHolderOop.hpp");
219 AD.addInclude(AD._CPP_file, "oops/markOop.hpp");
220 AD.addInclude(AD._CPP_file, "oops/methodOop.hpp");
221 AD.addInclude(AD._CPP_file, "oops/oop.inline.hpp");
222 AD.addInclude(AD._CPP_file, "oops/oop.inline2.hpp");
223 AD.addInclude(AD._CPP_file, "opto/cfgnode.hpp");
224 AD.addInclude(AD._CPP_file, "opto/locknode.hpp");
225 AD.addInclude(AD._CPP_file, "opto/opcodes.hpp");
226 AD.addInclude(AD._CPP_file, "opto/regalloc.hpp");
227 AD.addInclude(AD._CPP_file, "opto/regmask.hpp");
228 AD.addInclude(AD._CPP_file, "opto/runtime.hpp");
229 AD.addInclude(AD._CPP_file, "runtime/biasedLocking.hpp");
230 AD.addInclude(AD._CPP_file, "runtime/sharedRuntime.hpp");
231 AD.addInclude(AD._CPP_file, "runtime/stubRoutines.hpp");
232 AD.addInclude(AD._CPP_file, "utilities/growableArray.hpp");
233 #ifdef TARGET_ARCH_x86
234 AD.addInclude(AD._CPP_file, "assembler_x86.inline.hpp");
235 AD.addInclude(AD._CPP_file, "nativeInst_x86.hpp");
236 AD.addInclude(AD._CPP_file, "vmreg_x86.inline.hpp");
237 #endif
238 #ifdef TARGET_ARCH_sparc
239 AD.addInclude(AD._CPP_file, "assembler_sparc.inline.hpp");
240 AD.addInclude(AD._CPP_file, "nativeInst_sparc.hpp");
241 AD.addInclude(AD._CPP_file, "vmreg_sparc.inline.hpp");
242 #endif
243 AD.addInclude(AD._HPP_file, "memory/allocation.hpp");
244 AD.addInclude(AD._HPP_file, "opto/machnode.hpp");
245 AD.addInclude(AD._HPP_file, "opto/node.hpp");
246 AD.addInclude(AD._HPP_file, "opto/regalloc.hpp");
247 AD.addInclude(AD._HPP_file, "opto/subnode.hpp");
248 AD.addInclude(AD._CPP_CLONE_file, "precompiled.hpp");
249 AD.addInclude(AD._CPP_CLONE_file, "adfiles", get_basename(AD._HPP_file._name));
250 AD.addInclude(AD._CPP_EXPAND_file, "precompiled.hpp");
251 AD.addInclude(AD._CPP_EXPAND_file, "adfiles", get_basename(AD._HPP_file._name));
252 AD.addInclude(AD._CPP_FORMAT_file, "precompiled.hpp");
253 AD.addInclude(AD._CPP_FORMAT_file, "adfiles", get_basename(AD._HPP_file._name));
254 AD.addInclude(AD._CPP_GEN_file, "precompiled.hpp");
255 AD.addInclude(AD._CPP_GEN_file, "adfiles", get_basename(AD._HPP_file._name));
256 AD.addInclude(AD._CPP_GEN_file, "opto/cfgnode.hpp");
257 AD.addInclude(AD._CPP_GEN_file, "opto/locknode.hpp");
258 AD.addInclude(AD._CPP_MISC_file, "precompiled.hpp");
259 AD.addInclude(AD._CPP_MISC_file, "adfiles", get_basename(AD._HPP_file._name));
260 AD.addInclude(AD._CPP_PEEPHOLE_file, "precompiled.hpp");
261 AD.addInclude(AD._CPP_PEEPHOLE_file, "adfiles", get_basename(AD._HPP_file._name));
262 AD.addInclude(AD._CPP_PIPELINE_file, "precompiled.hpp");
263 AD.addInclude(AD._CPP_PIPELINE_file, "adfiles", get_basename(AD._HPP_file._name));
264 AD.addInclude(AD._DFA_file, "precompiled.hpp");
265 AD.addInclude(AD._DFA_file, "adfiles", get_basename(AD._HPP_file._name));
266 AD.addInclude(AD._DFA_file, "opto/matcher.hpp");
267 AD.addInclude(AD._DFA_file, "opto/opcodes.hpp");
196 // Make sure each .cpp file starts with include lines: 268 // Make sure each .cpp file starts with include lines:
197 // files declaring and defining generators for Mach* Objects (hpp,cpp) 269 // files declaring and defining generators for Mach* Objects (hpp,cpp)
198 AD.machineDependentIncludes(AD._CPP_file); // .cpp
199 AD.machineDependentIncludes(AD._CPP_CLONE_file); // .cpp
200 AD.machineDependentIncludes(AD._CPP_EXPAND_file); // .cpp
201 AD.machineDependentIncludes(AD._CPP_FORMAT_file); // .cpp
202 AD.machineDependentIncludes(AD._CPP_GEN_file); // .cpp
203 AD.machineDependentIncludes(AD._CPP_MISC_file); // .cpp
204 AD.machineDependentIncludes(AD._CPP_PEEPHOLE_file); // .cpp
205 AD.machineDependentIncludes(AD._CPP_PIPELINE_file); // .cpp
206 // Generate the result files: 270 // Generate the result files:
207 // enumerations, class definitions, object generators, and the DFA 271 // enumerations, class definitions, object generators, and the DFA
208 // file containing enumeration of machine operands & instructions (hpp) 272 // file containing enumeration of machine operands & instructions (hpp)
209 AD.addPreHeaderBlocks(AD._HPP_file._fp); // .hpp 273 AD.addPreHeaderBlocks(AD._HPP_file._fp); // .hpp
210 AD.buildMachOperEnum(AD._HPP_file._fp); // .hpp 274 AD.buildMachOperEnum(AD._HPP_file._fp); // .hpp
242 AD.addPreprocessorChecks(AD._CPP_MISC_file._fp); // .cpp 306 AD.addPreprocessorChecks(AD._CPP_MISC_file._fp); // .cpp
243 AD.addPreprocessorChecks(AD._CPP_PEEPHOLE_file._fp); // .cpp 307 AD.addPreprocessorChecks(AD._CPP_PEEPHOLE_file._fp); // .cpp
244 AD.addPreprocessorChecks(AD._CPP_PIPELINE_file._fp); // .cpp 308 AD.addPreprocessorChecks(AD._CPP_PIPELINE_file._fp); // .cpp
245 309
246 // define the finite automata that selects lowest cost production 310 // define the finite automata that selects lowest cost production
247 AD.machineDependentIncludes(AD._DFA_file); // .cpp
248 AD.buildDFA(AD._DFA_file._fp); 311 AD.buildDFA(AD._DFA_file._fp);
312 // Add include guards for all .hpp files
313 AD.addIncludeGuardEnd(AD._HPP_file, "GENERATED_ADFILES_AD_HPP"); // .hpp
314 AD.addIncludeGuardEnd(AD._VM_file, "GENERATED_ADFILES_ADGLOBALS_HPP"); // .hpp
249 315
250 AD.close_files(0); // Close all input/output files 316 AD.close_files(0); // Close all input/output files
251 317
252 // Final printout and statistics 318 // Final printout and statistics
253 // cout << program; 319 // cout << program;