| 1 | //==- HexagonMCExpr.h - Hexagon specific MC expression classes --*- 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_HEXAGON_HEXAGONMCEXPR_H |
| 10 | #define LLVM_LIB_TARGET_HEXAGON_HEXAGONMCEXPR_H |
| 11 | |
| 12 | #include "llvm/MC/MCExpr.h" |
| 13 | |
| 14 | namespace llvm { |
| 15 | class HexagonMCExpr : public MCTargetExpr { |
| 16 | public: |
| 17 | enum VariantKind : uint8_t { |
| 18 | VK_None, |
| 19 | |
| 20 | VK_DTPREL = MCSymbolRefExpr::FirstTargetSpecifier, |
| 21 | VK_GD_GOT, |
| 22 | VK_GD_PLT, |
| 23 | VK_GOT, |
| 24 | VK_GOTREL, |
| 25 | VK_IE, |
| 26 | VK_IE_GOT, |
| 27 | VK_LD_GOT, |
| 28 | VK_LD_PLT, |
| 29 | VK_PCREL, |
| 30 | VK_PLT, |
| 31 | VK_TPREL, |
| 32 | |
| 33 | VK_LO16, |
| 34 | VK_HI16, |
| 35 | VK_GPREL, |
| 36 | }; |
| 37 | |
| 38 | static HexagonMCExpr *create(MCExpr const *Expr, MCContext &Ctx); |
| 39 | void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override; |
| 40 | bool evaluateAsRelocatableImpl(MCValue &Res, |
| 41 | const MCAssembler *Asm) const override; |
| 42 | void visitUsedExpr(MCStreamer &Streamer) const override; |
| 43 | MCFragment *findAssociatedFragment() const override; |
| 44 | MCExpr const *getExpr() const; |
| 45 | void setMustExtend(bool Val = true); |
| 46 | bool mustExtend() const; |
| 47 | void setMustNotExtend(bool Val = true); |
| 48 | bool mustNotExtend() const; |
| 49 | void setS27_2_reloc(bool Val = true); |
| 50 | bool s27_2_reloc() const; |
| 51 | void setSignMismatch(bool Val = true); |
| 52 | bool signMismatch() const; |
| 53 | |
| 54 | private: |
| 55 | HexagonMCExpr(MCExpr const *Expr); |
| 56 | MCExpr const *Expr; |
| 57 | bool MustNotExtend; |
| 58 | bool MustExtend; |
| 59 | bool S27_2_reloc; |
| 60 | bool SignMismatch; |
| 61 | }; |
| 62 | } // end namespace llvm |
| 63 | |
| 64 | #endif // LLVM_LIB_TARGET_HEXAGON_HEXAGONMCEXPR_H |
| 65 | |