Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file the shared super class printer that converts from our internal |
| 11 | // representation of machine-dependent LLVM code to Intel and AT&T format |
| 12 | // assembly language. |
| 13 | // This printer is the output mechanism used by `llc'. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | |
Daniel Dunbar | 0b0441e | 2009-07-18 23:03:22 +0000 | [diff] [blame] | 17 | #include "X86.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 18 | #include "X86ATTAsmPrinter.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 19 | #include "X86IntelAsmPrinter.h" |
Chris Lattner | 621c44d | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 20 | #include "llvm/MC/MCAsmInfo.h" |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 21 | #include "llvm/Target/TargetRegistry.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 22 | using namespace llvm; |
| 23 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 24 | /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code |
| 25 | /// for a MachineFunction to the given output stream, using the given target |
| 26 | /// machine description. |
| 27 | /// |
Daniel Dunbar | 4cb6365 | 2009-08-13 23:48:47 +0000 | [diff] [blame] | 28 | static AsmPrinter *createX86CodePrinterPass(formatted_raw_ostream &o, |
| 29 | TargetMachine &tm, |
Chris Lattner | 621c44d | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 30 | const MCAsmInfo *tai, |
Daniel Dunbar | 4cb6365 | 2009-08-13 23:48:47 +0000 | [diff] [blame] | 31 | bool verbose) { |
Chris Lattner | 621c44d | 2009-08-22 20:48:53 +0000 | [diff] [blame] | 32 | if (tm.getMCAsmInfo()->getAssemblerDialect() == 1) |
Daniel Dunbar | ef5abb4 | 2009-08-13 19:38:51 +0000 | [diff] [blame] | 33 | return new X86IntelAsmPrinter(o, tm, tai, verbose); |
| 34 | return new X86ATTAsmPrinter(o, tm, tai, verbose); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 35 | } |
Anton Korobeynikov | 9ff5bee | 2008-08-17 13:53:59 +0000 | [diff] [blame] | 36 | |
Bob Wilson | ebbc1c4 | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 37 | // Force static initialization. |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 38 | extern "C" void LLVMInitializeX86AsmPrinter() { |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 39 | TargetRegistry::RegisterAsmPrinter(TheX86_32Target, createX86CodePrinterPass); |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 40 | TargetRegistry::RegisterAsmPrinter(TheX86_64Target, createX86CodePrinterPass); |
| 41 | } |