summaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetData.h
blob: 302efa2502afd8e761fc4d7548a42baa7baff735 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//===-- llvm/Target/TargetData.h - Data size & alignment info ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the wrapper for DataLayout to provide compatibility
// with the old TargetData class.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_TARGETDATA_H
#define LLVM_TARGET_TARGETDATA_H

#include "llvm/DataLayout.h"
#include "llvm/Pass.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/DataTypes.h"

namespace llvm {

/// TargetData - This class is just a wrapper to help with the transition to the
/// new DataLayout class.
class TargetData : public DataLayout {
public:
  /// Default ctor.
  ///
  /// @note This has to exist, because this is a pass, but it should never be
  /// used.
  TargetData() : DataLayout() {}

  /// Constructs a TargetData from a specification string.
  /// See DataLayout::init().
  explicit TargetData(StringRef TargetDescription)
    : DataLayout(TargetDescription) {}

  /// Initialize target data from properties stored in the module.
  explicit TargetData(const Module *M) : DataLayout(M) {}

  TargetData(const TargetData &TD) : DataLayout(TD) {}

  template <typename UIntTy>
  static UIntTy RoundUpAlignment(UIntTy Val, unsigned Alignment) {
    return DataLayout::RoundUpAlignment(Val, Alignment);
  }
};

} // End llvm namespace

#endif