1 /*
2 * Copyright (c) 1997, 2007, 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 *
23 */
24
25 // Definitions for Error Flags
26 #define WARN 0
27 #define SYNERR 1
28 #define SEMERR 2
29 #define INTERNAL_ERR 3
30
31 // Minimal declarations for include files
32 class OutputMap;
33 class ProductionState;
34 class Expr;
35
36 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
37 typedef BufferedFile ADLFILE;
38
39 //---------------------------ChainList-----------------------------------------
40 class ChainList {
41 NameList _name;
42 NameList _cost;
43 NameList _rule;
44
257 void buildMachRegisterNumbers(FILE *fp_hpp);
258 // Generate enumeration of machine register encodings
259 void buildMachRegisterEncodes(FILE *fp_hpp);
260 // Generate Regsiter Size Array
261 void declareRegSizes(FILE *fp_hpp);
262 // Generate Pipeline Class information
263 void declare_pipe_classes(FILE *fp_hpp);
264 // Generate Pipeline definitions
265 void build_pipeline_enums(FILE *fp_cpp);
266 // Generate Pipeline Class information
267 void build_pipe_classes(FILE *fp_cpp);
268
269 // Declare and define mappings from rules to result and input types
270 void build_map(OutputMap &map);
271 void buildReduceMaps(FILE *fp_hpp, FILE *fp_cpp);
272 // build flags for signaling that our machine needs this instruction cloned
273 void buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp);
274
275 // output SUN copyright info
276 void addSunCopyright(char* legal, int size, FILE *fp);
277 // output #include declarations for machine specific files
278 void machineDependentIncludes(ADLFILE &adlfile);
279 // Output C preprocessor code to verify the backend compilation environment.
280 void addPreprocessorChecks(FILE *fp);
281 // Output C source and header (source_hpp) blocks.
282 void addPreHeaderBlocks(FILE *fp_hpp);
283 void addHeaderBlocks(FILE *fp_hpp);
284 void addSourceBlocks(FILE *fp_cpp);
285 void generate_adlc_verification(FILE *fp_cpp);
286
287 // output declaration of class State
288 void defineStateClass(FILE *fp);
289
290 // Generator for MachOper objects given integer type
291 void buildMachOperGenerator(FILE *fp_cpp);
292 // Generator for MachNode objects given integer type
293 void buildMachNodeGenerator(FILE *fp_cpp);
294
295 // Generator for Expand methods for instructions with expand rules
296 void defineExpand(FILE *fp, InstructForm *node);
297 // Generator for Peephole methods for instructions with peephole rules
298 void definePeephole(FILE *fp, InstructForm *node);
370 BEGIN_INSTRUCTIONS,
371 BEGIN_INST_CHAIN_RULES,
372 END_INST_CHAIN_RULES,
373 BEGIN_REMATERIALIZE,
374 END_REMATERIALIZE,
375 END_INSTRUCTIONS
376 };
377 // Output routines specific to the derived class
378 virtual void declaration() {}
379 virtual void definition() {}
380 virtual void closing() { fprintf(_cpp, "};\n"); }
381 virtual void map(OperandForm &oper) { }
382 virtual void map(OpClassForm &opc) { }
383 virtual void map(char *internal_name) { }
384 // Allow enum-MachOperands to turn-off instructions
385 virtual bool do_instructions() { return true; }
386 virtual void map(InstructForm &inst) { }
387 // Allow derived class to output name and position specific info
388 virtual void record_position(OutputMap::position place, int index) {}
389 };
|
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 *
23 */
24
25 #ifndef SHARE_VM_ADLC_ARCHDESC_HPP
26 #define SHARE_VM_ADLC_ARCHDESC_HPP
27
28 // Definitions for Error Flags
29 #define WARN 0
30 #define SYNERR 1
31 #define SEMERR 2
32 #define INTERNAL_ERR 3
33
34 // Minimal declarations for include files
35 class OutputMap;
36 class ProductionState;
37 class Expr;
38
39 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
40 typedef BufferedFile ADLFILE;
41
42 //---------------------------ChainList-----------------------------------------
43 class ChainList {
44 NameList _name;
45 NameList _cost;
46 NameList _rule;
47
260 void buildMachRegisterNumbers(FILE *fp_hpp);
261 // Generate enumeration of machine register encodings
262 void buildMachRegisterEncodes(FILE *fp_hpp);
263 // Generate Regsiter Size Array
264 void declareRegSizes(FILE *fp_hpp);
265 // Generate Pipeline Class information
266 void declare_pipe_classes(FILE *fp_hpp);
267 // Generate Pipeline definitions
268 void build_pipeline_enums(FILE *fp_cpp);
269 // Generate Pipeline Class information
270 void build_pipe_classes(FILE *fp_cpp);
271
272 // Declare and define mappings from rules to result and input types
273 void build_map(OutputMap &map);
274 void buildReduceMaps(FILE *fp_hpp, FILE *fp_cpp);
275 // build flags for signaling that our machine needs this instruction cloned
276 void buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp);
277
278 // output SUN copyright info
279 void addSunCopyright(char* legal, int size, FILE *fp);
280 // output the start of an include guard.
281 void addIncludeGuardStart(ADLFILE &adlfile, const char* guardString);
282 // output the end of an include guard.
283 void addIncludeGuardEnd(ADLFILE &adlfile, const char* guardString);
284 // output the #include line for this file.
285 void addInclude(ADLFILE &adlfile, const char* fileName);
286 void addInclude(ADLFILE &adlfile, const char* includeDir, const char* fileName);
287 // Output C preprocessor code to verify the backend compilation environment.
288 void addPreprocessorChecks(FILE *fp);
289 // Output C source and header (source_hpp) blocks.
290 void addPreHeaderBlocks(FILE *fp_hpp);
291 void addHeaderBlocks(FILE *fp_hpp);
292 void addSourceBlocks(FILE *fp_cpp);
293 void generate_adlc_verification(FILE *fp_cpp);
294
295 // output declaration of class State
296 void defineStateClass(FILE *fp);
297
298 // Generator for MachOper objects given integer type
299 void buildMachOperGenerator(FILE *fp_cpp);
300 // Generator for MachNode objects given integer type
301 void buildMachNodeGenerator(FILE *fp_cpp);
302
303 // Generator for Expand methods for instructions with expand rules
304 void defineExpand(FILE *fp, InstructForm *node);
305 // Generator for Peephole methods for instructions with peephole rules
306 void definePeephole(FILE *fp, InstructForm *node);
378 BEGIN_INSTRUCTIONS,
379 BEGIN_INST_CHAIN_RULES,
380 END_INST_CHAIN_RULES,
381 BEGIN_REMATERIALIZE,
382 END_REMATERIALIZE,
383 END_INSTRUCTIONS
384 };
385 // Output routines specific to the derived class
386 virtual void declaration() {}
387 virtual void definition() {}
388 virtual void closing() { fprintf(_cpp, "};\n"); }
389 virtual void map(OperandForm &oper) { }
390 virtual void map(OpClassForm &opc) { }
391 virtual void map(char *internal_name) { }
392 // Allow enum-MachOperands to turn-off instructions
393 virtual bool do_instructions() { return true; }
394 virtual void map(InstructForm &inst) { }
395 // Allow derived class to output name and position specific info
396 virtual void record_position(OutputMap::position place, int index) {}
397 };
398
399 #endif // SHARE_VM_ADLC_ARCHDESC_HPP
|