src/hotspot/share/adlc/formsopt.cpp
author jbhateja
Tue, 26 Nov 2019 16:09:25 +0300
changeset 59278 8375560db76b
parent 47216 71c04702a3d5
permissions -rw-r--r--
8234394: C2: Dynamic register class support in ADLC Reviewed-by: vlivanov, sviswanathan, thartmann, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
     2
 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2129
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2129
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2129
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
// FORMS.CPP - Definitions for ADL Parser Forms Classes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
#include "adlc.hpp"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
//==============================Register Allocation============================
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
int RegisterForm::_reg_ctr = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
//------------------------------RegisterForm-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// Constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
RegisterForm::RegisterForm()
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  : _regDef(cmpstr,hashstr, Form::arena),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
    _regClass(cmpstr,hashstr, Form::arena),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
    _allocClass(cmpstr,hashstr, Form::arena) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
RegisterForm::~RegisterForm() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// record a new register definition
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
void RegisterForm::addRegDef(char *name, char *callingConv, char *c_conv,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
                             char *idealtype, char *encoding, char* concrete) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  RegDef *regDef = new RegDef(name, callingConv, c_conv, idealtype, encoding, concrete);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  _rdefs.addName(name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  _regDef.Insert(name,regDef);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// record a new register class
30202
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    50
template <typename T>
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    51
T* RegisterForm::addRegClass(const char* className) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    52
  T* regClass = new T(className);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  _rclasses.addName(className);
30202
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    54
  _regClass.Insert(className, regClass);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  return regClass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
30202
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    58
// Explicit instantiation for all supported register classes.
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    59
template RegClass* RegisterForm::addRegClass<RegClass>(const char* className);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    60
template CodeSnippetRegClass* RegisterForm::addRegClass<CodeSnippetRegClass>(const char* className);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    61
template ConditionalRegClass* RegisterForm::addRegClass<ConditionalRegClass>(const char* className);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    62
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// record a new register class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
AllocClass *RegisterForm::addAllocClass(char *className) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  AllocClass *allocClass = new AllocClass(className);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  _aclasses.addName(className);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  _allocClass.Insert(className,allocClass);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  return allocClass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
// Called after parsing the Register block.  Record the register class
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
// for spill-slots/regs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
void RegisterForm::addSpillRegClass() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Stack slots start at the next available even register number.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
    75
  _reg_ctr = (_reg_ctr+7) & ~7;
30202
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    76
  const char *rc_name = "stack_slots";
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    77
  RegClass* reg_class = new RegClass(rc_name);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
    78
  reg_class->set_stack_version(true);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  _rclasses.addName(rc_name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  _regClass.Insert(rc_name,reg_class);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
59278
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    83
// Called after parsing the Register block.  Record the register class
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    84
// for operands which are overwritten after matching.
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    85
void RegisterForm::addDynamicRegClass() {
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    86
  const char *rc_name = "dynamic";
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    87
  RegClass* reg_class = new RegClass(rc_name);
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    88
  reg_class->set_stack_version(false);
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    89
  _rclasses.addName(rc_name);
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    90
  _regClass.Insert(rc_name,reg_class);
8375560db76b 8234394: C2: Dynamic register class support in ADLC
jbhateja
parents: 47216
diff changeset
    91
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
// Provide iteration over all register definitions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
// in the order used by the register allocator
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
void        RegisterForm::reset_RegDefs() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  _current_ac = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  _aclasses.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
RegDef     *RegisterForm::iter_RegDefs() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // Check if we need to get the next AllocClass
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  if ( _current_ac == NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    const char *ac_name = _aclasses.iter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    if( ac_name == NULL )   return NULL;   // No more allocation classes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    _current_ac = (AllocClass*)_allocClass[ac_name];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    _current_ac->_regDefs.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    assert( _current_ac != NULL, "Name must match an allocation class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  const char *rd_name = _current_ac->_regDefs.iter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  if( rd_name == NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    // At end of this allocation class, check the next
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    _current_ac = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    return iter_RegDefs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  RegDef *reg_def = (RegDef*)_current_ac->_regDef[rd_name];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  assert( reg_def != NULL, "Name must match a register definition");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  return reg_def;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
// return the register definition with name 'regName'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
RegDef *RegisterForm::getRegDef(const char *regName) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  RegDef *regDef = (RegDef*)_regDef[regName];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  return  regDef;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
// return the register class with name 'className'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
RegClass *RegisterForm::getRegClass(const char *className) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  RegClass *regClass = (RegClass*)_regClass[className];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  return    regClass;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
// Check that register classes are compatible with chunks
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
bool   RegisterForm::verify() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  bool valid = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  // Verify Register Classes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // check that each register class contains registers from one chunk
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  const char *rc_name = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  _rclasses.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  while ( (rc_name = _rclasses.iter()) != NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    // Check the chunk value for all registers in this class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    RegClass *reg_class = getRegClass(rc_name);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    assert( reg_class != NULL, "InternalError() no matching register class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  } // end of RegClasses
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  // Verify that every register has been placed into an allocation class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  RegDef *reg_def = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  reset_RegDefs();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  uint  num_register_zero = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  while ( (reg_def = iter_RegDefs()) != NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    if( reg_def->register_num() == 0 )  ++num_register_zero;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  if( num_register_zero > 1 ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    fprintf(stderr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
            "ERROR: More than one register has been assigned register-number 0.\n"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
            "Probably because a register has not been entered into an allocation class.\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  return  valid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
// Compute RegMask size
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
int RegisterForm::RegMask_Size() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  // Need at least this many words
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  int words_for_regs = (_reg_ctr + 31)>>5;
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   168
  // The array of Register Mask bits should be large enough to cover
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   169
  // all the machine registers and all parameters that need to be passed
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   170
  // on the stack (stack registers) up to some interesting limit.  Methods
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   171
  // that need more parameters will NOT be compiled.  On Intel, the limit
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   172
  // is something like 90+ parameters.
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   173
  // Add a few (3 words == 96 bits) for incoming & outgoing arguments to calls.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // Round up to the next doubleword size.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11197
diff changeset
   175
  return (words_for_regs + 3 + 1) & ~1;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
void RegisterForm::dump() {                  // Debug printer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
void RegisterForm::output(FILE *fp) {          // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  const char *name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  fprintf(fp,"-------------------- Dump RegisterForm --------------------\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  for(_rdefs.reset(); (name = _rdefs.iter()) != NULL;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    ((RegDef*)_regDef[name])->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  for (_rclasses.reset(); (name = _rclasses.iter()) != NULL;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    ((RegClass*)_regClass[name])->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  for (_aclasses.reset(); (name = _aclasses.iter()) != NULL;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    ((AllocClass*)_allocClass[name])->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  fprintf(fp,"-------------------- end  RegisterForm --------------------\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
//------------------------------RegDef-----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
// Constructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
RegDef::RegDef(char *regname, char *callconv, char *c_conv, char * idealtype, char * encode, char * concrete)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  : _regname(regname), _callconv(callconv), _c_conv(c_conv),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    _idealtype(idealtype),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
    _register_encode(encode),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
    _concrete(concrete),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
    _register_num(0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  // Chunk and register mask are determined by the register number
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  // _register_num is set when registers are added to an allocation class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
RegDef::~RegDef() {                      // Destructor
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
void RegDef::set_register_num(uint32 register_num) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  _register_num      = register_num;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
// Bit pattern used for generating machine code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
const char* RegDef::register_encode() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  return _register_encode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
// Register number used in machine-independent code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
uint32 RegDef::register_num()    const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  return _register_num;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
void RegDef::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
void RegDef::output(FILE *fp) {         // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  fprintf(fp,"RegDef: %s (%s) encode as %s  using number %d\n",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
          _regname, (_callconv?_callconv:""), _register_encode, _register_num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
//------------------------------RegClass---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
// Construct a register class into which registers will be inserted
30202
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   242
RegClass::RegClass(const char* classid) : _stack_or_reg(false), _classid(classid), _regDef(cmpstr, hashstr, Form::arena) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   243
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   244
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   245
RegClass::~RegClass() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
// record a register in this class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
void RegClass::addReg(RegDef *regDef) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  _regDefs.addName(regDef->_regname);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  _regDef.Insert((void*)regDef->_regname, regDef);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
// Number of registers in class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
uint RegClass::size() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  return _regDef.Size();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
const RegDef *RegClass::get_RegDef(const char *rd_name) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  return  (const RegDef*)_regDef[rd_name];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
void RegClass::reset() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  _regDefs.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
const char *RegClass::rd_name_iter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  return _regDefs.iter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
RegDef *RegClass::RegDef_iter() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  const char *rd_name  = rd_name_iter();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  RegDef     *reg_def  = rd_name ? (RegDef*)_regDef[rd_name] : NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  return      reg_def;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
const RegDef* RegClass::find_first_elem() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  const RegDef* first = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  const RegDef* def = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  while ((def = RegDef_iter()) != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
    if (first == NULL || def->register_num() < first->register_num()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
      first = def;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  assert(first != NULL, "empty mask?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  return first;;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
// Collect all the registers in this register-word.  One bit per register.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
int RegClass::regs_in_word( int wordnum, bool stack_also ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  int         word = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  const char *name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
    int rnum = ((RegDef*)_regDef[name])->register_num();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    if( (rnum >> 5) == wordnum )
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   299
      word |= (1 << (rnum & 31));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  if( stack_also ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
    // Now also collect stack bits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
    for( int i = 0; i < 32; i++ )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
      if( wordnum*32+i >= RegisterForm::_reg_ctr )
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   305
        word |= (1 << i);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  return word;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
void RegClass::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
void RegClass::output(FILE *fp) {           // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  fprintf(fp,"RegClass: %s\n",_classid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  const char *name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
    ((RegDef*)_regDef[name])->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  fprintf(fp,"--- done with entries for reg_class %s\n\n",_classid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
30202
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   324
void RegClass::declare_register_masks(FILE* fp) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   325
  const char* prefix = "";
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   326
  const char* rc_name_to_upper = toUpper(_classid);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   327
  fprintf(fp, "extern const RegMask _%s%s_mask;\n", prefix,  rc_name_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   328
  fprintf(fp, "inline const RegMask &%s%s_mask() { return _%s%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   329
  if (_stack_or_reg) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   330
    fprintf(fp, "extern const RegMask _%sSTACK_OR_%s_mask;\n", prefix, rc_name_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   331
    fprintf(fp, "inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   332
  }
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   333
  delete[] rc_name_to_upper;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   334
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   335
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   336
void RegClass::build_register_masks(FILE* fp) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   337
  int len = RegisterForm::RegMask_Size();
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   338
  const char *prefix = "";
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   339
  const char* rc_name_to_upper = toUpper(_classid);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   340
  fprintf(fp, "const RegMask _%s%s_mask(", prefix, rc_name_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   341
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   342
  int i;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   343
  for(i = 0; i < len - 1; i++) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   344
    fprintf(fp," 0x%x,", regs_in_word(i, false));
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   345
  }
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   346
  fprintf(fp," 0x%x );\n", regs_in_word(i, false));
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   347
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   348
  if (_stack_or_reg) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   349
    fprintf(fp, "const RegMask _%sSTACK_OR_%s_mask(", prefix, rc_name_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   350
    for(i = 0; i < len - 1; i++) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   351
      fprintf(fp," 0x%x,", regs_in_word(i, true));
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   352
    }
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   353
    fprintf(fp," 0x%x );\n", regs_in_word(i, true));
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   354
  }
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   355
  delete[] rc_name_to_upper;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   356
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   357
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   358
//------------------------------CodeSnippetRegClass---------------------------
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   359
CodeSnippetRegClass::CodeSnippetRegClass(const char* classid) : RegClass(classid), _code_snippet(NULL) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   360
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   361
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   362
CodeSnippetRegClass::~CodeSnippetRegClass() {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   363
  delete _code_snippet;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   364
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   365
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   366
void CodeSnippetRegClass::declare_register_masks(FILE* fp) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   367
  const char* prefix = "";
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   368
  const char* rc_name_to_upper = toUpper(_classid);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   369
  fprintf(fp, "inline const RegMask &%s%s_mask() { %s }\n", prefix, rc_name_to_upper, _code_snippet);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   370
  delete[] rc_name_to_upper;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   371
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   372
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   373
//------------------------------ConditionalRegClass---------------------------
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   374
ConditionalRegClass::ConditionalRegClass(const char *classid) : RegClass(classid), _condition_code(NULL) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   375
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   376
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   377
ConditionalRegClass::~ConditionalRegClass() {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   378
  delete _condition_code;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   379
}
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   380
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   381
void ConditionalRegClass::declare_register_masks(FILE* fp) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   382
  const char* prefix = "";
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   383
  const char* rc_name_to_upper = toUpper(_classid);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   384
  const char* rclass_0_to_upper = toUpper(_rclasses[0]->_classid);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   385
  const char* rclass_1_to_upper = toUpper(_rclasses[1]->_classid);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   386
  fprintf(fp, "inline const RegMask &%s%s_mask() {"
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   387
              " return (%s) ?"
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   388
              " %s%s_mask() :"
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   389
              " %s%s_mask(); }\n",
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   390
              prefix, rc_name_to_upper,
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   391
              _condition_code,
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   392
              prefix, rclass_0_to_upper,
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   393
              prefix, rclass_1_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   394
  if (_stack_or_reg) {
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   395
    fprintf(fp, "inline const RegMask &%sSTACK_OR_%s_mask() {"
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   396
                  " return (%s) ?"
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   397
                  " %sSTACK_OR_%s_mask() :"
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   398
                  " %sSTACK_OR_%s_mask(); }\n",
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   399
                  prefix, rc_name_to_upper,
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   400
                  _condition_code,
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   401
                  prefix, rclass_0_to_upper,
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   402
                  prefix, rclass_1_to_upper);
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   403
  }
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   404
  delete[] rc_name_to_upper;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   405
  delete[] rclass_0_to_upper;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   406
  delete[] rclass_1_to_upper;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   407
  return;
6f5c48bd9b82 8075798: Allow ADLC register class to depend on runtime conditions also for cisc-spillable classes
zmajo
parents: 13104
diff changeset
   408
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
//------------------------------AllocClass-------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
AllocClass::AllocClass(char *classid) : _classid(classid), _regDef(cmpstr,hashstr, Form::arena) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
// record a register in this class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
void AllocClass::addReg(RegDef *regDef) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
  assert( regDef != NULL, "Can not add a NULL to an allocation class");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
  regDef->set_register_num( RegisterForm::_reg_ctr++ );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  // Add regDef to this allocation class
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  _regDefs.addName(regDef->_regname);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
  _regDef.Insert((void*)regDef->_regname, regDef);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
void AllocClass::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
void AllocClass::output(FILE *fp) {       // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  fprintf(fp,"AllocClass: %s \n",_classid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
  const char *name;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
  for(_regDefs.reset(); (name = _regDefs.iter()) != NULL;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
    ((RegDef*)_regDef[name])->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  fprintf(fp,"--- done with entries for alloc_class %s\n\n",_classid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
//==============================Frame Handling=================================
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
//------------------------------FrameForm--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
FrameForm::FrameForm() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  _frame_pointer = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
  _c_frame_pointer = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  _alignment = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  _return_addr = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  _c_return_addr = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
  _in_preserve_slots = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
  _varargs_C_out_slots_killed = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
  _calling_convention = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
  _c_calling_convention = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
  _return_value = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
  _c_return_value = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  _interpreter_frame_pointer_reg = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
FrameForm::~FrameForm() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
void FrameForm::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
void FrameForm::output(FILE *fp) {           // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
  fprintf(fp,"\nFrame:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
//==============================Scheduling=====================================
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
//------------------------------PipelineForm-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
PipelineForm::PipelineForm()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  :  _reslist               ()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
  ,  _resdict               (cmpstr, hashstr, Form::arena)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
  ,  _classdict             (cmpstr, hashstr, Form::arena)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  ,  _rescount              (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  ,  _maxcycleused          (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  ,  _stages                ()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
  ,  _stagecnt              (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
  ,  _classlist             ()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  ,  _classcnt              (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
  ,  _noplist               ()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
  ,  _nopcnt                (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  ,  _variableSizeInstrs    (false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  ,  _branchHasDelaySlot    (false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  ,  _maxInstrsPerBundle    (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  ,  _maxBundlesPerCycle    (1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  ,  _instrUnitSize         (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
  ,  _bundleUnitSize        (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  ,  _instrFetchUnitSize    (0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
  ,  _instrFetchUnits       (0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
PipelineForm::~PipelineForm() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
void PipelineForm::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
void PipelineForm::output(FILE *fp) {           // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  const char *res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
  const char *stage;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  const char *cls;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
  const char *nop;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  int count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  fprintf(fp,"\nPipeline:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  if (_variableSizeInstrs)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
    if (_instrUnitSize > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
      fprintf(fp," variable-sized instructions in %d byte units", _instrUnitSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
    else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
      fprintf(fp," variable-sized instructions");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
    if (_instrUnitSize > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
      fprintf(fp," fixed-sized instructions of %d bytes", _instrUnitSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
    else if (_bundleUnitSize > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
      fprintf(fp," fixed-sized bundles of %d bytes", _bundleUnitSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
    else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
      fprintf(fp," fixed-sized instructions");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
  if (_branchHasDelaySlot)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
    fprintf(fp,", branch has delay slot");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  if (_maxInstrsPerBundle > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
    fprintf(fp,", max of %d instruction%s in parallel",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
      _maxInstrsPerBundle, _maxInstrsPerBundle > 1 ? "s" : "");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
  if (_maxBundlesPerCycle > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
    fprintf(fp,", max of %d bundle%s in parallel",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
      _maxBundlesPerCycle, _maxBundlesPerCycle > 1 ? "s" : "");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
  if (_instrFetchUnitSize > 0 && _instrFetchUnits)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
    fprintf(fp, ", fetch %d x % d bytes per cycle", _instrFetchUnits, _instrFetchUnitSize);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
  fprintf(fp,"\nResource:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  for ( _reslist.reset(); (res = _reslist.iter()) != NULL; )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
    fprintf(fp," %s(0x%08x)", res, _resdict[res]->is_resource()->mask());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
  fprintf(fp,"\nDescription:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
  for ( _stages.reset(); (stage = _stages.iter()) != NULL; )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
    fprintf(fp," %s(%d)", stage, count++);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
  fprintf(fp,"\nClasses:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
  for ( _classlist.reset(); (cls = _classlist.iter()) != NULL; )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    _classdict[cls]->is_pipeclass()->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  fprintf(fp,"\nNop Instructions:");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
  for ( _noplist.reset(); (nop = _noplist.iter()) != NULL; )
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
    fprintf(fp, " \"%s\"", nop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
  fprintf(fp,"\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
//------------------------------ResourceForm-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
ResourceForm::ResourceForm(unsigned resmask)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
: _resmask(resmask) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
ResourceForm::~ResourceForm() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
ResourceForm  *ResourceForm::is_resource() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
  return (ResourceForm *)(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
void ResourceForm::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
void ResourceForm::output(FILE *fp) {          // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
  fprintf(fp, "resource: 0x%08x;\n", mask());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
//------------------------------PipeClassOperandForm----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
void PipeClassOperandForm::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
void PipeClassOperandForm::output(FILE *fp) {         // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
  fprintf(stderr,"PipeClassOperandForm: %s", _stage);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  fflush(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
  if (_more_instrs > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
    fprintf(stderr,"+%d", _more_instrs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
  fprintf(stderr," (%s)\n", _iswrite ? "write" : "read");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
  fflush(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
  fprintf(fp,"PipeClassOperandForm: %s", _stage);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
  if (_more_instrs > 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
    fprintf(fp,"+%d", _more_instrs);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
  fprintf(fp," (%s)\n", _iswrite ? "write" : "read");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
//------------------------------PipeClassResourceForm----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
void PipeClassResourceForm::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
void PipeClassResourceForm::output(FILE *fp) {         // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  fprintf(fp,"PipeClassResourceForm: %s at stage %s for %d cycles\n",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
     _resource, _stage, _cycles);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   595
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
489c9b5090e2 Initial load
duke
parents:
diff changeset
   598
//------------------------------PipeClassForm----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   599
PipeClassForm::PipeClassForm(const char *id, int num)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
  : _ident(id)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
  , _num(num)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
  , _localNames(cmpstr, hashstr, Form::arena)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
  , _localUsage(cmpstr, hashstr, Form::arena)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
  , _has_fixed_latency(0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   605
  , _fixed_latency(0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   606
  , _instruction_count(0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   607
  , _has_multiple_bundles(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   608
  , _has_branch_delay_slot(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   609
  , _force_serialization(false)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   610
  , _may_have_no_code(false) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   611
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   612
489c9b5090e2 Initial load
duke
parents:
diff changeset
   613
PipeClassForm::~PipeClassForm() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
PipeClassForm  *PipeClassForm::is_pipeclass() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  return (PipeClassForm *)(this);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
void PipeClassForm::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
void PipeClassForm::output(FILE *fp) {         // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
  fprintf(fp,"PipeClassForm: #%03d", _num);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
  if (_ident)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
     fprintf(fp," \"%s\":", _ident);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
  if (_has_fixed_latency)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
     fprintf(fp," latency %d", _fixed_latency);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
  if (_force_serialization)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
     fprintf(fp, ", force serialization");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
  if (_may_have_no_code)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
     fprintf(fp, ", may have no code");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
  fprintf(fp, ", %d instruction%s\n", InstructionCount(), InstructionCount() != 1 ? "s" : "");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
//==============================Peephole Optimization==========================
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
int Peephole::_peephole_counter = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
//------------------------------Peephole---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
Peephole::Peephole() : _match(NULL), _constraint(NULL), _replace(NULL), _next(NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
  _peephole_number = _peephole_counter++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
Peephole::~Peephole() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
// Append a peephole rule with the same root instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
void Peephole::append_peephole(Peephole *next_peephole) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
  if( _next == NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
    _next = next_peephole;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
    _next->append_peephole( next_peephole );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
// Store the components of this peephole rule
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
void Peephole::add_match(PeepMatch *match) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
  assert( _match == NULL, "fatal()" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
  _match = match;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
void Peephole::append_constraint(PeepConstraint *next_constraint) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
  if( _constraint == NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
    _constraint = next_constraint;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
    _constraint->append( next_constraint );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
void Peephole::add_replace(PeepReplace *replace) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
  assert( _replace == NULL, "fatal()" );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
  _replace = replace;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
// class Peephole accessor methods are in the declaration.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
void Peephole::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
void Peephole::output(FILE *fp) {         // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
  fprintf(fp,"Peephole:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
  if( _match != NULL )       _match->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
  if( _constraint != NULL )  _constraint->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
  if( _replace != NULL )     _replace->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
  // Output the next entry
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
  if( _next ) _next->output(fp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
//------------------------------PeepMatch--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
PeepMatch::PeepMatch(char *rule) : _max_position(0), _rule(rule) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
PeepMatch::~PeepMatch() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
// Insert info into the match-rule
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
void  PeepMatch::add_instruction(int parent, int position, const char *name,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
                                 int input) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
  if( position > _max_position ) _max_position = position;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   703
  _parent.addName((char*) (intptr_t) parent);
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   704
  _position.addName((char*) (intptr_t) position);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
  _instrs.addName(name);
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   706
  _input.addName((char*) (intptr_t) input);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
// Access info about instructions in the peep-match rule
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
int   PeepMatch::max_position() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
  return _max_position;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   714
const char *PeepMatch::instruction_name(int position) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
  return _instrs.name(position);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
// Iterate through all info on matched instructions
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
void  PeepMatch::reset() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
  _parent.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
  _position.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
  _instrs.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
  _input.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   726
void  PeepMatch::next_instruction(int &parent, int &position, const char* &name, int &input) {
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   727
  parent   = (int) (intptr_t) _parent.iter();
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   728
  position = (int) (intptr_t) _position.iter();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
  name     = _instrs.iter();
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   730
  input    = (int) (intptr_t) _input.iter();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
// 'true' if current position in iteration is a placeholder, not matched.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
bool  PeepMatch::is_placeholder() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
  return _instrs.current_is_signal();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
void PeepMatch::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
void PeepMatch::output(FILE *fp) {        // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
  fprintf(fp,"PeepMatch:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
//------------------------------PeepConstraint---------------------------------
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   748
PeepConstraint::PeepConstraint(int left_inst,  char* left_op, char* relation,
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   749
                               int right_inst, char* right_op)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
  : _left_inst(left_inst), _left_op(left_op), _relation(relation),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
    _right_inst(right_inst), _right_op(right_op), _next(NULL) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
PeepConstraint::~PeepConstraint() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   754
489c9b5090e2 Initial load
duke
parents:
diff changeset
   755
// Check if constraints use instruction at position
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   756
bool PeepConstraint::constrains_instruction(int position) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
  // Check local instruction constraints
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
  if( _left_inst  == position ) return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
  if( _right_inst == position ) return true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
  // Check remaining constraints in list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
  if( _next == NULL )  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
  else                 return _next->constrains_instruction(position);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
// Add another constraint
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
void PeepConstraint::append(PeepConstraint *next_constraint) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
  if( _next == NULL ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
    _next = next_constraint;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
    _next->append( next_constraint );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
// Access the next constraint in the list
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
PeepConstraint *PeepConstraint::next() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
  return _next;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
void PeepConstraint::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
void PeepConstraint::output(FILE *fp) {   // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
  fprintf(fp,"PeepConstraint:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
//------------------------------PeepReplace------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
PeepReplace::PeepReplace(char *rule) : _rule(rule) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
PeepReplace::~PeepReplace() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
// Add contents of peepreplace
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
void  PeepReplace::add_instruction(char *root) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
  _instruction.addName(root);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
  _operand_inst_num.add_signal();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
  _operand_op_name.add_signal();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
void  PeepReplace::add_operand( int inst_num, char *inst_operand ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
  _instruction.add_signal();
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   803
  _operand_inst_num.addName((char*) (intptr_t) inst_num);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
  _operand_op_name.addName(inst_operand);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
// Access contents of peepreplace
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
void  PeepReplace::reset() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
  _instruction.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
  _operand_inst_num.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
  _operand_op_name.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
}
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   813
void  PeepReplace::next_instruction(const char* &inst){
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
  inst                     = _instruction.iter();
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   815
  int         inst_num     = (int) (intptr_t) _operand_inst_num.iter();
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   816
  const char* inst_operand = _operand_op_name.iter();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
}
2129
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   818
void  PeepReplace::next_operand(int &inst_num, const char* &inst_operand) {
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   819
  const char* inst = _instruction.iter();
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   820
  inst_num         = (int) (intptr_t) _operand_inst_num.iter();
e810a33b5c67 6778669: Patch from Red Hat -- fixes compilation errors
twisti
parents: 1
diff changeset
   821
  inst_operand     = _operand_op_name.iter();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
void PeepReplace::dump() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
  output(stderr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
void PeepReplace::output(FILE *fp) {      // Write info to output files
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
  fprintf(fp,"PeepReplace:\n");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
}