LLVM  7.0.0svn
PPCMCExpr.h
Go to the documentation of this file.
1 //===-- PPCMCExpr.h - PPC specific MC expression classes --------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCMCEXPR_H
11 #define LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCMCEXPR_H
12 
13 #include "llvm/MC/MCAsmLayout.h"
14 #include "llvm/MC/MCExpr.h"
15 #include "llvm/MC/MCValue.h"
16 
17 namespace llvm {
18 
19 class PPCMCExpr : public MCTargetExpr {
20 public:
21  enum VariantKind {
32  };
33 
34 private:
35  const VariantKind Kind;
36  const MCExpr *Expr;
37  bool IsDarwin;
38 
39  int64_t evaluateAsInt64(int64_t Value) const;
40 
41  explicit PPCMCExpr(VariantKind Kind, const MCExpr *Expr, bool IsDarwin)
42  : Kind(Kind), Expr(Expr), IsDarwin(IsDarwin) {}
43 
44 public:
45  /// @name Construction
46  /// @{
47 
48  static const PPCMCExpr *create(VariantKind Kind, const MCExpr *Expr,
49  bool isDarwin, MCContext &Ctx);
50 
51  static const PPCMCExpr *createLo(const MCExpr *Expr,
52  bool isDarwin, MCContext &Ctx) {
53  return create(VK_PPC_LO, Expr, isDarwin, Ctx);
54  }
55 
56  static const PPCMCExpr *createHi(const MCExpr *Expr,
57  bool isDarwin, MCContext &Ctx) {
58  return create(VK_PPC_HI, Expr, isDarwin, Ctx);
59  }
60 
61  static const PPCMCExpr *createHa(const MCExpr *Expr,
62  bool isDarwin, MCContext &Ctx) {
63  return create(VK_PPC_HA, Expr, isDarwin, Ctx);
64  }
65 
66  /// @}
67  /// @name Accessors
68  /// @{
69 
70  /// getOpcode - Get the kind of this expression.
71  VariantKind getKind() const { return Kind; }
72 
73  /// getSubExpr - Get the child of this expression.
74  const MCExpr *getSubExpr() const { return Expr; }
75 
76  /// isDarwinSyntax - True if expression is to be printed using Darwin syntax.
77  bool isDarwinSyntax() const { return IsDarwin; }
78 
79 
80  /// @}
81 
82  void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
84  const MCAsmLayout *Layout,
85  const MCFixup *Fixup) const override;
86  void visitUsedExpr(MCStreamer &Streamer) const override;
87  MCFragment *findAssociatedFragment() const override {
89  }
90 
91  // There are no TLS PPCMCExprs at the moment.
92  void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override {}
93 
94  bool evaluateAsConstant(int64_t &Res) const;
95 
96  static bool classof(const MCExpr *E) {
97  return E->getKind() == MCExpr::Target;
98  }
99 };
100 } // end namespace llvm
101 
102 #endif
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: PPCMCExpr.h:71
This represents an "assembler immediate".
Definition: MCValue.h:40
static bool classof(const MCExpr *E)
Definition: PPCMCExpr.h:96
static const PPCMCExpr * create(VariantKind Kind, const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
Definition: PPCMCExpr.cpp:22
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
Definition: PPCMCExpr.h:92
static const PPCMCExpr * createHi(const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
Definition: PPCMCExpr.h:56
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:74
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:36
This is an extension point for target-specific MCExpr subclasses to implement.
Definition: MCExpr.h:579
Context object for machine code objects.
Definition: MCContext.h:63
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Streaming machine code generation interface.
Definition: MCStreamer.h:183
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static const PPCMCExpr * createLo(const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
Definition: PPCMCExpr.h:51
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
Definition: PPCMCExpr.cpp:27
const MCExpr * getSubExpr() const
getSubExpr - Get the child of this expression.
Definition: PPCMCExpr.h:74
PowerPC TLS Dynamic Call Fixup
ExprKind getKind() const
Definition: MCExpr.h:73
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Definition: PPCMCExpr.cpp:99
MCFragment * findAssociatedFragment() const override
Definition: PPCMCExpr.h:87
MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
Definition: MCExpr.cpp:839
bool evaluateAsConstant(int64_t &Res) const
Definition: PPCMCExpr.cpp:58
bool isDarwinSyntax() const
isDarwinSyntax - True if expression is to be printed using Darwin syntax.
Definition: PPCMCExpr.h:77
LLVM Value Representation.
Definition: Value.h:73
static const PPCMCExpr * createHa(const MCExpr *Expr, bool isDarwin, MCContext &Ctx)
Definition: PPCMCExpr.h:61
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46
Target specific expression.
Definition: MCExpr.h:43
void visitUsedExpr(MCStreamer &Streamer) const override
Definition: PPCMCExpr.cpp:160