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
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2005-07-01 22:44:09 +00:00
|
|
|
#include "X86ATTAsmPrinter.h"
|
|
|
|
#include "X86IntelAsmPrinter.h"
|
2008-08-17 18:24:26 +00:00
|
|
|
#include "../X86Subtarget.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.
|
|
|
|
///
|
2008-08-21 00:14:44 +00:00
|
|
|
FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o,
|
2006-09-06 18:34:40 +00:00
|
|
|
X86TargetMachine &tm) {
|
2006-09-07 12:23:47 +00:00
|
|
|
const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
|
2006-09-06 18:34:40 +00:00
|
|
|
|
2006-09-07 12:23:47 +00:00
|
|
|
if (Subtarget->isFlavorIntel()) {
|
2006-09-07 22:06:40 +00:00
|
|
|
return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo());
|
2006-09-07 12:23:47 +00:00
|
|
|
} else {
|
2006-09-07 22:06:40 +00:00
|
|
|
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo());
|
2004-10-04 07:24:48 +00:00
|
|
|
}
|
2003-06-19 19:32:32 +00:00
|
|
|
}
|
2008-08-17 13:53:59 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
static struct Register {
|
|
|
|
Register() {
|
|
|
|
X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
|
|
|
|
}
|
|
|
|
} Registrator;
|
|
|
|
}
|