rename MCImm ->MCValue.
[oota-llvm.git] / include / llvm / MC / MCValue.h
1 //===-- llvm/MC/MCValue.h - MCValue class -----------------------*- C++ -*-===//
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 // This file contains the declaration of the MCValue class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_MC_MCVALUE_H
15 #define LLVM_MC_MCVALUE_H
16
17 #include "llvm/Support/DataTypes.h"
18
19 namespace llvm {
20 class MCSymbol;
21
22 /// MCValue - This represents an "assembler immediate".  In its most general
23 /// form, this can hold "SymbolA - SymbolB + imm64".  Not all targets supports
24 /// relocations of this general form, but we need to represent this anyway.
25 ///
26 /// Note that this class must remain a simple POD value class, because we need
27 /// it to live in unions etc.
28 class MCValue {
29   MCSymbol *SymA, *SymB;
30   int64_t Cst;
31 public:
32
33   int64_t getCst() const { return Cst; }
34   MCSymbol *getSymA() const { return SymA; }
35   MCSymbol *getSymB() const { return SymB; }
36   
37   
38   static MCValue get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) {
39     MCValue R;
40     R.Cst = Val;
41     R.SymA = SymA;
42     R.SymB = SymB;
43     return R;
44   }
45   
46   static MCValue get(int64_t Val) {
47     MCValue R;
48     R.Cst = Val;
49     R.SymA = 0;
50     R.SymB = 0;
51     return R;
52   }
53   
54 };
55
56 } // end namespace llvm
57
58 #endif