MCMachObjectWriter.h revision b87422778c4e7b828e6e846b81fd77509439c622
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  // FIXME: Remove this, we should just always use it once we no longer care
23  // about Darwin 'as' compatibility.
24  const unsigned UseAggressiveSymbolFolding : 1;
25
26protected:
27  MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_,
28                           uint32_t CPUSubtype_,
29                           bool UseAggressiveSymbolFolding_ = false);
30
31public:
32  virtual ~MCMachObjectTargetWriter();
33
34  /// @name Accessors
35  /// @{
36
37  bool is64Bit() const { return Is64Bit; }
38  bool useAggressiveSymbolFolding() const { return UseAggressiveSymbolFolding; }
39  uint32_t getCPUType() const { return CPUType; }
40  uint32_t getCPUSubtype() const { return CPUSubtype; }
41
42  /// @}
43};
44
45/// \brief Construct a new Mach-O writer instance.
46///
47/// This routine takes ownership of the target writer subclass.
48///
49/// \param MOTW - The target specific Mach-O writer subclass.
50/// \param OS - The stream to write to.
51/// \returns The constructed object writer.
52MCObjectWriter *createMachObjectWriter(MCMachObjectTargetWriter *MOTW,
53                                       raw_ostream &OS, bool IsLittleEndian);
54
55} // End llvm namespace
56
57#endif
58