104 FormList _pre_header; // ditto for the very top of the hpp file
105 FormList _source; // List of Source Code Forms for output
106 FormList _instructions; // List of Instruction Forms for output
107 FormList _machnodes; // List of Node Classes (special for pipelining)
108 FormList _operands; // List of Operand Forms for output
109 FormList _opclass; // List of Operand Class Forms for output
110 FormList _attributes; // List of Attribute Forms for parsing
111 RegisterForm *_register; // Only one Register Form allowed
112 FrameForm *_frame; // Describe stack-frame layout
113 EncodeForm *_encode; // Only one Encode Form allowed
114 PipelineForm *_pipeline; // Pipeline Form for output
115
116 bool _has_match_rule[_last_opcode]; // found AD rule for ideal node in <arch>.ad
117
118 MatchList *_mlistab[_last_opcode]; // Array of MatchLists
119
120 // The Architecture Description identifies which user-defined operand can be used
121 // to access [stack_pointer + offset]
122 OperandForm *_cisc_spill_operand;
123
124 // Methods for outputting the DFA
125 void gen_match(FILE *fp, MatchList &mlist, ProductionState &status, Dict &operands_chained_from);
126 void chain_rule(FILE *fp, const char *indent, const char *ideal,
127 const Expr *icost, const char *irule,
128 Dict &operands_chained_from, ProductionState &status);
129 void expand_opclass(FILE *fp, const char *indent, const Expr *cost,
130 const char *result_type, ProductionState &status);
131 Expr *calc_cost(FILE *fp, const char *spaces, MatchList &mList, ProductionState &status);
132 void prune_matchlist(Dict &minimize, MatchList &mlist);
133
134 // Helper function that outputs code to generate an instruction in MachNodeGenerator
135 void buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *indent);
136
137 public:
138 ArchDesc();
139 ~ArchDesc();
140
141 // Option flags which control miscellaneous behaviors throughout the code
142 int _TotalLines; // Line Counter
143 int _no_output; // Flag to disable output of DFA, etc.
272 void build_map(OutputMap &map);
273 void buildReduceMaps(FILE *fp_hpp, FILE *fp_cpp);
274 // build flags for signaling that our machine needs this instruction cloned
275 void buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp);
276
277 // output SUN copyright info
278 void addSunCopyright(char* legal, int size, FILE *fp);
279 // output the start of an include guard.
280 void addIncludeGuardStart(ADLFILE &adlfile, const char* guardString);
281 // output the end of an include guard.
282 void addIncludeGuardEnd(ADLFILE &adlfile, const char* guardString);
283 // output the #include line for this file.
284 void addInclude(ADLFILE &adlfile, const char* fileName);
285 void addInclude(ADLFILE &adlfile, const char* includeDir, const char* fileName);
286 // Output C preprocessor code to verify the backend compilation environment.
287 void addPreprocessorChecks(FILE *fp);
288 // Output C source and header (source_hpp) blocks.
289 void addPreHeaderBlocks(FILE *fp_hpp);
290 void addHeaderBlocks(FILE *fp_hpp);
291 void addSourceBlocks(FILE *fp_cpp);
292 void generate_adlc_verification(FILE *fp_cpp);
293
294 // output declaration of class State
295 void defineStateClass(FILE *fp);
296
297 // Generator for MachOper objects given integer type
298 void buildMachOperGenerator(FILE *fp_cpp);
299 // Generator for MachNode objects given integer type
300 void buildMachNodeGenerator(FILE *fp_cpp);
301
302 // Generator for Expand methods for instructions with expand rules
303 void defineExpand (FILE *fp, InstructForm *node);
304 // Generator for Peephole methods for instructions with peephole rules
305 void definePeephole (FILE *fp, InstructForm *node);
306 // Generator for Size methods for instructions
307 void defineSize (FILE *fp, InstructForm &node);
308
309 public:
310 // Generator for EvalConstantValue methods for instructions
311 void defineEvalConstant(FILE *fp, InstructForm &node);
|
104 FormList _pre_header; // ditto for the very top of the hpp file
105 FormList _source; // List of Source Code Forms for output
106 FormList _instructions; // List of Instruction Forms for output
107 FormList _machnodes; // List of Node Classes (special for pipelining)
108 FormList _operands; // List of Operand Forms for output
109 FormList _opclass; // List of Operand Class Forms for output
110 FormList _attributes; // List of Attribute Forms for parsing
111 RegisterForm *_register; // Only one Register Form allowed
112 FrameForm *_frame; // Describe stack-frame layout
113 EncodeForm *_encode; // Only one Encode Form allowed
114 PipelineForm *_pipeline; // Pipeline Form for output
115
116 bool _has_match_rule[_last_opcode]; // found AD rule for ideal node in <arch>.ad
117
118 MatchList *_mlistab[_last_opcode]; // Array of MatchLists
119
120 // The Architecture Description identifies which user-defined operand can be used
121 // to access [stack_pointer + offset]
122 OperandForm *_cisc_spill_operand;
123
124 // If a Call node uses $constanttablebase, it gets MachConstantBaseNode
125 // by the matcher and the matcher will modify the jvms. If so, jvm states
126 // always have to be cloned when a node is cloned. Adlc generates
127 // Compile::needs_clone_jvms() accordingly.
128 bool _needs_clone_jvms;
129
130 // Methods for outputting the DFA
131 void gen_match(FILE *fp, MatchList &mlist, ProductionState &status, Dict &operands_chained_from);
132 void chain_rule(FILE *fp, const char *indent, const char *ideal,
133 const Expr *icost, const char *irule,
134 Dict &operands_chained_from, ProductionState &status);
135 void expand_opclass(FILE *fp, const char *indent, const Expr *cost,
136 const char *result_type, ProductionState &status);
137 Expr *calc_cost(FILE *fp, const char *spaces, MatchList &mList, ProductionState &status);
138 void prune_matchlist(Dict &minimize, MatchList &mlist);
139
140 // Helper function that outputs code to generate an instruction in MachNodeGenerator
141 void buildMachNode(FILE *fp_cpp, InstructForm *inst, const char *indent);
142
143 public:
144 ArchDesc();
145 ~ArchDesc();
146
147 // Option flags which control miscellaneous behaviors throughout the code
148 int _TotalLines; // Line Counter
149 int _no_output; // Flag to disable output of DFA, etc.
278 void build_map(OutputMap &map);
279 void buildReduceMaps(FILE *fp_hpp, FILE *fp_cpp);
280 // build flags for signaling that our machine needs this instruction cloned
281 void buildMustCloneMap(FILE *fp_hpp, FILE *fp_cpp);
282
283 // output SUN copyright info
284 void addSunCopyright(char* legal, int size, FILE *fp);
285 // output the start of an include guard.
286 void addIncludeGuardStart(ADLFILE &adlfile, const char* guardString);
287 // output the end of an include guard.
288 void addIncludeGuardEnd(ADLFILE &adlfile, const char* guardString);
289 // output the #include line for this file.
290 void addInclude(ADLFILE &adlfile, const char* fileName);
291 void addInclude(ADLFILE &adlfile, const char* includeDir, const char* fileName);
292 // Output C preprocessor code to verify the backend compilation environment.
293 void addPreprocessorChecks(FILE *fp);
294 // Output C source and header (source_hpp) blocks.
295 void addPreHeaderBlocks(FILE *fp_hpp);
296 void addHeaderBlocks(FILE *fp_hpp);
297 void addSourceBlocks(FILE *fp_cpp);
298 void generate_needs_clone_jvms(FILE *fp_cpp);
299 void generate_adlc_verification(FILE *fp_cpp);
300
301 // output declaration of class State
302 void defineStateClass(FILE *fp);
303
304 // Generator for MachOper objects given integer type
305 void buildMachOperGenerator(FILE *fp_cpp);
306 // Generator for MachNode objects given integer type
307 void buildMachNodeGenerator(FILE *fp_cpp);
308
309 // Generator for Expand methods for instructions with expand rules
310 void defineExpand (FILE *fp, InstructForm *node);
311 // Generator for Peephole methods for instructions with peephole rules
312 void definePeephole (FILE *fp, InstructForm *node);
313 // Generator for Size methods for instructions
314 void defineSize (FILE *fp, InstructForm &node);
315
316 public:
317 // Generator for EvalConstantValue methods for instructions
318 void defineEvalConstant(FILE *fp, InstructForm &node);
|