Files
TheRock/compiler/amd-llvm/llvm/lib/TargetParser/AVRTargetParser.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

51 lines
1.8 KiB
C++

//===-- AVRTargetParser - Parser for AVR target features ------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file implements a target parser to recognise AVR hardware features.
///
//===----------------------------------------------------------------------===//
#include "llvm/TargetParser/AVRTargetParser.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Errc.h"
using namespace llvm;
Expected<std::string> AVR::getFeatureSetFromEFlag(const unsigned EFlag) {
static const DenseMap<unsigned, StringRef> EFlagToFeatureSet = {
{ELF::EF_AVR_ARCH_AVR1, "avr1"},
{ELF::EF_AVR_ARCH_AVR2, "avr2"},
{ELF::EF_AVR_ARCH_AVR25, "avr25"},
{ELF::EF_AVR_ARCH_AVR3, "avr3"},
{ELF::EF_AVR_ARCH_AVR31, "avr31"},
{ELF::EF_AVR_ARCH_AVR35, "avr35"},
{ELF::EF_AVR_ARCH_AVR4, "avr4"},
{ELF::EF_AVR_ARCH_AVR5, "avr5"},
{ELF::EF_AVR_ARCH_AVR51, "avr51"},
{ELF::EF_AVR_ARCH_AVR6, "avr6"},
{ELF::EF_AVR_ARCH_AVRTINY, "avrtiny"},
{ELF::EF_AVR_ARCH_XMEGA1, "xmega1"},
{ELF::EF_AVR_ARCH_XMEGA2, "xmega2"},
{ELF::EF_AVR_ARCH_XMEGA3, "xmega3"},
{ELF::EF_AVR_ARCH_XMEGA4, "xmega4"},
{ELF::EF_AVR_ARCH_XMEGA5, "xmega"},
{ELF::EF_AVR_ARCH_XMEGA6, "xmega"},
{ELF::EF_AVR_ARCH_XMEGA7, "xmega"},
};
auto It = EFlagToFeatureSet.find(EFlag);
if (It != EFlagToFeatureSet.end())
return It->second.str();
return createStringError(errc::invalid_argument,
"unrecognised AVR version, 0x" +
Twine::utohexstr(EFlag));
}