LLVM 23.0.0git
SparcMCAsmInfo.cpp
Go to the documentation of this file.
1//===- SparcMCAsmInfo.cpp - Sparc asm properties --------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file contains the declarations of the SparcMCAsmInfo properties.
10//
11//===----------------------------------------------------------------------===//
12
13#include "SparcMCAsmInfo.h"
16#include "llvm/MC/MCExpr.h"
17#include "llvm/MC/MCStreamer.h"
20
21using namespace llvm;
22
23void SparcELFMCAsmInfo::anchor() {}
24
28 bool isV9 = (TheTriple.getArch() == Triple::sparcv9);
29 IsLittleEndian = (TheTriple.getArch() == Triple::sparcel);
30
31 if (isV9) {
33 }
34
35 Data16bitsDirective = "\t.half\t";
36 Data32bitsDirective = "\t.word\t";
37 // .xword is only supported by V9.
38 Data64bitsDirective = (isV9) ? "\t.xword\t" : nullptr;
39 ZeroDirective = "\t.skip\t";
40 CommentString = "!";
42
44
46}
47
48const MCExpr*
50 unsigned Encoding,
51 MCStreamer &Streamer) const {
52 if (Encoding & dwarf::DW_EH_PE_pcrel) {
53 MCContext &Ctx = Streamer.getContext();
54 return MCSpecifierExpr::create(Sym, ELF::R_SPARC_DISP32, Ctx);
55 }
56
57 return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
58}
59
60const MCExpr*
62 unsigned Encoding,
63 MCStreamer &Streamer) const {
64 if (Encoding & dwarf::DW_EH_PE_pcrel) {
65 MCContext &Ctx = Streamer.getContext();
66 return MCSpecifierExpr::create(Sym, ELF::R_SPARC_DISP32, Ctx);
67 }
68 return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
69}
70
72 const MCSpecifierExpr &Expr) const {
74 if (!S.empty())
75 OS << '%' << S << '(';
76 printExpr(OS, *Expr.getSubExpr());
77 if (!S.empty())
78 OS << ')';
79}
This file contains constants used for implementing Dwarf debug support.
static LVOptions Options
Definition LVOptions.cpp:25
MCAsmInfoELF(const MCTargetOptions &Options)
const char * Data16bitsDirective
Definition MCAsmInfo.h:247
const char * Data64bitsDirective
Definition MCAsmInfo.h:249
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition MCAsmInfo.h:361
const char * Data32bitsDirective
Definition MCAsmInfo.h:248
void printExpr(raw_ostream &, const MCExpr &) const
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:262
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:358
virtual const MCExpr * getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const
Definition MCAsmInfo.cpp:65
const char * ZeroDirective
This should be set to the directive used to get some number of zero (and non-zero if supported by the...
Definition MCAsmInfo.h:225
bool IsLittleEndian
True if target is little endian. Default is true.
Definition MCAsmInfo.h:94
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition MCAsmInfo.h:87
virtual const MCExpr * getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const
Definition MCAsmInfo.cpp:58
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition MCAsmInfo.h:91
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:135
Context object for machine code objects.
Definition MCContext.h:83
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:34
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition MCExpr.h:495
const MCExpr * getSubExpr() const
Definition MCExpr.h:509
static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.cpp:743
Spec getSpecifier() const
Definition MCExpr.h:508
Streaming machine code generation interface.
Definition MCStreamer.h:222
MCContext & getContext() const
Definition MCStreamer.h:323
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
const MCExpr * getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const override
SparcELFMCAsmInfo(const Triple &TheTriple, const MCTargetOptions &Options)
const MCExpr * getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const override
void printSpecifierExpr(raw_ostream &OS, const MCSpecifierExpr &Expr) const override
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
constexpr bool empty() const
empty - Check if the string is empty.
Definition StringRef.h:140
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
ArchType getArch() const
Get the parsed architecture type of this triple.
Definition Triple.h:435
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
StringRef getSpecifierName(uint16_t S)
@ DW_EH_PE_pcrel
Definition Dwarf.h:879
This is an optimization pass for GlobalISel generic memory operations.
@ DwarfCFI
DWARF-like instruction based exceptions.
Definition CodeGen.h:55