Add initial support for machine code emission
authorChris Lattner <sabre@nondot.org>
Mon, 2 Dec 2002 21:22:04 +0000 (21:22 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 2 Dec 2002 21:22:04 +0000 (21:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4865 91177308-0d34-0410-b5e6-96231b3b80d8

tools/jello/jello.cpp

index 01b2eb9ff2f9532117f0627b9e5a2569eeaaca85..aaf115a675ae80773e8a391130d3802a697174ed 100644 (file)
 #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());