1 //====- SparcMCExpr.h - Sparc specific MC expression classes --*- C++ -*-=====//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file describes Sparc-specific MCExprs, used for modifiers like
11 // "%hi" or "%lo" etc.,
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SPARCMCEXPR_H
16 #define LLVM_SPARCMCEXPR_H
18 #include "llvm/MC/MCExpr.h"
23 class SparcMCExpr : public MCTargetExpr {
39 VK_Sparc_TLS_LDM_HI22,
40 VK_Sparc_TLS_LDM_LO10,
42 VK_Sparc_TLS_LDM_CALL,
43 VK_Sparc_TLS_LDO_HIX22,
44 VK_Sparc_TLS_LDO_LOX10,
51 VK_Sparc_TLS_LE_HIX22,
56 const VariantKind Kind;
59 explicit SparcMCExpr(VariantKind _Kind, const MCExpr *_Expr)
60 : Kind(_Kind), Expr(_Expr) {}
63 /// @name Construction
66 static const SparcMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
72 /// getOpcode - Get the kind of this expression.
73 VariantKind getKind() const { return Kind; }
75 /// getSubExpr - Get the child of this expression.
76 const MCExpr *getSubExpr() const { return Expr; }
79 void PrintImpl(raw_ostream &OS) const;
80 bool EvaluateAsRelocatableImpl(MCValue &Res,
81 const MCAsmLayout *Layout) const;
82 void AddValueSymbols(MCAssembler *) const;
83 const MCSection *FindAssociatedSection() const {
84 return getSubExpr()->FindAssociatedSection();
87 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const;
89 static bool classof(const MCExpr *E) {
90 return E->getKind() == MCExpr::Target;
93 static bool classof(const SparcMCExpr *) { return true; }
95 static VariantKind parseVariantKind(StringRef name);
96 static bool printVariantKind(raw_ostream &OS, VariantKind Kind);
99 } // end namespace llvm.