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/Config/llvm-config.h"
12 #include "llvm/MC/MCExpr.h"
13 #include "llvm/Support/Debug.h"
14 #include "llvm/Support/ErrorHandling.h"
15 #include "llvm/Support/raw_ostream.h"
19 void MCValue::print(raw_ostream &OS) const {
25 // FIXME: prints as a number, which isn't ideal. But the meaning will be
26 // target-specific anyway.
28 OS << ':' << getRefKind() << ':';
38 OS << " + " << getConstant();
41 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
42 LLVM_DUMP_METHOD void MCValue::dump() const {
47 MCSymbolRefExpr::VariantKind MCValue::getAccessVariant() const {
48 const MCSymbolRefExpr *B = getSymB();
50 if (B->getKind() != MCSymbolRefExpr::VK_None)
51 llvm_unreachable("unsupported");
54 const MCSymbolRefExpr *A = getSymA();
56 return MCSymbolRefExpr::VK_None;
58 MCSymbolRefExpr::VariantKind Kind = A->getKind();
59 if (Kind == MCSymbolRefExpr::VK_WEAKREF)
60 return MCSymbolRefExpr::VK_None;