1 //===-- LanaiMCExpr.cpp - Lanai 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 //===----------------------------------------------------------------------===//
10 #include "LanaiMCExpr.h"
11 #include "llvm/MC/MCAssembler.h"
12 #include "llvm/MC/MCContext.h"
13 #include "llvm/MC/MCStreamer.h"
16 #define DEBUG_TYPE "lanaimcexpr"
18 const LanaiMCExpr *LanaiMCExpr::create(VariantKind Kind, const MCExpr *Expr,
20 return new (Ctx) LanaiMCExpr(Kind, Expr);
23 void LanaiMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
24 if (Kind == VK_Lanai_None) {
31 llvm_unreachable("Invalid kind!");
41 const MCExpr *Expr = getSubExpr();
46 void LanaiMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
47 Streamer.visitUsedExpr(*getSubExpr());
50 bool LanaiMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
51 const MCAsmLayout *Layout,
52 const MCFixup *Fixup) const {
53 if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
57 MCValue::get(Res.getSymA(), Res.getSymB(), Res.getConstant(), getKind());