BPFMCAsmInfo.h revision 360784
1228753Smm//===-- BPFMCAsmInfo.h - BPF asm properties -------------------*- C++ -*--====//
2248616Smm//
3228753Smm// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4228753Smm// See https://llvm.org/LICENSE.txt for license information.
5228753Smm// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6228753Smm//
7228753Smm//===----------------------------------------------------------------------===//
8228753Smm//
9228753Smm// This file contains the declaration of the BPFMCAsmInfo class.
10228753Smm//
11228753Smm//===----------------------------------------------------------------------===//
12228753Smm
13228753Smm#ifndef LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H
14228753Smm#define LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H
15228753Smm
16228753Smm#include "llvm/ADT/Triple.h"
17228753Smm#include "llvm/MC/MCAsmInfo.h"
18228753Smm
19228753Smmnamespace llvm {
20228753Smmclass Target;
21228753Smm
22228753Smmclass BPFMCAsmInfo : public MCAsmInfo {
23228753Smmpublic:
24228753Smm  explicit BPFMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) {
25228753Smm    if (TT.getArch() == Triple::bpfeb)
26228753Smm      IsLittleEndian = false;
27228753Smm
28228763Smm    PrivateGlobalPrefix = ".L";
29228753Smm    WeakRefDirective = "\t.weak\t";
30228753Smm
31228753Smm    UsesELFSectionDirectiveForBSS = true;
32228753Smm    HasSingleParameterDotFile = true;
33232153Smm    HasDotTypeDotSizeDirective = true;
34232153Smm
35232153Smm    SupportsDebugInformation = true;
36232153Smm    ExceptionsType = ExceptionHandling::DwarfCFI;
37232153Smm    MinInstAlignment = 8;
38232153Smm
39228753Smm    // the default is 4 and it only affects dwarf elf output
40228753Smm    // so if not set correctly, the dwarf data will be
41228753Smm    // messed up in random places by 4 bytes. .debug_line
42228753Smm    // section will be parsable, but with odd offsets and
43228753Smm    // line numbers, etc.
44228753Smm    CodePointerSize = 8;
45232153Smm  }
46232153Smm
47232153Smm  void setDwarfUsesRelocationsAcrossSections(bool enable) {
48228753Smm    DwarfUsesRelocationsAcrossSections = enable;
49228753Smm  }
50228753Smm};
51228753Smm}
52228753Smm
53248616Smm#endif
54248616Smm