LLVM 24.0.0git
RISCVMCAsmInfo.cpp
Go to the documentation of this file.
1//===-- RISCVMCAsmInfo.cpp - RISC-V 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 RISCVMCAsmInfo properties.
10//
11//===----------------------------------------------------------------------===//
12
13#include "RISCVMCAsmInfo.h"
16#include "llvm/MC/MCExpr.h"
17#include "llvm/MC/MCStreamer.h"
19using namespace llvm;
20
21static void printSpecifierExpr(const MCAsmInfo &MAI, raw_ostream &OS,
22 const MCSpecifierExpr &Expr) {
23 auto S = Expr.getSpecifier();
24 bool HasSpecifier = S != RISCV::S_None && S != RISCV::S_CALL_PLT;
25 if (HasSpecifier)
26 OS << '%' << RISCV::getSpecifierName(S) << '(';
27 MAI.printExpr(OS, *Expr.getSubExpr());
28 if (HasSpecifier)
29 OS << ')';
30}
31
33 : MCAsmInfoELF(TT, Options) {
34 IsLittleEndian = TT.isLittleEndian();
35 CodePointerSize = CalleeSaveStackSlotSize = TT.isArch64Bit() ? 8 : 4;
36 CommentString = "#";
37 AlignmentIsInBytes = false;
39 Data16bitsDirective = "\t.half\t";
40 Data32bitsDirective = "\t.word\t";
41 // The default symbol subtraction results in an ADD/SUB relocation pair.
42 // Processing this relocation pair is problematic when linker relaxation is
43 // enabled, so we follow binutils in using the R_RISCV_32_PCREL relocation
44 // for the FDE initial location.
45 DwarfFDERelSymbolSpec = ELF::R_RISCV_32_PCREL;
46
47 // .bss is supported without .section.
48 SectionDirectives.insert(".bss");
49
51}
52
static void printSpecifierExpr(const MCAsmInfo &MAI, raw_ostream &OS, const MCSpecifierExpr &Expr)
This file contains constants used for implementing Dwarf debug support.
static LVOptions Options
Definition LVOptions.cpp:25
static void printSpecifierExpr(const MCAsmInfo &MAI, raw_ostream &OS, const MCSpecifierExpr &Expr)
MCAsmInfoDarwin(const MCTargetOptions &Options)
MCAsmInfoELF(const Triple &TT, const MCTargetOptions &Options)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:69
StringRef InternalSymbolPrefix
For internal use by compiler and assembler, not meant to be visible externally.
Definition MCAsmInfo.h:169
const char * Data16bitsDirective
Definition MCAsmInfo.h:262
const char * Data32bitsDirective
Definition MCAsmInfo.h:263
void printExpr(raw_ostream &, const MCExpr &) const
SmallDenseSet< StringRef, 8 > SectionDirectives
Sections whose name also is supported as a directive without an explicit ".section" directive.
Definition MCAsmInfo.h:475
uint16_t DwarfFDERelSymbolSpec
The optional specifier to use for the relative FDE symbol references.
Definition MCAsmInfo.h:400
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:372
void(* SpecifierExprPrintFn)(const MCAsmInfo &, raw_ostream &, const MCSpecifierExpr &)
Definition MCAsmInfo.h:228
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line.
Definition MCAsmInfo.h:140
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:286
bool UseDataRegionDirectives
This is true if data region markers should be printed as ".data_region/.end_data_region" directives.
Definition MCAsmInfo.h:217
bool IsLittleEndian
True if target is little endian. Default is true.
Definition MCAsmInfo.h:95
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition MCAsmInfo.h:88
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition MCAsmInfo.h:92
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:144
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition MCExpr.h:491
const MCExpr * getSubExpr() const
Definition MCExpr.h:505
Spec getSpecifier() const
Definition MCExpr.h:504
RISCVMCAsmInfoDarwin(const MCTargetOptions &Options)
RISCVMCAsmInfo(const Triple &TargetTriple, const MCTargetOptions &Options)
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
StringRef getSpecifierName(Specifier Kind)
This is an optimization pass for GlobalISel generic memory operations.