2009-08-14 05:11:09 +02: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-01-05 02:28:17 +01:00
|
|
|
#include "llvm/Support/Debug.h"
|
2009-08-14 05:11:09 +02:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-09-03 07:46:51 +02:00
|
|
|
void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
|
2009-08-14 05:11:09 +02:00
|
|
|
if (isAbsolute()) {
|
|
|
|
OS << getConstant();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-09-03 07:46:51 +02:00
|
|
|
getSymA()->print(OS, MAI);
|
2009-08-14 05:41:23 +02:00
|
|
|
|
|
|
|
if (getSymB()) {
|
|
|
|
OS << " - ";
|
2009-09-03 07:46:51 +02:00
|
|
|
getSymB()->print(OS, MAI);
|
2009-08-14 05:41:23 +02:00
|
|
|
}
|
|
|
|
|
2009-08-14 05:11:09 +02:00
|
|
|
if (getConstant())
|
|
|
|
OS << " + " << getConstant();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MCValue::dump() const {
|
2010-01-05 02:28:17 +01:00
|
|
|
print(dbgs(), 0);
|
2009-08-14 05:11:09 +02:00
|
|
|
}
|