1 //===-- MipsMCSymbolRefExpr.h - Mips specific MCSymbolRefExpr class -------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #ifndef MIPSMCSYMBOLREFEXPR_H 11 #define MIPSMCSYMBOLREFEXPR_H 12 #include "llvm/MC/MCExpr.h" 13 14 namespace llvm { 15 16 class MipsMCSymbolRefExpr : public MCTargetExpr { 17 public: 18 enum VariantKind { 19 VK_Mips_None, 20 VK_Mips_GPREL, 21 VK_Mips_GOT_CALL, 22 VK_Mips_GOT, 23 VK_Mips_ABS_HI, 24 VK_Mips_ABS_LO, 25 VK_Mips_TLSGD, 26 VK_Mips_GOTTPREL, 27 VK_Mips_TPREL_HI, 28 VK_Mips_TPREL_LO 29 }; 30 31 private: 32 const VariantKind Kind; 33 const MCSymbol *Symbol; 34 int Offset; 35 MipsMCSymbolRefExpr(VariantKind _Kind,const MCSymbol * _Symbol,int _Offset)36 explicit MipsMCSymbolRefExpr(VariantKind _Kind, const MCSymbol *_Symbol, 37 int _Offset) 38 : Kind(_Kind), Symbol(_Symbol), Offset(_Offset) {} 39 40 public: 41 static const MipsMCSymbolRefExpr *Create(VariantKind Kind, 42 const MCSymbol *Symbol, int Offset, 43 MCContext &Ctx); 44 45 void PrintImpl(raw_ostream &OS) const; 46 bool EvaluateAsRelocatableImpl(MCValue &Res, 47 const MCAsmLayout *Layout) const; 48 void AddValueSymbols(MCAssembler *) const; 49 const MCSection *FindAssociatedSection() const; 50 classof(const MCExpr * E)51 static bool classof(const MCExpr *E) { 52 return E->getKind() == MCExpr::Target; 53 } 54 classof(const MipsMCSymbolRefExpr *)55 static bool classof(const MipsMCSymbolRefExpr *) { return true; } 56 getOffset()57 int getOffset() const { return Offset; } setOffset(int O)58 void setOffset(int O) { Offset = O; } 59 }; 60 } // end namespace llvm 61 62 #endif 63