blob: d616accbc3f04a2439442debf39f9cfbed81db8e [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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
Dan Gohmanf17a25c2007-07-18 16:29:46 +000017#include "X86ATTAsmPrinter.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018#include "X86IntelAsmPrinter.h"
Cédric Venet4fce6e22008-08-24 12:30:46 +000019#include "X86Subtarget.h"
Dan Gohmanf17a25c2007-07-18 16:29:46 +000020using namespace llvm;
21
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022/// 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///
Owen Anderson847b99b2008-08-21 00:14:44 +000026FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o,
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027 X86TargetMachine &tm) {
28 const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
29
30 if (Subtarget->isFlavorIntel()) {
31 return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo());
32 } else {
33 return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo());
34 }
35}
Anton Korobeynikov9ff5bee2008-08-17 13:53:59 +000036
37namespace {
38 static struct Register {
39 Register() {
40 X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
41 }
42 } Registrator;
43}