Support: Delete {aligned_,}{u,}{little,big}8_t

The byte has no endianness, so these types don't make sense.
uint8_t should be used instead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama 2014-09-11 21:46:33 +00:00
parent 4be836d563
commit f70f3d4708
7 changed files with 60 additions and 81 deletions

View File

@ -215,8 +215,8 @@ struct coff_symbol {
support::ulittle16_t Type;
support::ulittle8_t StorageClass;
support::ulittle8_t NumberOfAuxSymbols;
uint8_t StorageClass;
uint8_t NumberOfAuxSymbols;
};
typedef coff_symbol<support::ulittle16_t> coff_symbol16;
@ -362,12 +362,12 @@ struct coff_aux_section_definition {
support::ulittle16_t NumberOfLinenumbers;
support::ulittle32_t CheckSum;
support::ulittle16_t Number;
support::ulittle8_t Selection;
uint8_t Selection;
};
struct coff_aux_clr_token {
support::ulittle8_t AuxType;
support::ulittle8_t Reserved;
uint8_t AuxType;
uint8_t Reserved;
support::ulittle32_t SymbolTableIndex;
};

View File

@ -353,11 +353,11 @@ struct ExceptionDataRecord {
return makeArrayRef(&Data[Offset], EpilogueCount());
}
ArrayRef<support::ulittle8_t> UnwindByteCode() const {
ArrayRef<uint8_t> UnwindByteCode() const {
const size_t Offset = HeaderWords(*this)
+ (E() ? 0 : EpilogueCount());
const support::ulittle8_t *ByteCode =
reinterpret_cast<const support::ulittle8_t *>(&Data[Offset]);
const uint8_t *ByteCode =
reinterpret_cast<const uint8_t *>(&Data[Offset]);
return makeArrayRef(ByteCode, CodeWords() * sizeof(uint32_t));
}
@ -380,4 +380,3 @@ inline size_t HeaderWords(const ExceptionDataRecord &XR) {
}
#endif

View File

@ -116,8 +116,6 @@ public:
} // end namespace detail
typedef detail::packed_endian_specific_integral
<uint8_t, little, unaligned> ulittle8_t;
typedef detail::packed_endian_specific_integral
<uint16_t, little, unaligned> ulittle16_t;
typedef detail::packed_endian_specific_integral
@ -125,8 +123,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<uint64_t, little, unaligned> ulittle64_t;
typedef detail::packed_endian_specific_integral
<int8_t, little, unaligned> little8_t;
typedef detail::packed_endian_specific_integral
<int16_t, little, unaligned> little16_t;
typedef detail::packed_endian_specific_integral
@ -134,8 +130,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<int64_t, little, unaligned> little64_t;
typedef detail::packed_endian_specific_integral
<uint8_t, little, aligned> aligned_ulittle8_t;
typedef detail::packed_endian_specific_integral
<uint16_t, little, aligned> aligned_ulittle16_t;
typedef detail::packed_endian_specific_integral
@ -143,8 +137,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<uint64_t, little, aligned> aligned_ulittle64_t;
typedef detail::packed_endian_specific_integral
<int8_t, little, aligned> aligned_little8_t;
typedef detail::packed_endian_specific_integral
<int16_t, little, aligned> aligned_little16_t;
typedef detail::packed_endian_specific_integral
@ -152,8 +144,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<int64_t, little, aligned> aligned_little64_t;
typedef detail::packed_endian_specific_integral
<uint8_t, big, unaligned> ubig8_t;
typedef detail::packed_endian_specific_integral
<uint16_t, big, unaligned> ubig16_t;
typedef detail::packed_endian_specific_integral
@ -161,8 +151,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<uint64_t, big, unaligned> ubig64_t;
typedef detail::packed_endian_specific_integral
<int8_t, big, unaligned> big8_t;
typedef detail::packed_endian_specific_integral
<int16_t, big, unaligned> big16_t;
typedef detail::packed_endian_specific_integral
@ -170,8 +158,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<int64_t, big, unaligned> big64_t;
typedef detail::packed_endian_specific_integral
<uint8_t, big, aligned> aligned_ubig8_t;
typedef detail::packed_endian_specific_integral
<uint16_t, big, aligned> aligned_ubig16_t;
typedef detail::packed_endian_specific_integral
@ -179,8 +165,6 @@ typedef detail::packed_endian_specific_integral
typedef detail::packed_endian_specific_integral
<uint64_t, big, aligned> aligned_ubig64_t;
typedef detail::packed_endian_specific_integral
<int8_t, big, aligned> aligned_big8_t;
typedef detail::packed_endian_specific_integral
<int16_t, big, aligned> aligned_big16_t;
typedef detail::packed_endian_specific_integral

View File

@ -40,8 +40,8 @@ enum UnwindOpcodes {
/// or part thereof.
union UnwindCode {
struct {
support::ulittle8_t CodeOffset;
support::ulittle8_t UnwindOpAndOpInfo;
uint8_t CodeOffset;
uint8_t UnwindOpAndOpInfo;
} u;
support::ulittle16_t FrameOffset;
@ -74,10 +74,10 @@ struct RuntimeFunction {
/// UnwindInfo - An entry in the exception table.
struct UnwindInfo {
support::ulittle8_t VersionAndFlags;
support::ulittle8_t PrologSize;
support::ulittle8_t NumCodes;
support::ulittle8_t FrameRegisterAndOffset;
uint8_t VersionAndFlags;
uint8_t PrologSize;
uint8_t NumCodes;
uint8_t FrameRegisterAndOffset;
UnwindCode UnwindCodes[1];
uint8_t getVersion() const {

View File

@ -25,7 +25,6 @@
using namespace llvm;
using namespace object;
using support::ulittle8_t;
using support::ulittle16_t;
using support::ulittle32_t;
using support::little16_t;

View File

@ -233,7 +233,7 @@ ErrorOr<SymbolRef> Decoder::getRelocatedSymbol(const COFFObjectFile &,
return readobj_error::unknown_symbol;
}
bool Decoder::opcode_0xxxxxxx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_0xxxxxxx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint8_t Imm = OC[Offset] & 0x7f;
SW.startLine() << format("0x%02x ; %s sp, #(%u * 4)\n",
@ -244,7 +244,7 @@ bool Decoder::opcode_0xxxxxxx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_10Lxxxxx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_10Lxxxxx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
unsigned Link = (OC[Offset] & 0x20) >> 5;
uint16_t RegisterMask = (Link << (Prologue ? 14 : 15))
@ -263,7 +263,7 @@ bool Decoder::opcode_10Lxxxxx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_1100xxxx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_1100xxxx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
if (Prologue)
SW.startLine() << format("0x%02x ; mov r%u, sp\n",
@ -275,7 +275,7 @@ bool Decoder::opcode_1100xxxx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11010Lxx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11010Lxx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
unsigned Link = (OC[Offset] & 0x4) >> 3;
unsigned Count = (OC[Offset] & 0x3);
@ -292,7 +292,7 @@ bool Decoder::opcode_11010Lxx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11011Lxx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11011Lxx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
unsigned Link = (OC[Offset] & 0x4) >> 2;
unsigned Count = (OC[Offset] & 0x3) + 4;
@ -309,7 +309,7 @@ bool Decoder::opcode_11011Lxx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11100xxx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11100xxx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
unsigned High = (OC[Offset] & 0x7);
uint32_t VFPMask = (((1 << (High + 1)) - 1) << 8);
@ -323,7 +323,7 @@ bool Decoder::opcode_11100xxx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_111010xx(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_111010xx(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint16_t Imm = ((OC[Offset + 0] & 0x03) << 8) | ((OC[Offset + 1] & 0xff) << 0);
@ -336,7 +336,7 @@ bool Decoder::opcode_111010xx(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_1110110L(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_1110110L(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint8_t GPRMask = ((OC[Offset + 0] & 0x01) << (Prologue ? 14 : 15))
| ((OC[Offset + 1] & 0xff) << 0);
@ -350,7 +350,7 @@ bool Decoder::opcode_1110110L(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11101110(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11101110(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
assert(!Prologue && "may not be used in prologue");
@ -366,7 +366,7 @@ bool Decoder::opcode_11101110(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11101111(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11101111(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
assert(!Prologue && "may not be used in prologue");
@ -382,7 +382,7 @@ bool Decoder::opcode_11101111(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11110101(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11110101(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
unsigned Start = (OC[Offset + 1] & 0xf0) >> 4;
unsigned End = (OC[Offset + 1] & 0x0f) >> 0;
@ -397,7 +397,7 @@ bool Decoder::opcode_11110101(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11110110(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11110110(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
unsigned Start = (OC[Offset + 1] & 0xf0) >> 4;
unsigned End = (OC[Offset + 1] & 0x0f) >> 0;
@ -412,7 +412,7 @@ bool Decoder::opcode_11110110(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11110111(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11110111(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint32_t Imm = (OC[Offset + 1] << 8) | (OC[Offset + 2] << 0);
@ -425,7 +425,7 @@ bool Decoder::opcode_11110111(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11111000(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111000(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint32_t Imm = (OC[Offset + 1] << 16)
| (OC[Offset + 2] << 8)
@ -440,7 +440,7 @@ bool Decoder::opcode_11111000(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11111001(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111001(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint32_t Imm = (OC[Offset + 1] << 8) | (OC[Offset + 2] << 0);
@ -453,7 +453,7 @@ bool Decoder::opcode_11111001(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11111010(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111010(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
uint32_t Imm = (OC[Offset + 1] << 16)
| (OC[Offset + 2] << 8)
@ -468,41 +468,41 @@ bool Decoder::opcode_11111010(const ulittle8_t *OC, unsigned &Offset,
return false;
}
bool Decoder::opcode_11111011(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111011(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
SW.startLine() << format("0x%02x ; nop\n", OC[Offset]);
++Offset;
return false;
}
bool Decoder::opcode_11111100(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111100(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
SW.startLine() << format("0x%02x ; nop.w\n", OC[Offset]);
++Offset;
return false;
}
bool Decoder::opcode_11111101(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111101(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
SW.startLine() << format("0x%02x ; b\n", OC[Offset]);
++Offset;
return true;
}
bool Decoder::opcode_11111110(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111110(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
SW.startLine() << format("0x%02x ; b.w\n", OC[Offset]);
++Offset;
return true;
}
bool Decoder::opcode_11111111(const ulittle8_t *OC, unsigned &Offset,
bool Decoder::opcode_11111111(const uint8_t *OC, unsigned &Offset,
unsigned Length, bool Prologue) {
++Offset;
return true;
}
void Decoder::decodeOpcodes(ArrayRef<ulittle8_t> Opcodes, unsigned Offset,
void Decoder::decodeOpcodes(ArrayRef<uint8_t> Opcodes, unsigned Offset,
bool Prologue) {
assert((!Prologue || Offset == 0) && "prologue should always use offset 0");
@ -546,7 +546,7 @@ bool Decoder::dumpXDataRecord(const COFFObjectFile &COFF,
static_cast<uint64_t>(XData.CodeWords() * sizeof(uint32_t)));
if (XData.E()) {
ArrayRef<ulittle8_t> UC = XData.UnwindByteCode();
ArrayRef<uint8_t> UC = XData.UnwindByteCode();
if (!XData.F()) {
ListScope PS(SW, "Prologue");
decodeOpcodes(UC, 0, /*Prologue=*/true);
@ -741,4 +741,3 @@ std::error_code Decoder::dumpProcedureData(const COFFObjectFile &COFF) {
}
}
}

View File

@ -28,55 +28,54 @@ class Decoder {
struct RingEntry {
uint8_t Mask;
uint8_t Value;
bool (Decoder::*Routine)(const support::ulittle8_t *, unsigned &, unsigned,
bool);
bool (Decoder::*Routine)(const uint8_t *, unsigned &, unsigned, bool);
};
static const RingEntry Ring[];
bool opcode_0xxxxxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_0xxxxxxx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_10Lxxxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_10Lxxxxx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_1100xxxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_1100xxxx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11010Lxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11010Lxx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11011Lxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11011Lxx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11100xxx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11100xxx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_111010xx(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_111010xx(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_1110110L(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_1110110L(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11101110(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11101110(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11101111(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11101111(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11110101(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11110101(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11110110(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11110110(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11110111(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11110111(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111000(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111000(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111001(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111001(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111010(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111010(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111011(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111011(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111100(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111100(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111101(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111101(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111110(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111110(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
bool opcode_11111111(const support::ulittle8_t *Opcodes, unsigned &Offset,
bool opcode_11111111(const uint8_t *Opcodes, unsigned &Offset,
unsigned Length, bool Prologue);
void decodeOpcodes(ArrayRef<support::ulittle8_t> Opcodes, unsigned Offset,
void decodeOpcodes(ArrayRef<uint8_t> Opcodes, unsigned Offset,
bool Prologue);
void printRegisters(const std::pair<uint16_t, uint32_t> &RegisterMask);
@ -116,4 +115,3 @@ public:
}
#endif