1 //===-- PPCMCExpr.h - PPC 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"
14 #include "llvm/MC/MCValue.h"
15 #include "llvm/MC/MCAsmLayout.h"
19 class PPCMCExpr : public MCTargetExpr {
28 const VariantKind Kind;
31 explicit PPCMCExpr(VariantKind _Kind, const MCExpr *_Expr)
32 : Kind(_Kind), Expr(_Expr) {}
35 /// @name Construction
38 static const PPCMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
41 static const PPCMCExpr *CreateHa16(const MCExpr *Expr, MCContext &Ctx) {
42 return Create(VK_PPC_HA16, Expr, Ctx);
45 static const PPCMCExpr *CreateLo16(const MCExpr *Expr, MCContext &Ctx) {
46 return Create(VK_PPC_LO16, Expr, Ctx);
53 /// getOpcode - Get the kind of this expression.
54 VariantKind getKind() const { return Kind; }
56 /// getSubExpr - Get the child of this expression.
57 const MCExpr *getSubExpr() const { return Expr; }
61 void PrintImpl(raw_ostream &OS) const;
62 bool EvaluateAsRelocatableImpl(MCValue &Res,
63 const MCAsmLayout *Layout) const;
64 void AddValueSymbols(MCAssembler *) const;
65 const MCSection *FindAssociatedSection() const {
66 return getSubExpr()->FindAssociatedSection();
69 // There are no TLS PPCMCExprs at the moment.
70 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {}
72 static bool classof(const MCExpr *E) {
73 return E->getKind() == MCExpr::Target;
76 } // end namespace llvm