1 //===-- llvm/Target/TargetData.h - Data size & alignment info ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the wrapper for DataLayout to provide compatibility
11 // with the old TargetData class.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TARGET_TARGETDATA_H
16 #define LLVM_TARGET_TARGETDATA_H
18 #include "llvm/DataLayout.h"
19 #include "llvm/Pass.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/Support/DataTypes.h"
25 /// TargetData - This class is just a wrapper to help with the transition to the
26 /// new DataLayout class.
27 class TargetData : public DataLayout {
31 /// @note This has to exist, because this is a pass, but it should never be
33 TargetData() : DataLayout() {};
35 /// Constructs a TargetData from a specification string.
36 /// See DataLayout::init().
37 explicit TargetData(StringRef TargetDescription)
38 : DataLayout(TargetDescription) {}
40 /// Initialize target data from properties stored in the module.
41 explicit TargetData(const Module *M) : DataLayout(M) {}
43 TargetData(const TargetData &TD) : DataLayout(TD) {}
45 template <typename UIntTy>
46 static UIntTy RoundUpAlignment(UIntTy Val, unsigned Alignment) {
47 return DataLayout::RoundUpAlignment(Val, Alignment);
51 } // End llvm namespace