LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NVPTXMCExpr.h
Go to the documentation of this file.
1 //===-- NVPTXMCExpr.h - NVPTX 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 // Modeled after ARMMCExpr
11 
12 #ifndef NVPTXMCEXPR_H
13 #define NVPTXMCEXPR_H
14 
15 #include "llvm/ADT/APFloat.h"
16 #include "llvm/MC/MCExpr.h"
17 
18 namespace llvm {
19 
21 public:
22  enum VariantKind {
24  VK_NVPTX_SINGLE_PREC_FLOAT, // FP constant in single-precision
25  VK_NVPTX_DOUBLE_PREC_FLOAT // FP constant in double-precision
26  };
27 
28 private:
29  const VariantKind Kind;
30  const APFloat Flt;
31 
32  explicit NVPTXFloatMCExpr(VariantKind _Kind, APFloat _Flt)
33  : Kind(_Kind), Flt(_Flt) {}
34 
35 public:
36  /// @name Construction
37  /// @{
38 
39  static const NVPTXFloatMCExpr *Create(VariantKind Kind, APFloat Flt,
40  MCContext &Ctx);
41 
43  MCContext &Ctx) {
44  return Create(VK_NVPTX_SINGLE_PREC_FLOAT, Flt, Ctx);
45  }
46 
48  MCContext &Ctx) {
49  return Create(VK_NVPTX_DOUBLE_PREC_FLOAT, Flt, Ctx);
50  }
51 
52  /// @}
53  /// @name Accessors
54  /// @{
55 
56  /// getOpcode - Get the kind of this expression.
57  VariantKind getKind() const { return Kind; }
58 
59  /// getSubExpr - Get the child of this expression.
60  APFloat getAPFloat() const { return Flt; }
61 
62 /// @}
63 
64  void PrintImpl(raw_ostream &OS) const;
66  const MCAsmLayout *Layout) const {
67  return false;
68  }
69  void AddValueSymbols(MCAssembler *) const {};
71  return NULL;
72  }
73 
74  // There are no TLS NVPTXMCExprs at the moment.
76 
77  static bool classof(const MCExpr *E) {
78  return E->getKind() == MCExpr::Target;
79  }
80 };
81 } // end namespace llvm
82 
83 #endif
static const NVPTXFloatMCExpr * CreateConstantFPDouble(APFloat Flt, MCContext &Ctx)
Definition: NVPTXMCExpr.h:47
void AddValueSymbols(MCAssembler *) const
Definition: NVPTXMCExpr.h:69
ExprKind getKind() const
Definition: MCExpr.h:61
VariantKind getKind() const
getOpcode - Get the kind of this expression.
Definition: NVPTXMCExpr.h:57
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Definition: APFloat.h:122
bool EvaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout) const
Definition: NVPTXMCExpr.h:65
void PrintImpl(raw_ostream &OS) const
Definition: NVPTXMCExpr.cpp:22
This file declares a class to represent arbitrary precision floating point values and provide a varie...
APFloat getAPFloat() const
getSubExpr - Get the child of this expression.
Definition: NVPTXMCExpr.h:60
static bool classof(const MCExpr *E)
Definition: NVPTXMCExpr.h:77
static const NVPTXFloatMCExpr * CreateConstantFPSingle(APFloat Flt, MCContext &Ctx)
Definition: NVPTXMCExpr.h:42
const MCSection * FindAssociatedSection() const
Definition: NVPTXMCExpr.h:70
static const NVPTXFloatMCExpr * Create(VariantKind Kind, APFloat Flt, MCContext &Ctx)
Definition: NVPTXMCExpr.cpp:18
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const
Definition: NVPTXMCExpr.h:75
Target specific expression.
Definition: MCExpr.h:38