1 //===-- XtensaMCExpr.h - Xtensa specific MC expression classes --*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 6 // See https://llvm.org/LICENSE.txt for license information. 7 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 8 // 9 //===----------------------------------------------------------------------===// 10 // 11 // This file describes Xtensa-specific MCExprs 12 // 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_LIB_TARGET_XTENSA_MCTARGETDESC_XTENSAMCEXPR_H 16 #define LLVM_LIB_TARGET_XTENSA_MCTARGETDESC_XTENSAMCEXPR_H 17 18 #include "llvm/MC/MCExpr.h" 19 20 namespace llvm { 21 22 class StringRef; 23 class XtensaMCExpr : public MCTargetExpr { 24 public: 25 enum VariantKind { VK_Xtensa_None, VK_Xtensa_Invalid }; 26 27 private: 28 const MCExpr *Expr; 29 const VariantKind Kind; 30 XtensaMCExpr(const MCExpr * Expr,VariantKind Kind)31 explicit XtensaMCExpr(const MCExpr *Expr, VariantKind Kind) 32 : Expr(Expr), Kind(Kind) {} 33 34 public: 35 static const XtensaMCExpr *create(const MCExpr *Expr, VariantKind Kind, 36 MCContext &Ctx); 37 getKind()38 VariantKind getKind() const { return Kind; } 39 getSubExpr()40 const MCExpr *getSubExpr() const { return Expr; } 41 42 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override; 43 bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm, 44 const MCFixup *Fixup) const override; 45 void visitUsedExpr(MCStreamer &Streamer) const override; findAssociatedFragment()46 MCFragment *findAssociatedFragment() const override { 47 return getSubExpr()->findAssociatedFragment(); 48 } 49 fixELFSymbolsInTLSFixups(MCAssembler & Asm)50 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {} 51 52 static VariantKind getVariantKindForName(StringRef name); 53 static StringRef getVariantKindName(VariantKind Kind); 54 }; 55 56 } // end namespace llvm. 57 58 #endif // LLVM_LIB_TARGET_XTENSA_MCTARGETDESC_XTENSAMCEXPR_H 59