LLVM 22.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/MC/MCExpr.h"
15#include "llvm/MC/MCStreamer.h"
16#include "llvm/MC/MCValue.h"
18
19using namespace llvm;
20
22 {VE::S_HI32, "hi"},
23 {VE::S_LO32, "lo"},
24 {VE::S_PC_HI32, "pc_hi"},
25 {VE::S_PC_LO32, "pc_lo"},
26 {VE::S_GOT_HI32, "got_hi"},
27 {VE::S_GOT_LO32, "got_lo"},
28 {VE::S_GOTOFF_HI32, "gotoff_hi"},
29 {VE::S_GOTOFF_LO32, "gotoff_lo"},
30 {VE::S_PLT_HI32, "plt_hi"},
31 {VE::S_PLT_LO32, "plt_lo"},
32 {VE::S_TLS_GD_HI32, "tls_gd_hi"},
33 {VE::S_TLS_GD_LO32, "tls_gd_lo"},
34 {VE::S_TPOFF_HI32, "tpoff_hi"},
35 {VE::S_TPOFF_LO32, "tpoff_lo"},
36};
37
39 switch (S) {
40 default:
41 llvm_unreachable("Unhandled VEMCExpr::Specifier");
42 case VE::S_REFLONG:
44 case VE::S_HI32:
45 return VE::fixup_ve_hi32;
46 case VE::S_LO32:
47 return VE::fixup_ve_lo32;
48 case VE::S_PC_HI32:
50 case VE::S_PC_LO32:
52 case VE::S_GOT_HI32:
54 case VE::S_GOT_LO32:
60 case VE::S_PLT_HI32:
62 case VE::S_PLT_LO32:
72 }
73}
74
75void VEELFMCAsmInfo::anchor() {}
76
78
81
82 // VE uses ".*byte" directive for unaligned data.
83 Data8bitsDirective = "\t.byte\t";
84 Data16bitsDirective = "\t.2byte\t";
85 Data32bitsDirective = "\t.4byte\t";
86 Data64bitsDirective = "\t.8byte\t";
87
88 // Uses '.section' before '.bss' directive. VE requires this although
89 // assembler manual says sinple '.bss' is supported.
91
93
95}
96
98 const MCSpecifierExpr &Expr) const {
99 printExpr(OS, *Expr.getSubExpr());
100 auto specifier = Expr.getSpecifier();
101 if (specifier && specifier != VE::S_REFLONG)
102 OS << '@' << getSpecifierName(specifier);
103}
104
106 MCValue &Res,
107 const MCAssembler *Asm) const {
108 if (!Expr.getSubExpr()->evaluateAsRelocatable(Res, Asm))
109 return false;
110 Res.setSpecifier(Expr.getSpecifier());
111 return true;
112}
const MCAsmInfo::AtSpecifier atSpecifiers[]
raw_pwrite_stream & OS
const MCAsmInfo::AtSpecifier atSpecifiers[]
Definition: VEMCAsmInfo.cpp:21
const char * Data16bitsDirective
Definition: MCAsmInfo.h:248
unsigned MinInstAlignment
Every possible instruction length is a multiple of this value.
Definition: MCAsmInfo.h:123
void initializeAtSpecifiers(ArrayRef< AtSpecifier >)
Definition: MCAsmInfo.cpp:127
const char * Data8bitsDirective
These directives are used to output some unit of integer data to the current section.
Definition: MCAsmInfo.h:247
const char * Data64bitsDirective
Definition: MCAsmInfo.h:250
StringRef getSpecifierName(uint32_t S) const
Definition: MCAsmInfo.cpp:139
const char * Data32bitsDirective
Definition: MCAsmInfo.h:249
void printExpr(raw_ostream &, const MCExpr &) const
Definition: MCAsmInfo.cpp:153
unsigned MaxInstLength
This is the maximum possible length of an instruction, which is needed to compute the size of an inli...
Definition: MCAsmInfo.h:119
bool UsesELFSectionDirectiveForBSS
This is true if this target uses ELF '.section' directive before the '.bss' one.
Definition: MCAsmInfo.h:263
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition: MCAsmInfo.h:356
unsigned CodePointerSize
Code pointer size in bytes. Default is 4.
Definition: MCAsmInfo.h:87
unsigned CalleeSaveStackSlotSize
Size of the stack slot reserved for callee-saved registers, in bytes.
Definition: MCAsmInfo.h:91
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:495
const MCExpr * getSubExpr() const
Definition: MCExpr.h:509
Spec getSpecifier() const
Definition: MCExpr.h:508
void setSpecifier(uint32_t S)
Definition: MCValue.h:47
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:47
VEELFMCAsmInfo(const Triple &TheTriple)
Definition: VEMCAsmInfo.cpp:77
void printSpecifierExpr(raw_ostream &OS, const MCSpecifierExpr &Expr) const override
Definition: VEMCAsmInfo.cpp:97
bool evaluateAsRelocatableImpl(const MCSpecifierExpr &Expr, MCValue &Res, const MCAssembler *Asm) const override
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
Definition: VEFixupKinds.h:54
@ fixup_ve_plt_lo32
Definition: VEFixupKinds.h:49
@ fixup_ve_got_hi32
fixup_ve_got_hi32 - 32-bit fixup corresponding to foo@got_hi
Definition: VEFixupKinds.h:36
@ fixup_ve_gotoff_hi32
fixup_ve_gotoff_hi32 - 32-bit fixup corresponding to foo@gotoff_hi
Definition: VEFixupKinds.h:42
@ fixup_ve_got_lo32
fixup_ve_got_lo32 - 32-bit fixup corresponding to foo@got_lo
Definition: VEFixupKinds.h:39
@ fixup_ve_pc_hi32
fixup_ve_pc_hi32 - 32-bit fixup corresponding to foo@pc_hi
Definition: VEFixupKinds.h:30
@ fixup_ve_lo32
fixup_ve_lo32 - 32-bit fixup corresponding to foo@lo
Definition: VEFixupKinds.h:27
@ fixup_ve_gotoff_lo32
fixup_ve_gotoff_lo32 - 32-bit fixup corresponding to foo@gotoff_lo
Definition: VEFixupKinds.h:45
@ fixup_ve_hi32
fixup_ve_hi32 - 32-bit fixup corresponding to foo@hi
Definition: VEFixupKinds.h:24
@ fixup_ve_pc_lo32
fixup_ve_pc_lo32 - 32-bit fixup corresponding to foo@pc_lo
Definition: VEFixupKinds.h:33
@ fixup_ve_tpoff_lo32
Definition: VEFixupKinds.h:55
@ fixup_ve_plt_hi32
fixup_ve_plt_hi32/lo32
Definition: VEFixupKinds.h:48
@ fixup_ve_reflong
fixup_ve_reflong - 32-bit fixup corresponding to foo
Definition: VEFixupKinds.h:18
@ fixup_ve_tls_gd_lo32
Definition: VEFixupKinds.h:53
@ fixup_ve_tls_gd_hi32
fixups for Thread Local Storage
Definition: VEFixupKinds.h:52
VE::Fixups getFixupKind(uint8_t S)
Definition: VEMCAsmInfo.cpp:38
@ S_GOT_LO32
Definition: VEMCAsmInfo.h:45
@ S_GOTOFF_LO32
Definition: VEMCAsmInfo.h:47
@ S_TLS_GD_LO32
Definition: VEMCAsmInfo.h:51
@ S_TLS_GD_HI32
Definition: VEMCAsmInfo.h:50
@ S_TPOFF_HI32
Definition: VEMCAsmInfo.h:52
@ S_PLT_LO32
Definition: VEMCAsmInfo.h:49
@ S_GOT_HI32
Definition: VEMCAsmInfo.h:44
@ S_GOTOFF_HI32
Definition: VEMCAsmInfo.h:46
@ S_PLT_HI32
Definition: VEMCAsmInfo.h:48
@ S_TPOFF_LO32
Definition: VEMCAsmInfo.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18