1 //===-- SparcMCAsmInfo.cpp - Sparc asm properties -------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declarations of the SparcMCAsmInfo properties.
12 //===----------------------------------------------------------------------===//
14 #include "SparcMCAsmInfo.h"
15 #include "SparcMCExpr.h"
16 #include "llvm/ADT/Triple.h"
17 #include "llvm/MC/MCStreamer.h"
21 void SparcELFMCAsmInfo::anchor() { }
23 SparcELFMCAsmInfo::SparcELFMCAsmInfo(StringRef TT) {
24 IsLittleEndian = false;
26 bool isV9 = (TheTriple.getArch() == Triple::sparcv9);
29 PointerSize = CalleeSaveStackSlotSize = 8;
32 Data16bitsDirective = "\t.half\t";
33 Data32bitsDirective = "\t.word\t";
34 // .xword is only supported by V9.
35 Data64bitsDirective = (isV9) ? "\t.xword\t" : nullptr;
36 ZeroDirective = "\t.skip\t";
39 SupportsDebugInformation = true;
41 ExceptionsType = ExceptionHandling::DwarfCFI;
43 SunStyleELFSectionSwitchSyntax = true;
44 UsesELFSectionDirectiveForBSS = true;
46 if (TheTriple.getOS() == llvm::Triple::Solaris ||
47 TheTriple.getOS() == llvm::Triple::OpenBSD)
48 UseIntegratedAssembler = true;
52 SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
54 MCStreamer &Streamer) const {
55 if (Encoding & dwarf::DW_EH_PE_pcrel) {
56 MCContext &Ctx = Streamer.getContext();
57 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
58 MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
61 return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
65 SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
67 MCStreamer &Streamer) const {
68 if (Encoding & dwarf::DW_EH_PE_pcrel) {
69 MCContext &Ctx = Streamer.getContext();
70 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
71 MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
73 return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);