LLVM API Documentation
00001 //===-- ARMMCExpr.h - ARM specific MC expression classes --------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 00010 #ifndef LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H 00011 #define LLVM_LIB_TARGET_ARM_MCTARGETDESC_ARMMCEXPR_H 00012 00013 #include "llvm/MC/MCExpr.h" 00014 00015 namespace llvm { 00016 00017 class ARMMCExpr : public MCTargetExpr { 00018 public: 00019 enum VariantKind { 00020 VK_ARM_None, 00021 VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the .s file) 00022 VK_ARM_LO16 // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file) 00023 }; 00024 00025 private: 00026 const VariantKind Kind; 00027 const MCExpr *Expr; 00028 00029 explicit ARMMCExpr(VariantKind _Kind, const MCExpr *_Expr) 00030 : Kind(_Kind), Expr(_Expr) {} 00031 00032 public: 00033 /// @name Construction 00034 /// @{ 00035 00036 static const ARMMCExpr *Create(VariantKind Kind, const MCExpr *Expr, 00037 MCContext &Ctx); 00038 00039 static const ARMMCExpr *CreateUpper16(const MCExpr *Expr, MCContext &Ctx) { 00040 return Create(VK_ARM_HI16, Expr, Ctx); 00041 } 00042 00043 static const ARMMCExpr *CreateLower16(const MCExpr *Expr, MCContext &Ctx) { 00044 return Create(VK_ARM_LO16, Expr, Ctx); 00045 } 00046 00047 /// @} 00048 /// @name Accessors 00049 /// @{ 00050 00051 /// getOpcode - Get the kind of this expression. 00052 VariantKind getKind() const { return Kind; } 00053 00054 /// getSubExpr - Get the child of this expression. 00055 const MCExpr *getSubExpr() const { return Expr; } 00056 00057 /// @} 00058 00059 void PrintImpl(raw_ostream &OS) const override; 00060 bool EvaluateAsRelocatableImpl(MCValue &Res, 00061 const MCAsmLayout *Layout, 00062 const MCFixup *Fixup) const override { 00063 return false; 00064 } 00065 void visitUsedExpr(MCStreamer &Streamer) const override; 00066 const MCSection *FindAssociatedSection() const override { 00067 return getSubExpr()->FindAssociatedSection(); 00068 } 00069 00070 // There are no TLS ARMMCExprs at the moment. 00071 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {} 00072 00073 static bool classof(const MCExpr *E) { 00074 return E->getKind() == MCExpr::Target; 00075 } 00076 }; 00077 } // end namespace llvm 00078 00079 #endif