1 //===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===//
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 "llvm/MC/MCValue.h"
11 #include "llvm/MC/MCExpr.h"
12 #include "llvm/Support/Debug.h"
13 #include "llvm/Support/ErrorHandling.h"
14 #include "llvm/Support/raw_ostream.h"
18 void MCValue::print(raw_ostream &OS) const {
24 // FIXME: prints as a number, which isn't ideal. But the meaning will be
25 // target-specific anyway.
27 OS << ':' << getRefKind() << ':';
37 OS << " + " << getConstant();
40 LLVM_DUMP_METHOD void MCValue::dump() const {
44 MCSymbolRefExpr::VariantKind MCValue::getAccessVariant() const {
45 const MCSymbolRefExpr *B = getSymB();
47 if (B->getKind() != MCSymbolRefExpr::VK_None)
48 llvm_unreachable("unsupported");
51 const MCSymbolRefExpr *A = getSymA();
53 return MCSymbolRefExpr::VK_None;
55 MCSymbolRefExpr::VariantKind Kind = A->getKind();
56 if (Kind == MCSymbolRefExpr::VK_WEAKREF)
57 return MCSymbolRefExpr::VK_None;