blob: 280c6d7937b2b4b4a04d266b334e124437e161a0 [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"
Daniel Sanders50f17232015-09-15 16:17:27 +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
Daniel Sanders50f17232015-09-15 16:17:27 +000023SparcELFMCAsmInfo::SparcELFMCAsmInfo(const Triple &TheTriple) {
24 bool isV9 = (TheTriple.getArch() == Triple::sparcv9);
25 IsLittleEndian = (TheTriple.getArch() == Triple::sparcel);
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000026
27 if (isV9) {
Eli Bendersky32aab222013-01-23 16:22:04 +000028 PointerSize = CalleeSaveStackSlotSize = 8;
29 }
Evan Chenga83b37a2011-07-15 02:09:41 +000030
Jim Laskey0e835412006-09-07 22:05:02 +000031 Data16bitsDirective = "\t.half\t";
32 Data32bitsDirective = "\t.word\t";
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000033 // .xword is only supported by V9.
Craig Topper062a2ba2014-04-25 05:30:21 +000034 Data64bitsDirective = (isV9) ? "\t.xword\t" : nullptr;
Jim Laskey0e835412006-09-07 22:05:02 +000035 ZeroDirective = "\t.skip\t";
36 CommentString = "!";
Richard Penningtonbd1fc362009-09-08 12:47:30 +000037 SupportsDebugInformation = true;
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000038
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000039 ExceptionsType = ExceptionHandling::DwarfCFI;
40
Chris Lattnerc9ea8fd2009-08-08 20:43:12 +000041 SunStyleELFSectionSwitchSyntax = true;
Venkatraman Govindarajubc2190f2009-08-26 18:24:12 +000042 UsesELFSectionDirectiveForBSS = true;
Daniel Sanders753e1762014-02-13 14:44:26 +000043
Brad Smithdd6675c2015-01-14 07:53:39 +000044 UseIntegratedAssembler = true;
Anton Korobeynikov1a11e8a2008-08-07 09:51:25 +000045}
46
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000047const MCExpr*
48SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
49 unsigned Encoding,
50 MCStreamer &Streamer) const {
51 if (Encoding & dwarf::DW_EH_PE_pcrel) {
52 MCContext &Ctx = Streamer.getContext();
Jim Grosbach13760bd2015-05-30 01:25:56 +000053 return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
54 MCSymbolRefExpr::create(Sym, Ctx), Ctx);
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000055 }
Anton Korobeynikov1a11e8a2008-08-07 09:51:25 +000056
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000057 return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
58}
Venkatraman Govindaraju141d0e22014-01-29 06:59:20 +000059
60const MCExpr*
61SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
62 unsigned Encoding,
63 MCStreamer &Streamer) const {
64 if (Encoding & dwarf::DW_EH_PE_pcrel) {
65 MCContext &Ctx = Streamer.getContext();
Jim Grosbach13760bd2015-05-30 01:25:56 +000066 return SparcMCExpr::create(SparcMCExpr::VK_Sparc_R_DISP32,
67 MCSymbolRefExpr::create(Sym, Ctx), Ctx);
Venkatraman Govindaraju141d0e22014-01-29 06:59:20 +000068 }
69 return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
70}