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" |
Cédric Venet | 4fce6e2 | 2008-08-24 12:30:46 +0000 | [diff] [blame] | 20 | #include "X86Subtarget.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 | /// |
David Greene | 302008d | 2009-07-14 20:18:05 +0000 | [diff] [blame] | 28 | FunctionPass *llvm::createX86CodePrinterPass(formatted_raw_ostream &o, |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 29 | TargetMachine &tm, |
Bill Wendling | 5ed22ac | 2009-04-29 23:29:43 +0000 | [diff] [blame] | 30 | bool verbose) { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 31 | const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>(); |
| 32 | |
Chris Lattner | 63c4109 | 2009-06-18 23:33:13 +0000 | [diff] [blame] | 33 | if (Subtarget->isFlavorIntel()) |
Daniel Dunbar | b10d222 | 2009-07-01 01:48:54 +0000 | [diff] [blame] | 34 | return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); |
| 35 | return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose); |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 36 | } |
Anton Korobeynikov | 9ff5bee | 2008-08-17 13:53:59 +0000 | [diff] [blame] | 37 | |
Bob Wilson | ebbc1c4 | 2009-06-23 23:59:40 +0000 | [diff] [blame] | 38 | // Force static initialization. |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 39 | extern "C" void LLVMInitializeX86AsmPrinter() { |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 40 | TargetRegistry::RegisterAsmPrinter(TheX86_32Target, createX86CodePrinterPass); |
Daniel Dunbar | fe5939f | 2009-07-15 20:24:03 +0000 | [diff] [blame] | 41 | TargetRegistry::RegisterAsmPrinter(TheX86_64Target, createX86CodePrinterPass); |
| 42 | } |