LLVM 24.0.0git
SystemZMCAsmInfo.cpp
Go to the documentation of this file.
1//===-- SystemZMCAsmInfo.cpp - SystemZ 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#include "SystemZMCAsmInfo.h"
10#include "llvm/ADT/Enum.h"
11#include "llvm/MC/MCContext.h"
12#include "llvm/MC/MCExpr.h"
13#include "llvm/MC/MCValue.h"
14
15using namespace llvm;
16
18 {{"DTPOFF"}, SystemZ::S_DTPOFF}, {{"GOT"}, SystemZ::S_GOT},
19 {{"GOTENT"}, SystemZ::S_GOTENT}, {{"INDNTPOFF"}, SystemZ::S_INDNTPOFF},
20 {{"NTPOFF"}, SystemZ::S_NTPOFF}, {{"PLT"}, SystemZ::S_PLT},
21 {{"TLSGD"}, SystemZ::S_TLSGD}, {{"TLSLD"}, SystemZ::S_TLSLD},
22 {{"TLSLDM"}, SystemZ::S_TLSLDM},
23};
25
40
45 AllowAtInName = true;
51 CommentString = "*";
53 IsHLASM = true;
54 IsLittleEndian = false;
55 MaxInstLength = 6;
58
60
61 SpecifierExprPrintFn = [](const MCAsmInfo &MAI, raw_ostream &OS,
62 const MCSpecifierExpr &Expr) {
63 switch (Expr.getSpecifier()) {
64 case SystemZ::S_None:
65 OS << "AD";
66 break;
67 case SystemZ::S_QCon:
68 OS << "QD";
69 break;
70 case SystemZ::S_RCon:
71 OS << "RD";
72 break;
73 case SystemZ::S_VCon:
74 OS << "VD";
75 break;
76 default:
77 llvm_unreachable("Invalid kind");
78 }
79 OS << '(';
80 MAI.printExpr(OS, *Expr.getSubExpr());
81 OS << ')';
82 };
83 SpecifierExprEvaluateFn = [](const MCSpecifierExpr &Expr, MCValue &Res,
84 const MCAssembler *Asm) {
85 if (!Expr.getSubExpr()->evaluateAsRelocatable(Res, Asm))
86 return false;
87 Res.setSpecifier(Expr.getSpecifier());
88 return true;
89 };
90}
constexpr EnumStringDef< MCAsmInfo::AtSpecifierKind > AtSpecifierDefs[]
constexpr auto atSpecifiers
#define BUILD_ENUM_STRINGS(Tab)
Definition Enum.h:120
static LVOptions Options
Definition LVOptions.cpp:25
MCAsmInfoELF(const Triple &TT, const MCTargetOptions &Options)
MCAsmInfoGOFF(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
bool(* SpecifierExprEvaluateFn)(const MCSpecifierExpr &E, MCValue &Res, const MCAssembler *Asm)
Definition MCAsmInfo.h:231
unsigned DwarfSectionOffSpecifierExpr
If non-zero, MCSpecifierExpr kind used as base for DWARF-relative exprs.
Definition MCAsmInfo.h:423
bool AllowAdditionalComments
This indicates whether to allow additional "comment strings" to be lexed as a comment.
Definition MCAsmInfo.h:152
const char * Data64bitsDirective
Definition MCAsmInfo.h:264
bool AllowDollarAtStartOfIdentifier
This is true if the assembler allows the "$" character at the start of of a string to be lexed as an ...
Definition MCAsmInfo.h:201
bool AllowAtAtStartOfIdentifier
This is true if the assembler allows the "@" character at the start of a string to be lexed as an Asm...
Definition MCAsmInfo.h:208
bool UsesSetToEquateSymbol
Use .set instead of = to equate a symbol to an expression.
Definition MCAsmInfo.h:158
void printExpr(raw_ostream &, const MCExpr &) const
bool AllowAtInName
This is true if the assembler allows @ characters in symbol names.
Definition MCAsmInfo.h:187
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition MCAsmInfo.h:128
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
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition MCAsmInfo.h:183
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:240
void initializeAtSpecifiers(EnumStrings< AtSpecifierKind, 1 >)
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
LLVM_ABI bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm) const
Try to evaluate the expression to a relocatable value, i.e.
Definition MCExpr.cpp:450
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
SystemZMCAsmInfoELF(const Triple &TT, const MCTargetOptions &Options)
SystemZMCAsmInfoGOFF(const Triple &TT, 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
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Compile-time data representation of enum entries.
Definition Enum.h:47