| 1 | //===-- ARMAsmBackend.h - ARM Assembler Backend -----------------*- C++ -*-===// |
| 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 | #ifndef LLVM_LIB_TARGET_ARM_ARMASMBACKEND_H |
| 10 | #define LLVM_LIB_TARGET_ARM_ARMASMBACKEND_H |
| 11 | |
| 12 | #include "MCTargetDesc/ARMFixupKinds.h" |
| 13 | #include "MCTargetDesc/ARMMCTargetDesc.h" |
| 14 | #include "llvm/MC/MCAsmBackend.h" |
| 15 | #include "llvm/MC/MCSubtargetInfo.h" |
| 16 | #include "llvm/MC/TargetRegistry.h" |
| 17 | |
| 18 | namespace llvm { |
| 19 | |
| 20 | class ARMAsmBackend : public MCAsmBackend { |
| 21 | public: |
| 22 | ARMAsmBackend(const Target &T, llvm::endianness Endian) |
| 23 | : MCAsmBackend(Endian) {} |
| 24 | |
| 25 | bool hasNOP(const MCSubtargetInfo *STI) const { |
| 26 | return STI->hasFeature(Feature: ARM::HasV6T2Ops); |
| 27 | } |
| 28 | |
| 29 | std::optional<MCFixupKind> getFixupKind(StringRef Name) const override; |
| 30 | |
| 31 | MCFixupKindInfo getFixupKindInfo(MCFixupKind Kind) const override; |
| 32 | |
| 33 | bool shouldForceRelocation(const MCFixup &Fixup, const MCValue &Target); |
| 34 | |
| 35 | unsigned adjustFixupValue(const MCAssembler &Asm, const MCFixup &Fixup, |
| 36 | const MCValue &Target, uint64_t Value, |
| 37 | bool IsResolved, MCContext &Ctx, |
| 38 | const MCSubtargetInfo *STI) const; |
| 39 | |
| 40 | void applyFixup(const MCFragment &, const MCFixup &, const MCValue &Target, |
| 41 | MutableArrayRef<char> Data, uint64_t Value, |
| 42 | bool IsResolved) override; |
| 43 | |
| 44 | unsigned getRelaxedOpcode(unsigned Op, const MCSubtargetInfo &STI) const; |
| 45 | |
| 46 | bool mayNeedRelaxation(const MCInst &Inst, |
| 47 | const MCSubtargetInfo &STI) const override; |
| 48 | |
| 49 | const char *reasonForFixupRelaxation(const MCFixup &Fixup, |
| 50 | uint64_t Value) const; |
| 51 | |
| 52 | bool fixupNeedsRelaxationAdvanced(const MCFixup &, const MCValue &, uint64_t, |
| 53 | bool) const override; |
| 54 | |
| 55 | void relaxInstruction(MCInst &Inst, |
| 56 | const MCSubtargetInfo &STI) const override; |
| 57 | |
| 58 | bool writeNopData(raw_ostream &OS, uint64_t Count, |
| 59 | const MCSubtargetInfo *STI) const override; |
| 60 | |
| 61 | unsigned getPointerSize() const { return 4; } |
| 62 | }; |
| 63 | } // end namespace llvm |
| 64 | |
| 65 | #endif |
| 66 | |