+ return symval;
+}
+
+static int bytes_saved = 0;
+
+static int bytes_to_reloc[] = {
+ R_M32C_NONE,
+ R_M32C_8,
+ R_M32C_16,
+ R_M32C_24,
+ R_M32C_32
+};
+
+/* What we use the bits in a relax reloc addend (R_M32C_RL_*) for. */
+
+/* Mask for the number of relocs associated with this insn. */
+#define RLA_RELOCS 0x0000000f
+/* Number of bytes gas emitted (before gas's relaxing) */
+#define RLA_NBYTES 0x00000ff0
+
+/* If the displacement is within the given range and the new encoding
+ differs from the old encoding (the index), then the insn can be
+ relaxed to the new encoding. */
+typedef struct {
+ int bytes;
+ unsigned int max_disp;
+ unsigned char new_encoding;
+} EncodingTable;
+
+static EncodingTable m16c_addr_encodings[] = {
+ { 0, 0, 0 }, /* R0 */
+ { 0, 0, 1 }, /* R1 */
+ { 0, 0, 2 }, /* R2 */
+ { 0, 0, 3 }, /* R3 */
+ { 0, 0, 4 }, /* A0 */
+ { 0, 0, 5 }, /* A1 */
+ { 0, 0, 6 }, /* [A0] */
+ { 0, 0, 7 }, /* [A1] */
+ { 1, 0, 6 }, /* udsp:8[A0] */
+ { 1, 0, 7 }, /* udsp:8[A1] */
+ { 1, 0, 10 }, /* udsp:8[SB] */
+ { 1, 0, 11 }, /* sdsp:8[FB] */
+ { 2, 255, 8 }, /* udsp:16[A0] */
+ { 2, 255, 9 }, /* udsp:16[A1] */
+ { 2, 255, 10 }, /* udsp:16[SB] */
+ { 2, 0, 15 }, /* abs:16 */
+};
+
+static EncodingTable m16c_jmpaddr_encodings[] = {
+ { 0, 0, 0 }, /* R0 */
+ { 0, 0, 1 }, /* R1 */
+ { 0, 0, 2 }, /* R2 */
+ { 0, 0, 3 }, /* R3 */
+ { 0, 0, 4 }, /* A0 */
+ { 0, 0, 5 }, /* A1 */
+ { 0, 0, 6 }, /* [A0] */
+ { 0, 0, 7 }, /* [A1] */
+ { 1, 0, 6 }, /* udsp:8[A0] */
+ { 1, 0, 7 }, /* udsp:8[A1] */
+ { 1, 0, 10 }, /* udsp:8[SB] */
+ { 1, 0, 11 }, /* sdsp:8[FB] */
+ { 3, 255, 8 }, /* udsp:20[A0] */
+ { 3, 255, 9 }, /* udsp:20[A1] */
+ { 2, 255, 10 }, /* udsp:16[SB] */
+ { 2, 0, 15 }, /* abs:16 */
+};
+
+static EncodingTable m32c_addr_encodings[] = {
+ { 0, 0, 0 }, /* [A0] */
+ { 0, 0, 1 }, /* [A1] */
+ { 0, 0, 2 }, /* A0 */
+ { 0, 0, 3 }, /* A1 */
+ { 1, 0, 0 }, /* udsp:8[A0] */
+ { 1, 0, 1 }, /* udsp:8[A1] */
+ { 1, 0, 6 }, /* udsp:8[SB] */
+ { 1, 0, 7 }, /* sdsp:8[FB] */
+ { 2, 255, 4 }, /* udsp:16[A0] */
+ { 2, 255, 5 }, /* udsp:16[A1] */
+ { 2, 255, 6 }, /* udsp:16[SB] */
+ { 2, 127, 7 }, /* sdsp:16[FB] */
+ { 3, 65535, 8 }, /* udsp:24[A0] */
+ { 3, 65535, 9 }, /* udsp:24[A1] */
+ { 3, 65535, 15 }, /* abs24 */
+ { 2, 0, 15 }, /* abs16 */
+ { 0, 0, 16 }, /* R2 */
+ { 0, 0, 17 }, /* R3 */
+ { 0, 0, 18 }, /* R0 */
+ { 0, 0, 19 }, /* R1 */
+ { 0, 0, 20 }, /* */
+ { 0, 0, 21 }, /* */
+ { 0, 0, 22 }, /* */
+ { 0, 0, 23 }, /* */
+ { 0, 0, 24 }, /* */
+ { 0, 0, 25 }, /* */
+ { 0, 0, 26 }, /* */
+ { 0, 0, 27 }, /* */
+ { 0, 0, 28 }, /* */
+ { 0, 0, 29 }, /* */
+ { 0, 0, 30 }, /* */
+ { 0, 0, 31 }, /* */
+};
+