blob: 124cb3b4b98bbf189b8d6d9d1102d74483d592d4 [file] [log] [blame]
Chris Lattner7b26fce2009-08-22 20:48:53 +00001//===-- SparcMCAsmInfo.cpp - Sparc asm properties -------------------------===//
Jim Laskey0e835412006-09-07 22:05:02 +00002//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jim Laskey0e835412006-09-07 22:05:02 +00007//
8//===----------------------------------------------------------------------===//
9//
Chris Lattner7b26fce2009-08-22 20:48:53 +000010// This file contains the declarations of the SparcMCAsmInfo properties.
Jim Laskey0e835412006-09-07 22:05:02 +000011//
12//===----------------------------------------------------------------------===//
13
Chris Lattner7b26fce2009-08-22 20:48:53 +000014#include "SparcMCAsmInfo.h"
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000015#include "SparcMCExpr.h"
Evan Chenga83b37a2011-07-15 02:09:41 +000016#include "llvm/ADT/Triple.h"
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000017#include "llvm/MC/MCStreamer.h"
Evan Chenga83b37a2011-07-15 02:09:41 +000018
Jim Laskey0e835412006-09-07 22:05:02 +000019using namespace llvm;
20
Douglas Katzman9160e782015-04-29 20:30:57 +000021void SparcELFMCAsmInfo::anchor() {}
David Blaikiea379b1812011-12-20 02:50:00 +000022
Rafael Espindola140a8372013-05-10 18:16:59 +000023SparcELFMCAsmInfo::SparcELFMCAsmInfo(StringRef TT) {
Evan Chenga83b37a2011-07-15 02:09:41 +000024 Triple TheTriple(TT);
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000025 bool isV9 = (TheTriple.getArch() == Triple::sparcv9);
Douglas Katzman9160e782015-04-29 20:30:57 +000026 IsLittleEndian = (TheTriple.getArch() == Triple::sparcel);
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000027
28 if (isV9) {
Eli Bendersky32aab222013-01-23 16:22:04 +000029 PointerSize = CalleeSaveStackSlotSize = 8;
30 }
Evan Chenga83b37a2011-07-15 02:09:41 +000031
Jim Laskey0e835412006-09-07 22:05:02 +000032 Data16bitsDirective = "\t.half\t";
33 Data32bitsDirective = "\t.word\t";
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000034 // .xword is only supported by V9.
Craig Topper062a2ba2014-04-25 05:30:21 +000035 Data64bitsDirective = (isV9) ? "\t.xword\t" : nullptr;
Jim Laskey0e835412006-09-07 22:05:02 +000036 ZeroDirective = "\t.skip\t";
37 CommentString = "!";
Richard Penningtonbd1fc362009-09-08 12:47:30 +000038 SupportsDebugInformation = true;
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000039
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000040 ExceptionsType = ExceptionHandling::DwarfCFI;
41
Chris Lattnerc9ea8fd2009-08-08 20:43:12 +000042 SunStyleELFSectionSwitchSyntax = true;
Venkatraman Govindarajubc2190f2009-08-26 18:24:12 +000043 UsesELFSectionDirectiveForBSS = true;
Daniel Sanders753e1762014-02-13 14:44:26 +000044
Brad Smithdd6675c2015-01-14 07:53:39 +000045 UseIntegratedAssembler = true;
Anton Korobeynikov1a11e8a2008-08-07 09:51:25 +000046}
47
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000048const MCExpr*
49SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
50 unsigned Encoding,
51 MCStreamer &Streamer) const {
52 if (Encoding & dwarf::DW_EH_PE_pcrel) {
53 MCContext &Ctx = Streamer.getContext();
54 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
55 MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
56 }
Anton Korobeynikov1a11e8a2008-08-07 09:51:25 +000057
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000058 return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
59}
Venkatraman Govindaraju141d0e22014-01-29 06:59:20 +000060
61const MCExpr*
62SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
63 unsigned Encoding,
64 MCStreamer &Streamer) const {
65 if (Encoding & dwarf::DW_EH_PE_pcrel) {
66 MCContext &Ctx = Streamer.getContext();
67 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
68 MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
69 }
70 return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
71}