Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Unified Diff: src/arm64/assembler-arm64.h

Issue 1393043003: [arm64] Fix some signed/unsigned type inconsistencies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm64/assembler-arm64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm64/assembler-arm64.h
diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h
index 049cb63c2bd65a1cd2f111d424748fa6cfa4eb80..5667e7dd5cbfb6a77530fb9e379090c0f6216dfd 100644
--- a/src/arm64/assembler-arm64.h
+++ b/src/arm64/assembler-arm64.h
@@ -81,15 +81,15 @@ struct CPURegister {
kNoRegister
};
- static CPURegister Create(unsigned code, unsigned size, RegisterType type) {
+ static CPURegister Create(int code, int size, RegisterType type) {
CPURegister r = {code, size, type};
return r;
}
- unsigned code() const;
+ int code() const;
RegisterType type() const;
RegList Bit() const;
- unsigned SizeInBits() const;
+ int SizeInBits() const;
int SizeInBytes() const;
bool Is32Bits() const;
bool Is64Bits() const;
@@ -118,14 +118,14 @@ struct CPURegister {
bool is(const CPURegister& other) const { return Is(other); }
bool is_valid() const { return IsValid(); }
- unsigned reg_code;
- unsigned reg_size;
+ int reg_code;
+ int reg_size;
RegisterType reg_type;
};
struct Register : public CPURegister {
- static Register Create(unsigned code, unsigned size) {
+ static Register Create(int code, int size) {
return Register(CPURegister::Create(code, size, CPURegister::kRegister));
}
@@ -200,7 +200,7 @@ struct FPRegister : public CPURegister {
kCode_no_reg = -1
};
- static FPRegister Create(unsigned code, unsigned size) {
+ static FPRegister Create(int code, int size) {
return FPRegister(
CPURegister::Create(code, size, CPURegister::kFPRegister));
}
@@ -385,13 +385,13 @@ class CPURegList {
DCHECK(IsValid());
}
- CPURegList(CPURegister::RegisterType type, unsigned size, RegList list)
+ CPURegList(CPURegister::RegisterType type, int size, RegList list)
: list_(list), size_(size), type_(type) {
DCHECK(IsValid());
}
- CPURegList(CPURegister::RegisterType type, unsigned size,
- unsigned first_reg, unsigned last_reg)
+ CPURegList(CPURegister::RegisterType type, int size, int first_reg,
+ int last_reg)
: size_(size), type_(type) {
DCHECK(((type == CPURegister::kRegister) &&
(last_reg < kNumberOfRegisters)) ||
@@ -448,12 +448,12 @@ class CPURegList {
CPURegister PopHighestIndex();
// AAPCS64 callee-saved registers.
- static CPURegList GetCalleeSaved(unsigned size = kXRegSizeInBits);
- static CPURegList GetCalleeSavedFP(unsigned size = kDRegSizeInBits);
+ static CPURegList GetCalleeSaved(int size = kXRegSizeInBits);
+ static CPURegList GetCalleeSavedFP(int size = kDRegSizeInBits);
// AAPCS64 caller-saved registers. Note that this includes lr.
- static CPURegList GetCallerSaved(unsigned size = kXRegSizeInBits);
- static CPURegList GetCallerSavedFP(unsigned size = kDRegSizeInBits);
+ static CPURegList GetCallerSaved(int size = kXRegSizeInBits);
+ static CPURegList GetCallerSavedFP(int size = kDRegSizeInBits);
// Registers saved as safepoints.
static CPURegList GetSafepointSavedRegisters();
@@ -481,25 +481,25 @@ class CPURegList {
return CountSetBits(list_, kRegListSizeInBits);
}
- unsigned RegisterSizeInBits() const {
+ int RegisterSizeInBits() const {
DCHECK(IsValid());
return size_;
}
- unsigned RegisterSizeInBytes() const {
+ int RegisterSizeInBytes() const {
int size_in_bits = RegisterSizeInBits();
DCHECK((size_in_bits % kBitsPerByte) == 0);
return size_in_bits / kBitsPerByte;
}
- unsigned TotalSizeInBytes() const {
+ int TotalSizeInBytes() const {
DCHECK(IsValid());
return RegisterSizeInBytes() * Count();
}
private:
RegList list_;
- unsigned size_;
+ int size_;
CPURegister::RegisterType type_;
bool IsValid() const {
@@ -1121,39 +1121,24 @@ class Assembler : public AssemblerBase {
// Bitfield instructions.
// Bitfield move.
- void bfm(const Register& rd,
- const Register& rn,
- unsigned immr,
- unsigned imms);
+ void bfm(const Register& rd, const Register& rn, int immr, int imms);
// Signed bitfield move.
- void sbfm(const Register& rd,
- const Register& rn,
- unsigned immr,
- unsigned imms);
+ void sbfm(const Register& rd, const Register& rn, int immr, int imms);
// Unsigned bitfield move.
- void ubfm(const Register& rd,
- const Register& rn,
- unsigned immr,
- unsigned imms);
+ void ubfm(const Register& rd, const Register& rn, int immr, int imms);
// Bfm aliases.
// Bitfield insert.
- void bfi(const Register& rd,
- const Register& rn,
- unsigned lsb,
- unsigned width) {
+ void bfi(const Register& rd, const Register& rn, int lsb, int width) {
DCHECK(width >= 1);
DCHECK(lsb + width <= rn.SizeInBits());
bfm(rd, rn, (rd.SizeInBits() - lsb) & (rd.SizeInBits() - 1), width - 1);
}
// Bitfield extract and insert low.
- void bfxil(const Register& rd,
- const Register& rn,
- unsigned lsb,
- unsigned width) {
+ void bfxil(const Register& rd, const Register& rn, int lsb, int width) {
DCHECK(width >= 1);
DCHECK(lsb + width <= rn.SizeInBits());
bfm(rd, rn, lsb, lsb + width - 1);
@@ -1161,26 +1146,20 @@ class Assembler : public AssemblerBase {
// Sbfm aliases.
// Arithmetic shift right.
- void asr(const Register& rd, const Register& rn, unsigned shift) {
+ void asr(const Register& rd, const Register& rn, int shift) {
DCHECK(shift < rd.SizeInBits());
sbfm(rd, rn, shift, rd.SizeInBits() - 1);
}
// Signed bitfield insert in zero.
- void sbfiz(const Register& rd,
- const Register& rn,
- unsigned lsb,
- unsigned width) {
+ void sbfiz(const Register& rd, const Register& rn, int lsb, int width) {
DCHECK(width >= 1);
DCHECK(lsb + width <= rn.SizeInBits());
sbfm(rd, rn, (rd.SizeInBits() - lsb) & (rd.SizeInBits() - 1), width - 1);
}
// Signed bitfield extract.
- void sbfx(const Register& rd,
- const Register& rn,
- unsigned lsb,
- unsigned width) {
+ void sbfx(const Register& rd, const Register& rn, int lsb, int width) {
DCHECK(width >= 1);
DCHECK(lsb + width <= rn.SizeInBits());
sbfm(rd, rn, lsb, lsb + width - 1);
@@ -1203,33 +1182,27 @@ class Assembler : public AssemblerBase {
// Ubfm aliases.
// Logical shift left.
- void lsl(const Register& rd, const Register& rn, unsigned shift) {
- unsigned reg_size = rd.SizeInBits();
+ void lsl(const Register& rd, const Register& rn, int shift) {
+ int reg_size = rd.SizeInBits();
DCHECK(shift < reg_size);
ubfm(rd, rn, (reg_size - shift) % reg_size, reg_size - shift - 1);
}
// Logical shift right.
- void lsr(const Register& rd, const Register& rn, unsigned shift) {
+ void lsr(const Register& rd, const Register& rn, int shift) {
DCHECK(shift < rd.SizeInBits());
ubfm(rd, rn, shift, rd.SizeInBits() - 1);
}
// Unsigned bitfield insert in zero.
- void ubfiz(const Register& rd,
- const Register& rn,
- unsigned lsb,
- unsigned width) {
+ void ubfiz(const Register& rd, const Register& rn, int lsb, int width) {
DCHECK(width >= 1);
DCHECK(lsb + width <= rn.SizeInBits());
ubfm(rd, rn, (rd.SizeInBits() - lsb) & (rd.SizeInBits() - 1), width - 1);
}
// Unsigned bitfield extract.
- void ubfx(const Register& rd,
- const Register& rn,
- unsigned lsb,
- unsigned width) {
+ void ubfx(const Register& rd, const Register& rn, int lsb, int width) {
DCHECK(width >= 1);
DCHECK(lsb + width <= rn.SizeInBits());
ubfm(rd, rn, lsb, lsb + width - 1);
@@ -1251,10 +1224,8 @@ class Assembler : public AssemblerBase {
}
// Extract.
- void extr(const Register& rd,
- const Register& rn,
- const Register& rm,
- unsigned lsb);
+ void extr(const Register& rd, const Register& rn, const Register& rm,
+ int lsb);
// Conditional select: rd = cond ? rn : rm.
void csel(const Register& rd,
« no previous file with comments | « no previous file | src/arm64/assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698