LLVM API Documentation

MCValue.cpp

Go to the documentation of this file.
00001 //===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "llvm/MC/MCValue.h"
00011 #include "llvm/Support/raw_ostream.h"
00012 
00013 using namespace llvm;
00014 
00015 void MCValue::print(raw_ostream &OS) const {
00016   if (isAbsolute()) {
00017     OS << getConstant();
00018     return;
00019   }
00020 
00021   getSymA()->print(OS);
00022 
00023   if (getSymB()) {
00024     OS << " - "; 
00025     getSymB()->print(OS);
00026   }
00027 
00028   if (getConstant())
00029     OS << " + " << getConstant();
00030 }
00031 
00032 void MCValue::dump() const {
00033   print(errs());
00034 }