1 #ifdef USE_PRAGMA_IDENT_HDR
2 #pragma ident "@(#)forms.hpp 1.150 07/05/05 17:05:00 JVM"
3 #endif
4 /*
5 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
154 }
155
156 // Check constraints after parsing
157 virtual bool verify() { return true; }
158
159 virtual void dump() { output(stderr); } // Debug printer
160 // Write info to output files
161 virtual void output(FILE *fp) { fprintf(fp,"Form Output"); }
162
163 public:
164 // ADLC types, match the last character on ideal operands and instructions
165 enum DataType {
166 none = 0, // Not a simple type
167 idealI = 1, // Integer type
168 idealP = 2, // Pointer types, oop(s)
169 idealL = 3, // Long type
170 idealF = 4, // Float type
171 idealD = 5, // Double type
172 idealB = 6, // Byte type
173 idealC = 7, // Char type
174 idealS = 8 // String type
175 };
176 // Convert ideal name to a DataType, return DataType::none if not a 'ConX'
177 Form::DataType ideal_to_const_type(const char *ideal_type_name) const;
178 // Convert ideal name to a DataType, return DataType::none if not a 'sRegX
179 Form::DataType ideal_to_sReg_type(const char *name) const;
180 // Convert ideal name to a DataType, return DataType::none if not a 'RegX
181 Form::DataType ideal_to_Reg_type(const char *name) const;
182
183 // Convert ideal name to a DataType, return DataType::none if not a 'LoadX
184 Form::DataType is_load_from_memory(const char *opType) const;
185 // Convert ideal name to a DataType, return DataType::none if not a 'StoreX
186 Form::DataType is_store_to_memory(const char *opType) const;
187
188 // ADLC call types, matched with ideal world
189 enum CallType {
190 invalid_type = 0, // invalid call type
191 JAVA_STATIC = 1, // monomorphic entry
192 JAVA_DYNAMIC = 2, // possibly megamorphic, inline cache call
193 JAVA_COMPILED = 3, // callee will be compiled java
194 JAVA_INTERP = 4, // callee will be executed by interpreter
314 ~FormList();
315 };
316
317 //------------------------------NameList---------------------------------------
318 // Extendable list of pointers, <char *>
319 class NameList {
320 friend class PreserveIter;
321
322 private:
323 int _cur; // Insert next entry here; count of entries
324 int _max; // Number of spaces allocated
325 const char **_names; // Array of names
326
327 protected:
328 int _iter; // position during iteration
329 bool _justReset; // Set immediately after reset
330
331
332 public:
333 static const char *_signal; // reserved user-defined string
334 enum { Not_in_list = -1 };
335
336 void addName(const char *name);
337 void add_signal();
338 void clear(); // Remove all entries
339
340 int count() const;
341
342 void reset(); // Reset iteration
343 const char *iter(); // after reset(), first element : else next
344 const char *current(); // return current element in iteration.
345
346 bool current_is_signal(); // Return 'true' if current entry is signal
347 bool is_signal(const char *entry); // Return true if entry is a signal
348
349 bool search(const char *); // Search for a name in the list
350 int index(const char *); // Return index of name in list
351 const char *name (intptr_t index);// Return name at index in list
352
353 void dump(); // output to stderr
|
1 #ifdef USE_PRAGMA_IDENT_HDR
2 #pragma ident "@(#)forms.hpp 1.150 07/05/05 17:05:00 JVM"
3 #endif
4 /*
5 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved.
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 *
8 * This code is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 only, as
10 * published by the Free Software Foundation.
11 *
12 * This code is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * version 2 for more details (a copy is included in the LICENSE file that
16 * accompanied this code).
17 *
18 * You should have received a copy of the GNU General Public License version
19 * 2 along with this work; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
24 * have any questions.
25 *
154 }
155
156 // Check constraints after parsing
157 virtual bool verify() { return true; }
158
159 virtual void dump() { output(stderr); } // Debug printer
160 // Write info to output files
161 virtual void output(FILE *fp) { fprintf(fp,"Form Output"); }
162
163 public:
164 // ADLC types, match the last character on ideal operands and instructions
165 enum DataType {
166 none = 0, // Not a simple type
167 idealI = 1, // Integer type
168 idealP = 2, // Pointer types, oop(s)
169 idealL = 3, // Long type
170 idealF = 4, // Float type
171 idealD = 5, // Double type
172 idealB = 6, // Byte type
173 idealC = 7, // Char type
174 idealS = 8, // String type
175 idealN = 9 // Narrow oop types
176 };
177 // Convert ideal name to a DataType, return DataType::none if not a 'ConX'
178 Form::DataType ideal_to_const_type(const char *ideal_type_name) const;
179 // Convert ideal name to a DataType, return DataType::none if not a 'sRegX
180 Form::DataType ideal_to_sReg_type(const char *name) const;
181 // Convert ideal name to a DataType, return DataType::none if not a 'RegX
182 Form::DataType ideal_to_Reg_type(const char *name) const;
183
184 // Convert ideal name to a DataType, return DataType::none if not a 'LoadX
185 Form::DataType is_load_from_memory(const char *opType) const;
186 // Convert ideal name to a DataType, return DataType::none if not a 'StoreX
187 Form::DataType is_store_to_memory(const char *opType) const;
188
189 // ADLC call types, matched with ideal world
190 enum CallType {
191 invalid_type = 0, // invalid call type
192 JAVA_STATIC = 1, // monomorphic entry
193 JAVA_DYNAMIC = 2, // possibly megamorphic, inline cache call
194 JAVA_COMPILED = 3, // callee will be compiled java
195 JAVA_INTERP = 4, // callee will be executed by interpreter
315 ~FormList();
316 };
317
318 //------------------------------NameList---------------------------------------
319 // Extendable list of pointers, <char *>
320 class NameList {
321 friend class PreserveIter;
322
323 private:
324 int _cur; // Insert next entry here; count of entries
325 int _max; // Number of spaces allocated
326 const char **_names; // Array of names
327
328 protected:
329 int _iter; // position during iteration
330 bool _justReset; // Set immediately after reset
331
332
333 public:
334 static const char *_signal; // reserved user-defined string
335 static const char *_signal2; // reserved user-defined string
336 static const char *_signal3; // reserved user-defined string
337 enum { Not_in_list = -1 };
338
339 void addName(const char *name);
340 void add_signal();
341 void clear(); // Remove all entries
342
343 int count() const;
344
345 void reset(); // Reset iteration
346 const char *iter(); // after reset(), first element : else next
347 const char *current(); // return current element in iteration.
348
349 bool current_is_signal(); // Return 'true' if current entry is signal
350 bool is_signal(const char *entry); // Return true if entry is a signal
351
352 bool search(const char *); // Search for a name in the list
353 int index(const char *); // Return index of name in list
354 const char *name (intptr_t index);// Return name at index in list
355
356 void dump(); // output to stderr
|