2005-07-01 22:44:09 +00:00
|
|
|
//===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===//
|
2005-04-21 23:38:14 +00:00
|
|
|
//
|
2003-10-20 19:43:21 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:38:14 +00:00
|
|
|
//
|
2003-10-20 19:43:21 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-25 22:55:53 +00:00
|
|
|
//
|
2005-07-01 22:44:09 +00:00
|
|
|
// This file the shared super class printer that converts from our internal
|
|
|
|
// representation of machine-dependent LLVM code to Intel and AT&T format
|
|
|
|
// assembly language.
|
|
|
|
// This printer is the output mechanism used by `llc'.
|
2002-10-25 22:55:53 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-07-18 23:03:22 +00:00
|
|
|
#include "X86.h"
|
2005-07-01 22:44:09 +00:00
|
|
|
#include "X86ATTAsmPrinter.h"
|
|
|
|
#include "X86IntelAsmPrinter.h"
|
2008-08-24 12:30:46 +00:00
|
|
|
#include "X86Subtarget.h"
|
2009-07-15 20:24:03 +00:00
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
2004-02-14 06:00:36 +00:00
|
|
|
using namespace llvm;
|
2003-11-11 22:41:34 +00:00
|
|
|
|
2004-10-04 07:24:48 +00:00
|
|
|
/// createX86CodePrinterPass - Returns a pass that prints the X86 assembly code
|
|
|
|
/// for a MachineFunction to the given output stream, using the given target
|
|
|
|
/// machine description.
|
|
|
|
///
|
2009-07-25 06:49:55 +00:00
|
|
|
static FunctionPass *createX86CodePrinterPass(formatted_raw_ostream &o,
|
|
|
|
TargetMachine &tm,
|
|
|
|
bool verbose) {
|
2006-09-07 12:23:47 +00:00
|
|
|
const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
|
2006-09-06 18:34:40 +00:00
|
|
|
|
2009-06-18 23:33:13 +00:00
|
|
|
if (Subtarget->isFlavorIntel())
|
2009-07-01 01:48:54 +00:00
|
|
|
return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
|
|
|
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
|
2003-06-19 19:32:32 +00:00
|
|
|
}
|
2008-08-17 13:53:59 +00:00
|
|
|
|
2009-06-23 23:59:40 +00:00
|
|
|
// Force static initialization.
|
2009-07-15 20:24:03 +00:00
|
|
|
extern "C" void LLVMInitializeX86AsmPrinter() {
|
|
|
|
TargetRegistry::RegisterAsmPrinter(TheX86_32Target, createX86CodePrinterPass);
|
|
|
|
TargetRegistry::RegisterAsmPrinter(TheX86_64Target, createX86CodePrinterPass);
|
|
|
|
}
|