+class EmitMethodAssembly : public MethodPass {
+ TargetMachine &Target; // Target to compile for
+ std::ostream *Out; // Stream to print on
+public:
+ inline EmitMethodAssembly(TargetMachine &T, std::ostream *O)
+ : Target(T), Out(O) {}
+
+ virtual bool runOnMethod(Method *M) {
+ Target.emitAssembly(M, *Out);
+ Target.freeCompiledMethod(M); // Release memory for the method
+ return false;
+ }
+};
+
+
+//===---------------------------------------------------------------------===//
+// EmitGlobalsAssembly Pass
+//
+// Write assembly code for global values to specified output stream
+//===---------------------------------------------------------------------===//
+
+class EmitGlobalsAssembly : public Pass {