[llvm-commits] CVS: llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp PowerPCJITInfo.h PowerPCTargetMachine.cpp PowerPCTargetMachine.h

Brian Gaeke gaeke at cs.uiuc.edu
Fri Jan 23 00:36:02 PST 2004


Changes in directory llvm/lib/Target/PowerPC:

PowerPCCodeEmitter.cpp added (r1.1)
PowerPCJITInfo.h added (r1.1)
PowerPCTargetMachine.cpp updated: 1.1 -> 1.2
PowerPCTargetMachine.h updated: 1.1 -> 1.2

---
Log message:

Add CodeEmitter and JITInfo stubs. Dump the old
PowerPCTargetMachine::addPassesToJITCompile() method, in favor of the
TargetJITInfo interface.


---
Diffs of the changes:  (+95 -10)

Index: llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp
diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp:1.1
*** /dev/null	Fri Jan 23 00:35:53 2004
--- llvm/lib/Target/PowerPC/PowerPCCodeEmitter.cpp	Fri Jan 23 00:35:43 2004
***************
*** 0 ****
--- 1,43 ----
+ //===-- PowerPCCodeEmitter.cpp - JIT Code Emitter for PowerPC -----*- C++ -*-=//
+ // 
+ //                     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.
+ // 
+ //===----------------------------------------------------------------------===//
+ // 
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #include "PowerPCTargetMachine.h"
+ 
+ namespace llvm {
+ 
+ /// addPassesToEmitMachineCode - Add passes to the specified pass manager to get
+ /// machine code emitted.  This uses a MachineCodeEmitter object to handle
+ /// actually outputting the machine code and resolving things like the address
+ /// of functions.  This method should returns true if machine code emission is
+ /// not supported.
+ ///
+ bool PowerPCTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
+                                                       MachineCodeEmitter &MCE) {
+   return true;
+   // It should go something like this:
+   // PM.add(new Emitter(MCE));  // Machine code emitter pass for PowerPC
+   // Delete machine code for this function after emitting it:
+   // PM.add(createMachineCodeDeleter());
+ }
+ 
+ void *PowerPCJITInfo::getJITStubForFunction(Function *F,
+                                             MachineCodeEmitter &MCE) {
+   assert (0 && "PowerPCJITInfo::getJITStubForFunction not implemented");
+   return 0;
+ }
+ 
+ void PowerPCJITInfo::replaceMachineCodeForFunction (void *Old, void *New) {
+   assert (0 && "PowerPCJITInfo::replaceMachineCodeForFunction not implemented");
+ }
+ 
+ } // end llvm namespace
+ 


Index: llvm/lib/Target/PowerPC/PowerPCJITInfo.h
diff -c /dev/null llvm/lib/Target/PowerPC/PowerPCJITInfo.h:1.1
*** /dev/null	Fri Jan 23 00:35:53 2004
--- llvm/lib/Target/PowerPC/PowerPCJITInfo.h	Fri Jan 23 00:35:43 2004
***************
*** 0 ****
--- 1,49 ----
+ //===- PowerPCJITInfo.h - PowerPC impl. of the JIT interface ----*- C++ -*-===//
+ // 
+ //                     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 contains the PowerPC implementation of the TargetJITInfo class.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #ifndef POWERPCJITINFO_H
+ #define POWERPCJITINFO_H
+ 
+ #include "llvm/Target/TargetJITInfo.h"
+ 
+ namespace llvm {
+   class TargetMachine;
+   class IntrinsicLowering;
+ 
+   class PowerPCJITInfo : public TargetJITInfo {
+     TargetMachine &TM;
+   public:
+     PowerPCJITInfo(TargetMachine &tm) : TM(tm) {}
+ 
+     /// addPassesToJITCompile - Add passes to the specified pass manager to
+     /// implement a fast dynamic compiler for this target.  Return true if this
+     /// is not supported for this target.
+     ///
+     virtual void addPassesToJITCompile(FunctionPassManager &PM);
+     
+     /// replaceMachineCodeForFunction - Make it so that calling the function
+     /// whose machine code is at OLD turns into a call to NEW, perhaps by
+     /// overwriting OLD with a branch to NEW.  This is used for self-modifying
+     /// code.
+     ///
+     virtual void replaceMachineCodeForFunction(void *Old, void *New);
+     
+     /// getJITStubForFunction - Create or return a stub for the specified
+     /// function.  This stub acts just like the specified function, except that
+     /// it allows the "address" of the function to be taken without having to
+     /// generate code for it.
+     virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE);
+   };
+ }
+ 
+ #endif


Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp
diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.1 llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.2
--- llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp:1.1	Wed Jan 21 15:13:19 2004
+++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.cpp	Fri Jan 23 00:35:43 2004
@@ -43,11 +43,9 @@
 }
 
 /// addPassesToJITCompile - Add passes to the specified pass manager to
-/// implement a fast dynamic compiler for this target.  Return true if this is
-/// not supported for this target.
+/// implement a fast dynamic compiler for this target.
 ///
-bool PowerPCTargetMachine::addPassesToJITCompile(FunctionPassManager &PM) {
-  return true;
+void PowerPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
 }
 
 } // end namespace llvm


Index: llvm/lib/Target/PowerPC/PowerPCTargetMachine.h
diff -u llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.1 llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.2
--- llvm/lib/Target/PowerPC/PowerPCTargetMachine.h:1.1	Wed Jan 21 15:13:19 2004
+++ llvm/lib/Target/PowerPC/PowerPCTargetMachine.h	Fri Jan 23 00:35:43 2004
@@ -18,6 +18,7 @@
 #include "llvm/Target/TargetFrameInfo.h"
 #include "llvm/PassManager.h"
 #include "PowerPCInstrInfo.h"
+#include "PowerPCJITInfo.h"
 
 namespace llvm {
 
@@ -38,12 +39,6 @@
   virtual const TargetSchedInfo &getSchedInfo()  const { abort(); }
   virtual const TargetRegInfo   &getRegInfo()    const { abort(); }
   virtual const TargetCacheInfo  &getCacheInfo() const { abort(); }
-
-  /// addPassesToJITCompile - Add passes to the specified pass manager to
-  /// implement a fast dynamic compiler for this target.  Return true if this is
-  /// not supported for this target.
-  ///
-  virtual bool addPassesToJITCompile(FunctionPassManager &PM);
 
   /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
   /// get machine code emitted.  This uses a MachineCodeEmitter object to handle





More information about the llvm-commits mailing list