LLVM  14.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"
14 #include "SparcMCExpr.h"
15 #include "llvm/ADT/Triple.h"
17 #include "llvm/MC/MCExpr.h"
18 #include "llvm/MC/MCStreamer.h"
20 
21 using namespace llvm;
22 
23 void SparcELFMCAsmInfo::anchor() {}
24 
26  bool isV9 = (TheTriple.getArch() == Triple::sparcv9);
27  IsLittleEndian = (TheTriple.getArch() == Triple::sparcel);
28 
29  if (isV9) {
31  }
32 
33  Data16bitsDirective = "\t.half\t";
34  Data32bitsDirective = "\t.word\t";
35  // .xword is only supported by V9.
36  Data64bitsDirective = (isV9) ? "\t.xword\t" : nullptr;
37  ZeroDirective = "\t.skip\t";
38  CommentString = "!";
40 
42 
45 }
46 
47 const MCExpr*
49  unsigned Encoding,
50  MCStreamer &Streamer) const {
51  if (Encoding & dwarf::DW_EH_PE_pcrel) {
52  MCContext &Ctx = Streamer.getContext();
54  MCSymbolRefExpr::create(Sym, Ctx), Ctx);
55  }
56 
57  return MCAsmInfo::getExprForPersonalitySymbol(Sym, Encoding, Streamer);
58 }
59 
60 const MCExpr*
62  unsigned Encoding,
63  MCStreamer &Streamer) const {
64  if (Encoding & dwarf::DW_EH_PE_pcrel) {
65  MCContext &Ctx = Streamer.getContext();
67  MCSymbolRefExpr::create(Sym, Ctx), Ctx);
68  }
69  return MCAsmInfo::getExprForFDESymbol(Sym, Encoding, Streamer);
70 }
llvm::MCAsmInfo::getExprForFDESymbol
virtual const MCExpr * getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const
Definition: MCAsmInfo.cpp:102
llvm::SparcELFMCAsmInfo::SparcELFMCAsmInfo
SparcELFMCAsmInfo(const Triple &TheTriple)
Definition: SparcMCAsmInfo.cpp:25
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
MCTargetOptions.h
llvm::MCContext
Context object for machine code objects.
Definition: MCContext.h:72
llvm::MCAsmInfo::SupportsDebugInformation
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:445
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::MCAsmInfo::UsesELFSectionDirectiveForBSS
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:319
llvm::MCAsmInfo::Data64bitsDirective
const char * Data64bitsDirective
Definition: MCAsmInfo.h:288
llvm::MCAsmInfo::Data32bitsDirective
const char * Data32bitsDirective
Definition: MCAsmInfo.h:287
llvm::MCAsmInfo::getExprForPersonalitySymbol
virtual const MCExpr * getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const
Definition: MCAsmInfo.cpp:95
llvm::MCStreamer
Streaming machine code generation interface.
Definition: MCStreamer.h:199
llvm::SparcMCExpr::VK_Sparc_R_DISP32
@ VK_Sparc_R_DISP32
Definition: SparcMCExpr.h:43
llvm::Triple::sparcv9
@ sparcv9
Definition: Triple.h:76
llvm::Triple::sparcel
@ sparcel
Definition: Triple.h:77
llvm::SparcMCExpr::create
static const SparcMCExpr * create(VariantKind Kind, const MCExpr *Expr, MCContext &Ctx)
Definition: SparcMCExpr.cpp:26
SparcMCExpr.h
llvm::Triple::getArch
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:307
llvm::dwarf::DW_EH_PE_pcrel
@ DW_EH_PE_pcrel
Definition: Dwarf.h:443
llvm::MCAsmInfo::CommentString
StringRef CommentString
This indicates the comment string used by the assembler.
Definition: MCAsmInfo.h:135
llvm::MCAsmInfo::CodePointerSize
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:72
llvm::MCAsmInfo::ZeroDirective
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:249
llvm::MCAsmInfo::Data16bitsDirective
const char * Data16bitsDirective
Definition: MCAsmInfo.h:286
Triple.h
SparcMCAsmInfo.h
Dwarf.h
llvm::SparcELFMCAsmInfo::getExprForPersonalitySymbol
const MCExpr * getExprForPersonalitySymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const override
Definition: SparcMCAsmInfo.cpp:48
llvm::MCAsmInfo::SunStyleELFSectionSwitchSyntax
bool SunStyleELFSectionSwitchSyntax
This is true if this target uses "Sun Style" syntax for section switching ("#alloc,...
Definition: MCAsmInfo.h:314
llvm::MCAsmInfo::CalleeSaveStackSlotSize
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition: MCAsmInfo.h:76
llvm::MCSymbolRefExpr::create
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
Definition: MCExpr.h:385
llvm::MCStreamer::getContext
MCContext & getContext() const
Definition: MCStreamer.h:280
MCStreamer.h
llvm::MCAsmInfo::ExceptionsType
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition: MCAsmInfo.h:448
llvm::SparcELFMCAsmInfo::getExprForFDESymbol
const MCExpr * getExprForFDESymbol(const MCSymbol *Sym, unsigned Encoding, MCStreamer &Streamer) const override
Definition: SparcMCAsmInfo.cpp:61
MCExpr.h
llvm::ExceptionHandling::DwarfCFI
@ DwarfCFI
DWARF-like instruction based exceptions.
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
llvm::MCAsmInfo::IsLittleEndian
bool IsLittleEndian
True if target is little endian. Default is true.
Definition: MCAsmInfo.h:79