MCMachObjectWriter.h revision 5d05d9769ec98cdee359fd934a56c9455e21232b
1//===-- llvm/MC/MCMachObjectWriter.h - Mach Object Writer -------*- 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#ifndef LLVM_MC_MCMACHOBJECTWRITER_H
11#define LLVM_MC_MCMACHOBJECTWRITER_H
12
13#include "llvm/MC/MCObjectWriter.h"
14#include "llvm/Support/DataTypes.h"
15
16namespace llvm {
17
18class MCMachObjectTargetWriter {
19  const unsigned Is64Bit : 1;
20  const uint32_t CPUType;
21  const uint32_t CPUSubtype;
22
23protected:
24  MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
25                           uint32_t CPUSubtype_);
26
27public:
28  virtual ~MCMachObjectTargetWriter();
29
30  /// @name Accessors
31  /// @{
32
33  bool is64Bit() const { return Is64Bit; }
34  uint32_t getCPUType() const { return CPUType; }
35  uint32_t getCPUSubtype() const { return CPUSubtype; }
36
37  /// @}
38};
39
40/// \brief Construct a new Mach-O writer instance.
41///
42/// This routine takes ownership of the target writer subclass.
43///
44/// \param MOTW - The target specific Mach-O writer subclass.
45/// \param OS - The stream to write to.
46/// \returns The constructed object writer.
47MCObjectWriter *createMachObjectWriter(MCMachObjectTargetWriter *MOTW,
48                                       raw_ostream &OS, bool IsLittleEndian);
49
50} // End llvm namespace
51
52#endif
53