Shih-wei Liao | e264f62 | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | //===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===// |
| 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 "llvm/MC/MCValue.h" |
| 11 | #include "llvm/Support/Debug.h" |
| 12 | #include "llvm/Support/raw_ostream.h" |
| 13 | |
| 14 | using namespace llvm; |
| 15 | |
| 16 | void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const { |
| 17 | if (isAbsolute()) { |
| 18 | OS << getConstant(); |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | OS << *getSymA(); |
| 23 | |
| 24 | if (getSymB()) |
| 25 | OS << " - " << *getSymB(); |
| 26 | |
| 27 | if (getConstant()) |
| 28 | OS << " + " << getConstant(); |
| 29 | } |
| 30 | |
| 31 | void MCValue::dump() const { |
| 32 | print(dbgs(), 0); |
| 33 | } |