Branch: Tag:

2014-11-26

2014-11-26 16:00:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added #pragma {,no}disassemble.

When debugging the compiler it is is often useful to get
disassembly output for just a few functions in a specific
file. This pragma causes the compiler backend to dump the
result from the peep-hole optimizer to stderr for functions
defined in sections where #pragma disassemble is active.

Note that the pragma currently only has effect if pike
has been compiled --with-rtldebug (aka PIKE_DEBUG).

23:   #include "constants.h"   #include "interpret.h"   #include "pikecode.h" + #include "pike_compiler.h"      #ifdef PIKE_DEBUG   static int hasarg(int opcode)
184:   #endif    int relabel;    int reoptimize = relabel = !(debug_options & NO_PEEP_OPTIMIZING); +  struct lex *lex; +  CHECK_COMPILER(); +  lex = &THIS_COMPILATION->lex;       c=(p_instr *)instrbuf.s.str;    length=instrbuf.s.len / sizeof(p_instr);
506: Inside #if defined(PIKE_DEBUG)
   "0x%04"PRINTPTRDIFFT"x != 0x%04"PRINTPTRDIFFT"x\n",    e, c - ((p_instr *)instrbuf.s.str));    } -  if((a_flag > 2 && store_linenumbers) || a_flag > 3) +  if(((a_flag > 2) && store_linenumbers) || +  (a_flag > 3) || +  (lex->pragmas & ID_DISASSEMBLE))    {    if (c->opcode == F_POP_SYNCH_MARK) synch_depth--;    fprintf(stderr, "===%4ld %4lx %*s", (long)c->line,