LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCValue.cpp
Go to the documentation of this file.
1 //===- lib/MC/MCValue.cpp - MCValue implementation ------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/MC/MCValue.h"
11 #include "llvm/MC/MCExpr.h"
12 #include "llvm/Support/Debug.h"
14 
15 using namespace llvm;
16 
17 void MCValue::print(raw_ostream &OS, const MCAsmInfo *MAI) const {
18  if (isAbsolute()) {
19  OS << getConstant();
20  return;
21  }
22 
23  getSymA()->print(OS);
24 
25  if (getSymB()) {
26  OS << " - ";
27  getSymB()->print(OS);
28  }
29 
30  if (getConstant())
31  OS << " + " << getConstant();
32 }
33 
34 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
35 void MCValue::dump() const {
36  print(dbgs(), 0);
37 }
38 #endif
bool isAbsolute() const
isAbsolute - Is this an absolute (as opposed to relocatable) value.
Definition: MCValue.h:47
void dump() const
dump - Print the value to stderr.
Definition: MCValue.cpp:35
const MCSymbolRefExpr * getSymB() const
Definition: MCValue.h:44
const MCSymbolRefExpr * getSymA() const
Definition: MCValue.h:43
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
Definition: Debug.cpp:101
void print(raw_ostream &OS) const
Definition: MCExpr.cpp:31
int64_t getConstant() const
Definition: MCValue.h:42
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
Definition: MCValue.cpp:17