Overhaul my earlier submission due to feedback. It's a large patch, but most of
[llvm/msp430.git] / lib / Target / X86 / AsmPrinter / X86AsmPrinter.cpp
blob9282f5f33d70de1f480aa0b7391a89acae9be18d
1 //===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===//
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 // 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'.
15 //===----------------------------------------------------------------------===//
17 #include "X86ATTAsmPrinter.h"
18 #include "X86IntelAsmPrinter.h"
19 #include "X86Subtarget.h"
20 using namespace llvm;
22 /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
23 /// for a MachineFunction to the given output stream, using the given target
24 /// machine description.
25 ///
26 FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o,
27 X86TargetMachine &tm,
28 bool fast) {
29 const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
31 if (Subtarget->isFlavorIntel()) {
32 return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast);
33 } else {
34 return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast);
38 namespace {
39 static struct Register {
40 Register() {
41 X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
43 } Registrator;
46 extern "C" int X86AsmPrinterForceLink;
47 int X86AsmPrinterForceLink = 0;