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
21void RISCVMCAsmInfo::anchor() {}
22
25 IsLittleEndian = TT.isLittleEndian();
26 CodePointerSize = CalleeSaveStackSlotSize = TT.isArch64Bit() ? 8 : 4;
27 CommentString = "#";
28 AlignmentIsInBytes = false;
31 Data16bitsDirective = "\t.half\t";
32 Data32bitsDirective = "\t.word\t";
33 // The default symbol subtraction results in an ADD/SUB relocation pair.
34 // Processing this relocation pair is problematic when linker relaxation is
35 // enabled, so we follow binutils in using the R_RISCV_32_PCREL relocation
36 // for the FDE initial location.
37 DwarfFDERelSymbolSpec = ELF::R_RISCV_32_PCREL;
38}
39
41 const MCSpecifierExpr &Expr) const {
42 auto S = Expr.getSpecifier();
43 bool HasSpecifier = S != RISCV::S_None && S != RISCV::S_CALL_PLT;
44 if (HasSpecifier)
45 OS << '%' << RISCV::getSpecifierName(S) << '(';
46 printExpr(OS, *Expr.getSubExpr());
47 if (HasSpecifier)
48 OS << ')';
49}
50
64
66 raw_ostream &OS, const MCSpecifierExpr &Expr) const {
67 auto S = Expr.getSpecifier();
68 bool HasSpecifier = S != RISCV::S_None && S != RISCV::S_CALL_PLT;
69 if (HasSpecifier)
70 OS << '%' << RISCV::getSpecifierName(S) << '(';
71 printExpr(OS, *Expr.getSubExpr());
72 if (HasSpecifier)
73 OS << ')';
74}
This file contains constants used for implementing Dwarf debug support.
static LVOptions Options
Definition LVOptions.cpp:25
MCAsmInfoDarwin(const MCTargetOptions &Options)
MCAsmInfoELF(const MCTargetOptions &Options)
StringRef InternalSymbolPrefix
For internal use by compiler and assembler, not meant to be visible externally.
Definition MCAsmInfo.h:159
const char * Data16bitsDirective
Definition MCAsmInfo.h:243
ExceptionHandling ExceptionsType
Exception handling format for the target. Defaults to None.
Definition MCAsmInfo.h:357
const char * Data32bitsDirective
Definition MCAsmInfo.h:244
void printExpr(raw_ostream &, const MCExpr &) const
uint16_t DwarfFDERelSymbolSpec
The optional specifier to use for the relative FDE symbol references.
Definition MCAsmInfo.h:375
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:354
const char * SeparatorString
This string, if specified, is used to separate instructions from each other when on the same line.
Definition MCAsmInfo.h:130
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:268
bool UseDataRegionDirectives
This is true if data region markers should be printed as ".data_region/.end_data_region" directives.
Definition MCAsmInfo.h:207
bool IsLittleEndian
True if target is little endian. Default is true.
Definition MCAsmInfo.h:93
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition MCAsmInfo.h:86
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition MCAsmInfo.h:90
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:134
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition MCExpr.h:494
const MCExpr * getSubExpr() const
Definition MCExpr.h:508
Spec getSpecifier() const
Definition MCExpr.h:507
RISCVMCAsmInfoDarwin(const MCTargetOptions &Options)
void printSpecifierExpr(raw_ostream &OS, const MCSpecifierExpr &Expr) const override
void printSpecifierExpr(raw_ostream &OS, const MCSpecifierExpr &Expr) const override
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.
@ DwarfCFI
DWARF-like instruction based exceptions.
Definition CodeGen.h:56