blob: 9282f5f33d70de1f480aa0b7391a89acae9be18d [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,
Bill Wendling4f405312009-02-24 08:30:20 +000027 X86TargetMachine &tm,
28 bool fast) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000029 const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
30
31 if (Subtarget->isFlavorIntel()) {
Bill Wendling4f405312009-02-24 08:30:20 +000032 return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000033 } else {
Bill Wendling4f405312009-02-24 08:30:20 +000034 return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), fast);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000035 }
36}
Anton Korobeynikov9ff5bee2008-08-17 13:53:59 +000037
38namespace {
39 static struct Register {
40 Register() {
41 X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
42 }
43 } Registrator;
44}
Oscar Fuentes4f012352008-11-15 21:36:30 +000045
46extern "C" int X86AsmPrinterForceLink;
47int X86AsmPrinterForceLink = 0;