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
41
61
63 const MCSymbol *Sym, uint64_t Offset, MCContext &Ctx) const {
64 const MCExpr *Expr = MCSpecifierExpr::create(Sym, SystemZ::S_QCon, Ctx);
65 if (Offset)
66 Expr =
68 return Expr;
69}
70
72 raw_ostream &OS, const MCSpecifierExpr &Expr) const {
73 switch (Expr.getSpecifier()) {
74 case SystemZ::S_None:
75 OS << "AD";
76 break;
77 case SystemZ::S_QCon:
78 OS << "QD";
79 break;
80 case SystemZ::S_RCon:
81 OS << "RD";
82 break;
83 case SystemZ::S_VCon:
84 OS << "VD";
85 break;
86 default:
87 llvm_unreachable("Invalid kind");
88 }
89 OS << '(';
90 printExpr(OS, *Expr.getSubExpr());
91 OS << ')';
92}
93
95 const MCSpecifierExpr &Expr, MCValue &Res, const MCAssembler *Asm) const {
96 if (!Expr.getSubExpr()->evaluateAsRelocatable(Res, Asm))
97 return false;
98 Res.setSpecifier(Expr.getSpecifier());
99 return true;
100}
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 MCTargetOptions &Options)
MCAsmInfoGOFF(const MCTargetOptions &Options)
bool AllowAdditionalComments
This indicates whether to allow additional "comment strings" to be lexed as a comment.
Definition MCAsmInfo.h:142
const char * Data64bitsDirective
Definition MCAsmInfo.h:248
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:191
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:198
bool UsesSetToEquateSymbol
Use .set instead of = to equate a symbol to an expression.
Definition MCAsmInfo.h:148
void printExpr(raw_ostream &, const MCExpr &) const
bool AllowAtInName
This is true if the assembler allows @ characters in symbol names.
Definition MCAsmInfo.h:177
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition MCAsmInfo.h:118
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition MCAsmInfo.h:261
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:357
unsigned AssemblerDialect
Which dialect of an assembler variant to use. Defaults to 0.
Definition MCAsmInfo.h:173
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:224
void initializeAtSpecifiers(EnumStrings< AtSpecifierKind, 1 >)
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
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:342
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
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
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:494
const MCExpr * getSubExpr() const
Definition MCExpr.h:508
static const MCSpecifierExpr * create(const MCExpr *Expr, Spec S, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.cpp:743
Spec getSpecifier() const
Definition MCExpr.h:507
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
void setSpecifier(uint32_t S)
Definition MCValue.h:47
SystemZMCAsmInfoELF(const Triple &TT, const MCTargetOptions &Options)
bool evaluateAsRelocatableImpl(const MCSpecifierExpr &Expr, MCValue &Res, const MCAssembler *Asm) const override
SystemZMCAsmInfoGOFF(const Triple &TT, const MCTargetOptions &Options)
const MCExpr * getDwarfSectionOffsetExpr(const MCSymbol *Sym, uint64_t Offset, MCContext &Ctx) const override
Return the expression used to emit the offset of Sym + Offset from the start of its DWARF section.
void printSpecifierExpr(raw_ostream &OS, const MCSpecifierExpr &Expr) const override
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.
@ Offset
Definition DWP.cpp:577
Compile-time data representation of enum entries.
Definition Enum.h:47