Skip to content

Commit f244b8e

Browse files
committed
[MC] Port initializeVariantKinds to a few targets
1 parent e9c8d42 commit f244b8e

File tree

5 files changed

+73
-0
lines changed

5 files changed

+73
-0
lines changed

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@ static cl::opt<AsmWriterVariantTy> AsmWriterVariant(
3030
cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
3131
clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly")));
3232

33+
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
34+
{MCSymbolRefExpr::VK_COFF_IMGREL32, "IMGREL"},
35+
{MCSymbolRefExpr::VK_GOT, "GOT"},
36+
{MCSymbolRefExpr::VK_GOTPAGE, "GOTPAGE"},
37+
{MCSymbolRefExpr::VK_GOTPAGEOFF, "GOTPAGEOFF"},
38+
{MCSymbolRefExpr::VK_GOTPCREL, "GOTPCREL"},
39+
{MCSymbolRefExpr::VK_PAGE, "PAGE"},
40+
{MCSymbolRefExpr::VK_PAGEOFF, "PAGEOFF"},
41+
{MCSymbolRefExpr::VK_PLT, "PLT"},
42+
{MCSymbolRefExpr::VK_TLVP, "TLVP"},
43+
{MCSymbolRefExpr::VK_TLVPPAGE, "TLVPPAGE"},
44+
{MCSymbolRefExpr::VK_TLVPPAGEOFF, "TLVPPAGEOFF"},
45+
{MCSymbolRefExpr::VK_WEAKREF, "WEAKREF"},
46+
};
47+
3348
AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin(bool IsILP32) {
3449
// We prefer NEON instructions to be printed in the short, Apple-specific
3550
// form when targeting Darwin.
@@ -48,6 +63,8 @@ AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin(bool IsILP32) {
4863
UseDataRegionDirectives = true;
4964

5065
ExceptionsType = ExceptionHandling::DwarfCFI;
66+
67+
initializeVariantKinds(variantKindDescs);
5168
}
5269

5370
const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol(
@@ -97,6 +114,8 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) {
97114
ExceptionsType = ExceptionHandling::DwarfCFI;
98115

99116
HasIdentDirective = true;
117+
118+
initializeVariantKinds(variantKindDescs);
100119
}
101120

102121
AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
@@ -114,6 +133,8 @@ AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() {
114133
CommentString = "//";
115134
ExceptionsType = ExceptionHandling::WinEH;
116135
WinEHEncodingType = WinEH::EncodingType::Itanium;
136+
137+
initializeVariantKinds(variantKindDescs);
117138
}
118139

119140
AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
@@ -131,4 +152,6 @@ AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() {
131152
CommentString = "//";
132153
ExceptionsType = ExceptionHandling::WinEH;
133154
WinEHEncodingType = WinEH::EncodingType::Itanium;
155+
156+
initializeVariantKinds(variantKindDescs);
134157
}

llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@
1212

1313
#include "CSKYMCAsmInfo.h"
1414
#include "llvm/BinaryFormat/Dwarf.h"
15+
#include "llvm/MC/MCExpr.h"
1516
#include "llvm/MC/MCStreamer.h"
1617

1718
using namespace llvm;
1819

20+
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
21+
{MCSymbolRefExpr::VK_GOT, "GOT"},
22+
{MCSymbolRefExpr::VK_GOTOFF, "GOTOFF"},
23+
{MCSymbolRefExpr::VK_PLT, "PLT"},
24+
{MCSymbolRefExpr::VK_TLSGD, "TLSGD"},
25+
{MCSymbolRefExpr::VK_TLSLD, "TLSLD"},
26+
{MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"},
27+
{MCSymbolRefExpr::VK_TPOFF, "TPOFF"},
28+
};
29+
1930
void CSKYMCAsmInfo::anchor() {}
2031

2132
CSKYMCAsmInfo::CSKYMCAsmInfo(const Triple &TargetTriple) {
@@ -27,4 +38,6 @@ CSKYMCAsmInfo::CSKYMCAsmInfo(const Triple &TargetTriple) {
2738
UsesELFSectionDirectiveForBSS = true;
2839

2940
ExceptionsType = ExceptionHandling::DwarfCFI;
41+
42+
initializeVariantKinds(variantKindDescs);
3043
}

llvm/lib/Target/M68k/MCTargetDesc/M68kMCAsmInfo.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@
1313

1414
#include "M68kMCAsmInfo.h"
1515

16+
#include "llvm/MC/MCExpr.h"
1617
#include "llvm/TargetParser/Triple.h"
1718

1819
using namespace llvm;
1920

21+
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
22+
{MCSymbolRefExpr::VK_GOTOFF, "GOTOFF"},
23+
{MCSymbolRefExpr::VK_GOTPCREL, "GOTPCREL"},
24+
{MCSymbolRefExpr::VK_GOTTPOFF, "GOTTPOFF"},
25+
{MCSymbolRefExpr::VK_PLT, "PLT"},
26+
{MCSymbolRefExpr::VK_TLSGD, "TLSGD"},
27+
{MCSymbolRefExpr::VK_TLSLD, "TLSLD"},
28+
{MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"},
29+
{MCSymbolRefExpr::VK_TPOFF, "TPOFF"},
30+
};
31+
2032
void M68kELFMCAsmInfo::anchor() {}
2133

2234
M68kELFMCAsmInfo::M68kELFMCAsmInfo(const Triple &T) {
@@ -33,4 +45,6 @@ M68kELFMCAsmInfo::M68kELFMCAsmInfo(const Triple &T) {
3345

3446
UseMotorolaIntegers = true;
3547
CommentString = ";";
48+
49+
initializeVariantKinds(variantKindDescs);
3650
}

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
#include "RISCVMCAsmInfo.h"
1414
#include "MCTargetDesc/RISCVMCExpr.h"
1515
#include "llvm/BinaryFormat/Dwarf.h"
16+
#include "llvm/MC/MCExpr.h"
1617
#include "llvm/MC/MCStreamer.h"
1718
#include "llvm/TargetParser/Triple.h"
1819
using namespace llvm;
1920

21+
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
22+
{MCSymbolRefExpr::VK_GOTPCREL, "GOTPCREL"},
23+
{MCSymbolRefExpr::VK_PLT, "PLT"},
24+
};
25+
2026
void RISCVMCAsmInfo::anchor() {}
2127

2228
RISCVMCAsmInfo::RISCVMCAsmInfo(const Triple &TT) {
@@ -27,6 +33,8 @@ RISCVMCAsmInfo::RISCVMCAsmInfo(const Triple &TT) {
2733
ExceptionsType = ExceptionHandling::DwarfCFI;
2834
Data16bitsDirective = "\t.half\t";
2935
Data32bitsDirective = "\t.word\t";
36+
37+
initializeVariantKinds(variantKindDescs);
3038
}
3139

3240
const MCExpr *RISCVMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym,

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,22 @@
88

99
#include "SystemZMCAsmInfo.h"
1010
#include "llvm/MC/MCContext.h"
11+
#include "llvm/MC/MCExpr.h"
1112

1213
using namespace llvm;
1314

15+
const MCAsmInfo::VariantKindDesc variantKindDescs[] = {
16+
{MCSymbolRefExpr::VK_DTPOFF, "DTPOFF"},
17+
{MCSymbolRefExpr::VK_GOT, "GOT"},
18+
{MCSymbolRefExpr::VK_GOTENT, "GOTENT"},
19+
{MCSymbolRefExpr::VK_INDNTPOFF, "INDNTPOFF"},
20+
{MCSymbolRefExpr::VK_NTPOFF, "NTPOFF"},
21+
{MCSymbolRefExpr::VK_PLT, "PLT"},
22+
{MCSymbolRefExpr::VK_TLSGD, "TLSGD"},
23+
{MCSymbolRefExpr::VK_TLSLD, "TLSLD"},
24+
{MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"},
25+
};
26+
1427
SystemZMCAsmInfoELF::SystemZMCAsmInfoELF(const Triple &TT) {
1528
AssemblerDialect = AD_GNU;
1629
CalleeSaveStackSlotSize = 8;
@@ -22,6 +35,8 @@ SystemZMCAsmInfoELF::SystemZMCAsmInfoELF(const Triple &TT) {
2235
SupportsDebugInformation = true;
2336
UsesELFSectionDirectiveForBSS = true;
2437
ZeroDirective = "\t.space\t";
38+
39+
initializeVariantKinds(variantKindDescs);
2540
}
2641

2742
SystemZMCAsmInfoGOFF::SystemZMCAsmInfoGOFF(const Triple &TT) {

0 commit comments

Comments
 (0)