aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-02 21:22:04 +0000
committerChris Lattner <sabre@nondot.org>2002-12-02 21:22:04 +0000
commit18a171f34c5033d360f3c7e8a9813f09a04d6ed8 (patch)
tree2ee13e3df769ad4c404add5bca4ab8113b608bf1 /tools
parent928e23f9bafe41e5cce81bf98817bc9c825d972a (diff)
downloadexternal_llvm-18a171f34c5033d360f3c7e8a9813f09a04d6ed8.zip
external_llvm-18a171f34c5033d360f3c7e8a9813f09a04d6ed8.tar.gz
external_llvm-18a171f34c5033d360f3c7e8a9813f09a04d6ed8.tar.bz2
Add initial support for machine code emission
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4865 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/jello/jello.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/jello/jello.cpp b/tools/jello/jello.cpp
index 01b2eb9..aaf115a 100644
--- a/tools/jello/jello.cpp
+++ b/tools/jello/jello.cpp
@@ -16,6 +16,15 @@
#include "Support/CommandLine.h"
#include "Support/Statistic.h"
+
+#include "llvm/CodeGen/MachineCodeEmitter.h"
+
+struct JelloMachineCodeEmitter : public MachineCodeEmitter {
+
+
+};
+
+
namespace {
cl::opt<std::string>
InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
@@ -48,12 +57,24 @@ int main(int argc, char **argv) {
}
PassManager Passes;
+
+ // Compile LLVM Code down to machine code in the intermediate representation
if (Target.addPassesToJITCompile(Passes)) {
std::cerr << argv[0] << ": target '" << Target.getName()
<< "' doesn't support JIT compilation!\n";
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
// on demand.
Passes.run(*M.get());