Move TargetData to DataLayout.
[oota-llvm.git] / include / llvm / Target / TargetData.h
1 //===-- llvm/Target/TargetData.h - Data size & alignment info ---*- 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 defines the wrapper for DataLayout to provide compatibility
11 // with the old TargetData class.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TARGET_TARGETDATA_H
16 #define LLVM_TARGET_TARGETDATA_H
17
18 #include "llvm/DataLayout.h"
19 #include "llvm/Pass.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/Support/DataTypes.h"
22
23 namespace llvm {
24
25 /// TargetData - This class is just a wrapper to help with the transition to the
26 /// new DataLayout class.
27 class TargetData : public DataLayout {
28 public:
29   /// Default ctor.
30   ///
31   /// @note This has to exist, because this is a pass, but it should never be
32   /// used.
33   TargetData() : DataLayout() {}
34
35   /// Constructs a TargetData from a specification string.
36   /// See DataLayout::init().
37   explicit TargetData(StringRef TargetDescription)
38     : DataLayout(TargetDescription) {}
39
40   /// Initialize target data from properties stored in the module.
41   explicit TargetData(const Module *M) : DataLayout(M) {}
42
43   TargetData(const TargetData &TD) : DataLayout(TD) {}
44
45   template <typename UIntTy>
46   static UIntTy RoundUpAlignment(UIntTy Val, unsigned Alignment) {
47     return DataLayout::RoundUpAlignment(Val, Alignment);
48   }
49 };
50
51 } // End llvm namespace
52
53 #endif