freebsd-dev/contrib/llvm/lib/MC/MCValue.cpp

39 lines
882 B
C++
Raw Normal View History

2009-10-14 17:57:32 +00: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-21 10:49:05 +00:00
#include "llvm/MC/MCExpr.h"
2010-01-15 15:37:28 +00:00
#include "llvm/Support/Debug.h"
2009-10-14 17:57:32 +00:00
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
if (isAbsolute()) {
OS << getConstant();
return;
}
2010-03-21 10:49:05 +00:00
getSymA()->print(OS);
2009-10-14 17:57:32 +00:00
2010-03-21 10:49:05 +00:00
if (getSymB()) {
OS << " - ";
getSymB()->print(OS);
}
2009-10-14 17:57:32 +00:00
if (getConstant())
OS << " + " << getConstant();
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
2009-10-14 17:57:32 +00:00
void MCValue::dump() const {
2010-01-15 15:37:28 +00:00
print(dbgs(), 0);
2009-10-14 17:57:32 +00:00
}
#endif