Add include file to get the type for in64_t.
[oota-llvm.git] / include / llvm / MC / MCImm.h
1 //===-- llvm/MC/MCImm.h - MCImm 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 MCInst and MCOperand classes, which
11 // is the basic representation used to represent low-level machine code
12 // instructions.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_MC_MCIMM_H
17 #define LLVM_MC_MCIMM_H
18
19 #include "llvm/Support/DataTypes.h"
20
21 namespace llvm {
22 class MCSymbol;
23
24 /// MCImm - This represents an "assembler immediate".  In its most general form,
25 /// this can hold "SymbolA - SymbolB + imm64".  Not all targets supports
26 /// relocations of this general form, but we need to represent this anyway.
27 class MCImm {
28   MCSymbol *SymA, *SymB;
29   int64_t Cst;
30 public:
31
32   int64_t getCst() const { return Cst; }
33   MCSymbol *getSymA() const { return SymA; }
34   MCSymbol *getSymB() const { return SymB; }
35   
36   
37   static MCImm get(MCSymbol *SymA, MCSymbol *SymB = 0, int64_t Val = 0) {
38     MCImm R;
39     R.Cst = Val;
40     R.SymA = SymA;
41     R.SymB = SymB;
42     return R;
43   }
44   
45   static MCImm get(int64_t Val) {
46     MCImm R;
47     R.Cst = Val;
48     R.SymA = 0;
49     R.SymB = 0;
50     return R;
51   }
52   
53 };
54
55 } // end namespace llvm
56
57 #endif