/src/keystone/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | //===-- ARMMCExpr.cpp - ARM specific MC expression classes ----------------===// |
2 | | // |
3 | | // The LLVM Compiler Infrastructure |
4 | | // |
5 | | // This file is distributed under the University of Illinois Open Source |
6 | | // License. See LICENSE.TXT for details. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | |
10 | | #include "ARMMCExpr.h" |
11 | | #include "llvm/MC/MCAssembler.h" |
12 | | #include "llvm/MC/MCContext.h" |
13 | | #include "llvm/MC/MCStreamer.h" |
14 | | using namespace llvm_ks; |
15 | | |
16 | | #define DEBUG_TYPE "armmcexpr" |
17 | | |
18 | | const ARMMCExpr* |
19 | | ARMMCExpr::create(VariantKind Kind, const MCExpr *Expr, |
20 | 32 | MCContext &Ctx) { |
21 | 32 | return new (Ctx) ARMMCExpr(Kind, Expr); |
22 | 32 | } |
23 | | |
24 | 0 | void ARMMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const { |
25 | 0 | switch (Kind) { |
26 | 0 | default: llvm_unreachable("Invalid kind!"); |
27 | 0 | case VK_ARM_HI16: OS << ":upper16:"; break; |
28 | 0 | case VK_ARM_LO16: OS << ":lower16:"; break; |
29 | 0 | } |
30 | | |
31 | 0 | const MCExpr *Expr = getSubExpr(); |
32 | 0 | if (Expr->getKind() != MCExpr::SymbolRef) |
33 | 0 | OS << '('; |
34 | 0 | Expr->print(OS, MAI); |
35 | 0 | if (Expr->getKind() != MCExpr::SymbolRef) |
36 | 0 | OS << ')'; |
37 | 0 | } |
38 | | |
39 | 0 | void ARMMCExpr::visitUsedExpr(MCStreamer &Streamer) const { |
40 | 0 | Streamer.visitUsedExpr(*getSubExpr()); |
41 | 0 | } |