#include "as.h"
#include "subsegs.h"
+#include "dwarf2dbg.h"
#include "opcode/i386.h"
#ifndef REGISTER_WARNINGS
{"code32", set_16bit_code_flag, 0},
{"intel_syntax", set_intel_syntax, 1},
{"att_syntax", set_intel_syntax, 0},
+ {"file", dwarf2_directive_file, 0},
+ {"loc", dwarf2_directive_loc, 0},
{0, 0, 0}
};
}
}
+ dwarf2_emit_insn (insn_size);
+
#ifdef DEBUG386
if (flag_debug)
{
Initial production is 'expr'.
-
addOp + | -
alpha [a-zA-Z]
| DR0 | DR1 | DR2 | DR3 | DR6 | DR7
| TR3 | TR4 | TR5 | TR6 | TR7
-
We simplify the grammar in obvious places (e.g., register parsing is
done by calling parse_register) and eliminate immediate left recursion
to implement a recursive-descent parser.
{
char *op_string; /* The string being parsed. */
int got_a_float; /* Whether the operand is a float. */
- int op_modifier; /* Operand modifier. */
+ int op_modifier; /* Operand modifier. */
int is_mem; /* 1 if operand is memory reference. */
const reg_entry *reg; /* Last register reference found. */
char *disp; /* Displacement string being built. */
/* Prototypes for intel parser functions. */
static int intel_match_token PARAMS ((int code));
-static void intel_get_token PARAMS (());
-static void intel_putback_token PARAMS (());
-static int intel_expr PARAMS (());
-static int intel_e05 PARAMS (());
-static int intel_e05_1 PARAMS (());
-static int intel_e06 PARAMS (());
-static int intel_e06_1 PARAMS (());
-static int intel_e09 PARAMS (());
-static int intel_e09_1 PARAMS (());
-static int intel_e10 PARAMS (());
-static int intel_e10_1 PARAMS (());
-static int intel_e11 PARAMS (());
-
+static void intel_get_token PARAMS ((void));
+static void intel_putback_token PARAMS ((void));
+static int intel_expr PARAMS ((void));
+static int intel_e05 PARAMS ((void));
+static int intel_e05_1 PARAMS ((void));
+static int intel_e06 PARAMS ((void));
+static int intel_e06_1 PARAMS ((void));
+static int intel_e09 PARAMS ((void));
+static int intel_e09_1 PARAMS ((void));
+static int intel_e10 PARAMS ((void));
+static int intel_e10_1 PARAMS ((void));
+static int intel_e11 PARAMS ((void));
static int
i386_intel_operand (operand_string, got_a_float)
return ret;
}
-
/* expr SHORT e05
| e05 */
static int
return intel_e05 ();
}
-
/* e05 e06 e05'
- e05' addOp e06 e05'
+ e05' addOp e06 e05'
| Empty */
static int
intel_e05 ()
/* e05' Empty */
else
return 1;
-}
-
+}
/* e06 e09 e06'
return (intel_e09 () && intel_e06_1 ());
}
-
+
/* e06' Empty */
- else
+ else
return 1;
}
-
/* e09 OFFSET e10 e09'
| e10 e09'
{
intel_match_token ('[');
intel_parser.is_mem = 1;
-
+
/* Add a '+' to the displacement string if necessary. */
if (*intel_parser.disp != '\0')
strcat (intel_parser.disp, "+");
return 1;
}
-
/* e11 ( expr )
| [ expr ]
| BYTE
| DWORD
| QWORD
| XWORD
- | $
+ | $
| .
| register
| id
{
intel_match_token ('[');
intel_parser.is_mem = 1;
-
+
/* Operands for jump/call inside brackets denote absolute addresses. */
if (current_templates->start->opcode_modifier & Jump
|| current_templates->start->opcode_modifier & JumpDword
return (intel_expr () && intel_match_token (']'));
}
- /* e11 BYTE
+ /* e11 BYTE
| WORD
| DWORD
| QWORD
return 0;
}
- /* What follows must be a valid scale. */
+ /* What follows must be a valid scale. */
if (intel_match_token ('*')
&& strchr ("01248", *cur_token.str))
{
parsed as an immediate expression after we're done. */
else if (intel_parser.op_modifier == OFFSET_FLAT)
strcat (intel_parser.disp, reg->reg_name);
-
+
/* It's neither base nor index nor offset. */
else
{
return 1;
}
-
+
/* e11 id */
else if (cur_token.code == T_ID)
{
return 0;
}
- /* The constant is followed by `* reg', so it must be
+ /* The constant is followed by `* reg', so it must be
a valid scale. */
if (strchr ("01248", *save_str))
{
return 1;
}
-
as_bad (_("Unrecognized token '%s'"), cur_token.str);
return 0;
}
-
/* Match the given token against cur_token. If they match, read the next
token from the operand string. */
static int
}
}
-
/* Read a new token from intel_parser.op_string and store it in cur_token. */
static void
intel_get_token ()
new_token.reg = NULL;
new_token.str = NULL;
- /* Free the memory allocated to the previous token and move
+ /* Free the memory allocated to the previous token and move
cur_token to prev_token. */
if (prev_token.str)
free (prev_token.str);
/* Recognize special symbol names [0-9][bf]. */
if (strlen (intel_parser.op_string) == 2
- && (intel_parser.op_string[1] == 'b'
+ && (intel_parser.op_string[1] == 'b'
|| intel_parser.op_string[1] == 'f'))
new_token.code = T_ID;
}
cur_token = new_token;
}
-
/* Put cur_token back into the token stream and make cur_token point to
prev_token. */
static void
intel_parser.op_string -= strlen (cur_token.str);
free (cur_token.str);
cur_token = prev_token;
-
+
/* Forget prev_token. */
prev_token.code = T_NIL;
prev_token.reg = NULL;