mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-27 06:35:30 +00:00
1911fd4f85
This pass: 1. Splits TargetMachine into TargetMachine (generic targets, can be implemented any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by things using libcodegen and other support). 2. Instead of having each target fully populate the passmgr for file or JIT output, move all this to common code, and give targets hooks they can implement. 3. Commonalize the target population stuff between file emission and JIT emission. 4. All (native code) codegen stuff now happens in a FunctionPassManager, which paves the way for "fast -O0" stuff in the CFE later, and now LLC could lazily stream .bc files from disk to use less memory. 5. There are now many fewer #includes and the targets don't depend on the scalar xforms or libanalysis anymore (but codegen does). 6. Changing common code generator pass ordering stuff no longer requires touching all targets. 7. The JIT now has the option of "-fast" codegen or normal optimized codegen, which is now orthogonal to the fact that JIT'ing is being done. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30081 91177308-0d34-0410-b5e6-96231b3b80d8
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
//===-- 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"
|
|
#include "X86TargetMachine.h"
|
|
#include "llvm/PassManager.h"
|
|
#include "llvm/CodeGen/ELFWriter.h"
|
|
#include "llvm/Support/Compiler.h"
|
|
using namespace llvm;
|
|
|
|
namespace {
|
|
class VISIBILITY_HIDDEN X86ELFWriter : public ELFWriter {
|
|
public:
|
|
X86ELFWriter(std::ostream &O, X86TargetMachine &TM) : ELFWriter(O, TM) {
|
|
e_machine = 3; // EM_386
|
|
}
|
|
};
|
|
}
|
|
|
|
/// addX86ELFObjectWriterPass - Returns a pass that outputs the generated code
|
|
/// as an ELF object file.
|
|
///
|
|
void llvm::addX86ELFObjectWriterPass(FunctionPassManager &FPM,
|
|
std::ostream &O, X86TargetMachine &TM) {
|
|
X86ELFWriter *EW = new X86ELFWriter(O, TM);
|
|
FPM.add(EW);
|
|
FPM.add(createX86CodeEmitterPass(TM, EW->getMachineCodeEmitter()));
|
|
}
|