diff options
author | Fangrui Song <i@maskray.me> | 2025-03-02 21:30:05 -0800 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2025-03-02 21:30:05 -0800 |
commit | f244b8eed37a12539fb11b76e19ec7a7eb41dccc (patch) | |
tree | 3d46ba0488b0b6944a1491164d6e90d60560cfef /llvm/lib | |
parent | e9c8d42b895fe4934a149478788fa020bd69f7bf (diff) | |
download | llvm-f244b8eed37a12539fb11b76e19ec7a7eb41dccc.zip llvm-f244b8eed37a12539fb11b76e19ec7a7eb41dccc.tar.gz llvm-f244b8eed37a12539fb11b76e19ec7a7eb41dccc.tar.bz2 |
[MC] Port initializeVariantKinds to a few targets
Diffstat (limited to 'llvm/lib')
5 files changed, 73 insertions, 0 deletions
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp index 62eac05..9ff5363 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp @@ -30,6 +30,21 @@ static cl::opt<AsmWriterVariantTy> AsmWriterVariant( cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"), clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly"))); +const MCAsmInfo::VariantKindDesc variantKindDescs[] = { + {MCSymbolRefExpr::VK_COFF_IMGREL32, "IMGREL"}, + {MCSymbolRefExpr::VK_GOT, "GOT"}, + {MCSymbolRefExpr::VK_GOTPAGE, "GOTPAGE"}, + {MCSymbolRefExpr::VK_GOTPAGEOFF, "GOTPAGEOFF"}, + {MCSymbolRefExpr::VK_GOTPCREL, "GOTPCREL"}, + {MCSymbolRefExpr::VK_PAGE, "PAGE"}, + {MCSymbolRefExpr::VK_PAGEOFF, "PAGEOFF"}, + {MCSymbolRefExpr::VK_PLT, "PLT"}, + {MCSymbolRefExpr::VK_TLVP, "TLVP"}, + {MCSymbolRefExpr::VK_TLVPPAGE, "TLVPPAGE"}, + {MCSymbolRefExpr::VK_TLVPPAGEOFF, "TLVPPAGEOFF"}, + {MCSymbolRefExpr::VK_WEAKREF, "WEAKREF"}, +}; + AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin(bool IsILP32) { // We prefer NEON instructions to be printed in the short, Apple-specific // form when targeting Darwin. @@ -48,6 +63,8 @@ AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin(bool IsILP32) { UseDataRegionDirectives = true; ExceptionsType = ExceptionHandling::DwarfCFI; + + initializeVariantKinds(variantKindDescs); } const MCExpr *AArch64MCAsmInfoDarwin::getExprForPersonalitySymbol( @@ -97,6 +114,8 @@ AArch64MCAsmInfoELF::AArch64MCAsmInfoELF(const Triple &T) { ExceptionsType = ExceptionHandling::DwarfCFI; HasIdentDirective = true; + + initializeVariantKinds(variantKindDescs); } AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() { @@ -114,6 +133,8 @@ AArch64MCAsmInfoMicrosoftCOFF::AArch64MCAsmInfoMicrosoftCOFF() { CommentString = "//"; ExceptionsType = ExceptionHandling::WinEH; WinEHEncodingType = WinEH::EncodingType::Itanium; + + initializeVariantKinds(variantKindDescs); } AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() { @@ -131,4 +152,6 @@ AArch64MCAsmInfoGNUCOFF::AArch64MCAsmInfoGNUCOFF() { CommentString = "//"; ExceptionsType = ExceptionHandling::WinEH; WinEHEncodingType = WinEH::EncodingType::Itanium; + + initializeVariantKinds(variantKindDescs); } diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp index e8576d3..a036000 100644 --- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp +++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCAsmInfo.cpp @@ -12,10 +12,21 @@ #include "CSKYMCAsmInfo.h" #include "llvm/BinaryFormat/Dwarf.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCStreamer.h" using namespace llvm; +const MCAsmInfo::VariantKindDesc variantKindDescs[] = { + {MCSymbolRefExpr::VK_GOT, "GOT"}, + {MCSymbolRefExpr::VK_GOTOFF, "GOTOFF"}, + {MCSymbolRefExpr::VK_PLT, "PLT"}, + {MCSymbolRefExpr::VK_TLSGD, "TLSGD"}, + {MCSymbolRefExpr::VK_TLSLD, "TLSLD"}, + {MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"}, + {MCSymbolRefExpr::VK_TPOFF, "TPOFF"}, +}; + void CSKYMCAsmInfo::anchor() {} CSKYMCAsmInfo::CSKYMCAsmInfo(const Triple &TargetTriple) { @@ -27,4 +38,6 @@ CSKYMCAsmInfo::CSKYMCAsmInfo(const Triple &TargetTriple) { UsesELFSectionDirectiveForBSS = true; ExceptionsType = ExceptionHandling::DwarfCFI; + + initializeVariantKinds(variantKindDescs); } diff --git a/llvm/lib/Target/M68k/MCTargetDesc/M68kMCAsmInfo.cpp b/llvm/lib/Target/M68k/MCTargetDesc/M68kMCAsmInfo.cpp index bf5d63c..53534a0 100644 --- a/llvm/lib/Target/M68k/MCTargetDesc/M68kMCAsmInfo.cpp +++ b/llvm/lib/Target/M68k/MCTargetDesc/M68kMCAsmInfo.cpp @@ -13,10 +13,22 @@ #include "M68kMCAsmInfo.h" +#include "llvm/MC/MCExpr.h" #include "llvm/TargetParser/Triple.h" using namespace llvm; +const MCAsmInfo::VariantKindDesc variantKindDescs[] = { + {MCSymbolRefExpr::VK_GOTOFF, "GOTOFF"}, + {MCSymbolRefExpr::VK_GOTPCREL, "GOTPCREL"}, + {MCSymbolRefExpr::VK_GOTTPOFF, "GOTTPOFF"}, + {MCSymbolRefExpr::VK_PLT, "PLT"}, + {MCSymbolRefExpr::VK_TLSGD, "TLSGD"}, + {MCSymbolRefExpr::VK_TLSLD, "TLSLD"}, + {MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"}, + {MCSymbolRefExpr::VK_TPOFF, "TPOFF"}, +}; + void M68kELFMCAsmInfo::anchor() {} M68kELFMCAsmInfo::M68kELFMCAsmInfo(const Triple &T) { @@ -33,4 +45,6 @@ M68kELFMCAsmInfo::M68kELFMCAsmInfo(const Triple &T) { UseMotorolaIntegers = true; CommentString = ";"; + + initializeVariantKinds(variantKindDescs); } diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp index 7b92752..5965dc6 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp @@ -13,10 +13,16 @@ #include "RISCVMCAsmInfo.h" #include "MCTargetDesc/RISCVMCExpr.h" #include "llvm/BinaryFormat/Dwarf.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCStreamer.h" #include "llvm/TargetParser/Triple.h" using namespace llvm; +const MCAsmInfo::VariantKindDesc variantKindDescs[] = { + {MCSymbolRefExpr::VK_GOTPCREL, "GOTPCREL"}, + {MCSymbolRefExpr::VK_PLT, "PLT"}, +}; + void RISCVMCAsmInfo::anchor() {} RISCVMCAsmInfo::RISCVMCAsmInfo(const Triple &TT) { @@ -27,6 +33,8 @@ RISCVMCAsmInfo::RISCVMCAsmInfo(const Triple &TT) { ExceptionsType = ExceptionHandling::DwarfCFI; Data16bitsDirective = "\t.half\t"; Data32bitsDirective = "\t.word\t"; + + initializeVariantKinds(variantKindDescs); } const MCExpr *RISCVMCAsmInfo::getExprForFDESymbol(const MCSymbol *Sym, diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp index 16e7d05..ef2d043 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmInfo.cpp @@ -8,9 +8,22 @@ #include "SystemZMCAsmInfo.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" using namespace llvm; +const MCAsmInfo::VariantKindDesc variantKindDescs[] = { + {MCSymbolRefExpr::VK_DTPOFF, "DTPOFF"}, + {MCSymbolRefExpr::VK_GOT, "GOT"}, + {MCSymbolRefExpr::VK_GOTENT, "GOTENT"}, + {MCSymbolRefExpr::VK_INDNTPOFF, "INDNTPOFF"}, + {MCSymbolRefExpr::VK_NTPOFF, "NTPOFF"}, + {MCSymbolRefExpr::VK_PLT, "PLT"}, + {MCSymbolRefExpr::VK_TLSGD, "TLSGD"}, + {MCSymbolRefExpr::VK_TLSLD, "TLSLD"}, + {MCSymbolRefExpr::VK_TLSLDM, "TLSLDM"}, +}; + SystemZMCAsmInfoELF::SystemZMCAsmInfoELF(const Triple &TT) { AssemblerDialect = AD_GNU; CalleeSaveStackSlotSize = 8; @@ -22,6 +35,8 @@ SystemZMCAsmInfoELF::SystemZMCAsmInfoELF(const Triple &TT) { SupportsDebugInformation = true; UsesELFSectionDirectiveForBSS = true; ZeroDirective = "\t.space\t"; + + initializeVariantKinds(variantKindDescs); } SystemZMCAsmInfoGOFF::SystemZMCAsmInfoGOFF(const Triple &TT) { |