#include "language.h"
#include "parser-defs.h"
+static void
+free_funcalls PARAMS ((void));
+
static void
prefixify_expression PARAMS ((struct expression *));
static void
prefixify_subexp PARAMS ((struct expression *, struct expression *, int, int));
+/* Data structure for saving values of arglist_len for function calls whose
+ arguments contain other function calls. */
+
+struct funcall
+ {
+ struct funcall *next;
+ int arglist_len;
+ };
+
+static struct funcall *funcall_chain;
+
/* Assign machine-independent names to certain registers
(unless overridden by the REGISTER_NAMES table) */
+#ifdef NO_STD_REGS
+unsigned num_std_regs = 0;
+struct std_regs std_regs[1];
+#else
struct std_regs std_regs[] = {
+
#ifdef PC_REGNUM
{ "pc", PC_REGNUM },
#endif
#ifdef PS_REGNUM
{ "ps", PS_REGNUM },
#endif
+
};
unsigned num_std_regs = (sizeof std_regs / sizeof std_regs[0]);
+#endif
+
/* Begin counting arguments for a function call,
saving the data about any containing call. */
void
start_arglist ()
{
- register struct funcall *new = (struct funcall *) xmalloc (sizeof (struct funcall));
+ register struct funcall *new;
+ new = (struct funcall *) xmalloc (sizeof (struct funcall));
new->next = funcall_chain;
new->arglist_len = arglist_len;
arglist_len = 0;
/* Free everything in the funcall chain.
Used when there is an error inside parsing. */
-void
+static void
free_funcalls ()
{
register struct funcall *call, *next;
write_exp_elt (tmp);
}
+void
+write_exp_elt_block (b)
+ struct block *b;
+{
+ union exp_element tmp;
+ tmp.block = b;
+ write_exp_elt (tmp);
+}
+
void
write_exp_elt_longcst (expelt)
LONGEST expelt;
case OP_LONG:
case OP_DOUBLE:
+ case OP_VAR_VALUE:
oplen = 4;
break;
case OP_TYPE:
case OP_BOOL:
- case OP_VAR_VALUE:
case OP_LAST:
case OP_REGISTER:
case OP_INTERNALVAR:
oplen = 4 + BYTES_TO_EXP_ELEM (oplen);
break;
+ case OP_ARRAY:
+ oplen = 4;
+ args = longest_to_int (expr->elts[endpos - 2].longconst);
+ args -= longest_to_int (expr->elts[endpos - 3].longconst);
+ args += 1;
+ break;
+
case TERNOP_COND:
args = 3;
break;
case OP_LONG:
case OP_DOUBLE:
+ case OP_VAR_VALUE:
oplen = 4;
break;
case OP_TYPE:
case OP_BOOL:
- case OP_VAR_VALUE:
case OP_LAST:
case OP_REGISTER:
case OP_INTERNALVAR:
args=1;
break;
- case STRUCTOP_STRUCT:
+ case STRUCTOP_STRUCT:
case STRUCTOP_PTR:
args = 1;
/* fall through */
oplen = 4 + BYTES_TO_EXP_ELEM (oplen);
break;
+ case OP_ARRAY:
+ oplen = 4;
+ args = longest_to_int (inexpr->elts[inend - 2].longconst);
+ args -= longest_to_int (inexpr->elts[inend - 3].longconst);
+ args += 1;
+ break;
+
case TERNOP_COND:
args = 3;
break;