xref: /freebsd/contrib/llvm-project/llvm/lib/Target/BPF/MCTargetDesc/BPFMCAsmInfo.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //===-- BPFMCAsmInfo.h - BPF asm properties -------------------*- C++ -*--====//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file contains the declaration of the BPFMCAsmInfo class.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric 
130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H
140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_BPF_MCTARGETDESC_BPFMCASMINFO_H
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "llvm/MC/MCAsmInfo.h"
17*06c3fb27SDimitry Andric #include "llvm/TargetParser/Triple.h"
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric namespace llvm {
200b57cec5SDimitry Andric 
210b57cec5SDimitry Andric class BPFMCAsmInfo : public MCAsmInfo {
220b57cec5SDimitry Andric public:
BPFMCAsmInfo(const Triple & TT,const MCTargetOptions & Options)23480093f4SDimitry Andric   explicit BPFMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) {
240b57cec5SDimitry Andric     if (TT.getArch() == Triple::bpfeb)
250b57cec5SDimitry Andric       IsLittleEndian = false;
260b57cec5SDimitry Andric 
270b57cec5SDimitry Andric     PrivateGlobalPrefix = ".L";
280b57cec5SDimitry Andric     WeakRefDirective = "\t.weak\t";
290b57cec5SDimitry Andric 
300b57cec5SDimitry Andric     UsesELFSectionDirectiveForBSS = true;
310b57cec5SDimitry Andric     HasSingleParameterDotFile = true;
320b57cec5SDimitry Andric     HasDotTypeDotSizeDirective = true;
330b57cec5SDimitry Andric 
340b57cec5SDimitry Andric     SupportsDebugInformation = true;
350b57cec5SDimitry Andric     ExceptionsType = ExceptionHandling::DwarfCFI;
360b57cec5SDimitry Andric     MinInstAlignment = 8;
370b57cec5SDimitry Andric 
380b57cec5SDimitry Andric     // the default is 4 and it only affects dwarf elf output
390b57cec5SDimitry Andric     // so if not set correctly, the dwarf data will be
400b57cec5SDimitry Andric     // messed up in random places by 4 bytes. .debug_line
410b57cec5SDimitry Andric     // section will be parsable, but with odd offsets and
420b57cec5SDimitry Andric     // line numbers, etc.
430b57cec5SDimitry Andric     CodePointerSize = 8;
440b57cec5SDimitry Andric   }
450b57cec5SDimitry Andric 
setDwarfUsesRelocationsAcrossSections(bool enable)460b57cec5SDimitry Andric   void setDwarfUsesRelocationsAcrossSections(bool enable) {
470b57cec5SDimitry Andric     DwarfUsesRelocationsAcrossSections = enable;
480b57cec5SDimitry Andric   }
490b57cec5SDimitry Andric };
500b57cec5SDimitry Andric }
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric #endif
53