@@ -396,10 +396,10 @@ print_token (struct token_s token, char *buf, int bufsz)
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:
@@ -414,8 +414,8 @@ promote_token (struct token_s tok)
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
@@ -451,7 +451,7 @@ is_insn (const struct token_s *token, struct token_class *classes)
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;
@@ -519,12 +519,12 @@ get_token_class (struct token_s *token, struct token_classes *classes, int insn_
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
@@ -821,7 +821,7 @@ retry:;
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);
@@ -871,7 +871,7 @@ retry:;
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)));
@@ -458,7 +458,7 @@ static int
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;
@@ -570,7 +570,7 @@ insert_operand (struct kvxinsn *insn, struct kvx_operand *opdef,
{
/* 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;
}
@@ -661,8 +661,8 @@ insert_operand (struct kvxinsn *insn, struct kvx_operand *opdef,
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;
@@ -46,15 +46,15 @@ struct token_s {
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;
@@ -64,7 +64,7 @@ struct token_list
struct token_class {
const char ** class_values;
- long long class_id;
+ int64_t class_id;
int sz;
};
@@ -539,7 +539,7 @@ struct decoded_insn
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. */
@@ -593,20 +593,20 @@ decode_insn (bfd_vma memaddr, insn_t * insn, struct decoded_insn *res)
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;
@@ -1126,13 +1126,13 @@ print_insn_kvx (bfd_vma memaddr, struct disassemble_info *info)
{
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);
}
@@ -1141,18 +1141,18 @@ print_insn_kvx (bfd_vma memaddr, struct disassemble_info *info)
{
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);
}
}
@@ -1317,7 +1317,7 @@ decode_prologue_epilogue_bundle (bfd_vma memaddr,
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++)
{
@@ -1329,7 +1329,7 @@ decode_prologue_epilogue_bundle (bfd_vma memaddr,
}
if (flags & kvxSIGNED)
{
- unsigned long long signbit = 1LL << (width - 1);
+ uint64_t signbit = 1LL << (width - 1);
value = (value ^ signbit) - signbit;
}
value = (value << shift) + bias;
@@ -45,7 +45,7 @@ enum kvx_prologue_epilogue_insn_type
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;
};