src/share/vm/adlc/formssel.hpp

Fri, 15 Jun 2012 01:25:19 -0700

author
kvn
date
Fri, 15 Jun 2012 01:25:19 -0700
changeset 3882
8c92982cbbc4
parent 3316
f03a3c8bd5e5
child 4161
d336b3173277
permissions
-rw-r--r--

7119644: Increase superword's vector size up to 256 bits
Summary: Increase vector size up to 256-bits for YMM AVX registers on x86.
Reviewed-by: never, twisti, roland

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

mercurial