1 //===-- ARMMCExpr.h - ARM 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 #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
11 #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H
13 #include "llvm/MC/MCExpr.h"
17 class ARMMCExpr : public MCTargetExpr {
21 VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the .s file)
22 VK_ARM_LO16 // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file)
26 const VariantKind Kind;
29 explicit ARMMCExpr(VariantKind Kind, const MCExpr *Expr)
30 : Kind(Kind), Expr(Expr) {}
33 /// @name Construction
36 static const ARMMCExpr *create(VariantKind Kind, const MCExpr *Expr,
39 static const ARMMCExpr *createUpper16(const MCExpr *Expr, MCContext &Ctx) {
40 return create(VK_ARM_HI16, Expr, Ctx);
43 static const ARMMCExpr *createLower16(const MCExpr *Expr, MCContext &Ctx) {
44 return create(VK_ARM_LO16, Expr, Ctx);
51 /// getOpcode - Get the kind of this expression.
52 VariantKind getKind() const { return Kind; }
54 /// getSubExpr - Get the child of this expression.
55 const MCExpr *getSubExpr() const { return Expr; }
59 void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
60 bool evaluateAsRelocatableImpl(MCValue &Res,
61 const MCAsmLayout *Layout,
62 const MCFixup *Fixup) const override {
65 void visitUsedExpr(MCStreamer &Streamer) const override;
66 MCFragment *findAssociatedFragment() const override {
67 return getSubExpr()->findAssociatedFragment();
70 // There are no TLS ARMMCExprs at the moment.
71 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
73 static bool classof(const MCExpr *E) {
74 return E->getKind() == MCExpr::Target;
77 } // end namespace llvm