src/share/vm/adlc/formssel.hpp

Tue, 24 Dec 2013 11:48:39 -0800

author
mikael
date
Tue, 24 Dec 2013 11:48:39 -0800
changeset 6198
55fb97c4c58d
parent 5791
c9ccd7b85f20
child 6503
a9becfeecd1b
permissions
-rw-r--r--

8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
Summary: Copyright year updated for files modified during 2013
Reviewed-by: twisti, iveresov

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

mercurial