Fangrui Song 98a640a2fa [MC] Move VariantKind info to MCAsmInfo
Follow-up to 14951a5a3120e50084b3c5fb217e2d47992a24d1

* Unify getVariantKindName and getVariantKindForName
* Allow each target to specify the preferred case (albeit ignored in MCParser)

Note: targets that use variant kinds should call MCExpr::print with a
non-null MAI to print variant kinds. operator<< passes a nullptr to
`MCExpr::print`, which should be avoided (e.g. Hexagon; fixed in
commit cf00ac81ac049cddb80aec1d6d88b8fab4f209e8).
2025-03-02 20:36:20 -08:00

41 lines
1.4 KiB
C++

//===-- AVRMCAsmInfo.cpp - AVR asm properties -----------------------------===//
//
// 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 the declarations of the AVRMCAsmInfo properties.
//
//===----------------------------------------------------------------------===//
#include "AVRMCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/TargetParser/Triple.h"
using namespace llvm;
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
{MCSymbolRefExpr::VK_AVR_DIFF16, "diff16"},
{MCSymbolRefExpr::VK_AVR_DIFF32, "diff32"},
{MCSymbolRefExpr::VK_AVR_DIFF8, "diff8"},
{MCSymbolRefExpr::VK_AVR_HI8, "hi8"},
{MCSymbolRefExpr::VK_AVR_HLO8, "hlo8"},
{MCSymbolRefExpr::VK_AVR_LO8, "lo8"},
{MCSymbolRefExpr::VK_AVR_NONE, "none"},
{MCSymbolRefExpr::VK_AVR_PM, "pm"},
};
AVRMCAsmInfo::AVRMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) {
CodePointerSize = 2;
CalleeSaveStackSlotSize = 2;
CommentString = ";";
SeparatorString = "$";
PrivateGlobalPrefix = ".L";
PrivateLabelPrefix = ".L";
UsesELFSectionDirectiveForBSS = true;
SupportsDebugInformation = true;
initializeVariantKinds(variantKindDescs);
}