1 //===-- Nios2MCExpr.cpp - Nios2 specific MC expression classes ------------===//
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 //===----------------------------------------------------------------------===//
12 #include "Nios2MCExpr.h"
13 #include "llvm/MC/MCAsmInfo.h"
14 #include "llvm/MC/MCAssembler.h"
15 #include "llvm/MC/MCContext.h"
16 #include "llvm/MC/MCObjectStreamer.h"
17 #include "llvm/MC/MCSymbolELF.h"
21 #define DEBUG_TYPE "nios2mcexpr"
23 const Nios2MCExpr
*Nios2MCExpr::create(Nios2MCExpr::Nios2ExprKind Kind
,
24 const MCExpr
*Expr
, MCContext
&Ctx
) {
25 return new (Ctx
) Nios2MCExpr(Kind
, Expr
);
28 const Nios2MCExpr
*Nios2MCExpr::create(const MCSymbol
*Symbol
,
29 Nios2MCExpr::Nios2ExprKind Kind
,
31 const MCSymbolRefExpr
*MCSym
=
32 MCSymbolRefExpr::create(Symbol
, MCSymbolRefExpr::VK_None
, Ctx
);
33 return new (Ctx
) Nios2MCExpr(Kind
, MCSym
);
36 void Nios2MCExpr::printImpl(raw_ostream
&OS
, const MCAsmInfo
*MAI
) const {
41 llvm_unreachable("CEK_None and CEK_Special are invalid");
52 Expr
->print(OS
, MAI
, true);
56 bool Nios2MCExpr::evaluateAsRelocatableImpl(MCValue
&Res
,
57 const MCAsmLayout
*Layout
,
58 const MCFixup
*Fixup
) const {
59 return getSubExpr()->evaluateAsRelocatable(Res
, Layout
, Fixup
);
62 void Nios2MCExpr::visitUsedExpr(MCStreamer
&Streamer
) const {
63 Streamer
.visitUsedExpr(*getSubExpr());
66 void Nios2MCExpr::fixELFSymbolsInTLSFixups(MCAssembler
&Asm
) const {
70 llvm_unreachable("CEK_None and CEK_Special are invalid");