src/share/vm/adlc/adlparse.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hs-6771309 Sdiff src/share/vm/adlc

src/share/vm/adlc/adlparse.hpp

Print this page
rev 461 : Fixed 6771309: debugging AD files is difficult without #line directives in generated code
Summary: more and better #line and #define directives in the generated code; ADLC itself accepts #line directives
Reviewed-by: never, kvn


  76   enum { _preproc_limit = 20 };
  77   int       _preproc_depth;                 // How deep are we into ifdefs?
  78   int       _preproc_not_taken;             // How deep in not-taken ifdefs?
  79   bool      _preproc_taken[_preproc_limit]; // Are we taking this ifdef level?
  80   bool      _preproc_else[_preproc_limit];  // Did this level have an else yet?
  81 
  82   // ***** Level 1 Parse functions *****
  83   void instr_parse(void);       // Parse instruction definitions
  84   void oper_parse(void);        // Parse operand definitions
  85   void opclass_parse(void);     // Parse operand class definitions
  86   void ins_attr_parse(void);    // Parse instruction attrubute definitions
  87   void op_attr_parse(void);     // Parse operand attrubute definitions
  88   void source_parse(void);      // Parse source section
  89   void source_hpp_parse(void);  // Parse source_hpp section
  90   void reg_parse(void);         // Parse register section
  91   void encode_parse(void);      // Parse encoding section
  92   void frame_parse(void);       // Parse frame section
  93   void pipe_parse(void);        // Parse pipeline section
  94   void definitions_parse(void); // Parse definitions section
  95   void peep_parse(void);        // Parse peephole rule definitions

  96   void preproc_define(void);    // Parse a #define statement
  97   void preproc_undef(void);     // Parse an #undef statement
  98 
  99   // Helper functions for instr_parse().
 100   void adjust_set_rule(InstructForm *instr);
 101   void matchrule_clone_and_swap(MatchRule *rule, const char* instr_ident, int& match_rules_cnt);
 102 
 103   // ***** Level 2 Parse functions *****
 104   // Parse the components of the encode section
 105   void enc_class_parse(void);   // Parse encoding class definition
 106   void enc_class_parse_block(EncClass* encoding, char* ec_name);
 107 
 108   // Parse the components of the frame section
 109   void stack_dir_parse(FrameForm *frame);   // Parse the stack direction entry
 110   void sync_stack_slots_parse(FrameForm *frame);
 111   void frame_pointer_parse(FrameForm *frame, bool native);
 112   void interpreter_frame_pointer_parse(FrameForm *frame, bool native);
 113   void inline_cache_parse(FrameForm *frame, bool native);
 114   void interpreter_arg_ptr_parse(FrameForm *frame, bool native);
 115   void interpreter_method_oop_parse(FrameForm *frame, bool native);


 209   char *get_ident()            { return get_ident_common(true); }
 210   char *get_ident_no_preproc() { return get_ident_common(false); }
 211   char *get_ident_common(bool do_preproc);      // Grab it from the file buffer
 212   char *get_ident_dup(void);    // Grab a duplicate of the identifier
 213   char *get_ident_or_literal_constant(const char* description);
 214   // Grab unique identifier from file buffer
 215   char *get_unique_ident(FormDict &dict, const char *nameDescription);
 216   // Return the next replacement variable identifier
 217   char *get_rep_var_ident(void);
 218   // Skip first '$' and make a duplicate of the string
 219   char *get_rep_var_ident_dup(void);
 220   // Return the next token given as a signed integer.
 221   int   get_int(void);
 222   // Return the next token, a relational operator { ==, !=, <=, >= }
 223   char *get_relation_dup(void);
 224 
 225   void  get_oplist(NameList &parameters, FormDict &operands);// Parse type-operand pairs
 226   void  get_effectlist(FormDict &effects, FormDict &operands); // Parse effect-operand pairs
 227   // Return the contents of a parenthesized expression.
 228   // Requires initial '(' and consumes final ')', which is replaced by '\0'.
 229   char *get_paren_expr(const char *description);
 230   // Return expression up to next stop-char, which terminator replaces.
 231   // Does not require initial '('.  Does not consume final stop-char.
 232   // Final stop-char is left in _curchar, but is also is replaced by '\0'.
 233   char *get_expr(const char *description, const char *stop_chars);
 234   char *find_cpp_block(const char *description); // Parse a C++ code block
 235   // Issue parser error message & go to EOL
 236   void parse_err(int flag, const char *fmt, ...);





 237 
 238   // Return pointer to current character
 239   inline char  cur_char(void);
 240   // Advance to next character, assign this to _curchar
 241   inline void  next_char(void);
 242   inline void  next_char_or_line(void);
 243   // Advance File Buffer to next line, updating _curline
 244   inline void  next_line(void);
 245   // Issue an error if we are not at the beginning of a line (exc. whitespace).
 246   void ensure_start_of_line(void);
 247   // Issue an error if we are not at the end of a line (exc. whitespace).
 248   void ensure_end_of_line(void);
 249   // Skip whitespace, leaving ptr pointing to first non-whitespace character
 250   // Also handle preprocessor constructs like "#ifdef".
 251   void skipws()                { skipws_common(true); }
 252   // Skip comments and spaces but not newlines or preprocessor constructs.
 253   void skipws_no_preproc()     { skipws_common(false); }
 254   void skipws_common(bool do_preproc);
 255 
 256   FileBuff &_buf;               // File buffer to be parsed
 257   ArchDesc &_AD;                // Architecture Description being built
 258 
 259 public:
 260 
 261   ADLParser(FileBuff &buf, ArchDesc &archDesc); // Create new ADLParser object
 262   ~ADLParser();                 // Destroy ADLParser object
 263 
 264   void parse(void);             // Do the parsing & build forms lists
 265 
 266   int linenum() { return _buf.linenum(); }
 267 
 268   static bool is_literal_constant(const char *hex_string);
 269   static bool is_hex_digit(char digit);
 270   static bool is_int_token(const char* token, int& intval);

 271   static void trim(char* &token);  // trim leading & trailing spaces
 272 };


  76   enum { _preproc_limit = 20 };
  77   int       _preproc_depth;                 // How deep are we into ifdefs?
  78   int       _preproc_not_taken;             // How deep in not-taken ifdefs?
  79   bool      _preproc_taken[_preproc_limit]; // Are we taking this ifdef level?
  80   bool      _preproc_else[_preproc_limit];  // Did this level have an else yet?
  81 
  82   // ***** Level 1 Parse functions *****
  83   void instr_parse(void);       // Parse instruction definitions
  84   void oper_parse(void);        // Parse operand definitions
  85   void opclass_parse(void);     // Parse operand class definitions
  86   void ins_attr_parse(void);    // Parse instruction attrubute definitions
  87   void op_attr_parse(void);     // Parse operand attrubute definitions
  88   void source_parse(void);      // Parse source section
  89   void source_hpp_parse(void);  // Parse source_hpp section
  90   void reg_parse(void);         // Parse register section
  91   void encode_parse(void);      // Parse encoding section
  92   void frame_parse(void);       // Parse frame section
  93   void pipe_parse(void);        // Parse pipeline section
  94   void definitions_parse(void); // Parse definitions section
  95   void peep_parse(void);        // Parse peephole rule definitions
  96   void preproc_line(void);      // Parse a #line statement
  97   void preproc_define(void);    // Parse a #define statement
  98   void preproc_undef(void);     // Parse an #undef statement
  99 
 100   // Helper functions for instr_parse().
 101   void adjust_set_rule(InstructForm *instr);
 102   void matchrule_clone_and_swap(MatchRule *rule, const char* instr_ident, int& match_rules_cnt);
 103 
 104   // ***** Level 2 Parse functions *****
 105   // Parse the components of the encode section
 106   void enc_class_parse(void);   // Parse encoding class definition
 107   void enc_class_parse_block(EncClass* encoding, char* ec_name);
 108 
 109   // Parse the components of the frame section
 110   void stack_dir_parse(FrameForm *frame);   // Parse the stack direction entry
 111   void sync_stack_slots_parse(FrameForm *frame);
 112   void frame_pointer_parse(FrameForm *frame, bool native);
 113   void interpreter_frame_pointer_parse(FrameForm *frame, bool native);
 114   void inline_cache_parse(FrameForm *frame, bool native);
 115   void interpreter_arg_ptr_parse(FrameForm *frame, bool native);
 116   void interpreter_method_oop_parse(FrameForm *frame, bool native);


 210   char *get_ident()            { return get_ident_common(true); }
 211   char *get_ident_no_preproc() { return get_ident_common(false); }
 212   char *get_ident_common(bool do_preproc);      // Grab it from the file buffer
 213   char *get_ident_dup(void);    // Grab a duplicate of the identifier
 214   char *get_ident_or_literal_constant(const char* description);
 215   // Grab unique identifier from file buffer
 216   char *get_unique_ident(FormDict &dict, const char *nameDescription);
 217   // Return the next replacement variable identifier
 218   char *get_rep_var_ident(void);
 219   // Skip first '$' and make a duplicate of the string
 220   char *get_rep_var_ident_dup(void);
 221   // Return the next token given as a signed integer.
 222   int   get_int(void);
 223   // Return the next token, a relational operator { ==, !=, <=, >= }
 224   char *get_relation_dup(void);
 225 
 226   void  get_oplist(NameList &parameters, FormDict &operands);// Parse type-operand pairs
 227   void  get_effectlist(FormDict &effects, FormDict &operands); // Parse effect-operand pairs
 228   // Return the contents of a parenthesized expression.
 229   // Requires initial '(' and consumes final ')', which is replaced by '\0'.
 230   char *get_paren_expr(const char *description, bool include_location = false);
 231   // Return expression up to next stop-char, which terminator replaces.
 232   // Does not require initial '('.  Does not consume final stop-char.
 233   // Final stop-char is left in _curchar, but is also is replaced by '\0'.
 234   char *get_expr(const char *description, const char *stop_chars);
 235   char *find_cpp_block(const char *description); // Parse a C++ code block
 236   // Issue parser error message & go to EOL
 237   void parse_err(int flag, const char *fmt, ...);
 238   // Create a location marker for this file and line.
 239   char *get_line_string(int linenum = 0);
 240   // Return a location marker which tells the C preprocessor to
 241   // forget the previous location marker.  (Requires awk postprocessing.)
 242   char *end_line_marker() { return (char*)"\n#line 999999\n"; }
 243 
 244   // Return pointer to current character
 245   inline char  cur_char(void);
 246   // Advance to next character, assign this to _curchar
 247   inline void  next_char(void);
 248   inline void  next_char_or_line(void);
 249   // Advance File Buffer to next line, updating _curline
 250   inline void  next_line(void);
 251   // Issue an error if we are not at the beginning of a line (exc. whitespace).
 252   void ensure_start_of_line(void);
 253   // Issue an error if we are not at the end of a line (exc. whitespace).
 254   void ensure_end_of_line(void);
 255   // Skip whitespace, leaving ptr pointing to first non-whitespace character
 256   // Also handle preprocessor constructs like "#ifdef".
 257   void skipws()                { skipws_common(true); }
 258   // Skip comments and spaces but not newlines or preprocessor constructs.
 259   void skipws_no_preproc()     { skipws_common(false); }
 260   void skipws_common(bool do_preproc);
 261 
 262   FileBuff &_buf;               // File buffer to be parsed
 263   ArchDesc &_AD;                // Architecture Description being built
 264 
 265 public:
 266 
 267   ADLParser(FileBuff &buf, ArchDesc &archDesc); // Create new ADLParser object
 268   ~ADLParser();                 // Destroy ADLParser object
 269 
 270   void parse(void);             // Do the parsing & build forms lists
 271 
 272   int linenum() { return _buf.linenum(); }
 273 
 274   static bool is_literal_constant(const char *hex_string);
 275   static bool is_hex_digit(char digit);
 276   static bool is_int_token(const char* token, int& intval);
 277   static bool equivalent_expressions(const char* str1, const char* str2);
 278   static void trim(char* &token);  // trim leading & trailing spaces
 279 };
src/share/vm/adlc/adlparse.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File