| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 1 | //===-- MipsMCExpr.h - Mips specific MC expression classes ------*- C++ -*-===// | 
|  | 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 |  | 
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H | 
|  | 11 | #define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 12 |  | 
| Chandler Carruth | 442f784 | 2014-03-04 10:07:28 +0000 | [diff] [blame] | 13 | #include "llvm/MC/MCAsmLayout.h" | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 14 | #include "llvm/MC/MCExpr.h" | 
|  | 15 | #include "llvm/MC/MCValue.h" | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 16 |  | 
|  | 17 | namespace llvm { | 
|  | 18 |  | 
|  | 19 | class MipsMCExpr : public MCTargetExpr { | 
|  | 20 | public: | 
|  | 21 | enum VariantKind { | 
|  | 22 | VK_Mips_None, | 
| Sasa Stankovic | 06c4780 | 2014-04-03 10:37:45 +0000 | [diff] [blame] | 23 | VK_Mips_LO, | 
|  | 24 | VK_Mips_HI, | 
|  | 25 | VK_Mips_HIGHER, | 
|  | 26 | VK_Mips_HIGHEST | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 27 | }; | 
|  | 28 |  | 
|  | 29 | private: | 
|  | 30 | const VariantKind Kind; | 
|  | 31 | const MCExpr *Expr; | 
|  | 32 |  | 
|  | 33 | explicit MipsMCExpr(VariantKind Kind, const MCExpr *Expr) | 
|  | 34 | : Kind(Kind), Expr(Expr) {} | 
|  | 35 |  | 
|  | 36 | public: | 
| Sasa Stankovic | 06c4780 | 2014-04-03 10:37:45 +0000 | [diff] [blame] | 37 | static bool isSupportedBinaryExpr(MCSymbolRefExpr::VariantKind VK, | 
|  | 38 | const MCBinaryExpr *BE); | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 39 |  | 
| Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 40 | static const MipsMCExpr *create(MCSymbolRefExpr::VariantKind VK, | 
| Sasa Stankovic | 06c4780 | 2014-04-03 10:37:45 +0000 | [diff] [blame] | 41 | const MCExpr *Expr, MCContext &Ctx); | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 42 |  | 
|  | 43 | /// getOpcode - Get the kind of this expression. | 
|  | 44 | VariantKind getKind() const { return Kind; } | 
|  | 45 |  | 
|  | 46 | /// getSubExpr - Get the child of this expression. | 
|  | 47 | const MCExpr *getSubExpr() const { return Expr; } | 
|  | 48 |  | 
| Matt Arsenault | 8b64355 | 2015-06-09 00:31:39 +0000 | [diff] [blame] | 49 | void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override; | 
| Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 50 | bool evaluateAsRelocatableImpl(MCValue &Res, | 
| Joerg Sonnenberger | 752b91b | 2014-08-10 11:35:12 +0000 | [diff] [blame] | 51 | const MCAsmLayout *Layout, | 
|  | 52 | const MCFixup *Fixup) const override; | 
| Rafael Espindola | e2c6624 | 2014-06-25 15:45:33 +0000 | [diff] [blame] | 53 | void visitUsedExpr(MCStreamer &Streamer) const override; | 
| Jim Grosbach | 13760bd | 2015-05-30 01:25:56 +0000 | [diff] [blame] | 54 | MCSection *findAssociatedSection() const override { | 
|  | 55 | return getSubExpr()->findAssociatedSection(); | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 56 | } | 
|  | 57 |  | 
|  | 58 | // There are no TLS MipsMCExprs at the moment. | 
| Craig Topper | 56c590a | 2014-04-29 07:58:02 +0000 | [diff] [blame] | 59 | void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {} | 
| Petar Jovanovic | a5da588 | 2014-02-04 18:41:57 +0000 | [diff] [blame] | 60 |  | 
|  | 61 | static bool classof(const MCExpr *E) { | 
|  | 62 | return E->getKind() == MCExpr::Target; | 
|  | 63 | } | 
|  | 64 | }; | 
|  | 65 | } // end namespace llvm | 
|  | 66 |  | 
|  | 67 | #endif |