buf[i] = 0;
}
-static long long
+static int64_t
promote_token (struct token_s tok)
{
- long long cur_class = tok.class_id & -tok.class_id;
+ int64_t cur_class = tok.class_id & -tok.class_id;
switch (tok.category)
{
case CAT_REGISTER:
input_line_pointer = tok.insn + tok.begin;
expression (&exp);
input_line_pointer = ilp_save;
- long long new_class_id = tok.class_id;
- long long old_class_id = tok.class_id;
+ int64_t new_class_id = tok.class_id;
+ int64_t old_class_id = tok.class_id;
while (((new_class_id = env.promote_immediate (old_class_id))
!= old_class_id)
&& ((exp.X_op == O_symbol
return res;
}
-static long long
+static int64_t
get_token_class (struct token_s *token, struct token_classes *classes, int insn_p, int modifier_p)
{
int cur = 0;
if (class == classes->imm_classes)
{
- unsigned long long uval
+ uint64_t uval
= (token_val_p
? token->val
: strtoull (tok + (tok[0] == '-') + (tok[0] == '+'), NULL, 0));
- long long val = uval;
- long long pval = val < 0 ? -uval : uval;
+ int64_t val = uval;
+ int64_t pval = val < 0 ? -uval : uval;
int neg_power2_p = val < 0 && !(uval & (uval - 1));
unsigned len = pval ? 8 * sizeof (pval) - __builtin_clzll (pval) : 0;
while (class[cur].class_id != -1
parse_with_restarts (tok, cur_rule[i].jump_target, rules, errs);
/* While parsing fails but there is hope since the current token can be
promoted. */
- while (!fst_part && tok.class_id != (long long) promote_token (tok))
+ while (!fst_part && tok.class_id != (int64_t) promote_token (tok))
{
free_token_list (fst_part);
tok.class_id = promote_token (tok);
printf_debug (1, "snd_part: Trying to match: %s\n", TOKEN_NAME (CLASS_ID (tok)));
struct token_list *snd_part = parse_with_restarts (tok, cur_rule[i].stack_it, rules, errs);
- while (!snd_part && tok.class_id != (long long) promote_token (tok))
+ while (!snd_part && tok.class_id != (int64_t) promote_token (tok))
{
tok.class_id = promote_token (tok);
printf_debug (1, ">> Restart with %s?\n", TOKEN_NAME (CLASS_ID (tok)));
insert_operand (struct kvxinsn *insn, struct kvx_operand *opdef,
struct token_list *tok)
{
- unsigned long long op = 0;
+ uint64_t op = 0;
struct kvx_bitfield *bfields = opdef->bfield;
int bf_nb = opdef->bitfields;
int immx_ready = 0;
{
/* This is a immediate: either a regular immediate, or an
immediate that was saved in a variable through `.equ'. */
- unsigned long long sval = (long long) tok->val;
+ uint64_t sval = (int64_t) tok->val;
op = opdef->flags & kvxSIGNED ? sval : tok->val;
op >>= opdef->shift;
}
for (int bf_idx = 0; bf_idx < bf_nb; bf_idx++)
{
- unsigned long long value =
- ((unsigned long long) op >> bfields[bf_idx].from_offset);
+ uint64_t value =
+ ((uint64_t) op >> bfields[bf_idx].from_offset);
int j = 0;
int to_offset = bfields[bf_idx].to_offset;
value &= (1LL << bfields[bf_idx].size) - 1;
char *insn;
int begin, end;
int category;
- long long class_id;
- unsigned long long val;
+ int64_t class_id;
+ uint64_t val;
};
struct token_list
{
char *tok;
- unsigned long long val;
- long long class_id;
+ uint64_t val;
+ int64_t class_id;
int category;
int loc;
struct token_list *next;
struct token_class {
const char ** class_values;
- long long class_id;
+ int64_t class_id;
int sz;
};
CAT_IMMEDIATE,
} type;
/* The value of the operands. */
- unsigned long long val;
+ uint64_t val;
/* If it is an immediate, its sign. */
int sign;
/* If it is an immediate, is it pc relative. */
int flags = op->format[i]->flags;
int shift = op->format[i]->shift;
int bias = op->format[i]->bias;
- unsigned long long value = 0;
+ uint64_t value = 0;
for (int bf_idx = 0; bf_idx < bf_nb; bf_idx++)
{
int insn_idx = (int) bf[bf_idx].to_offset / 32;
int to_offset = bf[bf_idx].to_offset % 32;
- unsigned long long encoded_value =
+ uint64_t encoded_value =
insn->syllables[insn_idx] >> to_offset;
encoded_value &= (1LL << bf[bf_idx].size) - 1;
value |= encoded_value << bf[bf_idx].from_offset;
}
if (flags & kvxSIGNED)
{
- unsigned long long signbit = 1LL << (width - 1);
+ uint64_t signbit = 1LL << (width - 1);
value = (value ^ signbit) - signbit;
}
value = (value << shift) + bias;
{
if (dec.operands[i].width <= 32)
{
- (*info->fprintf_func) (info->stream, "%d (0x%x)",
- (int) dec.operands[i].val,
- (int) dec.operands[i].val);
+ (*info->fprintf_func) (info->stream, "%" PRId32 " (0x%" PRIx32 ")",
+ (int32_t) dec.operands[i].val,
+ (int32_t) dec.operands[i].val);
}
else
{
- (*info->fprintf_func) (info->stream, "%lld (0x%llx)",
+ (*info->fprintf_func) (info->stream, "%" PRId64 " (0x%" PRIx64 ")",
dec.operands[i].val,
dec.operands[i].val);
}
{
if (dec.operands[i].width <= 32)
{
- (*info->fprintf_func) (info->stream, "%u (0x%x)",
- (unsigned int) dec.operands[i].
+ (*info->fprintf_func) (info->stream, "%" PRIu32 " (0x%" PRIx32 ")",
+ (uint32_t) dec.operands[i].
val,
- (unsigned int) dec.operands[i].
+ (uint32_t) dec.operands[i].
val);
}
else
{
- (*info->fprintf_func) (info->stream, "%llu (0x%llx)",
- (unsigned long long) dec.
+ (*info->fprintf_func) (info->stream, "%" PRIu64 " (0x%" PRIx64 ")",
+ (uint64_t) dec.
operands[i].val,
- (unsigned long long) dec.
+ (uint64_t) dec.
operands[i].val);
}
}
int flags = fmt->flags;
int shift = fmt->shift;
int bias = fmt->bias;
- unsigned long long encoded_value, value = 0;
+ uint64_t encoded_value, value = 0;
for (int bf_idx = 0; bf_idx < bf_nb; bf_idx++)
{
}
if (flags & kvxSIGNED)
{
- unsigned long long signbit = 1LL << (width - 1);
+ uint64_t signbit = 1LL << (width - 1);
value = (value ^ signbit) - signbit;
}
value = (value << shift) + bias;
struct kvx_prologue_epilogue_insn
{
enum kvx_prologue_epilogue_insn_type insn_type;
- unsigned long long immediate;
+ uint64_t immediate;
int gpr_reg[3];
int nb_gprs;
};