003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/MC
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
MC
/
📁
..
📄
ConstantPools.h
(3.35 KB)
📄
LaneBitmask.h
(3.24 KB)
📄
MCAsmBackend.h
(8.09 KB)
📄
MCAsmInfo.h
(25.48 KB)
📄
MCAsmInfoCOFF.h
(900 B)
📄
MCAsmInfoDarwin.h
(927 B)
📄
MCAsmInfoELF.h
(711 B)
📄
MCAsmInfoWasm.h
(612 B)
📄
MCAsmInfoXCOFF.h
(792 B)
📄
MCAsmLayout.h
(3.75 KB)
📄
MCAsmMacro.h
(4.54 KB)
📄
MCAssembler.h
(16.1 KB)
📄
MCCodeEmitter.h
(1.53 KB)
📄
MCCodeView.h
(9.03 KB)
📄
MCContext.h
(31.99 KB)
📄
MCDirectives.h
(3.12 KB)
📁
MCDisassembler
📄
MCDwarf.h
(21.46 KB)
📄
MCELFObjectWriter.h
(5.27 KB)
📄
MCELFStreamer.h
(3.97 KB)
📄
MCExpr.h
(21.55 KB)
📄
MCFixedLenDisassembler.h
(1.39 KB)
📄
MCFixup.h
(7.4 KB)
📄
MCFixupKindInfo.h
(1.6 KB)
📄
MCFragment.h
(17.72 KB)
📄
MCInst.h
(6.06 KB)
📄
MCInstBuilder.h
(1.76 KB)
📄
MCInstPrinter.h
(5.88 KB)
📄
MCInstrAnalysis.h
(6.8 KB)
📄
MCInstrDesc.h
(25.13 KB)
📄
MCInstrInfo.h
(2.93 KB)
📄
MCInstrItineraries.h
(9.02 KB)
📄
MCLabel.h
(1.63 KB)
📄
MCLinkerOptimizationHint.h
(5.73 KB)
📄
MCMachObjectWriter.h
(9.77 KB)
📄
MCObjectFileInfo.h
(16.57 KB)
📄
MCObjectStreamer.h
(8.78 KB)
📄
MCObjectWriter.h
(4.44 KB)
📁
MCParser
📄
MCRegister.h
(4.16 KB)
📄
MCRegisterInfo.h
(28.96 KB)
📄
MCSchedule.h
(16.25 KB)
📄
MCSection.h
(6.52 KB)
📄
MCSectionCOFF.h
(3.37 KB)
📄
MCSectionELF.h
(3.3 KB)
📄
MCSectionMachO.h
(3.15 KB)
📄
MCSectionWasm.h
(2.78 KB)
📄
MCSectionXCOFF.h
(3.22 KB)
📄
MCStreamer.h
(43.55 KB)
📄
MCSubtargetInfo.h
(10.04 KB)
📄
MCSymbol.h
(13.8 KB)
📄
MCSymbolCOFF.h
(1.62 KB)
📄
MCSymbolELF.h
(1.45 KB)
📄
MCSymbolMachO.h
(4.18 KB)
📄
MCSymbolWasm.h
(4.28 KB)
📄
MCSymbolXCOFF.h
(2.39 KB)
📄
MCTargetOptions.h
(2.29 KB)
📄
MCTargetOptionsCommandFlags.h
(1.26 KB)
📄
MCValue.h
(2.42 KB)
📄
MCWasmObjectWriter.h
(1.61 KB)
📄
MCWasmStreamer.h
(2.83 KB)
📄
MCWin64EH.h
(2.41 KB)
📄
MCWinCOFFObjectWriter.h
(1.81 KB)
📄
MCWinCOFFStreamer.h
(3.05 KB)
📄
MCWinEH.h
(1.97 KB)
📄
MCXCOFFObjectWriter.h
(1.45 KB)
📄
MCXCOFFStreamer.h
(1.86 KB)
📄
MachineLocation.h
(2.04 KB)
📄
SectionKind.h
(7.53 KB)
📄
StringTableBuilder.h
(2.47 KB)
📄
SubtargetFeature.h
(7.12 KB)
Editing: MCAsmBackend.h
//===- llvm/MC/MCAsmBackend.h - MC Asm Backend ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_MC_MCASMBACKEND_H #define LLVM_MC_MCASMBACKEND_H #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCFixup.h" #include "llvm/MC/MCFragment.h" #include "llvm/Support/Endian.h" #include <cstdint> namespace llvm { class MCAsmLayout; class MCAssembler; class MCCFIInstruction; struct MCFixupKindInfo; class MCInst; class MCObjectStreamer; class MCObjectTargetWriter; class MCObjectWriter; class MCSubtargetInfo; class MCValue; class raw_pwrite_stream; class StringRef; /// Generic interface to target specific assembler backends. class MCAsmBackend { protected: // Can only create subclasses. MCAsmBackend(support::endianness Endian); public: MCAsmBackend(const MCAsmBackend &) = delete; MCAsmBackend &operator=(const MCAsmBackend &) = delete; virtual ~MCAsmBackend(); const support::endianness Endian; /// Return true if this target might automatically pad instructions and thus /// need to emit padding enable/disable directives around sensative code. virtual bool allowAutoPadding() const { return false; } /// Return true if this target allows an unrelaxable instruction to be /// emitted into RelaxableFragment and then we can increase its size in a /// tricky way for optimization. virtual bool allowEnhancedRelaxation() const { return false; } /// Give the target a chance to manipulate state related to instruction /// alignment (e.g. padding for optimization), instruction relaxablility, etc. /// before and after actually emitting the instruction. virtual void emitInstructionBegin(MCObjectStreamer &OS, const MCInst &Inst) {} virtual void emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst) {} /// lifetime management virtual void reset() {} /// Create a new MCObjectWriter instance for use by the assembler backend to /// emit the final object file. std::unique_ptr<MCObjectWriter> createObjectWriter(raw_pwrite_stream &OS) const; /// Create an MCObjectWriter that writes two object files: a .o file which is /// linked into the final program and a .dwo file which is used by debuggers. /// This function is only supported with ELF targets. std::unique_ptr<MCObjectWriter> createDwoObjectWriter(raw_pwrite_stream &OS, raw_pwrite_stream &DwoOS) const; virtual std::unique_ptr<MCObjectTargetWriter> createObjectTargetWriter() const = 0; /// \name Target Fixup Interfaces /// @{ /// Get the number of target specific fixup kinds. virtual unsigned getNumFixupKinds() const = 0; /// Map a relocation name used in .reloc to a fixup kind. virtual Optional<MCFixupKind> getFixupKind(StringRef Name) const; /// Get information on a fixup kind. virtual const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const; /// Hook to check if a relocation is needed for some target specific reason. virtual bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target) { return false; } /// Hook to check if extra nop bytes must be inserted for alignment directive. /// For some targets this may be necessary in order to support linker /// relaxation. The number of bytes to insert are returned in Size. virtual bool shouldInsertExtraNopBytesForCodeAlign(const MCAlignFragment &AF, unsigned &Size) { return false; } /// Hook which indicates if the target requires a fixup to be generated when /// handling an align directive in an executable section virtual bool shouldInsertFixupForCodeAlign(MCAssembler &Asm, const MCAsmLayout &Layout, MCAlignFragment &AF) { return false; } virtual bool evaluateTargetFixup(const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFixup &Fixup, const MCFragment *DF, const MCValue &Target, uint64_t &Value, bool &WasForced) { llvm_unreachable("Need to implement hook if target has custom fixups"); } /// Apply the \p Value for given \p Fixup into the provided data fragment, at /// the offset specified by the fixup and following the fixup kind as /// appropriate. Errors (such as an out of range fixup value) should be /// reported via \p Ctx. /// The \p STI is present only for fragments of type MCRelaxableFragment and /// MCDataFragment with hasInstructions() == true. virtual void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup, const MCValue &Target, MutableArrayRef<char> Data, uint64_t Value, bool IsResolved, const MCSubtargetInfo *STI) const = 0; /// Check whether the given target requires emitting differences of two /// symbols as a set of relocations. virtual bool requiresDiffExpressionRelocations() const { return false; } /// @} /// \name Target Relaxation Interfaces /// @{ /// Check whether the given instruction may need relaxation. /// /// \param Inst - The instruction to test. /// \param STI - The MCSubtargetInfo in effect when the instruction was /// encoded. virtual bool mayNeedRelaxation(const MCInst &Inst, const MCSubtargetInfo &STI) const = 0; /// Target specific predicate for whether a given fixup requires the /// associated instruction to be relaxed. virtual bool fixupNeedsRelaxationAdvanced(const MCFixup &Fixup, bool Resolved, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout, const bool WasForced) const; /// Simple predicate for targets where !Resolved implies requiring relaxation virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *DF, const MCAsmLayout &Layout) const = 0; /// Relax the instruction in the given fragment to the next wider instruction. /// /// \param [out] Inst The instruction to relax, which is also the relaxed /// instruction. /// \param STI the subtarget information for the associated instruction. virtual void relaxInstruction(MCInst &Inst, const MCSubtargetInfo &STI) const {}; /// @} /// Returns the minimum size of a nop in bytes on this target. The assembler /// will use this to emit excess padding in situations where the padding /// required for simple alignment would be less than the minimum nop size. /// virtual unsigned getMinimumNopSize() const { return 1; } /// Write an (optimal) nop sequence of Count bytes to the given output. If the /// target cannot generate such a sequence, it should return an error. /// /// \return - True on success. virtual bool writeNopData(raw_ostream &OS, uint64_t Count) const = 0; /// Give backend an opportunity to finish layout after relaxation virtual void finishLayout(MCAssembler const &Asm, MCAsmLayout &Layout) const {} /// Handle any target-specific assembler flags. By default, do nothing. virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {} /// Generate the compact unwind encoding for the CFI instructions. virtual uint32_t generateCompactUnwindEncoding(ArrayRef<MCCFIInstruction>) const { return 0; } /// Check whether a given symbol has been flagged with MICROMIPS flag. virtual bool isMicroMips(const MCSymbol *Sym) const { return false; } }; } // end namespace llvm #endif // LLVM_MC_MCASMBACKEND_H
Upload File
Create Folder