Merge "Add risc-v support to versioner."

This commit is contained in:
Treehugger Robot 2022-10-04 16:05:42 +00:00 committed by Gerrit Code Review
commit 8d585e2334
5 changed files with 16 additions and 3 deletions

View file

@ -28,6 +28,9 @@ std::string to_string(const Arch& arch) {
case Arch::arm64:
return "arm64";
case Arch::riscv64:
return "riscv64";
case Arch::x86:
return "x86";
@ -41,6 +44,7 @@ std::string to_string(const Arch& arch) {
static const std::unordered_map<std::string, Arch> arch_name_map{
{"arm", Arch::arm},
{"arm64", Arch::arm64},
{"riscv64", Arch::riscv64},
{"x86", Arch::x86},
{"x86_64", Arch::x86_64},
};

View file

@ -28,6 +28,7 @@
enum class Arch : size_t {
arm = 0,
arm64,
riscv64,
x86,
x86_64,
};
@ -121,6 +122,7 @@ class ArchMapIterator {
static const std::set<Arch> supported_archs = {
Arch::arm,
Arch::arm64,
Arch::riscv64,
Arch::x86,
Arch::x86_64,
};
@ -128,17 +130,19 @@ static const std::set<Arch> supported_archs = {
static ArchMap<std::string> arch_targets = {
{ Arch::arm, "arm-linux-androideabi" },
{ Arch::arm64, "aarch64-linux-android" },
{ Arch::riscv64, "riscv64-linux-android" },
{ Arch::x86, "i686-linux-android" },
{ Arch::x86_64, "x86_64-linux-android" },
};
static const std::set<int> default_levels = {
14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30,
14, 15, 16, 17, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34,
};
static const ArchMap<int> arch_min_api = {
{ Arch::arm, 9 },
{ Arch::arm64, 21 },
{ Arch::riscv64, 10000 },
{ Arch::x86, 9 },
{ Arch::x86_64, 21 },
};
@ -160,4 +164,7 @@ static const std::unordered_map<std::string, int> api_codename_map{
{"P", 28},
{"Q", 29},
{"R", 30},
{"S", 31},
{"T", 33},
{"U", 34},
};

View file

@ -170,6 +170,7 @@ class Visitor : public RecursiveASTVisitor<Visitor> {
&arch_availability[Arch::x86].introduced } },
{ "introduced_in_64",
{ &arch_availability[Arch::arm64].introduced,
&arch_availability[Arch::riscv64].introduced,
&arch_availability[Arch::x86_64].introduced } },
};

View file

@ -141,11 +141,12 @@ static std::string generateGuardCondition(const DeclarationAvailability& avail)
static const std::vector<std::pair<std::string, std::set<Arch>>> arch_sets = {
{ "", supported_archs },
{ "!defined(__LP64__)", { Arch::arm, Arch::x86 } },
{ "defined(__LP64__)", { Arch::arm64, Arch::x86_64 } },
{ "defined(__LP64__)", { Arch::arm64, Arch::riscv64, Arch::x86_64 } },
};
std::map<Arch, std::string> individual_archs = {
{ Arch::arm, "defined(__arm__)" },
{ Arch::arm64, "defined(__aarch64__)" },
{ Arch::riscv64, "defined(__riscv)" },
{ Arch::x86, "defined(__i386__)" },
{ Arch::x86_64, "defined(__x86_64__)" },
};

View file

@ -39,5 +39,5 @@ static const std::unordered_map<std::string, std::set<Arch>> ignored_headers = {
{ "sys/_system_properties.h", supported_archs },
// time64.h #errors when included on LP64 archs.
{ "time64.h", { Arch::arm64, Arch::x86_64 } },
{ "time64.h", { Arch::arm64, Arch::riscv64, Arch::x86_64 } },
};