blob: ef5f8ce15582489905bf640b1f56f90740ee2c0c [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
David Blaikiea379b1812011-12-20 02:50:00 +000021void SparcELFMCAsmInfo::anchor() { }
22
Rafael Espindola140a8372013-05-10 18:16:59 +000023SparcELFMCAsmInfo::SparcELFMCAsmInfo(StringRef TT) {
Evan Chenga83b37a2011-07-15 02:09:41 +000024 IsLittleEndian = false;
25 Triple TheTriple(TT);
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000026 bool isV9 = (TheTriple.getArch() == Triple::sparcv9);
27
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.
35 Data64bitsDirective = (isV9) ? "\t.xword\t" : 0;
Jim Laskey0e835412006-09-07 22:05:02 +000036 ZeroDirective = "\t.skip\t";
37 CommentString = "!";
Richard Penningtonbd1fc362009-09-08 12:47:30 +000038 HasLEB128 = true;
Richard Penningtonbd1fc362009-09-08 12:47:30 +000039 SupportsDebugInformation = true;
Venkatraman Govindarajub50bf5a2013-08-10 20:13:20 +000040
Venkatraman Govindaraju4c0cdd72013-09-26 15:11:00 +000041 ExceptionsType = ExceptionHandling::DwarfCFI;
42
Chris Lattnerc9ea8fd2009-08-08 20:43:12 +000043 SunStyleELFSectionSwitchSyntax = true;
Venkatraman Govindarajubc2190f2009-08-26 18:24:12 +000044 UsesELFSectionDirectiveForBSS = true;
Daniel Sanders753e1762014-02-13 14:44:26 +000045
46 if (TheTriple.getOS() == llvm::Triple::Solaris)
47 UseIntegratedAssembler = true;
Anton Korobeynikov1a11e8a2008-08-07 09:51:25 +000048}
49
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000050const MCExpr*
51SparcELFMCAsmInfo::getExprForPersonalitySymbol(const MCSymbol *Sym,
52 unsigned Encoding,
53 MCStreamer &Streamer) const {
54 if (Encoding & dwarf::DW_EH_PE_pcrel) {
55 MCContext &Ctx = Streamer.getContext();
56 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
57 MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
58 }
Anton Korobeynikov1a11e8a2008-08-07 09:51:25 +000059
Venkatraman Govindarajufd5c1f92014-01-29 04:51:35 +000060 return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
61}
Venkatraman Govindaraju141d0e22014-01-29 06:59:20 +000062
63const MCExpr*
64SparcELFMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,
65 unsigned Encoding,
66 MCStreamer &Streamer) const {
67 if (Encoding & dwarf::DW_EH_PE_pcrel) {
68 MCContext &Ctx = Streamer.getContext();
69 return SparcMCExpr::Create(SparcMCExpr::VK_Sparc_R_DISP32,
70 MCSymbolRefExpr::Create(Sym, Ctx), Ctx);
71 }
72 return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
73}