[Support] Add CSKY target parser and attributes parser

Construct LLVM Support module about CSKY target parser and attribute parser.
It refers CSKY ABIv2 and implementation of GNU binutils and GCC.

https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf

Now we only support CSKY 800 series cpus and newer cpus in the future undering CSKYv2 ABI specification.
There are 11 archs including ck801, ck802, ck803, ck803s, ck804, ck805, ck807, ck810, ck810v, ck860, ck860v.

Every arch has base extensions, the cpus of that arch family have more extended extensions than base extensions.
We need specify extended extensions for every cpu. Every extension has its enum value, name and related llvm feature string with +/-.
Every enum value represents a bit of uint64_t integer.

Differential Revision: https://reviews.llvm.org/D119917
This commit is contained in:
Zi Xuan Wu 2022-02-15 15:26:39 +08:00
parent 7f811ce127
commit 21bce9007a
15 changed files with 2651 additions and 0 deletions

View File

@ -866,6 +866,23 @@ enum {
#include "ELFRelocs/VE.def"
};
// CSKY Specific e_flags
enum : unsigned {
EF_CSKY_801 = 0xa,
EF_CSKY_802 = 0x10,
EF_CSKY_803 = 0x9,
EF_CSKY_805 = 0x11,
EF_CSKY_807 = 0x6,
EF_CSKY_810 = 0x8,
EF_CSKY_860 = 0xb,
EF_CSKY_800 = 0x1f,
EF_CSKY_FLOAT = 0x2000,
EF_CSKY_DSP = 0x4000,
EF_CSKY_ABIV2 = 0x20000000,
EF_CSKY_EFV1 = 0x1000000,
EF_CSKY_EFV2 = 0x2000000,
EF_CSKY_EFV3 = 0x3000000
};
// ELF Relocation types for CSKY
enum {
@ -991,6 +1008,8 @@ enum : unsigned {
SHT_RISCV_ATTRIBUTES = 0x70000003U,
SHT_CSKY_ATTRIBUTES = 0x70000001U,
SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type.
SHT_LOUSER = 0x80000000, // Lowest type reserved for applications.
SHT_HIUSER = 0xffffffff // Highest type reserved for applications.

View File

@ -0,0 +1,43 @@
//===---- CSKYAttributeParser.h - CSKY Attribute Parser ---------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
#define LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
#include "llvm/Support/CSKYAttributes.h"
#include "llvm/Support/ELFAttributeParser.h"
namespace llvm {
class CSKYAttributeParser : public ELFAttributeParser {
struct DisplayHandler {
CSKYAttrs::AttrType attribute;
Error (CSKYAttributeParser::*routine)(unsigned);
};
static const DisplayHandler displayRoutines[];
Error dspVersion(unsigned tag);
Error vdspVersion(unsigned tag);
Error fpuVersion(unsigned tag);
Error fpuABI(unsigned tag);
Error fpuRounding(unsigned tag);
Error fpuDenormal(unsigned tag);
Error fpuException(unsigned tag);
Error fpuHardFP(unsigned tag);
Error handler(uint64_t tag, bool &handled) override;
public:
CSKYAttributeParser(ScopedPrinter *sw)
: ELFAttributeParser(sw, CSKYAttrs::getCSKYAttributeTags(), "csky") {}
CSKYAttributeParser()
: ELFAttributeParser(CSKYAttrs::getCSKYAttributeTags(), "csky") {}
};
} // namespace llvm
#endif

View File

@ -0,0 +1,95 @@
//===---- CSKYAttributes.h - CSKY Attributes --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains enumerations for CSKY attributes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_CSKYATTRIBUTES_H
#define LLVM_SUPPORT_CSKYATTRIBUTES_H
#include "llvm/Support/ELFAttributes.h"
namespace llvm {
namespace CSKYAttrs {
const TagNameMap &getCSKYAttributeTags();
enum AttrType {
CSKY_ARCH_NAME = 4,
CSKY_CPU_NAME = 5,
CSKY_ISA_FLAGS = 6,
CSKY_ISA_EXT_FLAGS = 7,
CSKY_DSP_VERSION = 8,
CSKY_VDSP_VERSION = 9,
CSKY_FPU_VERSION = 16,
CSKY_FPU_ABI = 17,
CSKY_FPU_ROUNDING = 18,
CSKY_FPU_DENORMAL = 19,
CSKY_FPU_EXCEPTION = 20,
CSKY_FPU_NUMBER_MODULE = 21,
CSKY_FPU_HARDFP = 22
};
enum ISA_FLAGS {
V2_ISA_E1 = 1 << 1,
V2_ISA_1E2 = 1 << 2,
V2_ISA_2E3 = 1 << 3,
V2_ISA_3E7 = 1 << 4,
V2_ISA_7E10 = 1 << 5,
V2_ISA_3E3R1 = 1 << 6,
V2_ISA_3E3R2 = 1 << 7,
V2_ISA_10E60 = 1 << 8,
V2_ISA_3E3R3 = 1 << 9,
ISA_TRUST = 1 << 11,
ISA_CACHE = 1 << 12,
ISA_NVIC = 1 << 13,
ISA_CP = 1 << 14,
ISA_MP = 1 << 15,
ISA_MP_1E2 = 1 << 16,
ISA_JAVA = 1 << 17,
ISA_MAC = 1 << 18,
ISA_MAC_DSP = 1 << 19,
ISA_DSP = 1 << 20,
ISA_DSP_1E2 = 1 << 21,
ISA_DSP_ENHANCE = 1 << 22,
ISA_DSP_SILAN = 1 << 23,
ISA_VDSP = 1 << 24,
ISA_VDSP_2 = 1 << 25,
ISA_VDSP_2E3 = 1 << 26,
V2_ISA_DSPE60 = 1 << 27,
ISA_VDSP_2E60F = 1 << 28
};
enum ISA_EXT_FLAGS {
ISA_FLOAT_E1 = 1 << 0,
ISA_FLOAT_1E2 = 1 << 1,
ISA_FLOAT_1E3 = 1 << 2,
ISA_FLOAT_3E4 = 1 << 3,
ISA_FLOAT_7E60 = 1 << 4
};
enum { NONE = 0, NEEDED = 1 };
enum DSP_VERSION { DSP_VERSION_EXTENSION = 1, DSP_VERSION_2 = 2 };
enum VDSP_VERSION { VDSP_VERSION_1 = 1, VDSP_VERSION_2 = 2 };
enum FPU_VERSION { FPU_VERSION_1 = 1, FPU_VERSION_2 = 2, FPU_VERSION_3 = 3 };
enum FPU_ABI { FPU_ABI_SOFT = 1, FPU_ABI_SOFTFP = 2, FPU_ABI_HARD = 3 };
enum FPU_HARDFP {
FPU_HARDFP_HALF = 1,
FPU_HARDFP_SINGLE = 2,
FPU_HARDFP_DOUBLE = 4
};
} // namespace CSKYAttrs
} // namespace llvm
#endif

View File

@ -0,0 +1,524 @@
//===- CSKYTargetParser.def - CSKY target parsing defines -------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file provides defines to build up the CSKY target parser's logic.
//
//===----------------------------------------------------------------------===//
// NOTE: NO INCLUDE GUARD DESIRED!
#ifndef CSKY_FPU
#define CSKY_FPU(NAME, KIND, VERSION)
#endif
CSKY_FPU("invalid", FK_INVALID, FPUVersion::NONE)
CSKY_FPU("auto", FK_AUTO, FPUVersion::FPV2)
CSKY_FPU("fpv2", FK_FPV2, FPUVersion::FPV2)
CSKY_FPU("fpv2_divd", FK_FPV2_DIVD, FPUVersion::FPV2)
CSKY_FPU("fpv2_sf", FK_FPV2_SF, FPUVersion::FPV2)
CSKY_FPU("fpv3", FK_FPV3, FPUVersion::FPV3)
CSKY_FPU("fpv3_hf", FK_FPV3_HF, FPUVersion::FPV3)
CSKY_FPU("fpv3_hsf", FK_FPV3_HSF, FPUVersion::FPV3)
CSKY_FPU("fpv3_sdf", FK_FPV3_SDF, FPUVersion::FPV3)
#undef CSKY_FPU
#ifndef CSKY_ARCH
#define CSKY_ARCH(NAME, ID, ARCH_BASE_EXT)
#endif
CSKY_ARCH("invalid", INVALID, CSKY::AEK_INVALID)
CSKY_ARCH("ck801", CK801, CSKY::MAEK_E1 | CSKY::AEK_TRUST)
CSKY_ARCH("ck802", CK802, CSKY::MAEK_E2 | CSKY::AEK_TRUST | CSKY::AEK_NVIC)
CSKY_ARCH("ck803", CK803,
CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
CSKY::AEK_HWDIV)
CSKY_ARCH("ck803s", CK803S,
CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
CSKY::AEK_HWDIV)
CSKY_ARCH("ck804", CK804,
CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
CSKY::AEK_HWDIV | CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
CSKY_ARCH("ck805", CK805,
CSKY::MAEK_2E3 | CSKY::AEK_MP | CSKY::AEK_TRUST | CSKY::AEK_NVIC |
CSKY::AEK_HWDIV | CSKY::AEK_HIGHREG | CSKY::MAEK_3E3R2 |
CSKY::AEK_3E3R3 | CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E3)
CSKY_ARCH("ck807", CK807,
CSKY::MAEK_3E7 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
CSKY::AEK_NVIC | CSKY::AEK_CACHE)
CSKY_ARCH("ck810", CK810,
CSKY::MAEK_7E10 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
CSKY::AEK_NVIC | CSKY::AEK_CACHE)
CSKY_ARCH("ck810v", CK810V,
CSKY::MAEK_7E10 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 | CSKY::AEK_TRUST |
CSKY::AEK_HWDIV | CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 |
CSKY::AEK_DSPE60 | CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP |
CSKY::AEK_NVIC | CSKY::AEK_CACHE | CSKY::AEK_VDSPV1)
CSKY_ARCH("ck860", CK860,
CSKY::MAEK_10E60 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 |
CSKY::AEK_TRUST | CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
CSKY::AEK_CACHE | CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
CSKY_ARCH("ck860v", CK860V,
CSKY::MAEK_10E60 | CSKY::MAEK_MP | CSKY::MAEK_MP1E2 |
CSKY::AEK_TRUST | CSKY::AEK_HWDIV | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG | CSKY::AEK_HARDTP | CSKY::AEK_NVIC |
CSKY::AEK_CACHE | CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 |
CSKY::AEK_VDSPV2 | CSKY::AEK_VDSP2E60F)
#undef CSKY_ARCH
#ifndef CSKY_ARCH_EXT_NAME
#define CSKY_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE)
#endif
CSKY_ARCH_EXT_NAME("invalid", CSKY::AEK_INVALID, nullptr, nullptr)
CSKY_ARCH_EXT_NAME("none", CSKY::AEK_NONE, nullptr, nullptr)
CSKY_ARCH_EXT_NAME("fpuv2_sf", CSKY::AEK_FPUV2SF, "+fpuv2_sf", "-fpuv2_sf")
CSKY_ARCH_EXT_NAME("fpuv2_df", CSKY::AEK_FPUV2DF, "+fpuv2_df", "-fpuv2_df")
CSKY_ARCH_EXT_NAME("fdivdu", CSKY::AEK_FDIVDU, "+fdivdu", "-fdivdu")
CSKY_ARCH_EXT_NAME("fpuv3_hi", CSKY::AEK_FPUV3HI, "+fpuv3_hi", "-fpuv3_hi")
CSKY_ARCH_EXT_NAME("fpuv3_hf", CSKY::AEK_FPUV3HF, "+fpuv3_hf", "-fpuv3_hf")
CSKY_ARCH_EXT_NAME("fpuv3_sf", CSKY::AEK_FPUV3SF, "+fpuv3_sf", "-fpuv3_sf")
CSKY_ARCH_EXT_NAME("fpuv3_df", CSKY::AEK_FPUV3DF, "+fpuv3_df", "-fpuv3_df")
CSKY_ARCH_EXT_NAME("floate1", CSKY::AEK_FLOATE1, "+floate1", "-floate1")
CSKY_ARCH_EXT_NAME("float1e2", CSKY::AEK_FLOAT1E2, "+float1e2", "-float1e2")
CSKY_ARCH_EXT_NAME("float1e3", CSKY::AEK_FLOAT1E3, "+float1e3", "-float1e3")
CSKY_ARCH_EXT_NAME("float3e4", CSKY::AEK_FLOAT3E4, "+float3e4", "-float3e4")
CSKY_ARCH_EXT_NAME("float7e60", CSKY::AEK_FLOAT7E60, "+float7e60", "-float7e60")
CSKY_ARCH_EXT_NAME("hwdiv", CSKY::AEK_HWDIV, "+hwdiv", "-hwdiv")
CSKY_ARCH_EXT_NAME("multiple_stld", CSKY::AEK_STLD, "+multiple_stld",
"-multiple_stld")
CSKY_ARCH_EXT_NAME("pushpop", CSKY::AEK_PUSHPOP, "+pushpop", "-pushpop")
CSKY_ARCH_EXT_NAME("edsp", CSKY::AEK_EDSP, "+edsp", "-edsp")
CSKY_ARCH_EXT_NAME("dsp1e2", CSKY::AEK_DSP1E2, "+dsp1e2", "-dsp1e2")
CSKY_ARCH_EXT_NAME("dspe60", CSKY::AEK_DSPE60, "+dspe60", "-dspe60")
CSKY_ARCH_EXT_NAME("dspv2", CSKY::AEK_DSPV2, "+dspv2", "-dspv2")
CSKY_ARCH_EXT_NAME("dsp_silan", CSKY::AEK_DSPSILAN, "+dsp_silan", "-dsp_silan")
CSKY_ARCH_EXT_NAME("elrw", CSKY::AEK_ELRW, "+elrw", "-elrw")
CSKY_ARCH_EXT_NAME("trust", CSKY::AEK_TRUST, "+trust", "-trust")
CSKY_ARCH_EXT_NAME("java", CSKY::AEK_JAVA, "+java", "-java")
CSKY_ARCH_EXT_NAME("cache", CSKY::AEK_CACHE, "+cache", "-cache")
CSKY_ARCH_EXT_NAME("nvic", CSKY::AEK_NVIC, "+nvic", "-nvic")
CSKY_ARCH_EXT_NAME("doloop", CSKY::AEK_DOLOOP, "+doloop", "-doloop")
CSKY_ARCH_EXT_NAME("high-registers", CSKY::AEK_HIGHREG, "+high-registers",
"-high-registers")
CSKY_ARCH_EXT_NAME("smart", CSKY::AEK_SMART, "+smart", "-smart")
CSKY_ARCH_EXT_NAME("vdsp2e3", CSKY::AEK_VDSP2E3, "+vdsp2e3", "-vdsp2e3")
CSKY_ARCH_EXT_NAME("vdsp2e60f", CSKY::AEK_VDSP2E60F, "+vdsp2e60f", "-vdsp2e60f")
CSKY_ARCH_EXT_NAME("vdspv2", CSKY::AEK_VDSPV2, "+vdspv2", "-vdspv2")
CSKY_ARCH_EXT_NAME("hard-tp", CSKY::AEK_HARDTP, "+hard-tp", "-hard-tp")
CSKY_ARCH_EXT_NAME("soft-tp", CSKY::AEK_SOFTTP, "+soft-tp", "-soft-tp")
CSKY_ARCH_EXT_NAME("istack", CSKY::AEK_ISTACK, "+istack", "-istack")
CSKY_ARCH_EXT_NAME("constpool", CSKY::AEK_CONSTPOOL, "+constpool", "-constpool")
CSKY_ARCH_EXT_NAME("stack-size", CSKY::AEK_STACKSIZE, "+stack-size",
"-stack-size")
CSKY_ARCH_EXT_NAME("ccrt", CSKY::AEK_CCRT, "+ccrt", "-ccrt")
CSKY_ARCH_EXT_NAME("vdspv1", CSKY::AEK_VDSPV1, "+vdspv1", "-vdspv1")
CSKY_ARCH_EXT_NAME("e1", CSKY::AEK_E1, "+e1", "-e1")
CSKY_ARCH_EXT_NAME("e2", CSKY::AEK_E2, "+e2", "-e2")
CSKY_ARCH_EXT_NAME("2e3", CSKY::AEK_2E3, "+2e3", "-2e3")
CSKY_ARCH_EXT_NAME("mp", CSKY::AEK_MP, "+mp", "-mp")
CSKY_ARCH_EXT_NAME("3e3r1", CSKY::AEK_3E3R1, "+3e3r1", "-3e3r1")
CSKY_ARCH_EXT_NAME("3e3r2", CSKY::AEK_3E3R2, "+3e3r2", "-3e3r2")
CSKY_ARCH_EXT_NAME("3e3r3", CSKY::AEK_3E3R3, "+3e3r3", "-3e3r3")
CSKY_ARCH_EXT_NAME("3e7", CSKY::AEK_3E7, "+3e7", "-3e7")
CSKY_ARCH_EXT_NAME("mp1e2", CSKY::AEK_MP1E2, "+mp1e2", "-mp1e2")
CSKY_ARCH_EXT_NAME("7e10", CSKY::AEK_7E10, "+7e10", "-7e10")
CSKY_ARCH_EXT_NAME("10e60", CSKY::AEK_10E60, "+10e60", "-10e60")
#undef CSKY_ARCH_EXT_NAME
#ifndef CSKY_CPU_NAME
#define CSKY_CPU_NAME(NAME, ARCH_ID, DEFAULT_EXT)
#endif
CSKY_CPU_NAME("ck801", CK801, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck801t", CK801, CSKY::AEK_NONE)
CSKY_CPU_NAME("e801", CK801, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck802", CK802, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck802t", CK802, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck802j", CK802, CSKY::AEK_JAVA)
CSKY_CPU_NAME("e802", CK802, CSKY::AEK_NONE)
CSKY_CPU_NAME("e802t", CK802, CSKY::AEK_NONE)
CSKY_CPU_NAME("s802", CK802, CSKY::AEK_NONE)
CSKY_CPU_NAME("s802t", CK802, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803", CK803, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803h", CK803, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803t", CK803, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803ht", CK803, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803f", CK803,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803fh", CK803,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803e", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
CSKY_CPU_NAME("ck803eh", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
CSKY_CPU_NAME("ck803et", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
CSKY_CPU_NAME("ck803eht", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
CSKY_CPU_NAME("ck803ef", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803efh", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803ft", CK803,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803eft", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803efht", CK803,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803r1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803r2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803r3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803hr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803hr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803hr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803tr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803tr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803tr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803htr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803htr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803htr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2)
CSKY_CPU_NAME("ck803fr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803fr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803fr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803fhr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803fhr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803fhr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803er1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803er2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803er3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ehr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ehr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ehr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803etr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803etr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803etr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ehtr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ehtr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ehtr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efhr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efhr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efhr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803ftr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803ftr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803ftr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803eftr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803eftr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803eftr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efhtr1", CK803,
CSKY::MAEK_3E3R1 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efhtr2", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck803efhtr3", CK803,
CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3 | CSKY::AEK_DSPV2 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("s803", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("s803t", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("e803", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("e803t", CK803, CSKY::MAEK_3E3R2 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("ck803s", CK803S, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803st", CK803S, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck803se", CK803S,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
CSKY_CPU_NAME("ck803sf", CK803S,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803sef", CK803S,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck803seft", CK803S,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck804", CK804, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck804h", CK804, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck804t", CK804, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck804ht", CK804, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck804f", CK804,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck804fh", CK804,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck804e", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804eh", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804et", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804eht", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804ef", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804efh", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804ft", CK804,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck804eft", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck804efht", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("e804d", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("e804dt", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("e804f", CK804,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("e804ft", CK804,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("e804df", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("e804dft", CK804,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_HIGHREG)
CSKY_CPU_NAME("ck805", CK805, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck805e", CK805,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("ck805f", CK805,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck805t", CK805, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck805ef", CK805,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck805et", CK805,
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("ck805ft", CK805,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck805eft", CK805,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_DSPV2 | CSKY::AEK_3E3R1 | CSKY::AEK_3E3R3)
CSKY_CPU_NAME("i805", CK805, CSKY::AEK_NONE)
CSKY_CPU_NAME("i805f", CK805,
CSKY::AEK_FPUV2SF | CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E3)
CSKY_CPU_NAME("ck807", CK807, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck807e", CK807,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60)
CSKY_CPU_NAME("ck807f", CK807,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_FLOAT3E4)
CSKY_CPU_NAME("ck807ef", CK807,
CSKY::AEK_EDSP | CSKY::AEK_DSP1E2 | CSKY::AEK_DSPE60 |
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_FLOAT3E4)
CSKY_CPU_NAME("c807", CK807, CSKY::AEK_NONE)
CSKY_CPU_NAME("c807f", CK807,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_FLOAT3E4)
CSKY_CPU_NAME("r807", CK807, CSKY::AEK_NONE)
CSKY_CPU_NAME("r807f", CK807,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2 | CSKY::AEK_FLOAT1E3 |
CSKY::AEK_FLOAT3E4)
CSKY_CPU_NAME("ck810e", CK810, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810et", CK810, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810ef", CK810,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810eft", CK810,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810", CK810, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810f", CK810,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810t", CK810, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810ft", CK810,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("c810", CK810,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("c810t", CK810,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810v", CK810V, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810ev", CK810V, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810tv", CK810V, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck810etv", CK810V, CSKY::AEK_NONE)
CSKY_CPU_NAME("c810v", CK810V,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810fv", CK810V,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810efv", CK810V,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck810ftv", CK810V,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("c810tv", CK810V,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("c810eftv", CK810V,
CSKY::AEK_FPUV2SF | CSKY::AEK_FPUV2DF | CSKY::AEK_FDIVDU |
CSKY::AEK_FLOATE1 | CSKY::AEK_FLOAT1E2)
CSKY_CPU_NAME("ck860", CK860, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck860f", CK860,
CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
CSKY_CPU_NAME("c860", CK860,
CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
CSKY_CPU_NAME("ck860v", CK860V, CSKY::AEK_NONE)
CSKY_CPU_NAME("ck860fv", CK860V,
CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
CSKY_CPU_NAME("c860v", CK860V,
CSKY::AEK_FPUV3HI | CSKY::AEK_FPUV3HF | CSKY::AEK_FPUV3SF |
CSKY::AEK_FPUV3DF | CSKY::AEK_FLOAT7E60)
// Invalid CPU
CSKY_CPU_NAME("invalid", INVALID, CSKY::AEK_INVALID)
#undef CSKY_CPU_NAME

View File

@ -0,0 +1,203 @@
//===-- CSKYTargetParser - Parser for CSKY target features --------*- C++
//-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements a target parser to recognise CSKY hardware features
// such as FPU/CPU/ARCH/extensions and specific support such as HWDIV.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_CSKYTARGETPARSER_H
#define LLVM_SUPPORT_CSKYTARGETPARSER_H
#include "llvm/ADT/Triple.h"
#include <vector>
namespace llvm {
class StringRef;
namespace CSKY {
// Arch extension modifiers for CPUs.
enum ArchExtKind : uint64_t {
AEK_INVALID = 0,
AEK_NONE = 1,
AEK_FPUV2SF = 1 << 1,
AEK_FPUV2DF = 1 << 2,
AEK_FDIVDU = 1 << 3,
AEK_FPUV3HI = 1 << 4,
AEK_FPUV3HF = 1 << 5,
AEK_FPUV3SF = 1 << 6,
AEK_FPUV3DF = 1 << 7,
AEK_FLOATE1 = 1 << 8,
AEK_FLOAT1E2 = 1 << 9,
AEK_FLOAT1E3 = 1 << 10,
AEK_FLOAT3E4 = 1 << 11,
AEK_FLOAT7E60 = 1 << 12,
AEK_HWDIV = 1 << 13,
AEK_STLD = 1 << 14,
AEK_PUSHPOP = 1 << 15,
AEK_EDSP = 1 << 16,
AEK_DSP1E2 = 1 << 17,
AEK_DSPE60 = 1 << 18,
AEK_DSPV2 = 1 << 19,
AEK_DSPSILAN = 1 << 20,
AEK_ELRW = 1 << 21,
AEK_TRUST = 1 << 22,
AEK_JAVA = 1 << 23,
AEK_CACHE = 1 << 24,
AEK_NVIC = 1 << 25,
AEK_DOLOOP = 1 << 26,
AEK_HIGHREG = 1 << 27,
AEK_SMART = 1 << 28,
AEK_VDSP2E3 = 1 << 29,
AEK_VDSP2E60F = 1 << 30,
AEK_VDSPV2 = 1ULL << 31,
AEK_HARDTP = 1ULL << 32,
AEK_SOFTTP = 1ULL << 33,
AEK_ISTACK = 1ULL << 34,
AEK_CONSTPOOL = 1ULL << 35,
AEK_STACKSIZE = 1ULL << 36,
AEK_CCRT = 1ULL << 37,
AEK_VDSPV1 = 1ULL << 38,
AEK_E1 = 1ULL << 39,
AEK_E2 = 1ULL << 40,
AEK_2E3 = 1ULL << 41,
AEK_MP = 1ULL << 42,
AEK_3E3R1 = 1ULL << 43,
AEK_3E3R2 = 1ULL << 44,
AEK_3E3R3 = 1ULL << 45,
AEK_3E7 = 1ULL << 46,
AEK_MP1E2 = 1ULL << 47,
AEK_7E10 = 1ULL << 48,
AEK_10E60 = 1ULL << 49
};
// Arch extension modifiers for CPUs.
enum MultiArchExtKind : uint64_t {
MAEK_E1 = CSKY::AEK_E1 | CSKY::AEK_ELRW,
MAEK_E2 = CSKY::AEK_E2 | CSKY::MAEK_E1,
MAEK_2E3 = CSKY::AEK_2E3 | CSKY::MAEK_E2,
MAEK_MP = CSKY::AEK_MP | CSKY::MAEK_2E3,
MAEK_3E3R1 = CSKY::AEK_3E3R1,
MAEK_3E3R2 = CSKY::AEK_3E3R1 | CSKY::AEK_3E3R2 | CSKY::AEK_DOLOOP,
MAEK_3E7 = CSKY::AEK_3E7 | CSKY::MAEK_2E3,
MAEK_MP1E2 = CSKY::AEK_MP1E2 | CSKY::MAEK_3E7,
MAEK_7E10 = CSKY::AEK_7E10 | CSKY::MAEK_3E7,
MAEK_10E60 = CSKY::AEK_10E60 | CSKY::MAEK_7E10,
};
// FPU names.
enum CSKYFPUKind {
#define CSKY_FPU(NAME, KIND, VERSION) KIND,
#include "CSKYTargetParser.def"
FK_LAST
};
// FPU Version
enum class FPUVersion {
NONE,
FPV2,
FPV3,
};
// Arch names.
enum class ArchKind {
#define CSKY_ARCH(NAME, ID, ARCH_BASE_EXT) ID,
#include "CSKYTargetParser.def"
};
// List of Arch Extension names.
// FIXME: TableGen this.
struct ExtName {
const char *NameCStr;
size_t NameLength;
uint64_t ID;
const char *Feature;
const char *NegFeature;
StringRef getName() const { return StringRef(NameCStr, NameLength); }
};
const CSKY::ExtName CSKYARCHExtNames[] = {
#define CSKY_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) \
{NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE},
#include "CSKYTargetParser.def"
};
// List of CPU names and their arches.
template <typename T> struct CpuNames {
const char *NameCStr;
size_t NameLength;
T ArchID;
uint64_t defaultExt;
StringRef getName() const { return StringRef(NameCStr, NameLength); }
};
const CpuNames<CSKY::ArchKind> CPUNames[] = {
#define CSKY_CPU_NAME(NAME, ARCH_ID, DEFAULT_EXT) \
{NAME, sizeof(NAME) - 1, CSKY::ArchKind::ARCH_ID, DEFAULT_EXT},
#include "llvm/Support/CSKYTargetParser.def"
};
// FIXME: TableGen this.
// The entries must appear in the order listed in CSKY::CSKYFPUKind for correct
// indexing
struct FPUName {
const char *NameCStr;
size_t NameLength;
CSKYFPUKind ID;
FPUVersion FPUVer;
StringRef getName() const { return StringRef(NameCStr, NameLength); }
};
static const FPUName FPUNames[] = {
#define CSKY_FPU(NAME, KIND, VERSION) {NAME, sizeof(NAME) - 1, KIND, VERSION},
#include "llvm/Support/CSKYTargetParser.def"
};
// List of canonical arch names.
template <typename T> struct ArchNames {
const char *NameCStr;
size_t NameLength;
T ID;
uint64_t archBaseExt;
StringRef getName() const { return StringRef(NameCStr, NameLength); }
};
const ArchNames<CSKY::ArchKind> ARCHNames[] = {
#define CSKY_ARCH(NAME, ID, ARCH_BASE_EXT) \
{NAME, sizeof(NAME) - 1, CSKY::ArchKind::ID, ARCH_BASE_EXT},
#include "llvm/Support/CSKYTargetParser.def"
};
StringRef getArchName(ArchKind AK);
StringRef getDefaultCPU(StringRef Arch);
StringRef getArchExtName(uint64_t ArchExtKind);
StringRef getArchExtFeature(StringRef ArchExt);
uint64_t getDefaultExtensions(StringRef CPU);
bool getExtensionFeatures(uint64_t Extensions,
std::vector<StringRef> &Features);
// Information by ID
StringRef getFPUName(unsigned FPUKind);
FPUVersion getFPUVersion(unsigned FPUKind);
bool getFPUFeatures(CSKYFPUKind Kind, std::vector<StringRef> &Features);
// Parser
ArchKind parseArch(StringRef Arch);
ArchKind parseCPUArch(StringRef CPU);
uint64_t parseArchExt(StringRef ArchExt);
void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
} // namespace CSKY
} // namespace llvm
#endif

View File

@ -134,6 +134,9 @@ add_llvm_component_library(LLVMSupport
ConvertUTF.cpp
ConvertUTFWrapper.cpp
CrashRecoveryContext.cpp
CSKYAttributes.cpp
CSKYAttributeParser.cpp
CSKYTargetParser.cpp
DataExtractor.cpp
Debug.cpp
DebugCounter.cpp

View File

@ -0,0 +1,155 @@
//===-- CSKYAttributeParser.cpp - CSKY Attribute Parser -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/CSKYAttributeParser.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Errc.h"
using namespace llvm;
const CSKYAttributeParser::DisplayHandler
CSKYAttributeParser::displayRoutines[] = {
{
CSKYAttrs::CSKY_ARCH_NAME,
&ELFAttributeParser::stringAttribute,
},
{
CSKYAttrs::CSKY_CPU_NAME,
&ELFAttributeParser::stringAttribute,
},
{
CSKYAttrs::CSKY_ISA_FLAGS,
&ELFAttributeParser::integerAttribute,
},
{
CSKYAttrs::CSKY_ISA_EXT_FLAGS,
&ELFAttributeParser::integerAttribute,
},
{
CSKYAttrs::CSKY_DSP_VERSION,
&CSKYAttributeParser::dspVersion,
},
{
CSKYAttrs::CSKY_VDSP_VERSION,
&CSKYAttributeParser::vdspVersion,
},
{
CSKYAttrs::CSKY_FPU_VERSION,
&CSKYAttributeParser::fpuVersion,
},
{
CSKYAttrs::CSKY_FPU_ABI,
&CSKYAttributeParser::fpuABI,
},
{
CSKYAttrs::CSKY_FPU_ROUNDING,
&CSKYAttributeParser::fpuRounding,
},
{
CSKYAttrs::CSKY_FPU_DENORMAL,
&CSKYAttributeParser::fpuDenormal,
},
{
CSKYAttrs::CSKY_FPU_EXCEPTION,
&CSKYAttributeParser::fpuException,
},
{
CSKYAttrs::CSKY_FPU_NUMBER_MODULE,
&ELFAttributeParser::stringAttribute,
},
{
CSKYAttrs::CSKY_FPU_HARDFP,
&CSKYAttributeParser::fpuHardFP,
}};
Error CSKYAttributeParser::handler(uint64_t tag, bool &handled) {
handled = false;
for (unsigned AHI = 0, AHE = array_lengthof(displayRoutines); AHI != AHE;
++AHI) {
if (uint64_t(displayRoutines[AHI].attribute) == tag) {
if (Error e = (this->*displayRoutines[AHI].routine)(tag))
return e;
handled = true;
break;
}
}
return Error::success();
}
Error CSKYAttributeParser::dspVersion(unsigned tag) {
static const char *strings[] = {"Error", "DSP Extension", "DSP 2.0"};
return parseStringAttribute("Tag_CSKY_DSP_VERSION", tag,
makeArrayRef(strings));
}
Error CSKYAttributeParser::vdspVersion(unsigned tag) {
static const char *strings[] = {"Error", "VDSP Version 1", "VDSP Version 2"};
return parseStringAttribute("Tag_CSKY_VDSP_VERSION", tag,
makeArrayRef(strings));
}
Error CSKYAttributeParser::fpuVersion(unsigned tag) {
static const char *strings[] = {"Error", "FPU Version 1", "FPU Version 2",
"FPU Version 3"};
return parseStringAttribute("Tag_CSKY_FPU_VERSION", tag,
makeArrayRef(strings));
}
Error CSKYAttributeParser::fpuABI(unsigned tag) {
static const char *strings[] = {"Error", "Soft", "SoftFP", "Hard"};
return parseStringAttribute("Tag_CSKY_FPU_ABI", tag, makeArrayRef(strings));
}
Error CSKYAttributeParser::fpuRounding(unsigned tag) {
static const char *strings[] = {"None", "Needed"};
return parseStringAttribute("Tag_CSKY_FPU_ROUNDING", tag,
makeArrayRef(strings));
}
Error CSKYAttributeParser::fpuDenormal(unsigned tag) {
static const char *strings[] = {"None", "Needed"};
return parseStringAttribute("Tag_CSKY_FPU_DENORMAL", tag,
makeArrayRef(strings));
}
Error CSKYAttributeParser::fpuException(unsigned tag) {
static const char *strings[] = {"None", "Needed"};
return parseStringAttribute("Tag_CSKY_FPU_EXCEPTION", tag,
makeArrayRef(strings));
}
Error CSKYAttributeParser::fpuHardFP(unsigned tag) {
uint64_t value = de.getULEB128(cursor);
ListSeparator LS(" ");
std::string description;
if (value & 0x1) {
description += LS;
description += "Half";
}
if ((value >> 1) & 0x1) {
description += LS;
description += "Single";
}
if ((value >> 2) & 0x1) {
description += LS;
description += "Double";
}
if (description.empty()) {
printAttribute(tag, value, "");
return createStringError(errc::invalid_argument,
"unknown Tag_CSKY_FPU_HARDFP value: " +
Twine(value));
}
printAttribute(tag, value, description);
return Error::success();
}

View File

@ -0,0 +1,33 @@
//===-- CSKYAttributes.cpp - CSKY Attributes ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/CSKYAttributes.h"
using namespace llvm;
using namespace llvm::CSKYAttrs;
static const TagNameItem tagData[] = {
{CSKY_ARCH_NAME, "Tag_CSKY_ARCH_NAME"},
{CSKY_CPU_NAME, "Tag_CSKY_CPU_NAME"},
{CSKY_CPU_NAME, "Tag_CSKY_CPU_NAME"},
{CSKY_ISA_FLAGS, "Tag_CSKY_ISA_FLAGS"},
{CSKY_ISA_EXT_FLAGS, "Tag_CSKY_ISA_EXT_FLAGS"},
{CSKY_DSP_VERSION, "Tag_CSKY_DSP_VERSION"},
{CSKY_VDSP_VERSION, "Tag_CSKY_VDSP_VERSION"},
{CSKY_FPU_VERSION, "Tag_CSKY_FPU_VERSION"},
{CSKY_FPU_ABI, "Tag_CSKY_FPU_ABI"},
{CSKY_FPU_ROUNDING, "Tag_CSKY_FPU_ROUNDING"},
{CSKY_FPU_DENORMAL, "Tag_CSKY_FPU_DENORMAL"},
{CSKY_FPU_EXCEPTION, "Tag_CSKY_FPU_EXCEPTION"},
{CSKY_FPU_NUMBER_MODULE, "Tag_CSKY_FPU_NUMBER_MODULE"},
{CSKY_FPU_HARDFP, "Tag_CSKY_FPU_HARDFP"}};
constexpr TagNameMap CSKYAttributeTags{tagData};
const TagNameMap &llvm::CSKYAttrs::getCSKYAttributeTags() {
return CSKYAttributeTags;
}

View File

@ -0,0 +1,181 @@
//===-- 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 CSKY hardware features
// such as CPU/ARCH names.
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/CSKYTargetParser.h"
#include "llvm/ADT/StringSwitch.h"
#include <cctype>
using namespace llvm;
bool CSKY::getFPUFeatures(CSKYFPUKind CSKYFPUKind,
std::vector<StringRef> &Features) {
if (CSKYFPUKind >= FK_LAST || CSKYFPUKind == FK_INVALID)
return false;
switch (CSKYFPUKind) {
case FK_AUTO:
Features.push_back("+fpuv2_sf");
Features.push_back("+fpuv2_df");
Features.push_back("+fdivdu");
break;
case FK_FPV2:
Features.push_back("+fpuv2_sf");
Features.push_back("+fpuv2_df");
break;
case FK_FPV2_DIVD:
Features.push_back("+fpuv2_sf");
Features.push_back("+fpuv2_df");
Features.push_back("+fdivdu");
break;
case FK_FPV2_SF:
Features.push_back("+fpuv2_sf");
break;
case FK_FPV3:
Features.push_back("+fpuv3_hf");
Features.push_back("+fpuv3_sf");
Features.push_back("+fpuv3_df");
break;
case FK_FPV3_HF:
Features.push_back("+fpuv3_hf");
break;
case FK_FPV3_HSF:
Features.push_back("+fpuv3_hf");
Features.push_back("+fpuv3_sf");
break;
case FK_FPV3_SDF:
Features.push_back("+fpuv3_sf");
Features.push_back("+fpuv3_df");
break;
default:
llvm_unreachable("Unknown FPU Kind");
return false;
}
return true;
}
// ======================================================= //
// Information by ID
// ======================================================= //
StringRef CSKY::getArchName(ArchKind AK) {
return ARCHNames[static_cast<unsigned>(AK)].getName();
}
// The default cpu's name is same as arch name.
StringRef CSKY::getDefaultCPU(StringRef Arch) {
ArchKind AK = parseArch(Arch);
if (AK == CSKY::ArchKind::INVALID)
return StringRef();
return Arch;
}
// ======================================================= //
// Parsers
// ======================================================= //
CSKY::ArchKind CSKY::parseArch(StringRef Arch) {
for (const auto A : ARCHNames) {
if (A.getName() == Arch)
return A.ID;
}
return CSKY::ArchKind::INVALID;
}
CSKY::ArchKind CSKY::parseCPUArch(StringRef CPU) {
for (const auto C : CPUNames) {
if (CPU == C.getName())
return C.ArchID;
}
return CSKY::ArchKind::INVALID;
}
uint64_t CSKY::parseArchExt(StringRef ArchExt) {
for (const auto &A : CSKYARCHExtNames) {
if (ArchExt == A.getName())
return A.ID;
}
return AEK_INVALID;
}
void CSKY::fillValidCPUArchList(SmallVectorImpl<StringRef> &Values) {
for (const CpuNames<CSKY::ArchKind> &Arch : CPUNames) {
if (Arch.ArchID != CSKY::ArchKind::INVALID)
Values.push_back(Arch.getName());
}
}
StringRef CSKY::getFPUName(unsigned FPUKind) {
if (FPUKind >= FK_LAST)
return StringRef();
return FPUNames[FPUKind].getName();
}
CSKY::FPUVersion CSKY::getFPUVersion(unsigned FPUKind) {
if (FPUKind >= FK_LAST)
return FPUVersion::NONE;
return FPUNames[FPUKind].FPUVer;
}
uint64_t CSKY::getDefaultExtensions(StringRef CPU) {
return StringSwitch<uint64_t>(CPU)
#define CSKY_CPU_NAME(NAME, ID, DEFAULT_EXT) \
.Case(NAME, ARCHNames[static_cast<unsigned>(ArchKind::ID)].archBaseExt | \
DEFAULT_EXT)
#include "llvm/Support/CSKYTargetParser.def"
.Default(CSKY::AEK_INVALID);
}
StringRef CSKY::getArchExtName(uint64_t ArchExtKind) {
for (const auto &AE : CSKYARCHExtNames)
if (ArchExtKind == AE.ID)
return AE.getName();
return StringRef();
}
static bool stripNegationPrefix(StringRef &Name) {
if (Name.startswith("no")) {
Name = Name.substr(2);
return true;
}
return false;
}
StringRef CSKY::getArchExtFeature(StringRef ArchExt) {
bool Negated = stripNegationPrefix(ArchExt);
for (const auto &AE : CSKYARCHExtNames) {
if (AE.Feature && ArchExt == AE.getName())
return StringRef(Negated ? AE.NegFeature : AE.Feature);
}
return StringRef();
}
bool CSKY::getExtensionFeatures(uint64_t Extensions,
std::vector<StringRef> &Features) {
if (Extensions == CSKY::AEK_INVALID)
return false;
for (const auto &AE : CSKYARCHExtNames) {
if ((Extensions & AE.ID) == AE.ID && AE.Feature)
Features.push_back(AE.Feature);
else if (AE.NegFeature)
Features.push_back(AE.NegFeature);
}
return true;
}

View File

@ -18,6 +18,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCParser/MCAsmLexer.h"
#include "llvm/MC/MCParser/MCParsedAsmOperand.h"
#include "llvm/MC/MCParser/MCTargetAsmParser.h"

View File

@ -22,6 +22,8 @@ add_llvm_unittest(SupportTests
CompressionTest.cpp
ConvertUTFTest.cpp
CRCTest.cpp
CSKYAttributeParserTest.cpp
CSKYTargetParserTest.cpp
DataExtractorTest.cpp
DebugTest.cpp
DebugCounterTest.cpp

View File

@ -0,0 +1,236 @@
//===----- unittests/CSKYAttributeParserTest.cpp --------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/CSKYAttributeParser.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/ELFAttributes.h"
#include "gtest/gtest.h"
#include <string>
using namespace llvm;
struct CSKYAttributeSection {
unsigned Tag;
struct {
unsigned IntValue;
const char *StringValue;
} Value;
CSKYAttributeSection(unsigned tag, unsigned value) : Tag(tag) {
Value.IntValue = value;
}
CSKYAttributeSection(unsigned tag, const char *value) : Tag(tag) {
Value.StringValue = value;
}
void writeInt(raw_ostream &OS) {
OS.flush();
// Format version.
OS << 'A'
// uint32_t = VendorHeaderSize + TagHeaderSize + ContentsSize.
<< (uint8_t)16 << (uint8_t)0 << (uint8_t)0
<< (uint8_t)0
// CurrentVendor.
<< "csky"
<< '\0'
// ELFAttrs::File.
<< (uint8_t)1
// uint32_t = TagHeaderSize + ContentsSize.
<< (uint8_t)6 << (uint8_t)0 << (uint8_t)0
<< (uint8_t)0
// Tag
<< (uint8_t)Tag
// IntValue
<< (uint8_t)Value.IntValue;
}
void writeString(raw_ostream &OS) {
OS.flush();
// Format version.
OS << 'A'
// uint32_t = VendorHeaderSize + TagHeaderSize + ContentsSize.
<< (uint8_t)(16 + strlen(Value.StringValue)) << (uint8_t)0 << (uint8_t)0
<< (uint8_t)0
// CurrentVendor.
<< "csky"
<< '\0'
// ELFAttrs::File.
<< (uint8_t)1
// uint32_t = TagHeaderSize + ContentsSize.
<< (uint8_t)(6 + strlen(Value.StringValue)) << (uint8_t)0 << (uint8_t)0
<< (uint8_t)0
// Tag
<< (uint8_t)Tag
// StringValue
<< Value.StringValue << '\0';
}
};
static bool testAttributeInt(unsigned Tag, unsigned Value, unsigned ExpectedTag,
unsigned ExpectedValue) {
std::string buffer;
raw_string_ostream OS(buffer);
CSKYAttributeSection Section(Tag, Value);
Section.writeInt(OS);
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(OS.str().c_str()),
OS.str().size());
CSKYAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
Optional<unsigned> Attr = Parser.getAttributeValue(ExpectedTag);
return Attr.hasValue() && Attr.getValue() == ExpectedValue;
}
static bool testAttributeString(unsigned Tag, const char *Value,
unsigned ExpectedTag,
const char *ExpectedValue) {
std::string buffer;
raw_string_ostream OS(buffer);
CSKYAttributeSection Section(Tag, Value);
Section.writeString(OS);
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(OS.str().c_str()),
OS.str().size());
CSKYAttributeParser Parser;
cantFail(Parser.parse(Bytes, support::little));
Optional<StringRef> Attr = Parser.getAttributeString(ExpectedTag);
return Attr.hasValue() && Attr.getValue() == ExpectedValue;
}
static void testParseError(unsigned Tag, unsigned Value, const char *msg) {
std::string buffer;
raw_string_ostream OS(buffer);
CSKYAttributeSection Section(Tag, Value);
Section.writeInt(OS);
ArrayRef<uint8_t> Bytes(reinterpret_cast<const uint8_t *>(OS.str().c_str()),
OS.str().size());
CSKYAttributeParser Parser;
Error e = Parser.parse(Bytes, support::little);
EXPECT_STREQ(toString(std::move(e)).c_str(), msg);
}
static bool testTagString(unsigned Tag, const char *name) {
return ELFAttrs::attrTypeAsString(Tag, CSKYAttrs::getCSKYAttributeTags())
.str() == name;
}
TEST(ArchName, testAttribute) {
EXPECT_TRUE(testTagString(4, "Tag_CSKY_ARCH_NAME"));
EXPECT_TRUE(
testAttributeString(4, "ck860", CSKYAttrs::CSKY_ARCH_NAME, "ck860"));
EXPECT_FALSE(
testAttributeString(4, "ck86", CSKYAttrs::CSKY_ARCH_NAME, "ck60"));
}
TEST(CPUName, testAttribute) {
EXPECT_TRUE(testTagString(5, "Tag_CSKY_CPU_NAME"));
EXPECT_TRUE(
testAttributeString(5, "ck860fv", CSKYAttrs::CSKY_CPU_NAME, "ck860fv"));
EXPECT_FALSE(
testAttributeString(5, "ck860", CSKYAttrs::CSKY_CPU_NAME, "ck860fv"));
}
TEST(DSPVersion, testAttribute) {
EXPECT_TRUE(testTagString(8, "Tag_CSKY_DSP_VERSION"));
EXPECT_TRUE(testAttributeInt(8, 1, CSKYAttrs::CSKY_DSP_VERSION,
CSKYAttrs::DSP_VERSION_EXTENSION));
EXPECT_TRUE(testAttributeInt(8, 2, CSKYAttrs::CSKY_DSP_VERSION,
CSKYAttrs::DSP_VERSION_2));
EXPECT_FALSE(testAttributeInt(8, 0, CSKYAttrs::CSKY_DSP_VERSION,
CSKYAttrs::DSP_VERSION_EXTENSION));
testParseError(8, 3, "unknown Tag_CSKY_DSP_VERSION value: 3");
}
TEST(VDSPVersion, testAttribute) {
EXPECT_TRUE(testTagString(9, "Tag_CSKY_VDSP_VERSION"));
EXPECT_TRUE(testAttributeInt(9, 1, CSKYAttrs::CSKY_VDSP_VERSION,
CSKYAttrs::VDSP_VERSION_1));
EXPECT_TRUE(testAttributeInt(9, 2, CSKYAttrs::CSKY_VDSP_VERSION,
CSKYAttrs::VDSP_VERSION_2));
EXPECT_FALSE(testAttributeInt(9, 0, CSKYAttrs::CSKY_VDSP_VERSION,
CSKYAttrs::VDSP_VERSION_2));
testParseError(9, 3, "unknown Tag_CSKY_VDSP_VERSION value: 3");
}
TEST(FPUVersion, testAttribute) {
EXPECT_TRUE(testTagString(16, "Tag_CSKY_FPU_VERSION"));
EXPECT_TRUE(testAttributeInt(16, 1, CSKYAttrs::CSKY_FPU_VERSION,
CSKYAttrs::FPU_VERSION_1));
EXPECT_TRUE(testAttributeInt(16, 2, CSKYAttrs::CSKY_FPU_VERSION,
CSKYAttrs::FPU_VERSION_2));
EXPECT_TRUE(testAttributeInt(16, 3, CSKYAttrs::CSKY_FPU_VERSION,
CSKYAttrs::FPU_VERSION_3));
EXPECT_FALSE(testAttributeInt(16, 0, CSKYAttrs::CSKY_FPU_VERSION,
CSKYAttrs::FPU_VERSION_3));
testParseError(16, 4, "unknown Tag_CSKY_FPU_VERSION value: 4");
}
TEST(FPUABI, testAttribute) {
EXPECT_TRUE(testTagString(17, "Tag_CSKY_FPU_ABI"));
EXPECT_TRUE(testAttributeInt(17, 1, CSKYAttrs::CSKY_FPU_ABI,
CSKYAttrs::FPU_ABI_SOFT));
EXPECT_TRUE(testAttributeInt(17, 2, CSKYAttrs::CSKY_FPU_ABI,
CSKYAttrs::FPU_ABI_SOFTFP));
EXPECT_TRUE(testAttributeInt(17, 3, CSKYAttrs::CSKY_FPU_ABI,
CSKYAttrs::FPU_ABI_HARD));
EXPECT_FALSE(testAttributeInt(17, 0, CSKYAttrs::CSKY_FPU_ABI,
CSKYAttrs::FPU_ABI_HARD));
testParseError(17, 4, "unknown Tag_CSKY_FPU_ABI value: 4");
}
TEST(FPURounding, testAttribute) {
EXPECT_TRUE(testTagString(18, "Tag_CSKY_FPU_ROUNDING"));
EXPECT_TRUE(
testAttributeInt(18, 0, CSKYAttrs::CSKY_FPU_ROUNDING, CSKYAttrs::NONE));
EXPECT_TRUE(
testAttributeInt(18, 1, CSKYAttrs::CSKY_FPU_ROUNDING, CSKYAttrs::NEEDED));
testParseError(18, 2, "unknown Tag_CSKY_FPU_ROUNDING value: 2");
}
TEST(FPUDenormal, testAttribute) {
EXPECT_TRUE(testTagString(19, "Tag_CSKY_FPU_DENORMAL"));
EXPECT_TRUE(
testAttributeInt(19, 0, CSKYAttrs::CSKY_FPU_DENORMAL, CSKYAttrs::NONE));
EXPECT_TRUE(
testAttributeInt(19, 1, CSKYAttrs::CSKY_FPU_DENORMAL, CSKYAttrs::NEEDED));
testParseError(19, 2, "unknown Tag_CSKY_FPU_DENORMAL value: 2");
}
TEST(FPUException, testAttribute) {
EXPECT_TRUE(testTagString(20, "Tag_CSKY_FPU_EXCEPTION"));
EXPECT_TRUE(
testAttributeInt(20, 0, CSKYAttrs::CSKY_FPU_EXCEPTION, CSKYAttrs::NONE));
EXPECT_TRUE(testAttributeInt(20, 1, CSKYAttrs::CSKY_FPU_EXCEPTION,
CSKYAttrs::NEEDED));
testParseError(20, 2, "unknown Tag_CSKY_FPU_EXCEPTION value: 2");
}
TEST(FPUNumberModule, testAttribute) {
EXPECT_TRUE(testTagString(21, "Tag_CSKY_FPU_NUMBER_MODULE"));
EXPECT_TRUE(testAttributeString(
21, "IEEE 754", CSKYAttrs::CSKY_FPU_NUMBER_MODULE, "IEEE 754"));
EXPECT_FALSE(testAttributeString(
21, "IEEE 755", CSKYAttrs::CSKY_FPU_NUMBER_MODULE, "IEEE 754"));
}
TEST(FPUHardFP, testAttribute) {
EXPECT_TRUE(testTagString(22, "Tag_CSKY_FPU_HARDFP"));
EXPECT_TRUE(testAttributeInt(22, 1, CSKYAttrs::CSKY_FPU_HARDFP,
CSKYAttrs::FPU_HARDFP_HALF));
EXPECT_TRUE(testAttributeInt(22, 2, CSKYAttrs::CSKY_FPU_HARDFP,
CSKYAttrs::FPU_HARDFP_SINGLE));
EXPECT_TRUE(testAttributeInt(22, 4, CSKYAttrs::CSKY_FPU_HARDFP,
CSKYAttrs::FPU_HARDFP_DOUBLE));
EXPECT_FALSE(testAttributeInt(22, 3, CSKYAttrs::CSKY_FPU_HARDFP,
CSKYAttrs::FPU_HARDFP_DOUBLE));
testParseError(22, 0, "unknown Tag_CSKY_FPU_HARDFP value: 0");
testParseError(22, 8, "unknown Tag_CSKY_FPU_HARDFP value: 8");
}

File diff suppressed because it is too large Load Diff

View File

@ -62,6 +62,9 @@ static_library("Support") {
"ConvertUTF.cpp",
"ConvertUTFWrapper.cpp",
"CrashRecoveryContext.cpp",
"CSKYAttributeParser.cpp",
"CSKYAttributes.cpp",
"CSKYTargetParser.cpp",
"DAGDeltaAlgorithm.cpp",
"DJB.cpp",
"DataExtractor.cpp",

View File

@ -25,6 +25,8 @@ unittest("SupportTests") {
"CompressionTest.cpp",
"ConvertUTFTest.cpp",
"CrashRecoveryTest.cpp",
"CSKYAttributeParserTest.cpp",
"CSKYTargetParserTest.cpp",
"DJBTest.cpp",
"DataExtractorTest.cpp",
"DebugCounterTest.cpp",