aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCValue.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-14 03:11:09 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-14 03:11:09 +0000
commitafe6603590f38d854c54f2f48ff84080b2d6c06f (patch)
treeaf5259f30f61577469979e2bb8630ac46db0c9ab /llvm/lib/MC/MCValue.cpp
parent5d67a975131c286fab514fa8f1be73c748a11080 (diff)
downloadllvm-afe6603590f38d854c54f2f48ff84080b2d6c06f.zip
llvm-afe6603590f38d854c54f2f48ff84080b2d6c06f.tar.gz
llvm-afe6603590f38d854c54f2f48ff84080b2d6c06f.tar.bz2
Add MCValue::{print, dump}
llvm-svn: 78982
Diffstat (limited to 'llvm/lib/MC/MCValue.cpp')
-rw-r--r--llvm/lib/MC/MCValue.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCValue.cpp b/llvm/lib/MC/MCValue.cpp
new file mode 100644
index 0000000..9c73170
--- /dev/null
+++ b/llvm/lib/MC/MCValue.cpp
@@ -0,0 +1,30 @@
+//===- 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"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+void MCValue::print(raw_ostream &OS) const {
+ if (isAbsolute()) {
+ OS << getConstant();
+ return;
+ }
+
+ OS << getSymA();
+ if (getSymB())
+ OS << " - " << getSymB();
+ if (getConstant())
+ OS << " + " << getConstant();
+}
+
+void MCValue::dump() const {
+ print(errs());
+}