LLVM 24.0.0git
VEMCAsmInfo.cpp
Go to the documentation of this file.
1//===- VEMCAsmInfo.cpp - VE 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 VEMCAsmInfo properties.
10//
11//===----------------------------------------------------------------------===//
12
13#include "VEMCAsmInfo.h"
14#include "llvm/ADT/Enum.h"
15#include "llvm/MC/MCExpr.h"
16#include "llvm/MC/MCStreamer.h"
17#include "llvm/MC/MCValue.h"
19
20using namespace llvm;
21
23 {{"hi"}, VE::S_HI32},
24 {{"lo"}, VE::S_LO32},
25 {{"pc_hi"}, VE::S_PC_HI32},
26 {{"pc_lo"}, VE::S_PC_LO32},
27 {{"got_hi"}, VE::S_GOT_HI32},
28 {{"got_lo"}, VE::S_GOT_LO32},
29 {{"gotoff_hi"}, VE::S_GOTOFF_HI32},
30 {{"gotoff_lo"}, VE::S_GOTOFF_LO32},
31 {{"plt_hi"}, VE::S_PLT_HI32},
32 {{"plt_lo"}, VE::S_PLT_LO32},
33 {{"tls_gd_hi"}, VE::S_TLS_GD_HI32},
34 {{"tls_gd_lo"}, VE::S_TLS_GD_LO32},
35 {{"tpoff_hi"}, VE::S_TPOFF_HI32},
36 {{"tpoff_lo"}, VE::S_TPOFF_LO32},
37};
39
41 switch (S) {
42 default:
43 llvm_unreachable("Unhandled VEMCExpr::Specifier");
44 case VE::S_REFLONG:
46 case VE::S_HI32:
47 return VE::fixup_ve_hi32;
48 case VE::S_LO32:
49 return VE::fixup_ve_lo32;
50 case VE::S_PC_HI32:
52 case VE::S_PC_LO32:
54 case VE::S_GOT_HI32:
56 case VE::S_GOT_LO32:
62 case VE::S_PLT_HI32:
64 case VE::S_PLT_LO32:
74 }
75}
76
77void VEELFMCAsmInfo::anchor() {}
78
82
85
86 // VE uses ".*byte" directive for unaligned data.
87 Data8bitsDirective = "\t.byte\t";
88 Data16bitsDirective = "\t.2byte\t";
89 Data32bitsDirective = "\t.4byte\t";
90 Data64bitsDirective = "\t.8byte\t";
91
92 // Uses '.section' before '.bss' directive. VE requires this although
93 // assembler manual says sinple '.bss' is supported.
95
97
99}
100
102 const MCSpecifierExpr &Expr) const {
103 printExpr(OS, *Expr.getSubExpr());
104 auto specifier = Expr.getSpecifier();
105 if (specifier && specifier != VE::S_REFLONG)
106 OS << '@' << getSpecifierName(specifier);
107}
108
110 MCValue &Res,
111 const MCAssembler *Asm) const {
112 if (!Expr.getSubExpr()->evaluateAsRelocatable(Res, Asm))
113 return false;
114 Res.setSpecifier(Expr.getSpecifier());
115 return true;
116}
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)
const char * Data16bitsDirective
Definition MCAsmInfo.h:243
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition MCAsmInfo.h:122
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
Definition MCAsmInfo.h:242
const char * Data64bitsDirective
Definition MCAsmInfo.h:245
StringRef getSpecifierName(uint32_t S) const
const char * Data32bitsDirective
Definition MCAsmInfo.h:244
void printExpr(raw_ostream &, const MCExpr &) const
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:258
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:354
void initializeAtSpecifiers(EnumStrings< AtSpecifierKind, 1 >)
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
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
Spec getSpecifier() const
Definition MCExpr.h:507
void setSpecifier(uint32_t S)
Definition MCValue.h:47
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
void printSpecifierExpr(raw_ostream &OS, const MCSpecifierExpr &Expr) const override
bool evaluateAsRelocatableImpl(const MCSpecifierExpr &Expr, MCValue &Res, const MCAssembler *Asm) const override
VEELFMCAsmInfo(const Triple &TheTriple, const MCTargetOptions &Options)
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.
@ fixup_ve_tpoff_hi32
@ fixup_ve_plt_lo32
@ fixup_ve_got_hi32
fixup_ve_got_hi32 - 32-bit fixup corresponding to foo@got_hi
@ fixup_ve_gotoff_hi32
fixup_ve_gotoff_hi32 - 32-bit fixup corresponding to foo@gotoff_hi
@ fixup_ve_got_lo32
fixup_ve_got_lo32 - 32-bit fixup corresponding to foo@got_lo
@ fixup_ve_pc_hi32
fixup_ve_pc_hi32 - 32-bit fixup corresponding to foo@pc_hi
@ fixup_ve_lo32
fixup_ve_lo32 - 32-bit fixup corresponding to foo@lo
@ fixup_ve_gotoff_lo32
fixup_ve_gotoff_lo32 - 32-bit fixup corresponding to foo@gotoff_lo
@ fixup_ve_hi32
fixup_ve_hi32 - 32-bit fixup corresponding to foo@hi
@ fixup_ve_pc_lo32
fixup_ve_pc_lo32 - 32-bit fixup corresponding to foo@pc_lo
@ fixup_ve_tpoff_lo32
@ fixup_ve_plt_hi32
fixup_ve_plt_hi32/lo32
@ fixup_ve_reflong
fixup_ve_reflong - 32-bit fixup corresponding to foo
@ fixup_ve_tls_gd_lo32
@ fixup_ve_tls_gd_hi32
fixups for Thread Local Storage
VE::Fixups getFixupKind(uint8_t S)
@ S_GOTOFF_LO32
Definition VEMCAsmInfo.h:48
@ S_TLS_GD_LO32
Definition VEMCAsmInfo.h:52
@ S_TLS_GD_HI32
Definition VEMCAsmInfo.h:51
@ S_GOTOFF_HI32
Definition VEMCAsmInfo.h:47
This is an optimization pass for GlobalISel generic memory operations.
Compile-time data representation of enum entries.
Definition Enum.h:47