diff options
author | Sumanth Gundapaneni <sgundapa@codeaurora.org> | 2015-02-26 18:07:35 +0000 |
---|---|---|
committer | Sumanth Gundapaneni <sgundapa@codeaurora.org> | 2015-02-26 18:07:35 +0000 |
commit | a9049ea36848df64e26d3c11a11dd393fb469e79 (patch) | |
tree | 54f21f1c06ab32001f527d25430f11cd303433d8 /llvm/lib | |
parent | 947efbc138b30250da0baf6c4fe0f19b236dfc2c (diff) | |
download | bcm5719-llvm-a9049ea36848df64e26d3c11a11dd393fb469e79.tar.gz bcm5719-llvm-a9049ea36848df64e26d3c11a11dd393fb469e79.zip |
Use ".arch_extension" ARM directive to specify the additional CPU features
This patch is in response to r223147 where the avaiable features are
computed based on ".cpu" directive. This will work clean for the standard
variants like cortex-a9. For custom variants which rely on standard cpu names
for assembly, the additional features of a CPU should be propagated. This can be
done via ".arch_extension" as long as the assembler supports it. The
implementation for krait along with unit test will be submitted in next patch.
llvm-svn: 230650
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/ARM/ARMArchExtName.def | 30 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMArchExtName.h | 26 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp | 18 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp | 1 |
4 files changed, 75 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMArchExtName.def b/llvm/lib/Target/ARM/ARMArchExtName.def new file mode 100644 index 00000000000..d6da50c59e5 --- /dev/null +++ b/llvm/lib/Target/ARM/ARMArchExtName.def @@ -0,0 +1,30 @@ +//===-- ARMArchExtName.def - List of the ARM Extension names ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the list of the supported ARM Architecture Extension +// names. These can be used to enable the extension through .arch_extension +// attribute +// +//===----------------------------------------------------------------------===// + +// NOTE: NO INCLUDE GUARD DESIRED! + +#ifndef ARM_ARCHEXT_NAME +#error "You must define ARM_ARCHEXT_NAME(NAME, ID) before including ARMArchExtName.h" +#endif + +ARM_ARCHEXT_NAME("crc", CRC) +ARM_ARCHEXT_NAME("crypto", CRYPTO) +ARM_ARCHEXT_NAME("fp", FP) +ARM_ARCHEXT_NAME("idiv", HWDIV) +ARM_ARCHEXT_NAME("mp", MP) +ARM_ARCHEXT_NAME("sec", SEC) +ARM_ARCHEXT_NAME("virt", VIRT) + +#undef ARM_ARCHEXT_NAME diff --git a/llvm/lib/Target/ARM/ARMArchExtName.h b/llvm/lib/Target/ARM/ARMArchExtName.h new file mode 100644 index 00000000000..bc1157acdbe --- /dev/null +++ b/llvm/lib/Target/ARM/ARMArchExtName.h @@ -0,0 +1,26 @@ +//===-- ARMArchExtName.h - List of the ARM Extension names ------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_LIB_TARGET_ARM_ARMARCHEXTNAME_H +#define LLVM_LIB_TARGET_ARM_ARMARCHEXTNAME_H + +namespace llvm { +namespace ARM { + +enum ArchExtKind { + INVALID_ARCHEXT = 0 + +#define ARM_ARCHEXT_NAME(NAME, ID) , ID +#include "ARMArchExtName.def" +}; + +} // namespace ARM +} // namespace llvm + +#endif diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp index 34dcd1e876c..2b655202c28 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp @@ -15,6 +15,7 @@ #include "ARMArchName.h" #include "ARMFPUName.h" +#include "ARMArchExtName.h" #include "ARMRegisterInfo.h" #include "ARMUnwindOpAsm.h" #include "llvm/ADT/StringExtras.h" @@ -105,6 +106,19 @@ static unsigned GetArchDefaultCPUArch(unsigned ID) { return 0; } +static const char *GetArchExtName(unsigned ID) { + switch (ID) { + default: + llvm_unreachable("Unknown ARCH Extension kind"); + break; +#define ARM_ARCHEXT_NAME(NAME, ID) \ + case ARM::ID: \ + return NAME; +#include "ARMArchExtName.def" + } + return nullptr; +} + namespace { class ARMELFStreamer; @@ -134,6 +148,7 @@ class ARMTargetAsmStreamer : public ARMTargetStreamer { void emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StrinValue) override; void emitArch(unsigned Arch) override; + void emitArchExtension(unsigned ArchExt) override; void emitObjectArch(unsigned Arch) override; void emitFPU(unsigned FPU) override; void emitInst(uint32_t Inst, char Suffix = '\0') override; @@ -249,6 +264,9 @@ void ARMTargetAsmStreamer::emitIntTextAttribute(unsigned Attribute, void ARMTargetAsmStreamer::emitArch(unsigned Arch) { OS << "\t.arch\t" << GetArchName(Arch) << "\n"; } +void ARMTargetAsmStreamer::emitArchExtension(unsigned ArchExt) { + OS << "\t.arch_extension\t" << GetArchExtName(ArchExt) << "\n"; +} void ARMTargetAsmStreamer::emitObjectArch(unsigned Arch) { OS << "\t.object_arch\t" << GetArchName(Arch) << '\n'; } diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp index 8acd7aff6bc..b680db5c3a7 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp @@ -63,6 +63,7 @@ void ARMTargetStreamer::emitIntTextAttribute(unsigned Attribute, unsigned IntValue, StringRef StringValue) {} void ARMTargetStreamer::emitArch(unsigned Arch) {} +void ARMTargetStreamer::emitArchExtension(unsigned ArchExt) {} void ARMTargetStreamer::emitObjectArch(unsigned Arch) {} void ARMTargetStreamer::emitFPU(unsigned FPU) {} void ARMTargetStreamer::finishAttributeSection() {} |