2005-06-27 06:30:12 +00:00
|
|
|
//===-- X86ELFWriter.cpp - Emit an ELF file for the X86 backend -----------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements an ELF writer for the X86 backend. The public interface
|
|
|
|
// to this file is the createX86ELFObjectWriterPass function.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "X86.h"
|
2006-03-13 23:20:37 +00:00
|
|
|
#include "X86TargetMachine.h"
|
2005-07-11 05:17:48 +00:00
|
|
|
#include "llvm/PassManager.h"
|
2005-06-27 06:30:12 +00:00
|
|
|
#include "llvm/CodeGen/ELFWriter.h"
|
2006-06-28 23:27:49 +00:00
|
|
|
#include "llvm/Support/Visibility.h"
|
2005-06-27 06:30:12 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
2006-06-28 23:27:49 +00:00
|
|
|
class VISIBILITY_HIDDEN X86ELFWriter : public ELFWriter {
|
2005-06-27 06:30:12 +00:00
|
|
|
public:
|
2006-03-13 23:20:37 +00:00
|
|
|
X86ELFWriter(std::ostream &O, X86TargetMachine &TM) : ELFWriter(O, TM) {
|
2005-06-27 06:30:12 +00:00
|
|
|
e_machine = 3; // EM_386
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2005-07-11 05:17:48 +00:00
|
|
|
/// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code
|
|
|
|
/// as an ELF object file.
|
2005-06-27 06:30:12 +00:00
|
|
|
///
|
2005-07-11 05:17:48 +00:00
|
|
|
void llvm::addX86ELFObjectWriterPass(PassManager &FPM,
|
2006-03-13 23:20:37 +00:00
|
|
|
std::ostream &O, X86TargetMachine &TM) {
|
2005-07-11 05:17:48 +00:00
|
|
|
X86ELFWriter *EW = new X86ELFWriter(O, TM);
|
|
|
|
FPM.add(EW);
|
2006-07-25 20:40:54 +00:00
|
|
|
FPM.add(createX86CodeEmitterPass(TM, EW->getMachineCodeEmitter()));
|
2005-06-27 06:30:12 +00:00
|
|
|
}
|