LLVM  4.0.0
HexagonMCExpr.cpp
Go to the documentation of this file.
1 //===-- HexagonMCExpr.cpp - Hexagon specific MC expression classes
2 //----------===//
3 //
4 // The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 
11 #include "HexagonMCExpr.h"
12 #include "llvm/MC/MCContext.h"
13 #include "llvm/MC/MCStreamer.h"
14 #include "llvm/MC/MCValue.h"
16 
17 using namespace llvm;
18 
19 #define DEBUG_TYPE "hexagon-mcexpr"
20 
22  return new (Ctx) HexagonMCExpr(Expr);
23 }
24 
26  MCAsmLayout const *Layout,
27  MCFixup const *Fixup) const {
28  return Expr->evaluateAsRelocatable(Res, Layout, Fixup);
29 }
30 
32  Streamer.visitUsedExpr(*Expr);
33 }
34 
36  return Expr->findAssociatedFragment();
37 }
38 
40 
41 MCExpr const *HexagonMCExpr::getExpr() const { return Expr; }
42 
44  assert((!Val || !MustNotExtend) && "Extension contradiction");
45  MustExtend = Val;
46 }
47 
48 bool HexagonMCExpr::mustExtend() const { return MustExtend; }
50  assert((!Val || !MustExtend) && "Extension contradiction");
51  MustNotExtend = Val;
52 }
53 bool HexagonMCExpr::mustNotExtend() const { return MustNotExtend; }
54 
55 bool HexagonMCExpr::s23_2_reloc() const { return S23_2_reloc; }
57  S23_2_reloc = Val;
58 }
59 
61  return E->getKind() == MCExpr::Target;
62 }
63 
64 HexagonMCExpr::HexagonMCExpr(MCExpr const *Expr)
65  : Expr(Expr), MustNotExtend(false), MustExtend(false), S23_2_reloc(false),
66  SignMismatch(false) {}
67 
68 void HexagonMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
69  Expr->print(OS, MAI);
70 }
71 
73  SignMismatch = Val;
74 }
75 
77  return SignMismatch;
78 }
void setMustExtend(bool Val=true)
bool s23_2_reloc() const
This represents an "assembler immediate".
Definition: MCValue.h:40
void setMustNotExtend(bool Val=true)
ExprKind getKind() const
Definition: MCExpr.h:70
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
Definition: MCFixup.h:66
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const override
Encapsulates the layout of an assembly file at a particular point in time.
Definition: MCAsmLayout.h:29
MCFragment * findAssociatedFragment() const override
MCExpr const * getExpr() const
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:34
bool signMismatch() const
static bool classof(MCExpr const *E)
Context object for machine code objects.
Definition: MCContext.h:51
Function Alias Analysis false
void setS23_2_reloc(bool Val=true)
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:57
Streaming machine code generation interface.
Definition: MCStreamer.h:161
static HexagonMCExpr * create(MCExpr const *Expr, MCContext &Ctx)
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override
void setSignMismatch(bool Val=true)
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
Definition: MCExpr.cpp:581
void visitUsedExpr(const MCExpr &Expr)
Definition: MCStreamer.cpp:739
bool mustExtend() const
void visitUsedExpr(MCStreamer &Streamer) const override
bool mustNotExtend() const
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
Definition: MCExpr.cpp:33
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
Target specific expression.
Definition: MCExpr.h:41