1 //===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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
13 // This printer is the output mechanism used by `llc'.
15 //===----------------------------------------------------------------------===//
18 #include "X86ATTAsmPrinter.h"
19 #include "X86ATTInstPrinter.h"
20 #include "X86IntelInstPrinter.h"
21 #include "llvm/MC/MCAsmInfo.h"
22 #include "llvm/Target/TargetRegistry.h"
25 /// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
26 /// for a MachineFunction to the given output stream, using the given target
27 /// machine description.
29 static AsmPrinter *createX86CodePrinterPass(formatted_raw_ostream &o,
33 return new X86AsmPrinter(o, tm, tai, verbose);
37 static MCInstPrinter *createX86MCInstPrinter(const Target &T,
38 unsigned SyntaxVariant,
41 if (SyntaxVariant == 0)
42 return new X86ATTInstPrinter(O, MAI);
43 if (SyntaxVariant == 1)
44 return new X86IntelInstPrinter(O, MAI);
48 // Force static initialization.
49 extern "C" void LLVMInitializeX86AsmPrinter() {
50 TargetRegistry::RegisterAsmPrinter(TheX86_32Target, createX86CodePrinterPass);
51 TargetRegistry::RegisterAsmPrinter(TheX86_64Target, createX86CodePrinterPass);
53 TargetRegistry::RegisterMCInstPrinter(TheX86_32Target,createX86MCInstPrinter);
54 TargetRegistry::RegisterMCInstPrinter(TheX86_64Target,createX86MCInstPrinter);