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 {
33 const VariantKind Kind;
37 explicit PPCMCExpr(VariantKind _Kind, const MCExpr *_Expr,
39 : Kind(_Kind), Expr(_Expr), IsDarwin(_IsDarwin) {}
42 /// @name Construction
45 static const PPCMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
46 bool isDarwin, MCContext &Ctx);
48 static const PPCMCExpr *CreateLo(const MCExpr *Expr,
49 bool isDarwin, MCContext &Ctx) {
50 return Create(VK_PPC_LO, Expr, isDarwin, Ctx);
53 static const PPCMCExpr *CreateHi(const MCExpr *Expr,
54 bool isDarwin, MCContext &Ctx) {
55 return Create(VK_PPC_HI, Expr, isDarwin, Ctx);
58 static const PPCMCExpr *CreateHa(const MCExpr *Expr,
59 bool isDarwin, MCContext &Ctx) {
60 return Create(VK_PPC_HA, Expr, isDarwin, Ctx);
67 /// getOpcode - Get the kind of this expression.
68 VariantKind getKind() const { return Kind; }
70 /// getSubExpr - Get the child of this expression.
71 const MCExpr *getSubExpr() const { return Expr; }
73 /// isDarwinSyntax - True if expression is to be printed using Darwin syntax.
74 bool isDarwinSyntax() const { return IsDarwin; }
79 void PrintImpl(raw_ostream &OS) const;
80 bool EvaluateAsRelocatableImpl(MCValue &Res,
81 const MCAsmLayout *Layout) const;
82 void AddValueSymbols(MCAssembler *) const;
83 const MCSection *FindAssociatedSection() const {
84 return getSubExpr()->FindAssociatedSection();
87 // There are no TLS PPCMCExprs at the moment.
88 void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {}
90 static bool classof(const MCExpr *E) {
91 return E->getKind() == MCExpr::Target;
94 } // end namespace llvm