2009-08-14 11:11:09 +08:00
|
|
|
//===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/MC/MCValue.h"
|
2010-03-18 08:59:10 +08:00
|
|
|
#include "llvm/MC/MCExpr.h"
|
2010-01-05 09:28:17 +08:00
|
|
|
#include "llvm/Support/Debug.h"
|
2009-08-14 11:11:09 +08:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-09-03 13:46:51 +08:00
|
|
|
void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
2009-08-14 11:11:09 +08:00
|
|
|
if (isAbsolute()) {
|
|
|
|
OS << getConstant();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-03-18 08:59:10 +08:00
|
|
|
getSymA()->print(OS);
|
2009-08-14 11:41:23 +08:00
|
|
|
|
2010-03-18 08:59:10 +08:00
|
|
|
if (getSymB()) {
|
|
|
|
OS << " - ";
|
|
|
|
getSymB()->print(OS);
|
|
|
|
}
|
2009-08-14 11:41:23 +08:00
|
|
|
|
2009-08-14 11:11:09 +08:00
|
|
|
if (getConstant())
|
|
|
|
OS << " + " << getConstant();
|
|
|
|
}
|
|
|
|
|
2012-09-12 13:06:18 +08:00
|
|
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
2009-08-14 11:11:09 +08:00
|
|
|
void MCValue::dump() const {
|
2010-01-05 09:28:17 +08:00
|
|
|
print(dbgs(), 0);
|
2009-08-14 11:11:09 +08:00
|
|
|
}
|
2012-09-07 03:55:56 +08:00
|
|
|
#endif
|