LLVM 24.0.0git
CSKYMCAsmInfo.cpp
Go to the documentation of this file.
1//===-- CSKYMCAsmInfo.cpp - CSKY 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 CSKYMCAsmInfo properties.
10//
11//===----------------------------------------------------------------------===//
12
13#include "CSKYMCAsmInfo.h"
15#include "llvm/ADT/Enum.h"
17#include "llvm/MC/MCExpr.h"
18#include "llvm/MC/MCStreamer.h"
19
20using namespace llvm;
21
23 {{"GOT"}, CSKY::S_GOT}, {{"GOTOFF"}, CSKY::S_GOTOFF},
24 {{"PLT"}, CSKY::S_PLT}, {{"TLSGD"}, CSKY::S_TLSGD},
25 {{"TLSLDM"}, CSKY::S_TLSLDM}, {{"TPOFF"}, CSKY::S_TPOFF},
26};
28
30 using namespace CSKY;
31 switch (Kind) {
32 default:
33 llvm_unreachable("Invalid ELF symbol kind");
34 case S_None:
35 case S_ADDR:
36 return "";
37 case S_ADDR_HI16:
38 return "@HI16";
39 case S_ADDR_LO16:
40 return "@LO16";
41 case S_GOT_IMM18_BY4:
42 case S_GOT:
43 return "@GOT";
44 case S_GOTPC:
45 return "@GOTPC";
46 case S_GOTOFF:
47 return "@GOTOFF";
48 case S_PLT_IMM18_BY4:
49 case S_PLT:
50 return "@PLT";
51 case S_TLSLE:
52 return "@TPOFF";
53 case S_TLSIE:
54 return "@GOTTPOFF";
55 case S_TLSGD:
56 return "@TLSGD32";
57 case S_TLSLDO:
58 return "@TLSLDO32";
59 case S_TLSLDM:
60 return "@TLSLDM32";
61 }
62}
63
66 : MCAsmInfoELF(TargetTriple, Options) {
67 AlignmentIsInBytes = false;
69 CommentString = "#";
70
72
73 SpecifierExprPrintFn = [](const MCAsmInfo &MAI, raw_ostream &OS,
74 const MCSpecifierExpr &Expr) {
75 MAI.printExpr(OS, *Expr.getSubExpr());
76 OS << getVariantKindName(Expr.getSpecifier());
77 };
78}
constexpr EnumStringDef< MCAsmInfo::AtSpecifierKind > AtSpecifierDefs[]
constexpr auto atSpecifiers
static StringRef getVariantKindName(uint8_t Kind)
This file contains constants used for implementing Dwarf debug support.
#define BUILD_ENUM_STRINGS(Tab)
Definition Enum.h:120
static LVOptions Options
Definition LVOptions.cpp:25
CSKYMCAsmInfo(const Triple &TargetTriple, const MCTargetOptions &Options)
MCAsmInfoELF(const Triple &TT, const MCTargetOptions &Options)
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition MCAsmInfo.h:69
void printExpr(raw_ostream &, const MCExpr &) const
bool SupportsDebugInformation
True if target supports emission of debugging information.
Definition MCAsmInfo.h:372
void(* SpecifierExprPrintFn)(const MCAsmInfo &, raw_ostream &, const MCSpecifierExpr &)
Definition MCAsmInfo.h:228
bool AlignmentIsInBytes
If this is true (the default) then the asmprinter emits ".align N" directives, where N is the number ...
Definition MCAsmInfo.h:286
void initializeAtSpecifiers(EnumStrings< AtSpecifierKind, 1 >)
StringRef CommentString
This indicates the comment string used by the assembler.
Definition MCAsmInfo.h:144
Extension point for target-specific MCExpr subclasses with a relocation specifier,...
Definition MCExpr.h:491
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
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.
Compile-time data representation of enum entries.
Definition Enum.h:47