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 //===----------------------------------------------------------------------===//
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;
60 bool EvaluateAsRelocatableImpl(MCValue &Res,
61 const MCAsmLayout *Layout) const;
62 void AddValueSymbols(MCAssembler *) const;
63 const MCSection *FindAssociatedSection() const {
64 return getSubExpr()->FindAssociatedSection();
67 static bool classof(const MCExpr *E) {
68 return E->getKind() == MCExpr::Target;
71 } // end namespace llvm