blob: e5d80a4cbdec1c928864a91d724065af55e252cf [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,
Bill Wendling5ed22ac2009-04-29 23:29:43 +000028 bool verbose) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000029 const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
30
Chris Lattner63c41092009-06-18 23:33:13 +000031 if (Subtarget->isFlavorIntel())
Daniel Dunbarb10d2222009-07-01 01:48:54 +000032 return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
33 return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000034}
Anton Korobeynikov9ff5bee2008-08-17 13:53:59 +000035
36namespace {
37 static struct Register {
38 Register() {
39 X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
40 }
41 } Registrator;
42}
Oscar Fuentes4f012352008-11-15 21:36:30 +000043
44extern "C" int X86AsmPrinterForceLink;
45int X86AsmPrinterForceLink = 0;
Douglas Gregor1dc5ff42009-06-16 20:12:29 +000046
Bob Wilsonebbc1c42009-06-23 23:59:40 +000047// Force static initialization.
48extern "C" void LLVMInitializeX86AsmPrinter() { }