TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
//===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements a target parser to recognise hardware features such as
|
|
|
|
// FPU/CPU/ARCH names as well as specific support such as HDIV, etc.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Support/ARMBuildAttributes.h"
|
|
|
|
#include "llvm/Support/TargetParser.h"
|
|
|
|
#include "llvm/ADT/StringExtras.h"
|
|
|
|
#include "llvm/ADT/StringSwitch.h"
|
2015-11-19 00:32:12 +08:00
|
|
|
#include "llvm/ADT/Twine.h"
|
2015-05-23 04:43:30 +08:00
|
|
|
#include <cctype>
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
|
|
|
|
using namespace llvm;
|
2015-08-30 13:27:31 +08:00
|
|
|
using namespace ARM;
|
2016-05-25 20:02:33 +08:00
|
|
|
using namespace AArch64;
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2015-06-05 21:29:24 +08:00
|
|
|
// List of canonical FPU names (use getFPUSynonym) and which architectural
|
|
|
|
// features they correspond to (use getFPUFeatures).
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
// FIXME: TableGen this.
|
2015-06-29 17:32:29 +08:00
|
|
|
// The entries must appear in the order listed in ARM::FPUKind for correct indexing
|
2015-11-16 20:08:05 +08:00
|
|
|
static const struct {
|
2015-08-30 15:51:04 +08:00
|
|
|
const char *NameCStr;
|
|
|
|
size_t NameLength;
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
ARM::FPUKind ID;
|
2015-06-29 17:32:29 +08:00
|
|
|
ARM::FPUVersion FPUVersion;
|
2015-06-05 21:29:24 +08:00
|
|
|
ARM::NeonSupportLevel NeonSupport;
|
|
|
|
ARM::FPURestriction Restriction;
|
2015-08-30 15:51:04 +08:00
|
|
|
|
|
|
|
StringRef getName() const { return StringRef(NameCStr, NameLength); }
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
} FPUNames[] = {
|
2015-08-30 13:27:31 +08:00
|
|
|
#define ARM_FPU(NAME, KIND, VERSION, NEON_SUPPORT, RESTRICTION) \
|
2015-08-30 15:51:04 +08:00
|
|
|
{ NAME, sizeof(NAME) - 1, KIND, VERSION, NEON_SUPPORT, RESTRICTION },
|
2015-08-30 13:27:31 +08:00
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
};
|
2015-06-05 21:29:24 +08:00
|
|
|
|
2015-05-28 02:15:37 +08:00
|
|
|
// List of canonical arch names (use getArchSynonym).
|
|
|
|
// This table also provides the build attribute fields for CPU arch
|
|
|
|
// and Arch ID, according to the Addenda to the ARM ABI, chapters
|
|
|
|
// 2.4 and 2.3.5.2 respectively.
|
2015-05-28 23:05:18 +08:00
|
|
|
// FIXME: SubArch values were simplified to fit into the expectations
|
|
|
|
// of the triples and are not conforming with their official names.
|
|
|
|
// Check to see if the expectation should be changed.
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
// FIXME: TableGen this.
|
2016-07-28 14:11:18 +08:00
|
|
|
template <typename T> struct ArchNames {
|
2015-08-30 15:51:04 +08:00
|
|
|
const char *NameCStr;
|
|
|
|
size_t NameLength;
|
|
|
|
const char *CPUAttrCStr;
|
|
|
|
size_t CPUAttrLength;
|
|
|
|
const char *SubArchCStr;
|
|
|
|
size_t SubArchLength;
|
2015-11-16 19:15:22 +08:00
|
|
|
unsigned DefaultFPU;
|
2015-09-06 01:05:33 +08:00
|
|
|
unsigned ArchBaseExtensions;
|
2016-07-28 14:11:18 +08:00
|
|
|
T ID;
|
2015-12-15 05:57:05 +08:00
|
|
|
ARMBuildAttrs::CPUArch ArchAttr; // Arch ID in build attributes.
|
2015-08-30 15:51:04 +08:00
|
|
|
|
|
|
|
StringRef getName() const { return StringRef(NameCStr, NameLength); }
|
|
|
|
|
|
|
|
// CPU class in build attributes.
|
|
|
|
StringRef getCPUAttr() const { return StringRef(CPUAttrCStr, CPUAttrLength); }
|
|
|
|
|
|
|
|
// Sub-Arch name.
|
|
|
|
StringRef getSubArch() const { return StringRef(SubArchCStr, SubArchLength); }
|
2016-07-28 14:11:18 +08:00
|
|
|
};
|
|
|
|
ArchNames<ARM::ArchKind> ARCHNames[] = {
|
2015-11-16 19:15:22 +08:00
|
|
|
#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU, ARCH_BASE_EXT) \
|
2015-12-15 05:57:05 +08:00
|
|
|
{NAME, sizeof(NAME) - 1, CPU_ATTR, sizeof(CPU_ATTR) - 1, SUB_ARCH, \
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
sizeof(SUB_ARCH) - 1, ARCH_FPU, ARCH_BASE_EXT, ARM::ArchKind::ID, ARCH_ATTR},
|
2015-08-30 13:27:31 +08:00
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
};
|
2015-08-30 15:51:04 +08:00
|
|
|
|
2016-07-28 14:11:18 +08:00
|
|
|
ArchNames<AArch64::ArchKind> AArch64ARCHNames[] = {
|
|
|
|
#define AARCH64_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU, ARCH_BASE_EXT) \
|
|
|
|
{NAME, sizeof(NAME) - 1, CPU_ATTR, sizeof(CPU_ATTR) - 1, SUB_ARCH, \
|
|
|
|
sizeof(SUB_ARCH) - 1, ARCH_FPU, ARCH_BASE_EXT, AArch64::ArchKind::ID, ARCH_ATTR},
|
|
|
|
#include "llvm/Support/AArch64TargetParser.def"
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-05-28 16:59:03 +08:00
|
|
|
// List of Arch Extension names.
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
// FIXME: TableGen this.
|
2015-11-16 20:08:05 +08:00
|
|
|
static const struct {
|
2015-08-30 15:51:04 +08:00
|
|
|
const char *NameCStr;
|
|
|
|
size_t NameLength;
|
2015-07-28 06:26:59 +08:00
|
|
|
unsigned ID;
|
2015-11-19 00:32:12 +08:00
|
|
|
const char *Feature;
|
|
|
|
const char *NegFeature;
|
2015-08-30 15:51:04 +08:00
|
|
|
|
|
|
|
StringRef getName() const { return StringRef(NameCStr, NameLength); }
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
} ARCHExtNames[] = {
|
2015-11-19 00:32:12 +08:00
|
|
|
#define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) \
|
|
|
|
{ NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE },
|
2015-08-30 13:27:31 +08:00
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
2016-05-25 20:02:33 +08:00
|
|
|
},AArch64ARCHExtNames[] = {
|
|
|
|
#define AARCH64_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) \
|
|
|
|
{ NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE },
|
|
|
|
#include "llvm/Support/AArch64TargetParser.def"
|
2015-07-28 06:26:59 +08:00
|
|
|
};
|
2015-08-30 15:51:04 +08:00
|
|
|
|
2015-07-28 06:26:59 +08:00
|
|
|
// List of HWDiv names (use getHWDivSynonym) and which architectural
|
|
|
|
// features they correspond to (use getHWDivFeatures).
|
|
|
|
// FIXME: TableGen this.
|
2015-11-16 20:08:05 +08:00
|
|
|
static const struct {
|
2015-08-30 15:51:04 +08:00
|
|
|
const char *NameCStr;
|
|
|
|
size_t NameLength;
|
2015-07-28 06:26:59 +08:00
|
|
|
unsigned ID;
|
2015-08-30 15:51:04 +08:00
|
|
|
|
|
|
|
StringRef getName() const { return StringRef(NameCStr, NameLength); }
|
2015-07-28 06:26:59 +08:00
|
|
|
} HWDivNames[] = {
|
2015-08-30 15:51:04 +08:00
|
|
|
#define ARM_HW_DIV_NAME(NAME, ID) { NAME, sizeof(NAME) - 1, ID },
|
2015-08-30 13:27:31 +08:00
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
};
|
2015-08-30 15:51:04 +08:00
|
|
|
|
2015-05-20 23:05:07 +08:00
|
|
|
// List of CPU names and their arches.
|
|
|
|
// The same CPU can have multiple arches and can be default on multiple arches.
|
|
|
|
// When finding the Arch for a CPU, first-found prevails. Sort them accordingly.
|
2015-05-28 20:10:37 +08:00
|
|
|
// When this becomes table-generated, we'd probably need two tables.
|
2015-05-20 23:05:07 +08:00
|
|
|
// FIXME: TableGen this.
|
2016-07-28 14:11:18 +08:00
|
|
|
template <typename T> struct CpuNames {
|
2015-08-30 15:51:04 +08:00
|
|
|
const char *NameCStr;
|
|
|
|
size_t NameLength;
|
2016-07-28 14:11:18 +08:00
|
|
|
T ArchID;
|
2015-07-15 18:46:21 +08:00
|
|
|
bool Default; // is $Name the default CPU for $ArchID ?
|
2015-09-06 01:05:33 +08:00
|
|
|
unsigned DefaultExtensions;
|
2015-08-30 15:51:04 +08:00
|
|
|
|
|
|
|
StringRef getName() const { return StringRef(NameCStr, NameLength); }
|
2016-07-28 14:11:18 +08:00
|
|
|
};
|
|
|
|
CpuNames<ARM::ArchKind> CPUNames[] = {
|
2015-09-06 01:05:33 +08:00
|
|
|
#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
{ NAME, sizeof(NAME) - 1, ARM::ArchKind::ID, IS_DEFAULT, DEFAULT_EXT },
|
2015-08-30 13:27:31 +08:00
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
2015-05-20 23:05:07 +08:00
|
|
|
};
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
|
2016-07-28 14:11:18 +08:00
|
|
|
CpuNames<AArch64::ArchKind> AArch64CPUNames[] = {
|
|
|
|
#define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
|
|
|
|
{ NAME, sizeof(NAME) - 1, AArch64::ArchKind::ID, IS_DEFAULT, DEFAULT_EXT },
|
|
|
|
#include "llvm/Support/AArch64TargetParser.def"
|
|
|
|
};
|
|
|
|
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
} // namespace
|
|
|
|
|
|
|
|
// ======================================================= //
|
|
|
|
// Information by ID
|
|
|
|
// ======================================================= //
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef ARM::getFPUName(unsigned FPUKind) {
|
2015-05-20 23:05:07 +08:00
|
|
|
if (FPUKind >= ARM::FK_LAST)
|
2015-08-30 15:51:04 +08:00
|
|
|
return StringRef();
|
|
|
|
return FPUNames[FPUKind].getName();
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
FPUVersion ARM::getFPUVersion(unsigned FPUKind) {
|
2015-06-05 21:29:24 +08:00
|
|
|
if (FPUKind >= ARM::FK_LAST)
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return FPUVersion::NONE;
|
2015-06-05 21:29:24 +08:00
|
|
|
return FPUNames[FPUKind].FPUVersion;
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::NeonSupportLevel ARM::getFPUNeonSupportLevel(unsigned FPUKind) {
|
2015-06-05 21:29:24 +08:00
|
|
|
if (FPUKind >= ARM::FK_LAST)
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::NeonSupportLevel::None;
|
2015-06-05 21:29:24 +08:00
|
|
|
return FPUNames[FPUKind].NeonSupport;
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::FPURestriction ARM::getFPURestriction(unsigned FPUKind) {
|
2015-06-05 21:29:24 +08:00
|
|
|
if (FPUKind >= ARM::FK_LAST)
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::FPURestriction::None;
|
2015-06-05 21:29:24 +08:00
|
|
|
return FPUNames[FPUKind].Restriction;
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
unsigned llvm::ARM::getDefaultFPU(StringRef CPU, ArchKind AK) {
|
2015-11-16 19:15:22 +08:00
|
|
|
if (CPU == "generic")
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARCHNames[static_cast<unsigned>(AK)].DefaultFPU;
|
2015-11-16 19:15:22 +08:00
|
|
|
|
2015-08-30 17:01:38 +08:00
|
|
|
return StringSwitch<unsigned>(CPU)
|
2015-09-06 01:05:33 +08:00
|
|
|
#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
|
2015-08-30 17:01:38 +08:00
|
|
|
.Case(NAME, DEFAULT_FPU)
|
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
|
|
|
.Default(ARM::FK_INVALID);
|
2015-07-15 18:46:21 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
unsigned llvm::ARM::getDefaultExtensions(StringRef CPU, ArchKind AK) {
|
2015-11-16 20:08:05 +08:00
|
|
|
if (CPU == "generic")
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARCHNames[static_cast<unsigned>(AK)].ArchBaseExtensions;
|
2015-11-16 20:08:05 +08:00
|
|
|
|
|
|
|
return StringSwitch<unsigned>(CPU)
|
|
|
|
#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
.Case(NAME, ARCHNames[static_cast<unsigned>(ARM::ArchKind::ID)]\
|
|
|
|
.ArchBaseExtensions | DEFAULT_EXT)
|
2015-11-16 20:08:05 +08:00
|
|
|
#include "llvm/Support/ARMTargetParser.def"
|
|
|
|
.Default(ARM::AEK_INVALID);
|
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
bool llvm::ARM::getHWDivFeatures(unsigned HWDivKind,
|
2016-10-07 16:37:29 +08:00
|
|
|
std::vector<StringRef> &Features) {
|
2015-07-28 06:26:59 +08:00
|
|
|
|
|
|
|
if (HWDivKind == ARM::AEK_INVALID)
|
|
|
|
return false;
|
|
|
|
|
2015-08-30 10:17:15 +08:00
|
|
|
if (HWDivKind & ARM::AEK_HWDIVARM)
|
2015-07-28 06:26:59 +08:00
|
|
|
Features.push_back("+hwdiv-arm");
|
|
|
|
else
|
|
|
|
Features.push_back("-hwdiv-arm");
|
|
|
|
|
2017-04-20 17:38:25 +08:00
|
|
|
if (HWDivKind & ARM::AEK_HWDIVTHUMB)
|
2015-07-28 06:26:59 +08:00
|
|
|
Features.push_back("+hwdiv");
|
|
|
|
else
|
|
|
|
Features.push_back("-hwdiv");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-06 01:05:33 +08:00
|
|
|
bool llvm::ARM::getExtensionFeatures(unsigned Extensions,
|
2016-10-07 16:37:29 +08:00
|
|
|
std::vector<StringRef> &Features) {
|
2015-09-06 01:05:33 +08:00
|
|
|
|
|
|
|
if (Extensions == ARM::AEK_INVALID)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (Extensions & ARM::AEK_CRC)
|
|
|
|
Features.push_back("+crc");
|
|
|
|
else
|
|
|
|
Features.push_back("-crc");
|
|
|
|
|
2015-09-25 01:31:16 +08:00
|
|
|
if (Extensions & ARM::AEK_DSP)
|
2015-10-24 01:19:19 +08:00
|
|
|
Features.push_back("+dsp");
|
2015-09-25 01:31:16 +08:00
|
|
|
else
|
2015-10-24 01:19:19 +08:00
|
|
|
Features.push_back("-dsp");
|
2015-09-25 01:31:16 +08:00
|
|
|
|
2015-09-06 01:05:33 +08:00
|
|
|
return getHWDivFeatures(Extensions, Features);
|
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
bool llvm::ARM::getFPUFeatures(unsigned FPUKind,
|
2016-10-07 16:37:29 +08:00
|
|
|
std::vector<StringRef> &Features) {
|
2015-06-05 21:29:24 +08:00
|
|
|
|
|
|
|
if (FPUKind >= ARM::FK_LAST || FPUKind == ARM::FK_INVALID)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// fp-only-sp and d16 subtarget features are independent of each other, so we
|
|
|
|
// must enable/disable both.
|
|
|
|
switch (FPUNames[FPUKind].Restriction) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPURestriction::SP_D16:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+fp-only-sp");
|
|
|
|
Features.push_back("+d16");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPURestriction::D16:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-fp-only-sp");
|
|
|
|
Features.push_back("+d16");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPURestriction::None:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-fp-only-sp");
|
|
|
|
Features.push_back("-d16");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FPU version subtarget features are inclusive of lower-numbered ones, so
|
|
|
|
// enable the one corresponding to this version and disable all that are
|
2015-06-12 17:38:51 +08:00
|
|
|
// higher. We also have to make sure to disable fp16 when vfp4 is disabled,
|
|
|
|
// as +vfp4 implies +fp16 but -vfp4 does not imply -fp16.
|
2015-06-05 21:29:24 +08:00
|
|
|
switch (FPUNames[FPUKind].FPUVersion) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPUVersion::VFPV5:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+fp-armv8");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPUVersion::VFPV4:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+vfp4");
|
|
|
|
Features.push_back("-fp-armv8");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPUVersion::VFPV3_FP16:
|
2015-06-29 17:32:29 +08:00
|
|
|
Features.push_back("+vfp3");
|
|
|
|
Features.push_back("+fp16");
|
|
|
|
Features.push_back("-vfp4");
|
|
|
|
Features.push_back("-fp-armv8");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPUVersion::VFPV3:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+vfp3");
|
2015-06-12 17:38:51 +08:00
|
|
|
Features.push_back("-fp16");
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-vfp4");
|
|
|
|
Features.push_back("-fp-armv8");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPUVersion::VFPV2:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+vfp2");
|
|
|
|
Features.push_back("-vfp3");
|
2015-06-12 17:38:51 +08:00
|
|
|
Features.push_back("-fp16");
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-vfp4");
|
|
|
|
Features.push_back("-fp-armv8");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::FPUVersion::NONE:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-vfp2");
|
|
|
|
Features.push_back("-vfp3");
|
2015-06-12 17:38:51 +08:00
|
|
|
Features.push_back("-fp16");
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-vfp4");
|
|
|
|
Features.push_back("-fp-armv8");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
// crypto includes neon, so we handle this similarly to FPU version.
|
|
|
|
switch (FPUNames[FPUKind].NeonSupport) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::NeonSupportLevel::Crypto:
|
2015-09-06 01:05:33 +08:00
|
|
|
Features.push_back("+neon");
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+crypto");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::NeonSupportLevel::Neon:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("+neon");
|
|
|
|
Features.push_back("-crypto");
|
|
|
|
break;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::NeonSupportLevel::None:
|
2015-06-05 21:29:24 +08:00
|
|
|
Features.push_back("-neon");
|
|
|
|
Features.push_back("-crypto");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef llvm::ARM::getArchName(ArchKind AK) {
|
|
|
|
return ARCHNames[static_cast<unsigned>(AK)].getName();
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef llvm::ARM::getCPUAttr(ArchKind AK) {
|
|
|
|
return ARCHNames[static_cast<unsigned>(AK)].getCPUAttr();
|
2015-05-20 23:05:07 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef llvm::ARM::getSubArch(ArchKind AK) {
|
|
|
|
return ARCHNames[static_cast<unsigned>(AK)].getSubArch();
|
2015-05-28 23:05:18 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
unsigned llvm::ARM::getArchAttr(ArchKind AK) {
|
|
|
|
return ARCHNames[static_cast<unsigned>(AK)].ArchAttr;
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2015-08-30 15:51:04 +08:00
|
|
|
StringRef llvm::ARM::getArchExtName(unsigned ArchExtKind) {
|
2015-07-28 06:26:59 +08:00
|
|
|
for (const auto AE : ARCHExtNames) {
|
|
|
|
if (ArchExtKind == AE.ID)
|
2015-08-30 15:51:04 +08:00
|
|
|
return AE.getName();
|
2015-07-28 06:26:59 +08:00
|
|
|
}
|
2015-08-30 15:51:04 +08:00
|
|
|
return StringRef();
|
2015-07-28 06:26:59 +08:00
|
|
|
}
|
|
|
|
|
2016-10-07 16:37:29 +08:00
|
|
|
StringRef llvm::ARM::getArchExtFeature(StringRef ArchExt) {
|
2015-11-19 23:42:52 +08:00
|
|
|
if (ArchExt.startswith("no")) {
|
2015-11-19 23:03:11 +08:00
|
|
|
StringRef ArchExtBase(ArchExt.substr(2));
|
|
|
|
for (const auto AE : ARCHExtNames) {
|
|
|
|
if (AE.NegFeature && ArchExtBase == AE.getName())
|
2016-10-07 16:37:29 +08:00
|
|
|
return StringRef(AE.NegFeature);
|
2015-11-19 23:03:11 +08:00
|
|
|
}
|
|
|
|
}
|
2015-11-19 00:32:12 +08:00
|
|
|
for (const auto AE : ARCHExtNames) {
|
|
|
|
if (AE.Feature && ArchExt == AE.getName())
|
2016-10-07 16:37:29 +08:00
|
|
|
return StringRef(AE.Feature);
|
2015-11-19 00:32:12 +08:00
|
|
|
}
|
|
|
|
|
2016-10-07 16:37:29 +08:00
|
|
|
return StringRef();
|
2015-11-19 00:32:12 +08:00
|
|
|
}
|
|
|
|
|
2015-08-30 15:51:04 +08:00
|
|
|
StringRef llvm::ARM::getHWDivName(unsigned HWDivKind) {
|
2015-07-28 06:26:59 +08:00
|
|
|
for (const auto D : HWDivNames) {
|
|
|
|
if (HWDivKind == D.ID)
|
2015-08-30 15:51:04 +08:00
|
|
|
return D.getName();
|
2015-07-28 06:26:59 +08:00
|
|
|
}
|
2015-08-30 15:51:04 +08:00
|
|
|
return StringRef();
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2015-08-30 15:51:04 +08:00
|
|
|
StringRef llvm::ARM::getDefaultCPU(StringRef Arch) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ArchKind AK = parseArch(Arch);
|
|
|
|
if (AK == ARM::ArchKind::INVALID)
|
2015-08-30 15:51:04 +08:00
|
|
|
return StringRef();
|
2015-05-20 23:05:07 +08:00
|
|
|
|
|
|
|
// Look for multiple AKs to find the default for pair AK+Name.
|
|
|
|
for (const auto CPU : CPUNames) {
|
|
|
|
if (CPU.ArchID == AK && CPU.Default)
|
2015-08-30 15:51:04 +08:00
|
|
|
return CPU.getName();
|
2015-05-20 23:05:07 +08:00
|
|
|
}
|
2015-11-16 19:15:22 +08:00
|
|
|
|
|
|
|
// If we can't find a default then target the architecture instead
|
|
|
|
return "generic";
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2016-05-25 20:02:33 +08:00
|
|
|
StringRef llvm::AArch64::getFPUName(unsigned FPUKind) {
|
|
|
|
return ARM::getFPUName(FPUKind);
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::FPUVersion AArch64::getFPUVersion(unsigned FPUKind) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::getFPUVersion(FPUKind);
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::NeonSupportLevel AArch64::getFPUNeonSupportLevel(unsigned FPUKind) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::getFPUNeonSupportLevel( FPUKind);
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::FPURestriction AArch64::getFPURestriction(unsigned FPUKind) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::getFPURestriction(FPUKind);
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
unsigned llvm::AArch64::getDefaultFPU(StringRef CPU, ArchKind AK) {
|
2016-05-25 20:02:33 +08:00
|
|
|
if (CPU == "generic")
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return AArch64ARCHNames[static_cast<unsigned>(AK)].DefaultFPU;
|
2016-05-25 20:02:33 +08:00
|
|
|
|
|
|
|
return StringSwitch<unsigned>(CPU)
|
|
|
|
#define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
|
|
|
|
.Case(NAME, DEFAULT_FPU)
|
|
|
|
#include "llvm/Support/AArch64TargetParser.def"
|
|
|
|
.Default(ARM::FK_INVALID);
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
unsigned llvm::AArch64::getDefaultExtensions(StringRef CPU, ArchKind AK) {
|
2016-05-25 20:02:33 +08:00
|
|
|
if (CPU == "generic")
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return AArch64ARCHNames[static_cast<unsigned>(AK)].ArchBaseExtensions;
|
2016-05-25 20:02:33 +08:00
|
|
|
|
|
|
|
return StringSwitch<unsigned>(CPU)
|
2017-05-04 04:51:34 +08:00
|
|
|
#define AARCH64_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \
|
|
|
|
.Case(NAME, \
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
AArch64ARCHNames[static_cast<unsigned>(AArch64::ArchKind::ID)] \
|
|
|
|
.ArchBaseExtensions | \
|
2017-05-04 04:51:34 +08:00
|
|
|
DEFAULT_EXT)
|
2016-05-25 20:02:33 +08:00
|
|
|
#include "llvm/Support/AArch64TargetParser.def"
|
|
|
|
.Default(AArch64::AEK_INVALID);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool llvm::AArch64::getExtensionFeatures(unsigned Extensions,
|
2016-10-07 16:37:29 +08:00
|
|
|
std::vector<StringRef> &Features) {
|
2016-05-25 20:02:33 +08:00
|
|
|
|
|
|
|
if (Extensions == AArch64::AEK_INVALID)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (Extensions & AArch64::AEK_FP)
|
|
|
|
Features.push_back("+fp-armv8");
|
|
|
|
if (Extensions & AArch64::AEK_SIMD)
|
|
|
|
Features.push_back("+neon");
|
|
|
|
if (Extensions & AArch64::AEK_CRC)
|
|
|
|
Features.push_back("+crc");
|
|
|
|
if (Extensions & AArch64::AEK_CRYPTO)
|
|
|
|
Features.push_back("+crypto");
|
|
|
|
if (Extensions & AArch64::AEK_FP16)
|
|
|
|
Features.push_back("+fullfp16");
|
|
|
|
if (Extensions & AArch64::AEK_PROFILE)
|
|
|
|
Features.push_back("+spe");
|
2016-06-13 13:27:58 +08:00
|
|
|
if (Extensions & AArch64::AEK_RAS)
|
|
|
|
Features.push_back("+ras");
|
2017-02-18 02:34:24 +08:00
|
|
|
if (Extensions & AArch64::AEK_LSE)
|
|
|
|
Features.push_back("+lse");
|
2017-07-13 23:19:56 +08:00
|
|
|
if (Extensions & AArch64::AEK_SVE)
|
|
|
|
Features.push_back("+sve");
|
2016-05-25 20:02:33 +08:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool llvm::AArch64::getFPUFeatures(unsigned FPUKind,
|
2016-10-07 16:37:29 +08:00
|
|
|
std::vector<StringRef> &Features) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::getFPUFeatures(FPUKind, Features);
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
bool llvm::AArch64::getArchFeatures(AArch64::ArchKind AK,
|
|
|
|
std::vector<StringRef> &Features) {
|
|
|
|
if (AK == AArch64::ArchKind::ARMV8_1A)
|
2016-05-25 20:02:33 +08:00
|
|
|
Features.push_back("+v8.1a");
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
if (AK == AArch64::ArchKind::ARMV8_2A)
|
2016-05-25 20:02:33 +08:00
|
|
|
Features.push_back("+v8.2a");
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return AK != AArch64::ArchKind::INVALID;
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef llvm::AArch64::getArchName(ArchKind AK) {
|
|
|
|
return AArch64ARCHNames[static_cast<unsigned>(AK)].getName();
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef llvm::AArch64::getCPUAttr(ArchKind AK) {
|
|
|
|
return AArch64ARCHNames[static_cast<unsigned>(AK)].getCPUAttr();
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
StringRef llvm::AArch64::getSubArch(ArchKind AK) {
|
|
|
|
return AArch64ARCHNames[static_cast<unsigned>(AK)].getSubArch();
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
unsigned llvm::AArch64::getArchAttr(ArchKind AK) {
|
|
|
|
return AArch64ARCHNames[static_cast<unsigned>(AK)].ArchAttr;
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
2016-07-28 14:11:18 +08:00
|
|
|
StringRef llvm::AArch64::getArchExtName(unsigned ArchExtKind) {
|
2016-06-08 22:30:00 +08:00
|
|
|
for (const auto &AE : AArch64ARCHExtNames)
|
2016-07-28 14:11:18 +08:00
|
|
|
if (ArchExtKind == AE.ID)
|
2016-05-25 20:02:33 +08:00
|
|
|
return AE.getName();
|
|
|
|
return StringRef();
|
|
|
|
}
|
|
|
|
|
2016-10-07 16:37:29 +08:00
|
|
|
StringRef llvm::AArch64::getArchExtFeature(StringRef ArchExt) {
|
2016-05-25 20:02:33 +08:00
|
|
|
if (ArchExt.startswith("no")) {
|
|
|
|
StringRef ArchExtBase(ArchExt.substr(2));
|
2016-06-08 22:30:00 +08:00
|
|
|
for (const auto &AE : AArch64ARCHExtNames) {
|
2016-05-25 20:02:33 +08:00
|
|
|
if (AE.NegFeature && ArchExtBase == AE.getName())
|
2016-10-07 16:37:29 +08:00
|
|
|
return StringRef(AE.NegFeature);
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
}
|
2016-06-08 22:30:00 +08:00
|
|
|
|
|
|
|
for (const auto &AE : AArch64ARCHExtNames)
|
2016-05-25 20:02:33 +08:00
|
|
|
if (AE.Feature && ArchExt == AE.getName())
|
2016-10-07 16:37:29 +08:00
|
|
|
return StringRef(AE.Feature);
|
|
|
|
return StringRef();
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
StringRef llvm::AArch64::getDefaultCPU(StringRef Arch) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
AArch64::ArchKind AK = parseArch(Arch);
|
|
|
|
if (AK == ArchKind::INVALID)
|
2016-05-25 20:02:33 +08:00
|
|
|
return StringRef();
|
|
|
|
|
|
|
|
// Look for multiple AKs to find the default for pair AK+Name.
|
2016-06-08 22:30:00 +08:00
|
|
|
for (const auto &CPU : AArch64CPUNames)
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
if (CPU.ArchID == AK && CPU.Default)
|
2016-05-25 20:02:33 +08:00
|
|
|
return CPU.getName();
|
|
|
|
|
|
|
|
// If we can't find a default then target the architecture instead
|
|
|
|
return "generic";
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned llvm::AArch64::checkArchVersion(StringRef Arch) {
|
|
|
|
if (Arch[0] == 'v' && std::isdigit(Arch[1]))
|
|
|
|
return (Arch[1] - 48);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
// ======================================================= //
|
|
|
|
// Parsers
|
|
|
|
// ======================================================= //
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
static StringRef getHWDivSynonym(StringRef HWDiv) {
|
2015-07-28 06:26:59 +08:00
|
|
|
return StringSwitch<StringRef>(HWDiv)
|
2015-08-30 10:17:15 +08:00
|
|
|
.Case("thumb,arm", "arm,thumb")
|
|
|
|
.Default(HWDiv);
|
2015-07-28 06:26:59 +08:00
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
static StringRef getFPUSynonym(StringRef FPU) {
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
return StringSwitch<StringRef>(FPU)
|
2015-08-30 10:17:15 +08:00
|
|
|
.Cases("fpa", "fpe2", "fpe3", "maverick", "invalid") // Unsupported
|
|
|
|
.Case("vfp2", "vfpv2")
|
|
|
|
.Case("vfp3", "vfpv3")
|
|
|
|
.Case("vfp4", "vfpv4")
|
|
|
|
.Case("vfp3-d16", "vfpv3-d16")
|
|
|
|
.Case("vfp4-d16", "vfpv4-d16")
|
|
|
|
.Cases("fp4-sp-d16", "vfpv4-sp-d16", "fpv4-sp-d16")
|
|
|
|
.Cases("fp4-dp-d16", "fpv4-dp-d16", "vfpv4-d16")
|
|
|
|
.Case("fp5-sp-d16", "fpv5-sp-d16")
|
|
|
|
.Cases("fp5-dp-d16", "fpv5-dp-d16", "fpv5-d16")
|
|
|
|
// FIXME: Clang uses it, but it's bogus, since neon defaults to vfpv3.
|
|
|
|
.Case("neon-vfpv3", "neon")
|
|
|
|
.Default(FPU);
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
static StringRef getArchSynonym(StringRef Arch) {
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
return StringSwitch<StringRef>(Arch)
|
Cull non-standard variants of ARM architectures (NFC)
Summary:
This patch changes ARMV5, ARMV5E, ARMV6SM, ARMV6HL, ARMV7, ARMV7L,
ARMV7HL, ARMV7EM to be treated as aliases for the corresponding
standard architectures, instead of as actual architectures.
Reviewers: rengolin
Subscribers: aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D14577
llvm-svn: 252903
2015-11-12 23:51:41 +08:00
|
|
|
.Case("v5", "v5t")
|
|
|
|
.Case("v5e", "v5te")
|
Handle ARMv6-J as an alias, instead of fake architecture
Summary:
This follows D14577 to treat ARMv6-J as an alias for ARMv6,
instead of an architecture in its own right.
The functional change is that the default CPU when targeting ARMv6-J
changes from arm1136j-s to arm1136jf-s, which is currently used as
the default CPU for ARMv6; both are, in fact, ARMv6-J CPUs.
The J-bit (Jazelle support) is irrelevant to LLVM, and it doesn't
affect code generation, attributes, optimizations, or anything else,
apart from selecting the default CPU.
Reviewers: rengolin, logan, compnerd
Subscribers: aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D14755
llvm-svn: 253675
2015-11-21 00:46:09 +08:00
|
|
|
.Case("v6j", "v6")
|
Cull non-standard variants of ARM architectures (NFC)
Summary:
This patch changes ARMV5, ARMV5E, ARMV6SM, ARMV6HL, ARMV7, ARMV7L,
ARMV7HL, ARMV7EM to be treated as aliases for the corresponding
standard architectures, instead of as actual architectures.
Reviewers: rengolin
Subscribers: aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D14577
llvm-svn: 252903
2015-11-12 23:51:41 +08:00
|
|
|
.Case("v6hl", "v6k")
|
|
|
|
.Cases("v6m", "v6sm", "v6s-m", "v6-m")
|
2015-11-16 22:05:32 +08:00
|
|
|
.Cases("v6z", "v6zk", "v6kz")
|
Cull non-standard variants of ARM architectures (NFC)
Summary:
This patch changes ARMV5, ARMV5E, ARMV6SM, ARMV6HL, ARMV7, ARMV7L,
ARMV7HL, ARMV7EM to be treated as aliases for the corresponding
standard architectures, instead of as actual architectures.
Reviewers: rengolin
Subscribers: aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D14577
llvm-svn: 252903
2015-11-12 23:51:41 +08:00
|
|
|
.Cases("v7", "v7a", "v7hl", "v7l", "v7-a")
|
2015-08-30 10:17:15 +08:00
|
|
|
.Case("v7r", "v7-r")
|
|
|
|
.Case("v7m", "v7-m")
|
|
|
|
.Case("v7em", "v7e-m")
|
|
|
|
.Cases("v8", "v8a", "aarch64", "arm64", "v8-a")
|
|
|
|
.Case("v8.1a", "v8.1-a")
|
2015-12-01 18:33:56 +08:00
|
|
|
.Case("v8.2a", "v8.2-a")
|
2016-10-07 20:06:40 +08:00
|
|
|
.Case("v8r", "v8-r")
|
2016-01-15 18:24:39 +08:00
|
|
|
.Case("v8m.base", "v8-m.base")
|
|
|
|
.Case("v8m.main", "v8-m.main")
|
2015-08-30 10:17:15 +08:00
|
|
|
.Default(Arch);
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2015-05-20 23:05:07 +08:00
|
|
|
// MArch is expected to be of the form (arm|thumb)?(eb)?(v.+)?(eb)?, but
|
|
|
|
// (iwmmxt|xscale)(eb)? is also permitted. If the former, return
|
2015-05-23 04:43:30 +08:00
|
|
|
// "v.+", if the latter, return unmodified string, minus 'eb'.
|
|
|
|
// If invalid, return empty string.
|
2015-08-30 10:09:48 +08:00
|
|
|
StringRef llvm::ARM::getCanonicalArchName(StringRef Arch) {
|
2015-05-20 23:05:07 +08:00
|
|
|
size_t offset = StringRef::npos;
|
|
|
|
StringRef A = Arch;
|
2015-05-21 21:52:20 +08:00
|
|
|
StringRef Error = "";
|
2015-05-20 23:05:07 +08:00
|
|
|
|
|
|
|
// Begins with "arm" / "thumb", move past it.
|
2015-05-23 04:43:30 +08:00
|
|
|
if (A.startswith("arm64"))
|
|
|
|
offset = 5;
|
|
|
|
else if (A.startswith("arm"))
|
2015-05-20 23:05:07 +08:00
|
|
|
offset = 3;
|
|
|
|
else if (A.startswith("thumb"))
|
|
|
|
offset = 5;
|
2015-05-21 21:52:20 +08:00
|
|
|
else if (A.startswith("aarch64")) {
|
|
|
|
offset = 7;
|
|
|
|
// AArch64 uses "_be", not "eb" suffix.
|
|
|
|
if (A.find("eb") != StringRef::npos)
|
|
|
|
return Error;
|
2015-08-30 10:17:15 +08:00
|
|
|
if (A.substr(offset, 3) == "_be")
|
2015-05-21 21:52:20 +08:00
|
|
|
offset += 3;
|
|
|
|
}
|
|
|
|
|
2015-05-20 23:05:07 +08:00
|
|
|
// Ex. "armebv7", move past the "eb".
|
|
|
|
if (offset != StringRef::npos && A.substr(offset, 2) == "eb")
|
|
|
|
offset += 2;
|
|
|
|
// Or, if it ends with eb ("armv7eb"), chop it off.
|
|
|
|
else if (A.endswith("eb"))
|
|
|
|
A = A.substr(0, A.size() - 2);
|
2015-05-23 04:43:30 +08:00
|
|
|
// Trim the head
|
|
|
|
if (offset != StringRef::npos)
|
2015-05-20 23:05:07 +08:00
|
|
|
A = A.substr(offset);
|
|
|
|
|
2015-05-23 04:43:30 +08:00
|
|
|
// Empty string means offset reached the end, which means it's valid.
|
2015-05-20 23:05:07 +08:00
|
|
|
if (A.empty())
|
|
|
|
return Arch;
|
|
|
|
|
2015-05-23 04:43:30 +08:00
|
|
|
// Only match non-marketing names
|
|
|
|
if (offset != StringRef::npos) {
|
2015-08-30 10:17:15 +08:00
|
|
|
// Must start with 'vN'.
|
2015-05-23 04:43:30 +08:00
|
|
|
if (A[0] != 'v' || !std::isdigit(A[1]))
|
|
|
|
return Error;
|
|
|
|
// Can't have an extra 'eb'.
|
|
|
|
if (A.find("eb") != StringRef::npos)
|
|
|
|
return Error;
|
|
|
|
}
|
2015-05-20 23:05:07 +08:00
|
|
|
|
2015-05-23 04:43:30 +08:00
|
|
|
// Arch will either be a 'v' name (v7a) or a marketing name (xscale).
|
2015-05-20 23:05:07 +08:00
|
|
|
return A;
|
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
unsigned llvm::ARM::parseHWDiv(StringRef HWDiv) {
|
2015-07-28 06:26:59 +08:00
|
|
|
StringRef Syn = getHWDivSynonym(HWDiv);
|
|
|
|
for (const auto D : HWDivNames) {
|
2015-08-30 15:51:04 +08:00
|
|
|
if (Syn == D.getName())
|
2015-07-28 06:26:59 +08:00
|
|
|
return D.ID;
|
|
|
|
}
|
|
|
|
return ARM::AEK_INVALID;
|
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
unsigned llvm::ARM::parseFPU(StringRef FPU) {
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
StringRef Syn = getFPUSynonym(FPU);
|
|
|
|
for (const auto F : FPUNames) {
|
2015-08-30 15:51:04 +08:00
|
|
|
if (Syn == F.getName())
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
return F.ID;
|
|
|
|
}
|
2015-05-12 18:33:58 +08:00
|
|
|
return ARM::FK_INVALID;
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2015-05-20 23:05:07 +08:00
|
|
|
// Allows partial match, ex. "v7a" matches "armv7a".
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::ArchKind ARM::parseArch(StringRef Arch) {
|
2015-06-05 05:26:58 +08:00
|
|
|
Arch = getCanonicalArchName(Arch);
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
StringRef Syn = getArchSynonym(Arch);
|
|
|
|
for (const auto A : ARCHNames) {
|
2015-08-30 15:51:04 +08:00
|
|
|
if (A.getName().endswith(Syn))
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
return A.ID;
|
|
|
|
}
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::ArchKind::INVALID;
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
2015-08-30 10:09:48 +08:00
|
|
|
unsigned llvm::ARM::parseArchExt(StringRef ArchExt) {
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
for (const auto A : ARCHExtNames) {
|
2015-08-30 15:51:04 +08:00
|
|
|
if (ArchExt == A.getName())
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
return A.ID;
|
|
|
|
}
|
2015-05-12 18:33:58 +08:00
|
|
|
return ARM::AEK_INVALID;
|
TargetParser: FPU/ARCH/EXT parsing refactory - NFC
This new class in a global context contain arch-specific knowledge in order
to provide LLVM libraries, tools and projects with the ability to understand
the architectures. For now, only FPU, ARCH and ARCH extensions on ARM are
supported.
Current behaviour it to parse from free-text to enum values and back, so that
all users can share the same parser and codes. This simplifies a lot both the
ASM/Obj streamers in the back-end (where this came from), and the front-end
parsers for command line arguments (where this is going to be used next).
The previous implementation, using .def/.h includes is deprecated due to its
inflexibility to be built without the backend support and for being too
cumbersome. As more architectures join this scheme, and as more features of
such architectures are added (such as hardware features, type sizes, etc) into
a full blown TargetDescription class, having a set of classes is the most
sane implementation.
The ultimate goal of this refactor both LLVM's and Clang's target description
classes into one unique interface, so that we can de-duplicate and standardise
the descriptions, as well as make it available for other front-ends, tools,
etc.
The FPU parsing for command line options in Clang has been converted to use
this new library and a number of aliases were added for compatibility:
* A bogus neon-vfpv3 alias (neon defaults to vfp3)
* armv5/v6
* {fp4/fp5}-{sp/dp}-d16
Next steps:
* Port Clang's ARCH/EXT parsing to use this library.
* Create a TableGen back-end to generate this information.
* Run this TableGen process regardless of which back-ends are built.
* Expose more information and rename it to TargetDescription.
* Continue re-factoring Clang to use as much of it as possible.
llvm-svn: 236900
2015-05-09 05:04:27 +08:00
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::ArchKind llvm::ARM::parseCPUArch(StringRef CPU) {
|
2015-05-20 23:05:07 +08:00
|
|
|
for (const auto C : CPUNames) {
|
2015-08-30 15:51:04 +08:00
|
|
|
if (CPU == C.getName())
|
2015-05-20 23:05:07 +08:00
|
|
|
return C.ArchID;
|
|
|
|
}
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::ArchKind::INVALID;
|
2015-05-20 23:05:07 +08:00
|
|
|
}
|
|
|
|
|
2015-05-21 21:52:20 +08:00
|
|
|
// ARM, Thumb, AArch64
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::ISAKind ARM::parseArchISA(StringRef Arch) {
|
|
|
|
return StringSwitch<ARM::ISAKind>(Arch)
|
|
|
|
.StartsWith("aarch64", ARM::ISAKind::AARCH64)
|
|
|
|
.StartsWith("arm64", ARM::ISAKind::AARCH64)
|
|
|
|
.StartsWith("thumb", ARM::ISAKind::THUMB)
|
|
|
|
.StartsWith("arm", ARM::ISAKind::ARM)
|
|
|
|
.Default(ARM::ISAKind::INVALID);
|
2015-05-21 21:52:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Little/Big endian
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::EndianKind ARM::parseArchEndian(StringRef Arch) {
|
2015-08-30 10:17:15 +08:00
|
|
|
if (Arch.startswith("armeb") || Arch.startswith("thumbeb") ||
|
2015-05-21 21:52:20 +08:00
|
|
|
Arch.startswith("aarch64_be"))
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::EndianKind::BIG;
|
2015-05-21 21:52:20 +08:00
|
|
|
|
|
|
|
if (Arch.startswith("arm") || Arch.startswith("thumb")) {
|
|
|
|
if (Arch.endswith("eb"))
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::EndianKind::BIG;
|
2015-05-21 21:52:20 +08:00
|
|
|
else
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::EndianKind::LITTLE;
|
2015-05-21 21:52:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (Arch.startswith("aarch64"))
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::EndianKind::LITTLE;
|
2015-05-21 21:52:20 +08:00
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ARM::EndianKind::INVALID;
|
2015-05-21 21:52:20 +08:00
|
|
|
}
|
|
|
|
|
2015-05-23 02:17:55 +08:00
|
|
|
// Profile A/R/M
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::ProfileKind ARM::parseArchProfile(StringRef Arch) {
|
2015-05-23 02:17:55 +08:00
|
|
|
Arch = getCanonicalArchName(Arch);
|
2015-08-30 10:17:15 +08:00
|
|
|
switch (parseArch(Arch)) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV6M:
|
|
|
|
case ARM::ArchKind::ARMV7M:
|
|
|
|
case ARM::ArchKind::ARMV7EM:
|
|
|
|
case ARM::ArchKind::ARMV8MMainline:
|
|
|
|
case ARM::ArchKind::ARMV8MBaseline:
|
|
|
|
return ARM::ProfileKind::M;
|
|
|
|
case ARM::ArchKind::ARMV7R:
|
|
|
|
case ARM::ArchKind::ARMV8R:
|
|
|
|
return ARM::ProfileKind::R;
|
|
|
|
case ARM::ArchKind::ARMV7A:
|
|
|
|
case ARM::ArchKind::ARMV7VE:
|
|
|
|
case ARM::ArchKind::ARMV7K:
|
|
|
|
case ARM::ArchKind::ARMV8A:
|
|
|
|
case ARM::ArchKind::ARMV8_1A:
|
|
|
|
case ARM::ArchKind::ARMV8_2A:
|
|
|
|
return ARM::ProfileKind::A;
|
|
|
|
LLVM_FALLTHROUGH;
|
|
|
|
case ARM::ArchKind::ARMV2:
|
|
|
|
case ARM::ArchKind::ARMV2A:
|
|
|
|
case ARM::ArchKind::ARMV3:
|
|
|
|
case ARM::ArchKind::ARMV3M:
|
|
|
|
case ARM::ArchKind::ARMV4:
|
|
|
|
case ARM::ArchKind::ARMV4T:
|
|
|
|
case ARM::ArchKind::ARMV5T:
|
|
|
|
case ARM::ArchKind::ARMV5TE:
|
|
|
|
case ARM::ArchKind::ARMV5TEJ:
|
|
|
|
case ARM::ArchKind::ARMV6:
|
|
|
|
case ARM::ArchKind::ARMV6K:
|
|
|
|
case ARM::ArchKind::ARMV6T2:
|
|
|
|
case ARM::ArchKind::ARMV6KZ:
|
|
|
|
case ARM::ArchKind::ARMV7S:
|
|
|
|
case ARM::ArchKind::IWMMXT:
|
|
|
|
case ARM::ArchKind::IWMMXT2:
|
|
|
|
case ARM::ArchKind::XSCALE:
|
|
|
|
case ARM::ArchKind::INVALID:
|
|
|
|
return ARM::ProfileKind::INVALID;
|
2015-05-23 02:17:55 +08:00
|
|
|
}
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
llvm_unreachable("Unhandled architecture");
|
2015-05-23 02:17:55 +08:00
|
|
|
}
|
|
|
|
|
2015-05-23 04:43:30 +08:00
|
|
|
// Version number (ex. v7 = 7).
|
2015-08-30 10:09:48 +08:00
|
|
|
unsigned llvm::ARM::parseArchVersion(StringRef Arch) {
|
2015-05-23 02:17:55 +08:00
|
|
|
Arch = getCanonicalArchName(Arch);
|
2015-08-30 10:17:15 +08:00
|
|
|
switch (parseArch(Arch)) {
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV2:
|
|
|
|
case ARM::ArchKind::ARMV2A:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 2;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV3:
|
|
|
|
case ARM::ArchKind::ARMV3M:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 3;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV4:
|
|
|
|
case ARM::ArchKind::ARMV4T:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 4;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV5T:
|
|
|
|
case ARM::ArchKind::ARMV5TE:
|
|
|
|
case ARM::ArchKind::IWMMXT:
|
|
|
|
case ARM::ArchKind::IWMMXT2:
|
|
|
|
case ARM::ArchKind::XSCALE:
|
|
|
|
case ARM::ArchKind::ARMV5TEJ:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 5;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV6:
|
|
|
|
case ARM::ArchKind::ARMV6K:
|
|
|
|
case ARM::ArchKind::ARMV6T2:
|
|
|
|
case ARM::ArchKind::ARMV6KZ:
|
|
|
|
case ARM::ArchKind::ARMV6M:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 6;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV7A:
|
|
|
|
case ARM::ArchKind::ARMV7VE:
|
|
|
|
case ARM::ArchKind::ARMV7R:
|
|
|
|
case ARM::ArchKind::ARMV7M:
|
|
|
|
case ARM::ArchKind::ARMV7S:
|
|
|
|
case ARM::ArchKind::ARMV7EM:
|
|
|
|
case ARM::ArchKind::ARMV7K:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 7;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::ARMV8A:
|
|
|
|
case ARM::ArchKind::ARMV8_1A:
|
|
|
|
case ARM::ArchKind::ARMV8_2A:
|
|
|
|
case ARM::ArchKind::ARMV8R:
|
|
|
|
case ARM::ArchKind::ARMV8MBaseline:
|
|
|
|
case ARM::ArchKind::ARMV8MMainline:
|
2015-05-23 02:17:55 +08:00
|
|
|
return 8;
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
case ARM::ArchKind::INVALID:
|
|
|
|
return 0;
|
2015-05-23 02:17:55 +08:00
|
|
|
}
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
llvm_unreachable("Unhandled architecture");
|
2015-05-23 02:17:55 +08:00
|
|
|
}
|
2016-05-25 20:02:33 +08:00
|
|
|
|
2017-06-30 08:03:54 +08:00
|
|
|
StringRef llvm::ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) {
|
|
|
|
StringRef ArchName =
|
|
|
|
CPU.empty() ? TT.getArchName() : ARM::getArchName(ARM::parseCPUArch(CPU));
|
|
|
|
|
|
|
|
if (TT.isOSBinFormatMachO()) {
|
|
|
|
if (TT.getEnvironment() == Triple::EABI ||
|
|
|
|
TT.getOS() == Triple::UnknownOS ||
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
llvm::ARM::parseArchProfile(ArchName) == ARM::ProfileKind::M)
|
2017-06-30 08:03:54 +08:00
|
|
|
return "aapcs";
|
|
|
|
if (TT.isWatchABI())
|
|
|
|
return "aapcs16";
|
|
|
|
return "apcs-gnu";
|
|
|
|
} else if (TT.isOSWindows())
|
|
|
|
// FIXME: this is invalid for WindowsCE.
|
|
|
|
return "aapcs";
|
|
|
|
|
|
|
|
// Select the default based on the platform.
|
|
|
|
switch (TT.getEnvironment()) {
|
|
|
|
case Triple::Android:
|
|
|
|
case Triple::GNUEABI:
|
|
|
|
case Triple::GNUEABIHF:
|
|
|
|
case Triple::MuslEABI:
|
|
|
|
case Triple::MuslEABIHF:
|
|
|
|
return "aapcs-linux";
|
|
|
|
case Triple::EABIHF:
|
|
|
|
case Triple::EABI:
|
|
|
|
return "aapcs";
|
|
|
|
default:
|
|
|
|
if (TT.isOSNetBSD())
|
|
|
|
return "apcs-gnu";
|
|
|
|
if (TT.isOSOpenBSD())
|
|
|
|
return "aapcs-linux";
|
|
|
|
return "aapcs";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-25 20:02:33 +08:00
|
|
|
StringRef llvm::AArch64::getCanonicalArchName(StringRef Arch) {
|
|
|
|
return ARM::getCanonicalArchName(Arch);
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned llvm::AArch64::parseFPU(StringRef FPU) {
|
|
|
|
return ARM::parseFPU(FPU);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Allows partial match, ex. "v8a" matches "armv8a".
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
AArch64::ArchKind AArch64::parseArch(StringRef Arch) {
|
2016-05-25 20:02:33 +08:00
|
|
|
Arch = getCanonicalArchName(Arch);
|
|
|
|
if (checkArchVersion(Arch) < 8)
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ArchKind::INVALID;
|
2016-05-25 20:02:33 +08:00
|
|
|
|
|
|
|
StringRef Syn = getArchSynonym(Arch);
|
|
|
|
for (const auto A : AArch64ARCHNames) {
|
|
|
|
if (A.getName().endswith(Syn))
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return A.ID;
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ArchKind::INVALID;
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned llvm::AArch64::parseArchExt(StringRef ArchExt) {
|
|
|
|
for (const auto A : AArch64ARCHExtNames) {
|
|
|
|
if (ArchExt == A.getName())
|
|
|
|
return A.ID;
|
|
|
|
}
|
|
|
|
return AArch64::AEK_INVALID;
|
|
|
|
}
|
|
|
|
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
AArch64::ArchKind llvm::AArch64::parseCPUArch(StringRef CPU) {
|
2016-05-25 20:02:33 +08:00
|
|
|
for (const auto C : AArch64CPUNames) {
|
|
|
|
if (CPU == C.getName())
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return C.ArchID;
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
return ArchKind::INVALID;
|
2016-05-25 20:02:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// ARM, Thumb, AArch64
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::ISAKind AArch64::parseArchISA(StringRef Arch) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::parseArchISA(Arch);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Little/Big endian
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::EndianKind AArch64::parseArchEndian(StringRef Arch) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::parseArchEndian(Arch);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Profile A/R/M
|
[TargetParser] Use enum classes for various ARM kind enums.
Summary:
Using c++11 enum classes ensures that only valid enum values are used
for ArchKind, ProfileKind, VersionKind and ISAKind. This removes the
need for checks that the provided values map to a proper enum value,
allows us to get rid of AK_LAST and prevents comparing values from
different enums. It also removes a bunch of static_cast
from unsigned to enum values and vice versa, at the cost of introducing
static casts to access AArch64ARCHNames and ARMARCHNames by ArchKind.
FPUKind and ArchExtKind are the only remaining old-style enum in
TargetParser.h. I think it's beneficial to keep ArchExtKind as old-style
enum, but FPUKind can be converted too, but this patch is quite big, so
could do this in a follow-up patch. I could also split this patch up a
bit, if people would prefer that.
Reviewers: rengolin, javed.absar, chandlerc, rovka
Reviewed By: rovka
Subscribers: aemerson, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D35882
llvm-svn: 309287
2017-07-28 00:27:56 +08:00
|
|
|
ARM::ProfileKind AArch64::parseArchProfile(StringRef Arch) {
|
2016-05-25 20:02:33 +08:00
|
|
|
return ARM::parseArchProfile(Arch);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Version number (ex. v8 = 8).
|
|
|
|
unsigned llvm::AArch64::parseArchVersion(StringRef Arch) {
|
|
|
|
return ARM::parseArchVersion(Arch);
|
|
|
|
}
|