+/* Maximum number of opcode slots in a VLIW instruction. */
+#define MAX_SLOTS 15
+
+
+/* For all xtensa relax states except RELAX_DESIRE_ALIGN and
+ RELAX_DESIRE_ALIGN_IF_TARGET, the amount a frag might grow is stored
+ in the fr_var field. For the two exceptions, fr_var is a float value
+ that records the frequency with which the following instruction is
+ executed as a branch target. The aligner uses this information to
+ tell which targets are most important to be aligned. */
+
+enum xtensa_relax_statesE
+{
+ RELAX_XTENSA_NONE,
+
+ RELAX_ALIGN_NEXT_OPCODE,
+ /* Use the first opcode of the next fragment to determine the
+ alignment requirements. This is ONLY used for LOOPs currently. */
+
+ RELAX_CHECK_ALIGN_NEXT_OPCODE,
+ /* The next non-empty frag contains a loop instruction. Check to see
+ if it is correctly aligned, but do not align it. */
+
+ RELAX_DESIRE_ALIGN_IF_TARGET,
+ /* These are placed in front of labels and converted to either
+ RELAX_DESIRE_ALIGN / RELAX_LOOP_END or rs_fill of 0 before
+ relaxation begins. */
+
+ RELAX_ADD_NOP_IF_A0_B_RETW,
+ /* These are placed in front of conditional branches. Before
+ relaxation begins, they are turned into either NOPs for branches
+ immediately followed by RETW or RETW.N or rs_fills of 0. This is
+ used to avoid a hardware bug in some early versions of the
+ processor. */
+
+ RELAX_ADD_NOP_IF_PRE_LOOP_END,
+ /* These are placed after JX instructions. Before relaxation begins,
+ they are turned into either NOPs, if the JX is one instruction
+ before a loop end label, or rs_fills of 0. This is used to avoid a
+ hardware interlock issue prior to Xtensa version T1040. */
+
+ RELAX_ADD_NOP_IF_SHORT_LOOP,
+ /* These are placed after LOOP instructions and turned into NOPs when:
+ (1) there are less than 3 instructions in the loop; we place 2 of
+ these in a row to add up to 2 NOPS in short loops; or (2) the
+ instructions in the loop do not include a branch or jump.
+ Otherwise they are turned into rs_fills of 0 before relaxation
+ begins. This is used to avoid hardware bug PR3830. */
+
+ RELAX_ADD_NOP_IF_CLOSE_LOOP_END,
+ /* These are placed after LOOP instructions and turned into NOPs if
+ there are less than 12 bytes to the end of some other loop's end.
+ Otherwise they are turned into rs_fills of 0 before relaxation
+ begins. This is used to avoid hardware bug PR3830. */
+
+ RELAX_DESIRE_ALIGN,
+ /* The next fragment would like its first instruction to NOT cross an
+ instruction fetch boundary. */
+
+ RELAX_MAYBE_DESIRE_ALIGN,
+ /* The next fragment might like its first instruction to NOT cross an
+ instruction fetch boundary. These are placed after a branch that
+ might be relaxed. If the branch is relaxed, then this frag will be
+ a branch target and this frag will be changed to RELAX_DESIRE_ALIGN
+ frag. */
+
+ RELAX_LOOP_END,
+ /* This will be turned into a NOP or NOP.N if the previous instruction
+ is expanded to negate a loop. */
+
+ RELAX_LOOP_END_ADD_NOP,
+ /* When the code density option is available, this will generate a
+ NOP.N marked RELAX_NARROW. Otherwise, it will create an rs_fill
+ fragment with a NOP in it. Once a frag has been converted to
+ RELAX_LOOP_END_ADD_NOP, it should never be changed back to
+ RELAX_LOOP_END. */
+
+ RELAX_LITERAL,
+ /* Another fragment could generate an expansion here but has not yet. */
+
+ RELAX_LITERAL_NR,
+ /* Expansion has been generated by an instruction that generates a
+ literal. However, the stretch has NOT been reported yet in this
+ fragment. */
+
+ RELAX_LITERAL_FINAL,
+ /* Expansion has been generated by an instruction that generates a
+ literal. */
+
+ RELAX_LITERAL_POOL_BEGIN,
+ RELAX_LITERAL_POOL_END,
+ RELAX_LITERAL_POOL_CANDIDATE_BEGIN,
+ /* Technically these are not relaxations at all but mark a location
+ to store literals later. Note that fr_var stores the frchain for
+ BEGIN frags and fr_var stores now_seg for END frags. */
+
+ RELAX_NARROW,
+ /* The last instruction in this fragment (at->fr_opcode) can be
+ freely replaced with a single wider instruction if a future
+ alignment desires or needs it. */
+
+ RELAX_IMMED,
+ /* The last instruction in this fragment (at->fr_opcode) contains
+ an immediate or symbol. If the value does not fit, relax the
+ opcode using expansions from the relax table. */
+
+ RELAX_IMMED_STEP1,
+ /* The last instruction in this fragment (at->fr_opcode) contains a
+ literal. It has already been expanded 1 step. */
+
+ RELAX_IMMED_STEP2,
+ /* The last instruction in this fragment (at->fr_opcode) contains a
+ literal. It has already been expanded 2 steps. */
+
+ RELAX_IMMED_STEP3,
+ /* The last instruction in this fragment (at->fr_opcode) contains a
+ literal. It has already been expanded 3 steps. */
+
+ RELAX_SLOTS,
+ /* There are instructions within the last VLIW instruction that need
+ relaxation. Find the relaxation based on the slot info in
+ xtensa_frag_type. Relaxations that deal with particular opcodes
+ are slot-based (e.g., converting a MOVI to an L32R). Relaxations
+ that deal with entire instructions, such as alignment, are not
+ slot-based. */
+
+ RELAX_FILL_NOP,
+ /* This marks the location of a pipeline stall. We can fill these guys
+ in for alignment of any size. */
+
+ RELAX_UNREACHABLE,
+ /* This marks the location as unreachable. The assembler may widen or
+ narrow this area to meet alignment requirements of nearby
+ instructions. */
+
+ RELAX_MAYBE_UNREACHABLE,
+ /* This marks the location as possibly unreachable. These are placed
+ after a branch that may be relaxed into a branch and jump. If the
+ branch is relaxed, then this frag will be converted to a
+ RELAX_UNREACHABLE frag. */
+
+ RELAX_ORG,
+ /* This marks the location as having previously been an rs_org frag.
+ rs_org frags are converted to fill-zero frags immediately after
+ relaxation. However, we need to remember where they were so we can
+ prevent the linker from changing the size of any frag between the
+ section start and the org frag. */
+
+ RELAX_TRAMPOLINE,
+ /* Every few thousand frags, we insert one of these, just in case we may
+ need some space for a trampoline (jump to a jump) because the function
+ has gotten too big. If not needed, it disappears. */
+
+ RELAX_NONE
+};
+
+/* This is used as a stopper to bound the number of steps that
+ can be taken. */
+#define RELAX_IMMED_MAXSTEPS (RELAX_IMMED_STEP3 - RELAX_IMMED)
+