src/share/vm/adlc/formssel.hpp

Mon, 25 Jun 2012 21:33:35 -0400

author
coleenp
date
Mon, 25 Jun 2012 21:33:35 -0400
changeset 3875
246d977b51f2
parent 3316
f03a3c8bd5e5
child 3882
8c92982cbbc4
permissions
-rw-r--r--

7178670: runtime/7158800/BadUtf8.java fails in SymbolTable::rehash_table
Summary: Cannot delete _buckets and HashtableEntries in shared space (CDS)
Reviewed-by: acorn, kvn, dlong, dcubed, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #ifndef SHARE_VM_ADLC_FORMSSEL_HPP
stefank@2314 26 #define SHARE_VM_ADLC_FORMSSEL_HPP
stefank@2314 27
duke@435 28 // FORMSSEL.HPP - ADL Parser Instruction Selection Forms Classes
duke@435 29
duke@435 30 // Class List
duke@435 31 class Form;
duke@435 32 class InstructForm;
duke@435 33 class MachNodeForm;
duke@435 34 class OperandForm;
duke@435 35 class OpClassForm;
duke@435 36 class AttributeForm;
duke@435 37 class RegisterForm;
duke@435 38 class PipelineForm;
duke@435 39 class SourceForm;
duke@435 40 class EncodeForm;
duke@435 41 class Component;
duke@435 42 class Constraint;
duke@435 43 class Predicate;
duke@435 44 class MatchRule;
duke@435 45 class Attribute;
duke@435 46 class Effect;
duke@435 47 class ExpandRule;
duke@435 48 class RewriteRule;
duke@435 49 class ConstructRule;
duke@435 50 class FormatRule;
duke@435 51 class Peephole;
duke@435 52 class EncClass;
duke@435 53 class Interface;
duke@435 54 class RegInterface;
duke@435 55 class ConstInterface;
duke@435 56 class MemInterface;
duke@435 57 class CondInterface;
duke@435 58 class Opcode;
duke@435 59 class InsEncode;
duke@435 60 class RegDef;
duke@435 61 class RegClass;
duke@435 62 class AllocClass;
duke@435 63 class ResourceForm;
duke@435 64 class PipeDesc;
duke@435 65 class PipeClass;
duke@435 66 class PeepMatch;
duke@435 67 class PeepConstraint;
duke@435 68 class PeepReplace;
duke@435 69 class MatchList;
duke@435 70
duke@435 71 class ArchDesc;
duke@435 72
duke@435 73 //==============================Instructions===================================
duke@435 74 //------------------------------InstructForm-----------------------------------
duke@435 75 class InstructForm : public Form {
duke@435 76 private:
twisti@2350 77 bool _ideal_only; // Not a user-defined instruction
duke@435 78 // Members used for tracking CISC-spilling
twisti@2350 79 uint _cisc_spill_operand;// Which operand may cisc-spill
duke@435 80 void set_cisc_spill_operand(uint op_index) { _cisc_spill_operand = op_index; }
twisti@2350 81 bool _is_cisc_alternate;
duke@435 82 InstructForm *_cisc_spill_alternate;// cisc possible replacement
duke@435 83 const char *_cisc_reg_mask_name;
duke@435 84 InstructForm *_short_branch_form;
duke@435 85 bool _is_short_branch;
twisti@2350 86 bool _is_mach_constant; // true if Node is a MachConstantNode
duke@435 87 uint _alignment;
duke@435 88
duke@435 89 public:
duke@435 90 // Public Data
duke@435 91 const char *_ident; // Name of this instruction
duke@435 92 NameList _parameters; // Locally defined names
duke@435 93 FormDict _localNames; // Table of operands & their types
duke@435 94 MatchRule *_matrule; // Matching rule for this instruction
duke@435 95 Opcode *_opcode; // Encoding of the opcode for instruction
duke@435 96 char *_size; // Size of instruction
duke@435 97 InsEncode *_insencode; // Encoding class instruction belongs to
twisti@2350 98 InsEncode *_constant; // Encoding class constant value belongs to
duke@435 99 Attribute *_attribs; // List of Attribute rules
duke@435 100 Predicate *_predicate; // Predicate test for this instruction
duke@435 101 FormDict _effects; // Dictionary of effect rules
duke@435 102 ExpandRule *_exprule; // Expand rule for this instruction
duke@435 103 RewriteRule *_rewrule; // Rewrite rule for this instruction
duke@435 104 FormatRule *_format; // Format for assembly generation
duke@435 105 Peephole *_peephole; // List of peephole rules for instruction
duke@435 106 const char *_ins_pipe; // Instruction Scheduline description class
duke@435 107
duke@435 108 uint *_uniq_idx; // Indexes of unique operands
never@1034 109 int _uniq_idx_length; // Length of _uniq_idx array
duke@435 110 uint _num_uniq; // Number of unique operands
duke@435 111 ComponentList _components; // List of Components matches MachNode's
duke@435 112 // operand structure
duke@435 113
roland@3316 114 bool _has_call; // contain a call and caller save registers should be saved?
roland@3316 115
duke@435 116 // Public Methods
duke@435 117 InstructForm(const char *id, bool ideal_only = false);
duke@435 118 InstructForm(const char *id, InstructForm *instr, MatchRule *rule);
duke@435 119 ~InstructForm();
duke@435 120
duke@435 121 // Dynamic type check
duke@435 122 virtual InstructForm *is_instruction() const;
duke@435 123
duke@435 124 virtual bool ideal_only() const;
duke@435 125
duke@435 126 // This instruction sets a result
duke@435 127 virtual bool sets_result() const;
duke@435 128 // This instruction needs projections for additional DEFs or KILLs
duke@435 129 virtual bool needs_projections();
duke@435 130 // This instruction needs extra nodes for temporary inputs
duke@435 131 virtual bool has_temps();
duke@435 132 // This instruction defines or kills more than one object
duke@435 133 virtual uint num_defs_or_kills();
duke@435 134 // This instruction has an expand rule?
duke@435 135 virtual bool expands() const ;
duke@435 136 // Return this instruction's first peephole rule, or NULL
duke@435 137 virtual Peephole *peepholes() const;
duke@435 138 // Add a peephole rule to this instruction
duke@435 139 virtual void append_peephole(Peephole *peep);
duke@435 140
duke@435 141 virtual bool is_pinned(FormDict &globals); // should be pinned inside block
duke@435 142 virtual bool is_projection(FormDict &globals); // node requires projection
duke@435 143 virtual bool is_parm(FormDict &globals); // node matches ideal 'Parm'
duke@435 144 // ideal opcode enumeration
duke@435 145 virtual const char *ideal_Opcode(FormDict &globals) const;
duke@435 146 virtual int is_expensive() const; // node matches ideal 'CosD'
duke@435 147 virtual int is_empty_encoding() const; // _size=0 and/or _insencode empty
duke@435 148 virtual int is_tls_instruction() const; // tlsLoadP rule or ideal ThreadLocal
duke@435 149 virtual int is_ideal_copy() const; // node matches ideal 'Copy*'
duke@435 150 virtual bool is_ideal_if() const; // node matches ideal 'If'
duke@435 151 virtual bool is_ideal_fastlock() const; // node matches 'FastLock'
duke@435 152 virtual bool is_ideal_membar() const; // node matches ideal 'MemBarXXX'
duke@435 153 virtual bool is_ideal_loadPC() const; // node matches ideal 'LoadPC'
duke@435 154 virtual bool is_ideal_box() const; // node matches ideal 'Box'
duke@435 155 virtual bool is_ideal_goto() const; // node matches ideal 'Goto'
duke@435 156 virtual bool is_ideal_branch() const; // "" 'If' | 'Goto' | 'LoopEnd' | 'Jump'
duke@435 157 virtual bool is_ideal_jump() const; // node matches ideal 'Jump'
duke@435 158 virtual bool is_ideal_return() const; // node matches ideal 'Return'
duke@435 159 virtual bool is_ideal_halt() const; // node matches ideal 'Halt'
duke@435 160 virtual bool is_ideal_safepoint() const; // node matches 'SafePoint'
duke@435 161 virtual bool is_ideal_nop() const; // node matches 'Nop'
duke@435 162 virtual bool is_ideal_control() const; // control node
duke@435 163
duke@435 164 virtual Form::CallType is_ideal_call() const; // matches ideal 'Call'
duke@435 165 virtual Form::DataType is_ideal_load() const; // node matches ideal 'LoadXNode'
never@1290 166 // Should antidep checks be disabled for this Instruct
never@1290 167 // See definition of MatchRule::skip_antidep_check
never@1290 168 bool skip_antidep_check() const;
duke@435 169 virtual Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
duke@435 170 bool is_ideal_mem() const { return is_ideal_load() != Form::none || is_ideal_store() != Form::none; }
duke@435 171 virtual uint two_address(FormDict &globals); // output reg must match input reg
duke@435 172 // when chaining a constant to an instruction, return 'true' and set opType
duke@435 173 virtual Form::DataType is_chain_of_constant(FormDict &globals);
duke@435 174 virtual Form::DataType is_chain_of_constant(FormDict &globals, const char * &opType);
duke@435 175 virtual Form::DataType is_chain_of_constant(FormDict &globals, const char * &opType, const char * &result_type);
duke@435 176
duke@435 177 // Check if a simple chain rule
duke@435 178 virtual bool is_simple_chain_rule(FormDict &globals) const;
duke@435 179
duke@435 180 // check for structural rematerialization
duke@435 181 virtual bool rematerialize(FormDict &globals, RegisterForm *registers);
duke@435 182
duke@435 183 // loads from memory, so must check for anti-dependence
duke@435 184 virtual bool needs_anti_dependence_check(FormDict &globals) const;
duke@435 185 virtual int memory_operand(FormDict &globals) const;
duke@435 186 bool is_wide_memory_kill(FormDict &globals) const;
duke@435 187
duke@435 188 enum memory_operand_type {
duke@435 189 NO_MEMORY_OPERAND = -1,
duke@435 190 MANY_MEMORY_OPERANDS = 999999
duke@435 191 };
duke@435 192
duke@435 193
duke@435 194 // This instruction captures the machine-independent bottom_type
duke@435 195 // Expected use is for pointer vs oop determination for LoadP
never@1896 196 virtual bool captures_bottom_type(FormDict& globals) const;
duke@435 197
duke@435 198 virtual const char *cost(); // Access ins_cost attribute
duke@435 199 virtual uint num_opnds(); // Count of num_opnds for MachNode class
duke@435 200 virtual uint num_post_match_opnds();
duke@435 201 virtual uint num_consts(FormDict &globals) const;// Constants in match rule
duke@435 202 // Constants in match rule with specified type
duke@435 203 virtual uint num_consts(FormDict &globals, Form::DataType type) const;
duke@435 204
duke@435 205 // Return the register class associated with 'leaf'.
duke@435 206 virtual const char *out_reg_class(FormDict &globals);
duke@435 207
duke@435 208 // number of ideal node inputs to skip
duke@435 209 virtual uint oper_input_base(FormDict &globals);
duke@435 210
duke@435 211 // Does this instruction need a base-oop edge?
duke@435 212 int needs_base_oop_edge(FormDict &globals) const;
duke@435 213
duke@435 214 // Build instruction predicates. If the user uses the same operand name
duke@435 215 // twice, we need to check that the operands are pointer-eequivalent in
duke@435 216 // the DFA during the labeling process.
duke@435 217 Predicate *build_predicate();
duke@435 218
duke@435 219 virtual void build_components(); // top-level operands
duke@435 220 // Return zero-based position in component list; -1 if not in list.
duke@435 221 virtual int operand_position(const char *name, int usedef);
duke@435 222 virtual int operand_position_format(const char *name);
duke@435 223
duke@435 224 // Return zero-based position in component list; -1 if not in list.
duke@435 225 virtual int label_position();
duke@435 226 virtual int method_position();
duke@435 227 // Return number of relocation entries needed for this instruction.
duke@435 228 virtual uint reloc(FormDict &globals);
duke@435 229
duke@435 230 const char *reduce_result();
duke@435 231 // Return the name of the operand on the right hand side of the binary match
duke@435 232 // Return NULL if there is no right hand side
duke@435 233 const char *reduce_right(FormDict &globals) const;
duke@435 234 const char *reduce_left(FormDict &globals) const;
duke@435 235
duke@435 236 // Base class for this instruction, MachNode except for calls
never@1896 237 virtual const char *mach_base_class(FormDict &globals) const;
duke@435 238
duke@435 239 // Check if this instruction can cisc-spill to 'alternate'
duke@435 240 bool cisc_spills_to(ArchDesc &AD, InstructForm *alternate);
duke@435 241 InstructForm *cisc_spill_alternate() { return _cisc_spill_alternate; }
duke@435 242 uint cisc_spill_operand() const { return _cisc_spill_operand; }
duke@435 243 bool is_cisc_alternate() const { return _is_cisc_alternate; }
duke@435 244 void set_cisc_alternate(bool val) { _is_cisc_alternate = val; }
duke@435 245 const char *cisc_reg_mask_name() const { return _cisc_reg_mask_name; }
duke@435 246 void set_cisc_reg_mask_name(const char *rm_name) { _cisc_reg_mask_name = rm_name; }
duke@435 247 // Output cisc-method prototypes and method bodies
duke@435 248 void declare_cisc_version(ArchDesc &AD, FILE *fp_cpp);
duke@435 249 bool define_cisc_version (ArchDesc &AD, FILE *fp_cpp);
duke@435 250
duke@435 251 bool check_branch_variant(ArchDesc &AD, InstructForm *short_branch);
duke@435 252
duke@435 253 bool is_short_branch() { return _is_short_branch; }
duke@435 254 void set_short_branch(bool val) { _is_short_branch = val; }
duke@435 255
twisti@2350 256 bool is_mach_constant() const { return _is_mach_constant; }
twisti@2350 257 void set_is_mach_constant(bool x) { _is_mach_constant = x; }
twisti@2350 258
duke@435 259 InstructForm *short_branch_form() { return _short_branch_form; }
duke@435 260 bool has_short_branch_form() { return _short_branch_form != NULL; }
duke@435 261 // Output short branch prototypes and method bodies
duke@435 262 void declare_short_branch_methods(FILE *fp_cpp);
never@1896 263 bool define_short_branch_methods(ArchDesc &AD, FILE *fp_cpp);
duke@435 264
duke@435 265 uint alignment() { return _alignment; }
duke@435 266 void set_alignment(uint val) { _alignment = val; }
duke@435 267
duke@435 268 // Seach through operands to determine operands unique positions.
duke@435 269 void set_unique_opnds();
duke@435 270 uint num_unique_opnds() { return _num_uniq; }
duke@435 271 uint unique_opnds_idx(int idx) {
never@1034 272 if( _uniq_idx != NULL && idx > 0 ) {
never@1034 273 assert(idx < _uniq_idx_length, "out of bounds");
duke@435 274 return _uniq_idx[idx];
never@1034 275 } else {
duke@435 276 return idx;
never@1034 277 }
never@1034 278 }
duke@435 279
duke@435 280 // Operands which are only KILLs aren't part of the input array and
duke@435 281 // require special handling in some cases. Their position in this
duke@435 282 // operand list is higher than the number of unique operands.
duke@435 283 bool is_noninput_operand(uint idx) {
duke@435 284 return (idx >= num_unique_opnds());
duke@435 285 }
duke@435 286
duke@435 287 // --------------------------- FILE *output_routines
duke@435 288 //
duke@435 289 // Generate the format call for the replacement variable
duke@435 290 void rep_var_format(FILE *fp, const char *rep_var);
twisti@1040 291 // Generate index values needed for determining the operand position
duke@435 292 void index_temps (FILE *fp, FormDict &globals, const char *prefix = "", const char *receiver = "");
duke@435 293 // ---------------------------
duke@435 294
duke@435 295 virtual bool verify(); // Check consistency after parsing
duke@435 296
duke@435 297 virtual void dump(); // Debug printer
duke@435 298 virtual void output(FILE *fp); // Write to output files
duke@435 299 };
duke@435 300
duke@435 301 //------------------------------EncodeForm-------------------------------------
duke@435 302 class EncodeForm : public Form {
duke@435 303 private:
duke@435 304
duke@435 305 public:
duke@435 306 // Public Data
duke@435 307 NameList _eclasses; // List of encode class names
duke@435 308 Dict _encClass; // Map encode class names to EncClass objects
duke@435 309
duke@435 310 // Public Methods
duke@435 311 EncodeForm();
duke@435 312 ~EncodeForm();
duke@435 313
duke@435 314 EncClass *add_EncClass(const char *className);
duke@435 315 EncClass *encClass(const char *className);
duke@435 316
duke@435 317 const char *encClassPrototype(const char *className);
duke@435 318 const char *encClassBody(const char *className);
duke@435 319
duke@435 320 void dump(); // Debug printer
duke@435 321 void output(FILE *fp); // Write info to output files
duke@435 322 };
duke@435 323
duke@435 324 //------------------------------EncClass---------------------------------------
duke@435 325 class EncClass : public Form {
duke@435 326 public:
duke@435 327 // NameList for parameter type and name
duke@435 328 NameList _parameter_type;
duke@435 329 NameList _parameter_name;
duke@435 330
duke@435 331 // Breakdown the encoding into strings separated by $replacement_variables
duke@435 332 // There is an entry in _strings, perhaps NULL, that precedes each _rep_vars
duke@435 333 NameList _code; // Strings passed through to tty->print
duke@435 334 NameList _rep_vars; // replacement variables
duke@435 335
duke@435 336 NameList _parameters; // Locally defined names
duke@435 337 FormDict _localNames; // Table of components & their types
duke@435 338
duke@435 339 public:
duke@435 340 // Public Data
duke@435 341 const char *_name; // encoding class name
duke@435 342
duke@435 343 // Public Methods
duke@435 344 EncClass(const char *name);
duke@435 345 ~EncClass();
duke@435 346
duke@435 347 // --------------------------- Parameters
duke@435 348 // Add a parameter <type,name> pair
duke@435 349 void add_parameter(const char *parameter_type, const char *parameter_name);
duke@435 350 // Verify operand types in parameter list
duke@435 351 bool check_parameter_types(FormDict &globals);
duke@435 352 // Obtain the zero-based index corresponding to a replacement variable
duke@435 353 int rep_var_index(const char *rep_var);
duke@435 354 int num_args() { return _parameter_name.count(); }
duke@435 355
duke@435 356 // --------------------------- Code Block
duke@435 357 // Add code
twisti@1040 358 void add_code(const char *string_preceding_replacement_var);
duke@435 359 // Add a replacement variable or one of its subfields
duke@435 360 // Subfields are stored with a leading '$'
duke@435 361 void add_rep_var(char *replacement_var);
duke@435 362
duke@435 363 bool verify();
duke@435 364 void dump();
duke@435 365 void output(FILE *fp);
duke@435 366 };
duke@435 367
duke@435 368 //------------------------------MachNode---------------------------------------
duke@435 369 class MachNodeForm: public Form {
duke@435 370 private:
duke@435 371
duke@435 372 public:
duke@435 373 char *_ident; // Name of this instruction
duke@435 374 const char *_machnode_pipe; // Instruction Scheduline description class
duke@435 375
duke@435 376 // Public Methods
duke@435 377 MachNodeForm(char *id);
duke@435 378 ~MachNodeForm();
duke@435 379
duke@435 380 virtual MachNodeForm *is_machnode() const;
duke@435 381
duke@435 382 void dump(); // Debug printer
duke@435 383 void output(FILE *fp); // Write info to output files
duke@435 384 };
duke@435 385
duke@435 386 //------------------------------Opcode-----------------------------------------
duke@435 387 class Opcode : public Form {
duke@435 388 private:
duke@435 389
duke@435 390 public:
duke@435 391 // Public Data
duke@435 392 // Strings representing instruction opcodes, user defines placement in emit
duke@435 393 char *_primary;
duke@435 394 char *_secondary;
duke@435 395 char *_tertiary;
duke@435 396
duke@435 397 enum opcode_type {
duke@435 398 NOT_AN_OPCODE = -1,
duke@435 399 PRIMARY = 1,
duke@435 400 SECONDARY = 2,
duke@435 401 TERTIARY = 3
duke@435 402 };
duke@435 403
duke@435 404 // Public Methods
duke@435 405 Opcode(char *primary, char *secondary, char *tertiary);
duke@435 406 ~Opcode();
duke@435 407
duke@435 408 static Opcode::opcode_type as_opcode_type(const char *designator);
duke@435 409
duke@435 410 void dump();
duke@435 411 void output(FILE *fp);
duke@435 412
duke@435 413 // --------------------------- FILE *output_routines
never@850 414 bool print_opcode(FILE *fp, Opcode::opcode_type desired_opcode);
duke@435 415 };
duke@435 416
duke@435 417 //------------------------------InsEncode--------------------------------------
duke@435 418 class InsEncode : public Form {
duke@435 419 private:
duke@435 420 // Public Data (access directly only for reads)
duke@435 421 // The encodings can only have the values predefined by the ADLC:
duke@435 422 // blank, RegReg, RegMem, MemReg, ...
duke@435 423 NameList _encoding;
duke@435 424 // NameList _parameter;
duke@435 425 // The parameters for each encoding are preceeded by a NameList::_signal
duke@435 426 // and follow the parameters for the previous encoding.
duke@435 427
duke@435 428 // char *_encode; // Type of instruction encoding
duke@435 429
duke@435 430 public:
duke@435 431 // Public Methods
duke@435 432 InsEncode();
duke@435 433 ~InsEncode();
duke@435 434
duke@435 435 // Add "encode class name" and its parameters
duke@435 436 NameAndList *add_encode(char *encode_method_name);
duke@435 437 // Parameters are added to the returned "NameAndList" by the parser
duke@435 438
duke@435 439 // Access the list of encodings
duke@435 440 void reset();
duke@435 441 const char *encode_class_iter();
duke@435 442
duke@435 443 // Returns the number of arguments to the current encoding in the iteration
duke@435 444 int current_encoding_num_args() {
duke@435 445 return ((NameAndList*)_encoding.current())->count();
duke@435 446 }
duke@435 447
duke@435 448 // --------------------------- Parameters
duke@435 449 // The following call depends upon position within encode_class_iteration
duke@435 450 //
duke@435 451 // Obtain parameter name from zero based index
duke@435 452 const char *rep_var_name(InstructForm &inst, uint param_no);
duke@435 453 // ---------------------------
duke@435 454
duke@435 455 void dump();
duke@435 456 void output(FILE *fp);
duke@435 457 };
duke@435 458
duke@435 459 //------------------------------Effect-----------------------------------------
duke@435 460 class Effect : public Form {
duke@435 461 private:
duke@435 462
duke@435 463 public:
duke@435 464 // Public Data
duke@435 465 const char *_name; // Pre-defined name for effect
duke@435 466 int _use_def; // Enumeration value of effect
duke@435 467
duke@435 468 // Public Methods
duke@435 469 Effect(const char *name); // Constructor
duke@435 470 ~Effect(); // Destructor
duke@435 471
duke@435 472 // Dynamic type check
duke@435 473 virtual Effect *is_effect() const;
duke@435 474
duke@435 475 // Return 'true' if this use def info equals the parameter
duke@435 476 bool is(int use_def_kill_enum) const;
duke@435 477 // Return 'true' if this use def info is a superset of parameter
duke@435 478 bool isa(int use_def_kill_enum) const;
duke@435 479
duke@435 480 void dump(); // Debug printer
duke@435 481 void output(FILE *fp); // Write info to output files
duke@435 482 };
duke@435 483
duke@435 484 //------------------------------ExpandRule-------------------------------------
duke@435 485 class ExpandRule : public Form {
duke@435 486 private:
duke@435 487 NameList _expand_instrs; // ordered list of instructions and operands
duke@435 488
duke@435 489 public:
duke@435 490 // Public Data
duke@435 491 NameList _newopers; // List of newly created operands
duke@435 492 Dict _newopconst; // Map new operands to their constructors
duke@435 493
duke@435 494 void add_instruction(NameAndList *instruction_name_and_operand_list);
duke@435 495 void reset_instructions();
duke@435 496 NameAndList *iter_instructions();
duke@435 497
duke@435 498 // Public Methods
duke@435 499 ExpandRule(); // Constructor
duke@435 500 ~ExpandRule(); // Destructor
duke@435 501
duke@435 502 void dump(); // Debug printer
duke@435 503 void output(FILE *fp); // Write info to output files
duke@435 504 };
duke@435 505
duke@435 506 //------------------------------RewriteRule------------------------------------
duke@435 507 class RewriteRule : public Form {
duke@435 508 private:
duke@435 509
duke@435 510 public:
duke@435 511 // Public Data
duke@435 512 SourceForm *_condition; // Rewrite condition code
duke@435 513 InstructForm *_instrs; // List of instructions to expand to
duke@435 514 OperandForm *_opers; // List of operands generated by expand
duke@435 515 char *_tempParams; // Hold string until parser is finished.
duke@435 516 char *_tempBlock; // Hold string until parser is finished.
duke@435 517
duke@435 518 // Public Methods
duke@435 519 RewriteRule(char* params, char* block) ;
duke@435 520 ~RewriteRule(); // Destructor
duke@435 521 void dump(); // Debug printer
duke@435 522 void output(FILE *fp); // Write info to output files
duke@435 523 };
duke@435 524
duke@435 525
duke@435 526 //==============================Operands=======================================
duke@435 527 //------------------------------OpClassForm------------------------------------
duke@435 528 class OpClassForm : public Form {
duke@435 529 public:
duke@435 530 // Public Data
duke@435 531 const char *_ident; // Name of this operand
duke@435 532 NameList _oplst; // List of operand forms included in class
duke@435 533
duke@435 534 // Public Methods
duke@435 535 OpClassForm(const char *id);
duke@435 536 ~OpClassForm();
duke@435 537
duke@435 538 // dynamic type check
duke@435 539 virtual OpClassForm *is_opclass() const;
duke@435 540 virtual Form::InterfaceType interface_type(FormDict &globals) const;
duke@435 541 virtual bool stack_slots_only(FormDict &globals) const;
duke@435 542
duke@435 543 virtual bool is_cisc_mem(FormDict &globals) const;
duke@435 544
duke@435 545
duke@435 546 // Min and Max opcodes of operands in this operand class
duke@435 547 int _minCode;
duke@435 548 int _maxCode;
duke@435 549
duke@435 550 virtual bool ideal_only() const;
duke@435 551 virtual void dump(); // Debug printer
duke@435 552 virtual void output(FILE *fp); // Write to output files
duke@435 553 };
duke@435 554
duke@435 555 //------------------------------OperandForm------------------------------------
duke@435 556 class OperandForm : public OpClassForm {
duke@435 557 private:
duke@435 558 bool _ideal_only; // Not a user-defined instruction
duke@435 559
duke@435 560 public:
duke@435 561 // Public Data
duke@435 562 NameList _parameters; // Locally defined names
duke@435 563 FormDict _localNames; // Table of components & their types
duke@435 564 MatchRule *_matrule; // Matching rule for this operand
duke@435 565 Interface *_interface; // Encoding interface for this operand
duke@435 566 Attribute *_attribs; // List of Attribute rules
duke@435 567 Predicate *_predicate; // Predicate test for this operand
duke@435 568 Constraint *_constraint; // Constraint Rule for this operand
duke@435 569 ConstructRule *_construct; // Construction of operand data after matching
duke@435 570 FormatRule *_format; // Format for assembly generation
duke@435 571 NameList _classes; // List of opclasses which contain this oper
duke@435 572
duke@435 573 ComponentList _components; //
duke@435 574
duke@435 575 // Public Methods
duke@435 576 OperandForm(const char *id);
duke@435 577 OperandForm(const char *id, bool ideal_only);
duke@435 578 ~OperandForm();
duke@435 579
duke@435 580 // Dynamic type check
duke@435 581 virtual OperandForm *is_operand() const;
duke@435 582
duke@435 583 virtual bool ideal_only() const;
duke@435 584 virtual Form::InterfaceType interface_type(FormDict &globals) const;
duke@435 585 virtual bool stack_slots_only(FormDict &globals) const;
duke@435 586
duke@435 587 virtual const char *cost(); // Access ins_cost attribute
duke@435 588 virtual uint num_leaves() const;// Leaves in complex operand
duke@435 589 // Constants in operands' match rules
duke@435 590 virtual uint num_consts(FormDict &globals) const;
duke@435 591 // Constants in operand's match rule with specified type
duke@435 592 virtual uint num_consts(FormDict &globals, Form::DataType type) const;
duke@435 593 // Pointer Constants in operands' match rules
duke@435 594 virtual uint num_const_ptrs(FormDict &globals) const;
duke@435 595 // The number of input edges in the machine world == num_leaves - num_consts
duke@435 596 virtual uint num_edges(FormDict &globals) const;
duke@435 597
duke@435 598 // Check if this operand is usable for cisc-spilling
duke@435 599 virtual bool is_cisc_reg(FormDict &globals) const;
duke@435 600
duke@435 601 // node matches ideal 'Bool', grab condition codes from the ideal world
duke@435 602 virtual bool is_ideal_bool() const;
duke@435 603
duke@435 604 // Has an integer constant suitable for spill offsets
duke@435 605 bool has_conI(FormDict &globals) const {
duke@435 606 return (num_consts(globals,idealI) == 1) && !is_ideal_bool(); }
duke@435 607 bool has_conL(FormDict &globals) const {
duke@435 608 return (num_consts(globals,idealL) == 1) && !is_ideal_bool(); }
duke@435 609
duke@435 610 // Node is user-defined operand for an sRegX
duke@435 611 virtual Form::DataType is_user_name_for_sReg() const;
duke@435 612
duke@435 613 // Return ideal type, if there is a single ideal type for this operand
duke@435 614 virtual const char *ideal_type(FormDict &globals, RegisterForm *registers = NULL) const;
duke@435 615 // If there is a single ideal type for this interface field, return it.
duke@435 616 virtual const char *interface_ideal_type(FormDict &globals,
duke@435 617 const char *field_name) const;
duke@435 618
duke@435 619 // Return true if this operand represents a bound register class
duke@435 620 bool is_bound_register() const;
duke@435 621
duke@435 622 // Return the Register class for this operand. Returns NULL if
duke@435 623 // operand isn't a register form.
duke@435 624 RegClass* get_RegClass() const;
duke@435 625
duke@435 626 virtual bool is_interface_field(const char *field_name,
duke@435 627 const char * &value) const;
duke@435 628
duke@435 629 // If this operand has a single ideal type, return its type
duke@435 630 virtual Form::DataType simple_type(FormDict &globals) const;
duke@435 631 // If this operand is an ideal constant, return its type
duke@435 632 virtual Form::DataType is_base_constant(FormDict &globals) const;
duke@435 633
duke@435 634 // "true" if this operand is a simple type that is swallowed
duke@435 635 virtual bool swallowed(FormDict &globals) const;
duke@435 636
duke@435 637 // Return register class name if a constraint specifies the register class.
duke@435 638 virtual const char *constrained_reg_class() const;
duke@435 639 // Return the register class associated with 'leaf'.
duke@435 640 virtual const char *in_reg_class(uint leaf, FormDict &globals);
duke@435 641
duke@435 642 // Build component list from MatchRule and operand's parameter list
duke@435 643 virtual void build_components(); // top-level operands
duke@435 644
duke@435 645 // Return zero-based position in component list; -1 if not in list.
duke@435 646 virtual int operand_position(const char *name, int usedef);
duke@435 647
duke@435 648 // Return zero-based position in component list; -1 if not in list.
duke@435 649 virtual int constant_position(FormDict &globals, const Component *comp);
duke@435 650 virtual int constant_position(FormDict &globals, const char *local_name);
duke@435 651 // Return the operand form corresponding to the given index, else NULL.
duke@435 652 virtual OperandForm *constant_operand(FormDict &globals, uint const_index);
duke@435 653
duke@435 654 // Return zero-based position in component list; -1 if not in list.
duke@435 655 virtual int register_position(FormDict &globals, const char *regname);
duke@435 656
duke@435 657 const char *reduce_result() const;
duke@435 658 // Return the name of the operand on the right hand side of the binary match
duke@435 659 // Return NULL if there is no right hand side
duke@435 660 const char *reduce_right(FormDict &globals) const;
duke@435 661 const char *reduce_left(FormDict &globals) const;
duke@435 662
duke@435 663
duke@435 664 // --------------------------- FILE *output_routines
duke@435 665 //
duke@435 666 // Output code for disp_is_oop, if true.
duke@435 667 void disp_is_oop(FILE *fp, FormDict &globals);
duke@435 668 // Generate code for internal and external format methods
duke@435 669 void int_format(FILE *fp, FormDict &globals, uint index);
duke@435 670 void ext_format(FILE *fp, FormDict &globals, uint index);
duke@435 671 void format_constant(FILE *fp, uint con_index, uint con_type);
duke@435 672 // Output code to access the value of the index'th constant
duke@435 673 void access_constant(FILE *fp, FormDict &globals,
duke@435 674 uint con_index);
duke@435 675 // ---------------------------
duke@435 676
duke@435 677
duke@435 678 virtual void dump(); // Debug printer
duke@435 679 virtual void output(FILE *fp); // Write to output files
duke@435 680 };
duke@435 681
duke@435 682 //------------------------------Constraint-------------------------------------
duke@435 683 class Constraint : public Form {
duke@435 684 private:
duke@435 685
duke@435 686 public:
duke@435 687 const char *_func; // Constraint function
duke@435 688 const char *_arg; // function's argument
duke@435 689
duke@435 690 // Public Methods
duke@435 691 Constraint(const char *func, const char *arg); // Constructor
duke@435 692 ~Constraint();
duke@435 693
duke@435 694 bool stack_slots_only() const;
duke@435 695
duke@435 696 void dump(); // Debug printer
duke@435 697 void output(FILE *fp); // Write info to output files
duke@435 698 };
duke@435 699
duke@435 700 //------------------------------Predicate--------------------------------------
duke@435 701 class Predicate : public Form {
duke@435 702 private:
duke@435 703
duke@435 704 public:
duke@435 705 // Public Data
duke@435 706 char *_pred; // C++ source string for predicate
duke@435 707
duke@435 708 // Public Methods
duke@435 709 Predicate(char *pr);
duke@435 710 ~Predicate();
duke@435 711
duke@435 712 void dump();
duke@435 713 void output(FILE *fp);
duke@435 714 };
duke@435 715
duke@435 716 //------------------------------Interface--------------------------------------
duke@435 717 class Interface : public Form {
duke@435 718 private:
duke@435 719
duke@435 720 public:
duke@435 721 // Public Data
duke@435 722 const char *_name; // String representing the interface name
duke@435 723
duke@435 724 // Public Methods
duke@435 725 Interface(const char *name);
duke@435 726 ~Interface();
duke@435 727
duke@435 728 virtual Form::InterfaceType interface_type(FormDict &globals) const;
duke@435 729
duke@435 730 RegInterface *is_RegInterface();
duke@435 731 MemInterface *is_MemInterface();
duke@435 732 ConstInterface *is_ConstInterface();
duke@435 733 CondInterface *is_CondInterface();
duke@435 734
duke@435 735
duke@435 736 void dump();
duke@435 737 void output(FILE *fp);
duke@435 738 };
duke@435 739
duke@435 740 //------------------------------RegInterface-----------------------------------
duke@435 741 class RegInterface : public Interface {
duke@435 742 private:
duke@435 743
duke@435 744 public:
duke@435 745 // Public Methods
duke@435 746 RegInterface();
duke@435 747 ~RegInterface();
duke@435 748
duke@435 749 void dump();
duke@435 750 void output(FILE *fp);
duke@435 751 };
duke@435 752
duke@435 753 //------------------------------ConstInterface---------------------------------
duke@435 754 class ConstInterface : public Interface {
duke@435 755 private:
duke@435 756
duke@435 757 public:
duke@435 758 // Public Methods
duke@435 759 ConstInterface();
duke@435 760 ~ConstInterface();
duke@435 761
duke@435 762 void dump();
duke@435 763 void output(FILE *fp);
duke@435 764 };
duke@435 765
duke@435 766 //------------------------------MemInterface-----------------------------------
duke@435 767 class MemInterface : public Interface {
duke@435 768 private:
duke@435 769
duke@435 770 public:
duke@435 771 // Public Data
duke@435 772 char *_base; // Base address
duke@435 773 char *_index; // index
duke@435 774 char *_scale; // scaling factor
duke@435 775 char *_disp; // displacement
duke@435 776
duke@435 777 // Public Methods
duke@435 778 MemInterface(char *base, char *index, char *scale, char *disp);
duke@435 779 ~MemInterface();
duke@435 780
duke@435 781 void dump();
duke@435 782 void output(FILE *fp);
duke@435 783 };
duke@435 784
duke@435 785 //------------------------------CondInterface----------------------------------
duke@435 786 class CondInterface : public Interface {
duke@435 787 private:
duke@435 788
duke@435 789 public:
duke@435 790 const char *_equal;
duke@435 791 const char *_not_equal;
duke@435 792 const char *_less;
duke@435 793 const char *_greater_equal;
duke@435 794 const char *_less_equal;
duke@435 795 const char *_greater;
never@850 796 const char *_equal_format;
never@850 797 const char *_not_equal_format;
never@850 798 const char *_less_format;
never@850 799 const char *_greater_equal_format;
never@850 800 const char *_less_equal_format;
never@850 801 const char *_greater_format;
duke@435 802
duke@435 803 // Public Methods
never@850 804 CondInterface(const char* equal, const char* equal_format,
never@850 805 const char* not_equal, const char* not_equal_format,
never@850 806 const char* less, const char* less_format,
never@850 807 const char* greater_equal, const char* greater_equal_format,
never@850 808 const char* less_equal, const char* less_equal_format,
never@850 809 const char* greater, const char* greater_format);
duke@435 810 ~CondInterface();
duke@435 811
duke@435 812 void dump();
duke@435 813 void output(FILE *fp);
duke@435 814 };
duke@435 815
duke@435 816 //------------------------------ConstructRule----------------------------------
duke@435 817 class ConstructRule : public Form {
duke@435 818 private:
duke@435 819
duke@435 820 public:
duke@435 821 // Public Data
duke@435 822 char *_expr; // String representing the match expression
duke@435 823 char *_construct; // String representing C++ constructor code
duke@435 824
duke@435 825 // Public Methods
duke@435 826 ConstructRule(char *cnstr);
duke@435 827 ~ConstructRule();
duke@435 828
duke@435 829 void dump();
duke@435 830 void output(FILE *fp);
duke@435 831 };
duke@435 832
duke@435 833
duke@435 834 //==============================Shared=========================================
duke@435 835 //------------------------------AttributeForm----------------------------------
duke@435 836 class AttributeForm : public Form {
duke@435 837 private:
duke@435 838 // counters for unique instruction or operand ID
duke@435 839 static int _insId; // user-defined machine instruction types
duke@435 840 static int _opId; // user-defined operand types
duke@435 841
duke@435 842 int id; // hold type for this object
duke@435 843
duke@435 844 public:
duke@435 845 // Public Data
duke@435 846 char *_attrname; // Name of attribute
duke@435 847 int _atype; // Either INS_ATTR or OP_ATTR
duke@435 848 char *_attrdef; // C++ source which evaluates to constant
duke@435 849
duke@435 850 // Public Methods
duke@435 851 AttributeForm(char *attr, int type, char *attrdef);
duke@435 852 ~AttributeForm();
duke@435 853
duke@435 854 // Dynamic type check
duke@435 855 virtual AttributeForm *is_attribute() const;
duke@435 856
duke@435 857 int type() { return id;} // return this object's "id"
duke@435 858
duke@435 859 static const char* _ins_cost; // "ins_cost"
duke@435 860 static const char* _op_cost; // "op_cost"
duke@435 861
duke@435 862 void dump(); // Debug printer
duke@435 863 void output(FILE *fp); // Write output files
duke@435 864 };
duke@435 865
duke@435 866 //------------------------------Component--------------------------------------
duke@435 867 class Component : public Form {
duke@435 868 private:
duke@435 869
duke@435 870 public:
duke@435 871 // Public Data
duke@435 872 const char *_name; // Name of this component
duke@435 873 const char *_type; // Type of this component
duke@435 874 int _usedef; // Value of component
duke@435 875
duke@435 876 // Public Methods
duke@435 877 Component(const char *name, const char *type, int usedef);
duke@435 878 ~Component();
duke@435 879
duke@435 880
duke@435 881 // Return 'true' if this use def info equals the parameter
duke@435 882 bool is(int use_def_kill_enum) const;
duke@435 883 // Return 'true' if this use def info is a superset of parameter
duke@435 884 bool isa(int use_def_kill_enum) const;
duke@435 885 int promote_use_def_info(int new_use_def);
duke@435 886 const char *base_type(FormDict &globals);
duke@435 887 // Form::DataType is_base_constant(FormDict &globals);
duke@435 888
duke@435 889 void dump(); // Debug printer
duke@435 890 void output(FILE *fp); // Write to output files
duke@435 891
duke@435 892 public:
duke@435 893 // Implementation depends upon working bit intersection and union.
duke@435 894 enum use_def_enum {
duke@435 895 INVALID = 0x0,
duke@435 896 USE = 0x1,
duke@435 897 DEF = 0x2, USE_DEF = 0x3,
duke@435 898 KILL = 0x4, USE_KILL = 0x5,
duke@435 899 SYNTHETIC = 0x8,
roland@3316 900 TEMP = USE | SYNTHETIC,
roland@3316 901 CALL = 0x10
duke@435 902 };
duke@435 903 };
duke@435 904
duke@435 905
duke@435 906 //------------------------------MatchNode--------------------------------------
duke@435 907 class MatchNode : public Form {
duke@435 908 private:
duke@435 909
duke@435 910 public:
duke@435 911 // Public Data
duke@435 912 const char *_result; // The name of the output of this node
duke@435 913 const char *_name; // The name that appeared in the match rule
duke@435 914 const char *_opType; // The Operation/Type matched
duke@435 915 MatchNode *_lChild; // Left child in expression tree
duke@435 916 MatchNode *_rChild; // Right child in expression tree
duke@435 917 int _numleaves; // Sum of numleaves for all direct children
duke@435 918 ArchDesc &_AD; // Reference to ArchDesc object
duke@435 919 char *_internalop; // String representing internal operand
duke@435 920 int _commutative_id; // id of commutative operation
duke@435 921
duke@435 922 // Public Methods
duke@435 923 MatchNode(ArchDesc &ad, const char *result = 0, const char *expr = 0,
duke@435 924 const char *opType=0, MatchNode *lChild=NULL,
duke@435 925 MatchNode *rChild=NULL);
duke@435 926 MatchNode(ArchDesc &ad, MatchNode& mNode); // Shallow copy constructor;
duke@435 927 MatchNode(ArchDesc &ad, MatchNode& mNode, int clone); // Construct clone
duke@435 928 ~MatchNode();
duke@435 929
duke@435 930 // return 0 if not found:
duke@435 931 // return 1 if found and position is incremented by operand offset in rule
duke@435 932 bool find_name(const char *str, int &position) const;
duke@435 933 bool find_type(const char *str, int &position) const;
twisti@1038 934 virtual void append_components(FormDict& locals, ComponentList& components,
twisti@1038 935 bool def_flag = false) const;
duke@435 936 bool base_operand(uint &position, FormDict &globals,
duke@435 937 const char * &result, const char * &name,
duke@435 938 const char * &opType) const;
duke@435 939 // recursive count on operands
duke@435 940 uint num_consts(FormDict &globals) const;
duke@435 941 uint num_const_ptrs(FormDict &globals) const;
duke@435 942 // recursive count of constants with specified type
duke@435 943 uint num_consts(FormDict &globals, Form::DataType type) const;
duke@435 944 // uint num_consts() const; // Local inspection only
duke@435 945 int needs_ideal_memory_edge(FormDict &globals) const;
duke@435 946 int needs_base_oop_edge() const;
duke@435 947
duke@435 948 // Help build instruction predicates. Search for operand names.
duke@435 949 void count_instr_names( Dict &names );
duke@435 950 int build_instr_pred( char *buf, const char *name, int cnt );
duke@435 951 void build_internalop( );
duke@435 952
duke@435 953 // Return the name of the operands associated with reducing to this operand:
duke@435 954 // The result type, plus the left and right sides of the binary match
duke@435 955 // Return NULL if there is no left or right hand side
duke@435 956 bool sets_result() const; // rule "Set"s result of match
duke@435 957 const char *reduce_right(FormDict &globals) const;
duke@435 958 const char *reduce_left (FormDict &globals) const;
duke@435 959
duke@435 960 // Recursive version of check in MatchRule
twisti@1038 961 int cisc_spill_match(FormDict& globals, RegisterForm* registers,
twisti@1038 962 MatchNode* mRule2, const char* &operand,
twisti@1038 963 const char* &reg_type);
duke@435 964 int cisc_spill_merge(int left_result, int right_result);
duke@435 965
twisti@1038 966 virtual bool equivalent(FormDict& globals, MatchNode* mNode2);
duke@435 967
duke@435 968 void count_commutative_op(int& count);
duke@435 969 void swap_commutative_op(bool atroot, int count);
duke@435 970
duke@435 971 void dump();
duke@435 972 void output(FILE *fp);
duke@435 973 };
duke@435 974
duke@435 975 //------------------------------MatchRule--------------------------------------
duke@435 976 class MatchRule : public MatchNode {
duke@435 977 private:
duke@435 978
duke@435 979 public:
duke@435 980 // Public Data
duke@435 981 const char *_machType; // Machine type index
duke@435 982 int _depth; // Expression tree depth
duke@435 983 char *_construct; // String representing C++ constructor code
duke@435 984 int _numchilds; // Number of direct children
duke@435 985 MatchRule *_next; // Pointer to next match rule
duke@435 986
duke@435 987 // Public Methods
duke@435 988 MatchRule(ArchDesc &ad);
duke@435 989 MatchRule(ArchDesc &ad, MatchRule* mRule); // Shallow copy constructor;
duke@435 990 MatchRule(ArchDesc &ad, MatchNode* mroot, int depth, char* construct, int numleaves);
duke@435 991 ~MatchRule();
duke@435 992
twisti@1038 993 virtual void append_components(FormDict& locals, ComponentList& components, bool def_flag = false) const;
duke@435 994 // Recursive call on all operands' match rules in my match rule.
duke@435 995 bool base_operand(uint &position, FormDict &globals,
duke@435 996 const char * &result, const char * &name,
duke@435 997 const char * &opType) const;
duke@435 998
duke@435 999
duke@435 1000 bool is_base_register(FormDict &globals) const;
duke@435 1001 Form::DataType is_base_constant(FormDict &globals) const;
duke@435 1002 bool is_chain_rule(FormDict &globals) const;
duke@435 1003 int is_ideal_copy() const;
duke@435 1004 int is_expensive() const; // node matches ideal 'CosD'
duke@435 1005 bool is_ideal_if() const; // node matches ideal 'If'
duke@435 1006 bool is_ideal_fastlock() const; // node matches ideal 'FastLock'
duke@435 1007 bool is_ideal_jump() const; // node matches ideal 'Jump'
duke@435 1008 bool is_ideal_membar() const; // node matches ideal 'MemBarXXX'
duke@435 1009 bool is_ideal_loadPC() const; // node matches ideal 'LoadPC'
duke@435 1010 bool is_ideal_box() const; // node matches ideal 'Box'
duke@435 1011 bool is_ideal_goto() const; // node matches ideal 'Goto'
duke@435 1012 bool is_ideal_loopEnd() const; // node matches ideal 'LoopEnd'
duke@435 1013 bool is_ideal_bool() const; // node matches ideal 'Bool'
duke@435 1014 Form::DataType is_ideal_load() const;// node matches ideal 'LoadXNode'
never@1290 1015 // Should antidep checks be disabled for this rule
never@1290 1016 // See definition of MatchRule::skip_antidep_check
never@1290 1017 bool skip_antidep_check() const;
duke@435 1018 Form::DataType is_ideal_store() const;// node matches ideal 'StoreXNode'
duke@435 1019
duke@435 1020 // Check if 'mRule2' is a cisc-spill variant of this MatchRule
twisti@1038 1021 int matchrule_cisc_spill_match(FormDict &globals, RegisterForm* registers,
twisti@1038 1022 MatchRule* mRule2, const char* &operand,
twisti@1038 1023 const char* &reg_type);
duke@435 1024
duke@435 1025 // Check if 'mRule2' is equivalent to this MatchRule
twisti@1038 1026 virtual bool equivalent(FormDict& globals, MatchNode* mRule2);
duke@435 1027
twisti@1038 1028 void matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt);
duke@435 1029
duke@435 1030 void dump();
duke@435 1031 void output(FILE *fp);
duke@435 1032 };
duke@435 1033
duke@435 1034 //------------------------------Attribute--------------------------------------
duke@435 1035 class Attribute : public Form {
duke@435 1036 private:
duke@435 1037
duke@435 1038 public:
duke@435 1039 // Public Data
duke@435 1040 char *_ident; // Name of predefined attribute
duke@435 1041 char *_val; // C++ source which evaluates to constant
duke@435 1042 int _atype; // Either INS_ATTR or OP_ATTR
duke@435 1043 int int_val(ArchDesc &ad); // Return atoi(_val), ensuring syntax.
duke@435 1044
duke@435 1045 // Public Methods
duke@435 1046 Attribute(char *id, char* val, int type);
duke@435 1047 ~Attribute();
duke@435 1048
duke@435 1049 void dump();
duke@435 1050 void output(FILE *fp);
duke@435 1051 };
duke@435 1052
duke@435 1053 //------------------------------FormatRule-------------------------------------
duke@435 1054 class FormatRule : public Form {
duke@435 1055 private:
duke@435 1056
duke@435 1057 public:
duke@435 1058 // Public Data
duke@435 1059 // There is an entry in _strings, perhaps NULL, that precedes each _rep_vars
duke@435 1060 NameList _strings; // Strings passed through to tty->print
duke@435 1061 NameList _rep_vars; // replacement variables
duke@435 1062 char *_temp; // String representing the assembly code
duke@435 1063
duke@435 1064 // Public Methods
duke@435 1065 FormatRule(char *temp);
duke@435 1066 ~FormatRule();
duke@435 1067
duke@435 1068 void dump();
duke@435 1069 void output(FILE *fp);
duke@435 1070 };
stefank@2314 1071
stefank@2314 1072 #endif // SHARE_VM_ADLC_FORMSSEL_HPP

mercurial