2011-01-13 15:58:56 +08:00
|
|
|
//===-- ARMMCExpr.cpp - ARM 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 "ARMMCExpr.h"
|
|
|
|
#include "llvm/MC/MCAssembler.h"
|
2012-12-04 00:50:05 +08:00
|
|
|
#include "llvm/MC/MCContext.h"
|
2015-03-04 09:24:11 +08:00
|
|
|
#include "llvm/MC/MCStreamer.h"
|
2011-01-13 15:58:56 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2014-04-22 10:41:26 +08:00
|
|
|
#define DEBUG_TYPE "armmcexpr"
|
|
|
|
|
2011-01-13 15:58:56 +08:00
|
|
|
const ARMMCExpr*
|
2015-05-30 09:25:56 +08:00
|
|
|
ARMMCExpr::create(VariantKind Kind, const MCExpr *Expr,
|
2011-01-13 15:58:56 +08:00
|
|
|
MCContext &Ctx) {
|
|
|
|
return new (Ctx) ARMMCExpr(Kind, Expr);
|
|
|
|
}
|
|
|
|
|
2015-06-09 08:31:39 +08:00
|
|
|
void ARMMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
2011-01-13 15:58:56 +08:00
|
|
|
switch (Kind) {
|
2012-02-07 10:50:20 +08:00
|
|
|
default: llvm_unreachable("Invalid kind!");
|
2011-01-13 15:58:56 +08:00
|
|
|
case VK_ARM_HI16: OS << ":upper16:"; break;
|
|
|
|
case VK_ARM_LO16: OS << ":lower16:"; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
const MCExpr *Expr = getSubExpr();
|
|
|
|
if (Expr->getKind() != MCExpr::SymbolRef)
|
|
|
|
OS << '(';
|
2015-06-09 08:31:39 +08:00
|
|
|
Expr->print(OS, MAI);
|
2011-01-13 15:58:56 +08:00
|
|
|
if (Expr->getKind() != MCExpr::SymbolRef)
|
|
|
|
OS << ')';
|
|
|
|
}
|
|
|
|
|
2014-06-25 23:45:33 +08:00
|
|
|
void ARMMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
|
2014-06-25 23:29:54 +08:00
|
|
|
Streamer.visitUsedExpr(*getSubExpr());
|
2011-01-13 15:58:56 +08:00
|
|
|
}
|