llvm/llvm/include/llvm/TargetParser/CSKYTargetParser.h

//===-- 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_TARGETPARSER_CSKYTARGETPARSER_H
#define LLVM_TARGETPARSER_CSKYTARGETPARSER_H

#include "llvm/TargetParser/Triple.h"
#include <vector>

namespace llvm {
class StringRef;

namespace CSKY {

// Arch extension modifiers for CPUs.
enum ArchExtKind : uint64_t {};

// Arch extension modifiers for CPUs.
enum MultiArchExtKind : uint64_t {};
// FPU names.
enum CSKYFPUKind {};

// FPU Version
enum class FPUVersion {};

// Arch names.
enum class ArchKind {};

// List of Arch Extension names.
// FIXME: TableGen this.
struct ExtName {};

const CSKY::ExtName CSKYARCHExtNames[] =;

// List of CPU names and their arches.
template <typename T> struct CpuNames {};
const CpuNames<CSKY::ArchKind> CPUNames[] =;

// FIXME: TableGen this.
// The entries must appear in the order listed in CSKY::CSKYFPUKind for correct
// indexing
struct FPUName {};

static const FPUName FPUNames[] =;

// List of canonical arch names.
template <typename T> struct ArchNames {};
const ArchNames<CSKY::ArchKind> ARCHNames[] =;

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