This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to add a NOP instruction in each basic block for obj code that gcc generates


The simplest way is going to be something like
   fprintf (asm_out_file, "\tnop\n");

I added fprintf (asm_out_file, "\tnop\n"); to the end of case CODE_LABEL. Then I recompile the gcc. Unfortunately, it doesn't seem that a NOP was inserted. Any ideaes?

   case CODE_LABEL:
     /* The target port might emit labels in the output function for
        some insn, e.g. sh.c output_branchy_insn.  */
     if (CODE_LABEL_NUMBER (insn) <= max_labelno)
       {
         int align = LABEL_TO_ALIGNMENT (insn);
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
         int max_skip = LABEL_TO_MAX_SKIP (insn);
#endif

         if (align && NEXT_INSN (insn))
           {
#ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
             ASM_OUTPUT_MAX_SKIP_ALIGN (file, align, max_skip);
#else
#ifdef ASM_OUTPUT_ALIGN_WITH_NOP
             ASM_OUTPUT_ALIGN_WITH_NOP (file, align);
#else
             ASM_OUTPUT_ALIGN (file, align);
#endif
#endif
           }
       }
       fprintf (asm_out_file, "\tnop\n");


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]