Added LLVM copyright header (for lack of a better term).
[oota-llvm.git] / include / llvm / CodeGen / MachineConstantPool.h
1 //===-- CodeGen/MachineConstantPool.h - Abstract Constant Pool --*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 // 
10 // The MachineConstantPool class keeps track of constants referenced by a
11 // function which must be spilled to memory.  This is used for constants which
12 // are unable to be used directly as operands to instructions, which typically
13 // include floating point and large integer constants.
14 //
15 // Instructions reference the address of these constant pool constants through
16 // the use of MO_ConstantPoolIndex values.  When emitting assembly or machine
17 // code, these virtual address references are converted to refer to the
18 // address of the function constant pool values.
19 //
20 //===----------------------------------------------------------------------===//
21
22 #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
23 #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
24
25 #include <vector>
26 class Constant;
27
28 class MachineConstantPool {
29   std::vector<Constant*> Constants;
30 public:
31
32   /// getConstantPoolIndex - Create a new entry in the constant pool or return
33   /// an existing one.  This should eventually allow sharing of duplicate
34   /// objects in the constant pool, but this is adequate for now.
35   ///
36   unsigned getConstantPoolIndex(Constant *C) {
37     Constants.push_back(C);
38     return Constants.size()-1;
39   }
40
41   const std::vector<Constant*> &getConstants() const { return Constants; }
42
43   /// print - Used by the MachineFunction printer to print information about
44   /// stack objects.  Implemented in MachineFunction.cpp
45   ///
46   void print(std::ostream &OS) const;
47
48   /// dump - Call print(std::cerr) to be called from the debugger.
49   void dump() const;
50 };
51
52 #endif