1//===-- HexagonMCAsmInfo.cpp - Hexagon 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 HexagonMCAsmInfo properties.
10//
11//===----------------------------------------------------------------------===//
12
13#include "HexagonMCAsmInfo.h"
14#include "MCTargetDesc/HexagonMCExpr.h"
15#include "llvm/ADT/Enum.h"
16#include "llvm/MC/MCExpr.h"
17
18using namespace llvm;
19
20constexpr EnumStringDef<MCAsmInfo::AtSpecifierKind> AtSpecifierDefs[] = {
21 {.Names: {"DTPREL"}, .Value: HexagonMCExpr::VK_DTPREL},
22 {.Names: {"GDGOT"}, .Value: HexagonMCExpr::VK_GD_GOT},
23 {.Names: {"GDPLT"}, .Value: HexagonMCExpr::VK_GD_PLT},
24 {.Names: {"GOT"}, .Value: HexagonMCExpr::VK_GOT},
25 {.Names: {"GOTREL"}, .Value: HexagonMCExpr::VK_GOTREL},
26 {.Names: {"IE"}, .Value: HexagonMCExpr::VK_IE},
27 {.Names: {"IEGOT"}, .Value: HexagonMCExpr::VK_IE_GOT},
28 {.Names: {"LDGOT"}, .Value: HexagonMCExpr::VK_LD_GOT},
29 {.Names: {"LDPLT"}, .Value: HexagonMCExpr::VK_LD_PLT},
30 {.Names: {"PCREL"}, .Value: HexagonMCExpr::VK_PCREL},
31 {.Names: {"PLT"}, .Value: HexagonMCExpr::VK_PLT},
32 {.Names: {"TPREL"}, .Value: HexagonMCExpr::VK_TPREL},
33};
34constexpr auto atSpecifiers = BUILD_ENUM_STRINGS(AtSpecifierDefs);
35
36// Pin the vtable to this file.
37void HexagonMCAsmInfo::anchor() {}
38
39HexagonMCAsmInfo::HexagonMCAsmInfo(const Triple &TT,
40 const MCTargetOptions &Options)
41 : MCAsmInfoELF(Options) {
42 Data16bitsDirective = "\t.half\t";
43 Data32bitsDirective = "\t.word\t";
44 Data64bitsDirective = nullptr; // .xword is only supported by V9.
45 CommentString = "//";
46 SupportsDebugInformation = true;
47
48 LCOMMDirectiveAlignmentType = LCOMM::ByteAlignment;
49 InlineAsmStart = "# InlineAsm Start";
50 InlineAsmEnd = "# InlineAsm End";
51 UsesSetToEquateSymbol = true;
52 ZeroDirective = "\t.space\t";
53 AscizDirective = "\t.string\t";
54
55 MinInstAlignment = 4;
56 UsesELFSectionDirectiveForBSS = true;
57 ExceptionsType = ExceptionHandling::DwarfCFI;
58 UseLogicalShr = false;
59
60 initializeAtSpecifiers(atSpecifiers);
61}
62