2015-11-09 12:07:48 +08:00
|
|
|
//===-- HexagonMCExpr.cpp - Hexagon specific MC expression classes
|
|
|
|
//----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "HexagonMCExpr.h"
|
|
|
|
#include "llvm/MC/MCContext.h"
|
2016-02-16 02:42:07 +08:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
2015-11-09 12:07:48 +08:00
|
|
|
#include "llvm/MC/MCValue.h"
|
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
#define DEBUG_TYPE "hexagon-mcexpr"
|
|
|
|
|
2016-02-16 02:47:55 +08:00
|
|
|
HexagonMCExpr *HexagonMCExpr::create(MCExpr const *Expr, MCContext &Ctx) {
|
2016-02-16 02:42:07 +08:00
|
|
|
return new (Ctx) HexagonMCExpr(Expr);
|
2015-11-09 12:07:48 +08:00
|
|
|
}
|
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
bool HexagonMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
|
|
|
|
MCAsmLayout const *Layout,
|
|
|
|
MCFixup const *Fixup) const {
|
2015-11-09 12:07:48 +08:00
|
|
|
return Expr->evaluateAsRelocatable(Res, Layout, Fixup);
|
|
|
|
}
|
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
void HexagonMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
|
|
|
|
Streamer.visitUsedExpr(*Expr);
|
|
|
|
}
|
2015-11-09 12:07:48 +08:00
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
MCFragment *llvm::HexagonMCExpr::findAssociatedFragment() const {
|
2015-11-09 12:07:48 +08:00
|
|
|
return Expr->findAssociatedFragment();
|
|
|
|
}
|
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
void HexagonMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {}
|
|
|
|
|
|
|
|
MCExpr const *HexagonMCExpr::getExpr() const { return Expr; }
|
2015-11-09 12:07:48 +08:00
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
void HexagonMCExpr::setMustExtend(bool Val) {
|
|
|
|
assert((!Val || !MustNotExtend) && "Extension contradiction");
|
|
|
|
MustExtend = Val;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HexagonMCExpr::mustExtend() const { return MustExtend; }
|
|
|
|
void HexagonMCExpr::setMustNotExtend(bool Val) {
|
|
|
|
assert((!Val || !MustExtend) && "Extension contradiction");
|
|
|
|
MustNotExtend = Val;
|
|
|
|
}
|
|
|
|
bool HexagonMCExpr::mustNotExtend() const { return MustNotExtend; }
|
2015-11-09 12:07:48 +08:00
|
|
|
|
2016-02-17 04:38:17 +08:00
|
|
|
bool HexagonMCExpr::s23_2_reloc() const { return S23_2_reloc; }
|
|
|
|
void HexagonMCExpr::setS23_2_reloc(bool Val) {
|
|
|
|
S23_2_reloc = Val;
|
|
|
|
}
|
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
bool HexagonMCExpr::classof(MCExpr const *E) {
|
2015-11-09 12:07:48 +08:00
|
|
|
return E->getKind() == MCExpr::Target;
|
|
|
|
}
|
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
HexagonMCExpr::HexagonMCExpr(MCExpr const *Expr)
|
2016-02-17 04:38:17 +08:00
|
|
|
: Expr(Expr), MustNotExtend(false), MustExtend(false), S23_2_reloc(false) {}
|
2015-11-09 12:07:48 +08:00
|
|
|
|
2016-02-16 02:42:07 +08:00
|
|
|
void HexagonMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
2015-11-09 12:07:48 +08:00
|
|
|
Expr->print(OS, MAI);
|
|
|
|
}
|