mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 13:50:11 +00:00
[Statepoint][NFC] Use uint16_t and add an assert (#78717)
Use a fixed width integer type and assert that DwarRegNum fits the 16 bits. This is a follow up to review comments on #78600.
This commit is contained in:
parent
5954b9dca2
commit
0388ab3e29
@ -259,7 +259,7 @@ private:
|
|||||||
class StackMaps {
|
class StackMaps {
|
||||||
public:
|
public:
|
||||||
struct Location {
|
struct Location {
|
||||||
enum LocationType : unsigned short {
|
enum LocationType : uint16_t {
|
||||||
Unprocessed,
|
Unprocessed,
|
||||||
Register,
|
Register,
|
||||||
Direct,
|
Direct,
|
||||||
@ -268,24 +268,22 @@ public:
|
|||||||
ConstantIndex
|
ConstantIndex
|
||||||
};
|
};
|
||||||
LocationType Type = Unprocessed;
|
LocationType Type = Unprocessed;
|
||||||
unsigned short Size = 0;
|
uint16_t Size = 0;
|
||||||
unsigned short Reg = 0;
|
uint16_t Reg = 0;
|
||||||
int32_t Offset = 0;
|
int32_t Offset = 0;
|
||||||
|
|
||||||
Location() = default;
|
Location() = default;
|
||||||
Location(LocationType Type, unsigned short Size, unsigned short Reg,
|
Location(LocationType Type, uint16_t Size, uint16_t Reg, int32_t Offset)
|
||||||
int32_t Offset)
|
|
||||||
: Type(Type), Size(Size), Reg(Reg), Offset(Offset) {}
|
: Type(Type), Size(Size), Reg(Reg), Offset(Offset) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LiveOutReg {
|
struct LiveOutReg {
|
||||||
unsigned short Reg = 0;
|
uint16_t Reg = 0;
|
||||||
unsigned short DwarfRegNum = 0;
|
uint16_t DwarfRegNum = 0;
|
||||||
unsigned short Size = 0;
|
uint16_t Size = 0;
|
||||||
|
|
||||||
LiveOutReg() = default;
|
LiveOutReg() = default;
|
||||||
LiveOutReg(unsigned short Reg, unsigned short DwarfRegNum,
|
LiveOutReg(uint16_t Reg, uint16_t DwarfRegNum, uint16_t Size)
|
||||||
unsigned short Size)
|
|
||||||
: Reg(Reg), DwarfRegNum(DwarfRegNum), Size(Size) {}
|
: Reg(Reg), DwarfRegNum(DwarfRegNum), Size(Size) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ static unsigned getDwarfRegNum(unsigned Reg, const TargetRegisterInfo *TRI) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(RegNum >= 0 && "Invalid Dwarf register number.");
|
assert(RegNum >= 0 && isUInt<16>(RegNum) && "Invalid Dwarf register number.");
|
||||||
return (unsigned)RegNum;
|
return (unsigned)RegNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user