2005-07-02 06:44:09 +08:00
|
|
|
//===-- X86AsmPrinter.cpp - Convert X86 LLVM IR to X86 assembly -----------===//
|
2005-04-22 07:38:14 +08:00
|
|
|
//
|
2003-10-21 03:43:21 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:38:14 +08:00
|
|
|
//
|
2003-10-21 03:43:21 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-10-26 06:55:53 +08:00
|
|
|
//
|
2005-07-02 06:44:09 +08: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-26 06:55:53 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2005-07-02 06:44:09 +08:00
|
|
|
#include "X86ATTAsmPrinter.h"
|
|
|
|
#include "X86IntelAsmPrinter.h"
|
2008-08-18 02:24:26 +08:00
|
|
|
#include "../X86Subtarget.h"
|
2004-02-14 14:00:36 +08:00
|
|
|
using namespace llvm;
|
2003-11-12 06:41:34 +08:00
|
|
|
|
2004-10-04 15:24:48 +08: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 08:14:44 +08:00
|
|
|
FunctionPass *llvm::createX86CodePrinterPass(raw_ostream &o,
|
2006-09-07 02:34:40 +08:00
|
|
|
X86TargetMachine &tm) {
|
2006-09-07 20:23:47 +08:00
|
|
|
const X86Subtarget *Subtarget = &tm.getSubtarget<X86Subtarget>();
|
2006-09-07 02:34:40 +08:00
|
|
|
|
2006-09-07 20:23:47 +08:00
|
|
|
if (Subtarget->isFlavorIntel()) {
|
2006-09-08 06:06:40 +08:00
|
|
|
return new X86IntelAsmPrinter(o, tm, tm.getTargetAsmInfo());
|
2006-09-07 20:23:47 +08:00
|
|
|
} else {
|
2006-09-08 06:06:40 +08:00
|
|
|
return new X86ATTAsmPrinter(o, tm, tm.getTargetAsmInfo());
|
2004-10-04 15:24:48 +08:00
|
|
|
}
|
2003-06-20 03:32:32 +08:00
|
|
|
}
|
2008-08-17 21:53:59 +08:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
static struct Register {
|
|
|
|
Register() {
|
|
|
|
X86TargetMachine::registerAsmPrinter(createX86CodePrinterPass);
|
|
|
|
}
|
|
|
|
} Registrator;
|
|
|
|
}
|