Use BranchProbability instead of floating points in IfConverter.
[llvm/stm8.git] / lib / Target / ARM / ARMMCExpr.h
blob0a2e883deb1d40b259c8f6094a76513937a437e2
1 //===-- ARMMCExpr.h - ARM specific MC expression classes ------------------===//
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 //===----------------------------------------------------------------------===//
10 #ifndef ARMMCEXPR_H
11 #define ARMMCEXPR_H
13 #include "llvm/MC/MCExpr.h"
15 namespace llvm {
17 class ARMMCExpr : public MCTargetExpr {
18 public:
19 enum VariantKind {
20 VK_ARM_None,
21 VK_ARM_HI16, // The R_ARM_MOVT_ABS relocation (:upper16: in the .s file)
22 VK_ARM_LO16 // The R_ARM_MOVW_ABS_NC relocation (:lower16: in the .s file)
25 private:
26 const VariantKind Kind;
27 const MCExpr *Expr;
29 explicit ARMMCExpr(VariantKind _Kind, const MCExpr *_Expr)
30 : Kind(_Kind), Expr(_Expr) {}
32 public:
33 /// @name Construction
34 /// @{
36 static const ARMMCExpr *Create(VariantKind Kind, const MCExpr *Expr,
37 MCContext &Ctx);
39 static const ARMMCExpr *CreateUpper16(const MCExpr *Expr, MCContext &Ctx) {
40 return Create(VK_ARM_HI16, Expr, Ctx);
43 static const ARMMCExpr *CreateLower16(const MCExpr *Expr, MCContext &Ctx) {
44 return Create(VK_ARM_LO16, Expr, Ctx);
47 /// @}
48 /// @name Accessors
49 /// @{
51 /// getOpcode - Get the kind of this expression.
52 VariantKind getKind() const { return Kind; }
54 /// getSubExpr - Get the child of this expression.
55 const MCExpr *getSubExpr() const { return Expr; }
57 /// @}
59 void PrintImpl(raw_ostream &OS) const;
60 bool EvaluateAsRelocatableImpl(MCValue &Res,
61 const MCAsmLayout *Layout) const;
62 void AddValueSymbols(MCAssembler *) const;
63 const MCSection *FindAssociatedSection() const {
64 return getSubExpr()->FindAssociatedSection();
67 static bool classof(const MCExpr *E) {
68 return E->getKind() == MCExpr::Target;
71 static bool classof(const ARMMCExpr *) { return true; }
74 } // end namespace llvm
76 #endif