Path: blob/main/contrib/llvm-project/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
35294 views
//===- SparcMCAsmInfo.cpp - Sparc asm properties --------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file contains the declarations of the SparcMCAsmInfo properties.9//10//===----------------------------------------------------------------------===//1112#include "SparcMCAsmInfo.h"13#include "SparcMCExpr.h"14#include "llvm/BinaryFormat/Dwarf.h"15#include "llvm/MC/MCExpr.h"16#include "llvm/MC/MCStreamer.h"17#include "llvm/MC/MCTargetOptions.h"18#include "llvm/TargetParser/Triple.h"1920using namespace llvm;2122void SparcELFMCAsmInfo::anchor() {}2324SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Triple &TheTriple) {25bool isV9 = (TheTriple.getArch() == Triple::sparcv9);26IsLittleEndian = (TheTriple.getArch() == Triple::sparcel);2728if (isV9) {29CodePointerSize = CalleeSaveStackSlotSize = 8;30}3132Data16bitsDirective = "\t.half\t";33Data32bitsDirective = "\t.word\t";34// .xword is only supported by V9.35Data64bitsDirective = (isV9) ? "\t.xword\t" : nullptr;36ZeroDirective = "\t.skip\t";37CommentString = "!";38SupportsDebugInformation = true;3940ExceptionsType = ExceptionHandling::DwarfCFI;4142UsesELFSectionDirectiveForBSS = true;43}4445const MCExpr*46SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,47unsigned Encoding,48MCStreamer &Streamer) const {49if (Encoding & dwarf::DW_EH_PE_pcrel) {50MCContext &Ctx = Streamer.getContext();51return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,52MCSymbolRefExpr::create(Sym, Ctx), Ctx);53}5455return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);56}5758const MCExpr*59SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,60unsigned Encoding,61MCStreamer &Streamer) const {62if (Encoding & dwarf::DW_EH_PE_pcrel) {63MCContext &Ctx = Streamer.getContext();64return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,65MCSymbolRefExpr::create(Sym, Ctx), Ctx);66}67return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);68}697071