llvm.org GIT mirror llvm / 9b2f25e
X86/MC/Mach-O: Split out createX86MachObjectWriter(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122246 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 9 years ago
4 changed file(s) with 48 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
2828 X86ISelLowering.cpp
2929 X86InstrInfo.cpp
3030 X86JITInfo.cpp
31 X86MachObjectWriter.cpp
3132 X86MCAsmInfo.cpp
3233 X86MCCodeEmitter.cpp
3334 X86MCInstLower.cpp
2222 class JITCodeEmitter;
2323 class MCCodeEmitter;
2424 class MCContext;
25 class MCObjectWriter;
2526 class MachineCodeEmitter;
2627 class Target;
2728 class TargetAsmBackend;
2829 class X86TargetMachine;
2930 class formatted_raw_ostream;
31 class raw_ostream;
3032
3133 /// createX86ISelDag - This pass converts a legalized DAG into a
3234 /// X86-specific DAG, ready for instruction scheduling.
7375 ///
7476 FunctionPass *createX86MaxStackAlignmentHeuristicPass();
7577
78
79 /// createX86MachObjectWriter - Construct an X86 Mach-O object writer.
80 MCObjectWriter *createX86MachObjectWriter(raw_ostream &OS,
81 bool Is64Bit,
82 uint32_t CPUType,
83 uint32_t CPUSubtype);
84
7685 extern Target TheX86_32Target, TheX86_64Target;
7786
7887 } // End llvm namespace
4545 }
4646
4747 namespace {
48 class X86MachObjectWriter : public MCMachObjectTargetWriter {
49 public:
50 X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,
51 uint32_t CPUSubtype)
52 : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
53 /*UseAggressiveSymbolFolding=*/Is64Bit) {}
54 };
5548
5649 class X86ELFObjectWriter : public MCELFObjectTargetWriter {
5750 public:
356349 : DarwinX86AsmBackend(T) {}
357350
358351 MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
359 return createMachObjectWriter(new X86MachObjectWriter(
360 /*Is64Bit=*/false,
361 object::mach::CTM_i386,
362 object::mach::CSX86_ALL),
363 OS, /*IsLittleEndian=*/true);
352 return createX86MachObjectWriter(OS, /*Is64Bit=*/false,
353 object::mach::CTM_i386,
354 object::mach::CSX86_ALL);
364355 }
365356 };
366357
372363 }
373364
374365 MCObjectWriter *createObjectWriter(raw_ostream &OS) const {
375 return createMachObjectWriter(new X86MachObjectWriter(
376 /*Is64Bit=*/true,
377 object::mach::CTM_x86_64,
378 object::mach::CSX86_ALL),
379 OS, /*IsLittleEndian=*/true);
366 return createX86MachObjectWriter(OS, /*Is64Bit=*/true,
367 object::mach::CTM_x86_64,
368 object::mach::CSX86_ALL);
380369 }
381370
382371 virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
0 //===-- X86MachObjectWriter.cpp - X86 Mach-O Writer -----------------------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "X86.h"
10 #include "llvm/MC/MCMachObjectWriter.h"
11 using namespace llvm;
12
13 namespace {
14 class X86MachObjectWriter : public MCMachObjectTargetWriter {
15 public:
16 X86MachObjectWriter(bool Is64Bit, uint32_t CPUType,
17 uint32_t CPUSubtype)
18 : MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype,
19 /*UseAggressiveSymbolFolding=*/Is64Bit) {}
20 };
21 }
22
23 MCObjectWriter *llvm::createX86MachObjectWriter(raw_ostream &OS,
24 bool Is64Bit,
25 uint32_t CPUType,
26 uint32_t CPUSubtype) {
27 return createMachObjectWriter(new X86MachObjectWriter(Is64Bit,
28 CPUType,
29 CPUSubtype),
30 OS, /*IsLittleEndian=*/true);
31 }