mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 03:53:04 +02:00
Add initial support for machine code emission
llvm-svn: 4865
This commit is contained in:
parent
54d6377268
commit
d29ab7a539
@ -16,6 +16,15 @@
|
|||||||
#include "Support/CommandLine.h"
|
#include "Support/CommandLine.h"
|
||||||
#include "Support/Statistic.h"
|
#include "Support/Statistic.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "llvm/CodeGen/MachineCodeEmitter.h"
|
||||||
|
|
||||||
|
struct JelloMachineCodeEmitter : public MachineCodeEmitter {
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
cl::opt<std::string>
|
cl::opt<std::string>
|
||||||
InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
|
InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
|
||||||
@ -48,12 +57,24 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PassManager Passes;
|
PassManager Passes;
|
||||||
|
|
||||||
|
// Compile LLVM Code down to machine code in the intermediate representation
|
||||||
if (Target.addPassesToJITCompile(Passes)) {
|
if (Target.addPassesToJITCompile(Passes)) {
|
||||||
std::cerr << argv[0] << ": target '" << Target.getName()
|
std::cerr << argv[0] << ": target '" << Target.getName()
|
||||||
<< "' doesn't support JIT compilation!\n";
|
<< "' doesn't support JIT compilation!\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Turn the machine code intermediate representation into bytes in memory that
|
||||||
|
// may be executed.
|
||||||
|
//
|
||||||
|
JelloMachineCodeEmitter MCE;
|
||||||
|
if (Target.addPassesToEmitMachineCode(Passes, MCE)) {
|
||||||
|
std::cerr << argv[0] << ": target '" << Target.getName()
|
||||||
|
<< "' doesn't support machine code emission!\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// JIT all of the methods in the module. Eventually this will JIT functions
|
// JIT all of the methods in the module. Eventually this will JIT functions
|
||||||
// on demand.
|
// on demand.
|
||||||
Passes.run(*M.get());
|
Passes.run(*M.get());
|
||||||
|
Loading…
Reference in New Issue
Block a user