Daniel Dunbar | 12783d1 | 2010-02-21 21:54:14 +0000 | [diff] [blame] | 1 | //===-- 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" |
| 14 | using namespace llvm; |
| 15 | |
| 16 | namespace { |
| 17 | |
| 18 | class X86AsmBackend : public TargetAsmBackend { |
| 19 | public: |
Daniel Dunbar | 6c27f5e | 2010-03-11 01:34:16 +0000 | [diff] [blame] | 20 | X86AsmBackend(const Target &T) |
Daniel Dunbar | 12783d1 | 2010-02-21 21:54:14 +0000 | [diff] [blame] | 21 | : TargetAsmBackend(T) {} |
| 22 | }; |
| 23 | |
Daniel Dunbar | 23ac7c7 | 2010-03-11 01:34:21 +0000 | [diff] [blame^] | 24 | class DarwinX86AsmBackend : public X86AsmBackend { |
| 25 | public: |
| 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 Dunbar | 12783d1 | 2010-02-21 21:54:14 +0000 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | TargetAsmBackend *llvm::createX86_32AsmBackend(const Target &T, |
Daniel Dunbar | 6c27f5e | 2010-03-11 01:34:16 +0000 | [diff] [blame] | 37 | const std::string &TT) { |
Daniel Dunbar | 23ac7c7 | 2010-03-11 01:34:21 +0000 | [diff] [blame^] | 38 | switch (Triple(TT).getOS()) { |
| 39 | case Triple::Darwin: |
| 40 | return new DarwinX86AsmBackend(T); |
| 41 | default: |
| 42 | return new X86AsmBackend(T); |
| 43 | } |
Daniel Dunbar | 12783d1 | 2010-02-21 21:54:14 +0000 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | TargetAsmBackend *llvm::createX86_64AsmBackend(const Target &T, |
Daniel Dunbar | 6c27f5e | 2010-03-11 01:34:16 +0000 | [diff] [blame] | 47 | const std::string &TT) { |
Daniel Dunbar | 23ac7c7 | 2010-03-11 01:34:21 +0000 | [diff] [blame^] | 48 | switch (Triple(TT).getOS()) { |
| 49 | case Triple::Darwin: |
| 50 | return new DarwinX86AsmBackend(T); |
| 51 | default: |
| 52 | return new X86AsmBackend(T); |
| 53 | } |
Daniel Dunbar | 12783d1 | 2010-02-21 21:54:14 +0000 | [diff] [blame] | 54 | } |