12924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar//===--- CGRecordLayout.h - LLVM Record Layout Information ------*- C++ -*-===//
22924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar//
32924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar//                     The LLVM Compiler Infrastructure
42924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar//
52924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar// This file is distributed under the University of Illinois Open Source
62924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar// License. See LICENSE.TXT for details.
72924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar//
82924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar//===----------------------------------------------------------------------===//
92924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
102924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar#ifndef CLANG_CODEGEN_CGRECORDLAYOUT_H
112924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar#define CLANG_CODEGEN_CGRECORDLAYOUT_H
122924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
1328ebde58dd94b5ed2a6d149251202ab2c602a4a6Ken Dyck#include "clang/AST/CharUnits.h"
14198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar#include "clang/AST/Decl.h"
15d47d3b0cfeb7e8564ff77f48130fe63282b6d127Chris Lattner#include "clang/Basic/LLVM.h"
16d47d3b0cfeb7e8564ff77f48130fe63282b6d127Chris Lattner#include "llvm/ADT/DenseMap.h"
173b844ba7d5be205a9b4f5f0b0d1b7978977f4b8cChandler Carruth#include "llvm/IR/DerivedTypes.h"
18d47d3b0cfeb7e8564ff77f48130fe63282b6d127Chris Lattner
19270e203b50ed8791e61afd357596bcf050cf2bfdDaniel Dunbarnamespace llvm {
20ba2c2eec87d614b06e194b289627bbfe0642e4ceAnders Carlsson  class StructType;
21270e203b50ed8791e61afd357596bcf050cf2bfdDaniel Dunbar}
22270e203b50ed8791e61afd357596bcf050cf2bfdDaniel Dunbar
232924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbarnamespace clang {
242924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbarnamespace CodeGen {
252924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
2672d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// \brief Structure with information about how a bitfield should be accessed.
27ab970f90ce31a53fe7e6375a37536bf0832fd922Daniel Dunbar///
2872d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// Often we layout a sequence of bitfields as a contiguous sequence of bits.
2972d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// When the AST record layout does this, we represent it in the LLVM IR's type
3072d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// as either a sequence of i8 members or a byte array to reserve the number of
3172d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// bytes touched without forcing any particular alignment beyond the basic
3272d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// character alignment.
3372d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
3472d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// Then accessing a particular bitfield involves converting this byte array
3572d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// into a single integer of that size (i24 or i40 -- may not be power-of-two
3672d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// size), loading it, and shifting and masking to extract the particular
3772d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// subsequence of bits which make up that particular bitfield. This structure
3872d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// encodes the information used to construct the extraction code sequences.
3972d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// The CGRecordLayout also has a field index which encodes which byte-sequence
4072d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// this bitfield falls within. Let's assume the following C struct:
4172d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
4272d2dab6058467036df73a5f668036a519043e5bChandler Carruth///   struct S {
4372d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     char a, b, c;
4472d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     unsigned bits : 3;
4572d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     unsigned more_bits : 4;
4672d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     unsigned still_more_bits : 7;
4772d2dab6058467036df73a5f668036a519043e5bChandler Carruth///   };
4872d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
4972d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// This will end up as the following LLVM type. The first array is the
5072d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// bitfield, and the second is the padding out to a 4-byte alignmnet.
5172d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
5272d2dab6058467036df73a5f668036a519043e5bChandler Carruth///   %t = type { i8, i8, i8, i8, i8, [3 x i8] }
5372d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
5472d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// When generating code to access more_bits, we'll generate something
5572d2dab6058467036df73a5f668036a519043e5bChandler Carruth/// essentially like this:
5672d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
5772d2dab6058467036df73a5f668036a519043e5bChandler Carruth///   define i32 @foo(%t* %base) {
5872d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     %0 = gep %t* %base, i32 0, i32 3
5972d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     %2 = load i8* %1
6072d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     %3 = lshr i8 %2, 3
6172d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     %4 = and i8 %3, 15
6272d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     %5 = zext i8 %4 to i32
6372d2dab6058467036df73a5f668036a519043e5bChandler Carruth///     ret i32 %i
6472d2dab6058467036df73a5f668036a519043e5bChandler Carruth///   }
6572d2dab6058467036df73a5f668036a519043e5bChandler Carruth///
6672d2dab6058467036df73a5f668036a519043e5bChandler Carruthstruct CGBitFieldInfo {
6772d2dab6058467036df73a5f668036a519043e5bChandler Carruth  /// The offset within a contiguous run of bitfields that are represented as
6872d2dab6058467036df73a5f668036a519043e5bChandler Carruth  /// a single "field" within the LLVM struct type. This offset is in bits.
6972d2dab6058467036df73a5f668036a519043e5bChandler Carruth  unsigned Offset : 16;
70ab970f90ce31a53fe7e6375a37536bf0832fd922Daniel Dunbar
717fb619500404129322af972aab66c369949a2a74Daniel Dunbar  /// The total size of the bit-field, in bits.
7272d2dab6058467036df73a5f668036a519043e5bChandler Carruth  unsigned Size : 15;
737f2896406c8f14bf123578610043a919ba1a1c8aDaniel Dunbar
747fb619500404129322af972aab66c369949a2a74Daniel Dunbar  /// Whether the bit-field is signed.
7572d2dab6058467036df73a5f668036a519043e5bChandler Carruth  unsigned IsSigned : 1;
7693c62967d4ac7620a8ed2c5f875daab9adb416f0Daniel Dunbar
7772d2dab6058467036df73a5f668036a519043e5bChandler Carruth  /// The storage size in bits which should be used when accessing this
7872d2dab6058467036df73a5f668036a519043e5bChandler Carruth  /// bitfield.
7972d2dab6058467036df73a5f668036a519043e5bChandler Carruth  unsigned StorageSize;
80e792584917983edb9bbfd5751b1fa6a4136e566aDaniel Dunbar
8172d2dab6058467036df73a5f668036a519043e5bChandler Carruth  /// The alignment which should be used when accessing the bitfield.
8272d2dab6058467036df73a5f668036a519043e5bChandler Carruth  unsigned StorageAlignment;
83e792584917983edb9bbfd5751b1fa6a4136e566aDaniel Dunbar
8472d2dab6058467036df73a5f668036a519043e5bChandler Carruth  CGBitFieldInfo()
8572d2dab6058467036df73a5f668036a519043e5bChandler Carruth      : Offset(), Size(), IsSigned(), StorageSize(), StorageAlignment() {}
86ab970f90ce31a53fe7e6375a37536bf0832fd922Daniel Dunbar
8772d2dab6058467036df73a5f668036a519043e5bChandler Carruth  CGBitFieldInfo(unsigned Offset, unsigned Size, bool IsSigned,
8872d2dab6058467036df73a5f668036a519043e5bChandler Carruth                 unsigned StorageSize, unsigned StorageAlignment)
8972d2dab6058467036df73a5f668036a519043e5bChandler Carruth      : Offset(Offset), Size(Size), IsSigned(IsSigned),
9072d2dab6058467036df73a5f668036a519043e5bChandler Carruth        StorageSize(StorageSize), StorageAlignment(StorageAlignment) {}
91e792584917983edb9bbfd5751b1fa6a4136e566aDaniel Dunbar
928cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner  void print(raw_ostream &OS) const;
9393c62967d4ac7620a8ed2c5f875daab9adb416f0Daniel Dunbar  void dump() const;
94e7a80bd66a80ce509de9b50f32cdd402914edd2eDaniel Dunbar
95e7a80bd66a80ce509de9b50f32cdd402914edd2eDaniel Dunbar  /// \brief Given a bit-field decl, build an appropriate helper object for
96e7a80bd66a80ce509de9b50f32cdd402914edd2eDaniel Dunbar  /// accessing that field (which is expected to have the given offset and
97e7a80bd66a80ce509de9b50f32cdd402914edd2eDaniel Dunbar  /// size).
9872d2dab6058467036df73a5f668036a519043e5bChandler Carruth  static CGBitFieldInfo MakeInfo(class CodeGenTypes &Types,
9972d2dab6058467036df73a5f668036a519043e5bChandler Carruth                                 const FieldDecl *FD,
10072d2dab6058467036df73a5f668036a519043e5bChandler Carruth                                 uint64_t Offset, uint64_t Size,
10172d2dab6058467036df73a5f668036a519043e5bChandler Carruth                                 uint64_t StorageSize,
10272d2dab6058467036df73a5f668036a519043e5bChandler Carruth                                 uint64_t StorageAlignment);
1032eec0b2e3e931de6cefbb266a7652a0622fe95b2Daniel Dunbar};
1042eec0b2e3e931de6cefbb266a7652a0622fe95b2Daniel Dunbar
1052924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar/// CGRecordLayout - This class handles struct and union layout info while
1062924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar/// lowering AST types to LLVM types.
107198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar///
108198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar/// These layout objects are only created on demand as IR generation requires.
1092924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbarclass CGRecordLayout {
110198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  friend class CodeGenTypes;
111198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar
112f56faa01936b9cf909623d7f06e3c2569ca4a78eDmitri Gribenko  CGRecordLayout(const CGRecordLayout &) LLVM_DELETED_FUNCTION;
113f56faa01936b9cf909623d7f06e3c2569ca4a78eDmitri Gribenko  void operator=(const CGRecordLayout &) LLVM_DELETED_FUNCTION;
1142924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
115198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbarprivate:
1169b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// The LLVM type corresponding to this record layout; used when
1179b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// laying it out as a complete object.
1189cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::StructType *CompleteObjectType;
1192924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
1209b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// The LLVM type for the non-virtual part of this record layout;
1219b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// used when laying it out as a base subobject.
1229cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::StructType *BaseSubobjectType;
1233d155e683a74d3783362ef1865be91544eb8a9fcAnders Carlsson
124198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  /// Map from (non-bit-field) struct field to the corresponding llvm struct
125198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  /// type field no. This info is populated by record builder.
126198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  llvm::DenseMap<const FieldDecl *, unsigned> FieldInfo;
127198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar
128198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  /// Map from (bit-field) struct field to the corresponding llvm struct type
129198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  /// field no. This info is populated by record builder.
1302eec0b2e3e931de6cefbb266a7652a0622fe95b2Daniel Dunbar  llvm::DenseMap<const FieldDecl *, CGBitFieldInfo> BitFields;
131198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar
132c6772ce9c80ff524c7c522b5f0b37de58786bd84Anders Carlsson  // FIXME: Maybe we could use a CXXBaseSpecifier as the key and use a single
133651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  // map for both virtual and non-virtual bases.
1349b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  llvm::DenseMap<const CXXRecordDecl *, unsigned> NonVirtualBases;
135c6772ce9c80ff524c7c522b5f0b37de58786bd84Anders Carlsson
1369b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// Map from virtual bases to their field index in the complete object.
1379b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  llvm::DenseMap<const CXXRecordDecl *, unsigned> CompleteObjectVirtualBases;
1389b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall
1399b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// False if any direct or indirect subobject of this class, when
1409b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// considered as a complete object, requires a non-zero bitpattern
1419b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// when zero-initialized.
142f16aa103d3afd42fbca2ab346f191bf745cec092John McCall  bool IsZeroInitializable : 1;
1432924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
1449b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// False if any direct or indirect subobject of this class, when
1459b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// considered as a base subobject, requires a non-zero bitpattern
1469b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// when zero-initialized.
1479b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  bool IsZeroInitializableAsBase : 1;
1482924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
1499b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCallpublic:
1509cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  CGRecordLayout(llvm::StructType *CompleteObjectType,
1519cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner                 llvm::StructType *BaseSubobjectType,
1529b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall                 bool IsZeroInitializable,
1539b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall                 bool IsZeroInitializableAsBase)
1549b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    : CompleteObjectType(CompleteObjectType),
1559b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall      BaseSubobjectType(BaseSubobjectType),
1569b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall      IsZeroInitializable(IsZeroInitializable),
1579b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall      IsZeroInitializableAsBase(IsZeroInitializableAsBase) {}
1589b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall
1599b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// \brief Return the "complete object" LLVM type associated with
1609b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// this record.
1619cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::StructType *getLLVMType() const {
1629cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    return CompleteObjectType;
1632924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar  }
1642924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
1659b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// \brief Return the "base subobject" LLVM type associated with
1669b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// this record.
1679cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner  llvm::StructType *getBaseSubobjectLLVMType() const {
1689cbe4f0ba01ec304e1e3d071c071f7bca33631c0Chris Lattner    return BaseSubobjectType;
1693d155e683a74d3783362ef1865be91544eb8a9fcAnders Carlsson  }
1703d155e683a74d3783362ef1865be91544eb8a9fcAnders Carlsson
171f16aa103d3afd42fbca2ab346f191bf745cec092John McCall  /// \brief Check whether this struct can be C++ zero-initialized
172f16aa103d3afd42fbca2ab346f191bf745cec092John McCall  /// with a zeroinitializer.
173f16aa103d3afd42fbca2ab346f191bf745cec092John McCall  bool isZeroInitializable() const {
174f16aa103d3afd42fbca2ab346f191bf745cec092John McCall    return IsZeroInitializable;
1752924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar  }
176198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar
1779b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// \brief Check whether this struct can be C++ zero-initialized
1789b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// with a zeroinitializer when considered as a base subobject.
1799b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  bool isZeroInitializableAsBase() const {
1809b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    return IsZeroInitializableAsBase;
1819b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  }
1829b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall
18350810d355ab2cf3f11f4e6c478a1df7c1f9f233dDaniel Dunbar  /// \brief Return llvm::StructType element number that corresponds to the
18450810d355ab2cf3f11f4e6c478a1df7c1f9f233dDaniel Dunbar  /// field FD.
185198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  unsigned getLLVMFieldNo(const FieldDecl *FD) const {
1866bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines    FD = FD->getCanonicalDecl();
187198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar    assert(FieldInfo.count(FD) && "Invalid field for record!");
188198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar    return FieldInfo.lookup(FD);
189198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  }
190198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar
191c6772ce9c80ff524c7c522b5f0b37de58786bd84Anders Carlsson  unsigned getNonVirtualBaseLLVMFieldNo(const CXXRecordDecl *RD) const {
1929b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    assert(NonVirtualBases.count(RD) && "Invalid non-virtual base!");
1939b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    return NonVirtualBases.lookup(RD);
1949b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  }
1959b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall
1969b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// \brief Return the LLVM field index corresponding to the given
1979b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  /// virtual base.  Only valid when operating on the complete object.
1989b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall  unsigned getVirtualBaseIndex(const CXXRecordDecl *base) const {
1999b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    assert(CompleteObjectVirtualBases.count(base) && "Invalid virtual base!");
2009b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    return CompleteObjectVirtualBases.lookup(base);
201c6772ce9c80ff524c7c522b5f0b37de58786bd84Anders Carlsson  }
202c6772ce9c80ff524c7c522b5f0b37de58786bd84Anders Carlsson
20350810d355ab2cf3f11f4e6c478a1df7c1f9f233dDaniel Dunbar  /// \brief Return the BitFieldInfo that corresponds to the field FD.
2042eec0b2e3e931de6cefbb266a7652a0622fe95b2Daniel Dunbar  const CGBitFieldInfo &getBitFieldInfo(const FieldDecl *FD) const {
2056bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines    FD = FD->getCanonicalDecl();
206651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    assert(FD->isBitField() && "Invalid call for non-bit-field decl!");
2072eec0b2e3e931de6cefbb266a7652a0622fe95b2Daniel Dunbar    llvm::DenseMap<const FieldDecl *, CGBitFieldInfo>::const_iterator
208198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar      it = BitFields.find(FD);
2099b7da1c46d6d2849f9cb51328d7fcddf2c417672John McCall    assert(it != BitFields.end() && "Unable to find bitfield info");
210198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar    return it->second;
211198bcb44b6271c92fd856403f34b518828100aacDaniel Dunbar  }
21293c62967d4ac7620a8ed2c5f875daab9adb416f0Daniel Dunbar
2138cc488fefb2fb04bc8d5398da29f0182f97934cfChris Lattner  void print(raw_ostream &OS) const;
21493c62967d4ac7620a8ed2c5f875daab9adb416f0Daniel Dunbar  void dump() const;
2152924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar};
2162924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
2172924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar}  // end namespace CodeGen
2182924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar}  // end namespace clang
2192924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar
2202924ade97ee4228fcf3518d89cd4bd1653236b48Daniel Dunbar#endif
221