X86/exp-asm-printer: Lower MachineOperand::MO_JumpTableIndex to MCOperand.
[oota-llvm.git] / lib / Target / X86 / AsmPrinter / X86AsmPrinter.cpp
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'.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #include "X86.h"
18 #include "X86ATTAsmPrinter.h"
19 #include "X86IntelAsmPrinter.h"
20 #include "llvm/MC/MCAsmInfo.h"
21 #include "llvm/Target/TargetRegistry.h"
22 using namespace llvm;
23
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 ///
28 static AsmPrinter *createX86CodePrinterPass(formatted_raw_ostream &o,
29                                             TargetMachine &tm,
30                                             const MCAsmInfo *tai,
31                                             bool verbose) {
32   if (tm.getMCAsmInfo()->getAssemblerDialect() == 1)
33     return new X86IntelAsmPrinter(o, tm, tai, verbose);
34   return new X86ATTAsmPrinter(o, tm, tai, verbose);
35 }
36
37 // Force static initialization.
38 extern "C" void LLVMInitializeX86AsmPrinter() { 
39   TargetRegistry::RegisterAsmPrinter(TheX86_32Target, createX86CodePrinterPass);
40   TargetRegistry::RegisterAsmPrinter(TheX86_64Target, createX86CodePrinterPass);
41 }