mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
tools: remove unnecessary copy of array_lengthof
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206115 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
15c435a367
commit
2ef2fd45b8
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include "ARMAttributeParser.h"
|
#include "ARMAttributeParser.h"
|
||||||
#include "StreamWriter.h"
|
#include "StreamWriter.h"
|
||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Support/LEB128.h"
|
#include "llvm/Support/LEB128.h"
|
||||||
|
|
||||||
@ -22,11 +23,6 @@ static const EnumEntry<unsigned> TagNames[] = {
|
|||||||
{ "Tag_Symbol", ARMBuildAttrs::Symbol },
|
{ "Tag_Symbol", ARMBuildAttrs::Symbol },
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename type_, size_t size_>
|
|
||||||
size_t countof(const type_ (&)[size_]) {
|
|
||||||
return size_;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
#define ATTRIBUTE_HANDLER(Attr_) \
|
#define ATTRIBUTE_HANDLER(Attr_) \
|
||||||
{ ARMBuildAttrs::Attr_, &ARMAttributeParser::Attr_ }
|
{ ARMBuildAttrs::Attr_, &ARMAttributeParser::Attr_ }
|
||||||
@ -129,7 +125,8 @@ void ARMAttributeParser::CPU_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +152,8 @@ void ARMAttributeParser::ARM_ISA_use(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "Permitted" };
|
static const char *Strings[] = { "Not Permitted", "Permitted" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +162,8 @@ void ARMAttributeParser::THUMB_ISA_use(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "Thumb-1", "Thumb-2" };
|
static const char *Strings[] = { "Not Permitted", "Thumb-1", "Thumb-2" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +175,8 @@ void ARMAttributeParser::FP_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,8 @@ void ARMAttributeParser::WMMX_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "WMMXv1", "WMMXv2" };
|
static const char *Strings[] = { "Not Permitted", "WMMXv1", "WMMXv2" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +197,8 @@ void ARMAttributeParser::Advanced_SIMD_arch(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +210,8 @@ void ARMAttributeParser::PCS_config(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +220,8 @@ void ARMAttributeParser::ABI_PCS_R9_use(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "v6", "Static Base", "TLS", "Unused" };
|
static const char *Strings[] = { "v6", "Static Base", "TLS", "Unused" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +232,8 @@ void ARMAttributeParser::ABI_PCS_RW_data(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +242,8 @@ void ARMAttributeParser::ABI_PCS_RO_data(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Absolute", "PC-relative", "Not Permitted" };
|
static const char *Strings[] = { "Absolute", "PC-relative", "Not Permitted" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,7 +252,8 @@ void ARMAttributeParser::ABI_PCS_GOT_use(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "Direct", "GOT-Indirect" };
|
static const char *Strings[] = { "Not Permitted", "Direct", "GOT-Indirect" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +264,8 @@ void ARMAttributeParser::ABI_PCS_wchar_t(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +274,8 @@ void ARMAttributeParser::ABI_FP_rounding(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "IEEE-754", "Runtime" };
|
static const char *Strings[] = { "IEEE-754", "Runtime" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +284,8 @@ void ARMAttributeParser::ABI_FP_denormal(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Unsupported", "IEEE-754", "Sign Only" };
|
static const char *Strings[] = { "Unsupported", "IEEE-754", "Sign Only" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,7 +294,8 @@ void ARMAttributeParser::ABI_FP_exceptions(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "IEEE-754" };
|
static const char *Strings[] = { "Not Permitted", "IEEE-754" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,7 +305,8 @@ void ARMAttributeParser::ABI_FP_user_exceptions(AttrType Tag,
|
|||||||
static const char *Strings[] = { "Not Permitted", "IEEE-754" };
|
static const char *Strings[] = { "Not Permitted", "IEEE-754" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +317,8 @@ void ARMAttributeParser::ABI_FP_number_model(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +331,7 @@ void ARMAttributeParser::ABI_align_needed(AttrType Tag, const uint8_t *Data,
|
|||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
|
|
||||||
std::string Description;
|
std::string Description;
|
||||||
if (Value < countof(Strings))
|
if (Value < array_lengthof(Strings))
|
||||||
Description = std::string(Strings[Value]);
|
Description = std::string(Strings[Value]);
|
||||||
else if (Value <= 12)
|
else if (Value <= 12)
|
||||||
Description = std::string("8-byte alignment, ") + utostr(1 << Value)
|
Description = std::string("8-byte alignment, ") + utostr(1 << Value)
|
||||||
@ -339,7 +352,7 @@ void ARMAttributeParser::ABI_align_preserved(AttrType Tag, const uint8_t *Data,
|
|||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
|
|
||||||
std::string Description;
|
std::string Description;
|
||||||
if (Value < countof(Strings))
|
if (Value < array_lengthof(Strings))
|
||||||
Description = std::string(Strings[Value]);
|
Description = std::string(Strings[Value]);
|
||||||
else if (Value <= 12)
|
else if (Value <= 12)
|
||||||
Description = std::string("8-byte stack alignment, ") + utostr(1 << Value)
|
Description = std::string("8-byte stack alignment, ") + utostr(1 << Value)
|
||||||
@ -357,7 +370,8 @@ void ARMAttributeParser::ABI_enum_size(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,7 +382,8 @@ void ARMAttributeParser::ABI_HardFP_use(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +394,8 @@ void ARMAttributeParser::ABI_VFP_args(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,7 +404,8 @@ void ARMAttributeParser::ABI_WMMX_args(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "AAPCS", "iWMMX", "Custom" };
|
static const char *Strings[] = { "AAPCS", "iWMMX", "Custom" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +418,8 @@ void ARMAttributeParser::ABI_optimization_goals(AttrType Tag,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,7 +432,8 @@ void ARMAttributeParser::ABI_FP_optimization_goals(AttrType Tag,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +464,8 @@ void ARMAttributeParser::CPU_unaligned_access(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "v6-style" };
|
static const char *Strings[] = { "Not Permitted", "v6-style" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -454,7 +474,8 @@ void ARMAttributeParser::FP_HP_extension(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "If Available", "Permitted" };
|
static const char *Strings[] = { "If Available", "Permitted" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +484,8 @@ void ARMAttributeParser::ABI_FP_16bit_format(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "IEEE-754", "VFPv3" };
|
static const char *Strings[] = { "Not Permitted", "IEEE-754", "VFPv3" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,7 +494,8 @@ void ARMAttributeParser::MPextension_use(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "Permitted" };
|
static const char *Strings[] = { "Not Permitted", "Permitted" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +506,8 @@ void ARMAttributeParser::DIV_use(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,7 +516,8 @@ void ARMAttributeParser::T2EE_use(AttrType Tag, const uint8_t *Data,
|
|||||||
static const char *Strings[] = { "Not Permitted", "Permitted" };
|
static const char *Strings[] = { "Not Permitted", "Permitted" };
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,7 +529,8 @@ void ARMAttributeParser::Virtualization_use(AttrType Tag, const uint8_t *Data,
|
|||||||
};
|
};
|
||||||
|
|
||||||
uint64_t Value = ParseInteger(Data, Offset);
|
uint64_t Value = ParseInteger(Data, Offset);
|
||||||
StringRef ValueDesc = (Value < countof(Strings)) ? Strings[Value] : NULL;
|
StringRef ValueDesc =
|
||||||
|
(Value < array_lengthof(Strings)) ? Strings[Value] : NULL;
|
||||||
PrintAttribute(Tag, Value, ValueDesc);
|
PrintAttribute(Tag, Value, ValueDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +560,7 @@ void ARMAttributeParser::ParseAttributeList(const uint8_t *Data,
|
|||||||
Offset += Length;
|
Offset += Length;
|
||||||
|
|
||||||
bool Handled = false;
|
bool Handled = false;
|
||||||
for (unsigned AHI = 0, AHE = countof(DisplayRoutines);
|
for (unsigned AHI = 0, AHE = array_lengthof(DisplayRoutines);
|
||||||
AHI != AHE && !Handled; ++AHI) {
|
AHI != AHE && !Handled; ++AHI) {
|
||||||
if (DisplayRoutines[AHI].Attribute == Tag) {
|
if (DisplayRoutines[AHI].Attribute == Tag) {
|
||||||
(this->*DisplayRoutines[AHI].Routine)(ARMBuildAttrs::AttrType(Tag),
|
(this->*DisplayRoutines[AHI].Routine)(ARMBuildAttrs::AttrType(Tag),
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "Error.h"
|
#include "Error.h"
|
||||||
#include "StreamWriter.h"
|
#include "StreamWriter.h"
|
||||||
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/Object/ELF.h"
|
#include "llvm/Object/ELF.h"
|
||||||
#include "llvm/Object/ELFTypes.h"
|
#include "llvm/Object/ELFTypes.h"
|
||||||
#include "llvm/Support/ARMEHABI.h"
|
#include "llvm/Support/ARMEHABI.h"
|
||||||
@ -20,13 +21,6 @@
|
|||||||
#include "llvm/Support/Format.h"
|
#include "llvm/Support/Format.h"
|
||||||
#include "llvm/Support/type_traits.h"
|
#include "llvm/Support/type_traits.h"
|
||||||
|
|
||||||
namespace {
|
|
||||||
template <typename type_, size_t N>
|
|
||||||
size_t countof(const type_ (&)[N]) {
|
|
||||||
return N;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
namespace ARM {
|
namespace ARM {
|
||||||
namespace EHABI {
|
namespace EHABI {
|
||||||
@ -296,7 +290,8 @@ void OpcodeDecoder::PrintRegisters(uint32_t VFPMask, StringRef Prefix) {
|
|||||||
void OpcodeDecoder::Decode(const uint8_t *Opcodes, off_t Offset, size_t Length) {
|
void OpcodeDecoder::Decode(const uint8_t *Opcodes, off_t Offset, size_t Length) {
|
||||||
for (unsigned OCI = Offset; OCI < Length + Offset; ) {
|
for (unsigned OCI = Offset; OCI < Length + Offset; ) {
|
||||||
bool Decoded = false;
|
bool Decoded = false;
|
||||||
for (unsigned REI = 0, REE = countof(Ring); REI != REE && !Decoded; ++REI) {
|
for (unsigned REI = 0, REE = array_lengthof(Ring);
|
||||||
|
REI != REE && !Decoded; ++REI) {
|
||||||
if ((Opcodes[OCI ^ 3] & Ring[REI].Mask) == Ring[REI].Value) {
|
if ((Opcodes[OCI ^ 3] & Ring[REI].Mask) == Ring[REI].Value) {
|
||||||
(this->*Ring[REI].Routine)(Opcodes, OCI);
|
(this->*Ring[REI].Routine)(Opcodes, OCI);
|
||||||
Decoded = true;
|
Decoded = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user