blob: 88cc2c734bcc78e37143ce25b35d5e85971e5df4 [file] [log] [blame]
Daniel Dunbar12783d12010-02-21 21:54:14 +00001//===-- X86AsmBackend.cpp - X86 Assembler Backend -------------------------===//
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#include "llvm/Target/TargetAsmBackend.h"
11#include "X86.h"
12#include "llvm/Target/TargetRegistry.h"
13#include "llvm/Target/TargetAsmBackend.h"
14using namespace llvm;
15
16namespace {
17
18class X86AsmBackend : public TargetAsmBackend {
19public:
Daniel Dunbar6c27f5e2010-03-11 01:34:16 +000020 X86AsmBackend(const Target &T)
Daniel Dunbar12783d12010-02-21 21:54:14 +000021 : TargetAsmBackend(T) {}
22};
23
Daniel Dunbar23ac7c72010-03-11 01:34:21 +000024class DarwinX86AsmBackend : public X86AsmBackend {
25public:
26 DarwinX86AsmBackend(const Target &T)
27 : X86AsmBackend(T) {}
28
29 virtual bool hasAbsolutizedSet() const { return true; }
30
31 virtual bool hasScatteredSymbols() const { return true; }
32};
33
Daniel Dunbar12783d12010-02-21 21:54:14 +000034}
35
36TargetAsmBackend *llvm::createX86_32AsmBackend(const Target &T,
Daniel Dunbar6c27f5e2010-03-11 01:34:16 +000037 const std::string &TT) {
Daniel Dunbar23ac7c72010-03-11 01:34:21 +000038 switch (Triple(TT).getOS()) {
39 case Triple::Darwin:
40 return new DarwinX86AsmBackend(T);
41 default:
42 return new X86AsmBackend(T);
43 }
Daniel Dunbar12783d12010-02-21 21:54:14 +000044}
45
46TargetAsmBackend *llvm::createX86_64AsmBackend(const Target &T,
Daniel Dunbar6c27f5e2010-03-11 01:34:16 +000047 const std::string &TT) {
Daniel Dunbar23ac7c72010-03-11 01:34:21 +000048 switch (Triple(TT).getOS()) {
49 case Triple::Darwin:
50 return new DarwinX86AsmBackend(T);
51 default:
52 return new X86AsmBackend(T);
53 }
Daniel Dunbar12783d12010-02-21 21:54:14 +000054}