[llvm-commits] [llvm] r100414 - in /llvm/trunk: include/llvm/CodeGen/MachineFunction.h lib/CodeGen/MachineFunction.cpp lib/CodeGen/MachineFunctionAnalysis.cpp

Chris Lattner sabre at nondot.org
Sun Apr 4 22:49:50 PDT 2010


Author: lattner
Date: Mon Apr  5 00:49:50 2010
New Revision: 100414

URL: http://llvm.org/viewvc/llvm-project?rev=100414&view=rev
Log:
enhance MachineFunction to have a MMI pointer.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineFunction.h
    llvm/trunk/lib/CodeGen/MachineFunction.cpp
    llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=100414&r1=100413&r2=100414&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Apr  5 00:49:50 2010
@@ -32,6 +32,7 @@
 class MachineFrameInfo;
 class MachineConstantPool;
 class MachineJumpTableInfo;
+class MachineModuleInfo;
 class MCContext;
 class Pass;
 class TargetMachine;
@@ -72,7 +73,8 @@
   Function *Fn;
   const TargetMachine &Target;
   MCContext &Ctx;
-
+  MachineModuleInfo &MMI;
+  
   // RegInfo - Information about each register in use in the function.
   MachineRegisterInfo *RegInfo;
 
@@ -107,8 +109,8 @@
   typedef ilist<MachineBasicBlock> BasicBlockListType;
   BasicBlockListType BasicBlocks;
 
-  // Default debug location. Used to print out the debug label at the beginning
-  // of a function.
+  /// Default debug location. Used to print out the debug label at the beginning
+  /// of a function.
   DebugLoc DefaultDebugLoc;
 
   /// FunctionNumber - This provides a unique ID for each function emitted in
@@ -116,17 +118,17 @@
   ///
   unsigned FunctionNumber;
   
-  // The alignment of the function.
+  /// The alignment of the function.
   unsigned Alignment;
 
   MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT
   void operator=(const MachineFunction&);   // DO NOT IMPLEMENT
-
 public:
   MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum,
-                  MCContext &Ctx);
+                  MachineModuleInfo &MMI);
   ~MachineFunction();
 
+  MachineModuleInfo &getMMI() const { return MMI; }
   MCContext &getContext() const { return Ctx; }
   
   /// getFunction - Return the LLVM function that this machine code represents

Modified: llvm/trunk/lib/CodeGen/MachineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunction.cpp?rev=100414&r1=100413&r2=100414&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunction.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunction.cpp Mon Apr  5 00:49:50 2010
@@ -23,6 +23,7 @@
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/CodeGen/MachineJumpTableInfo.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
 #include "llvm/CodeGen/Passes.h"
 #include "llvm/MC/MCAsmInfo.h"
@@ -51,8 +52,8 @@
 }
 
 MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
-                                 unsigned FunctionNum, MCContext &ctx)
-  : Fn(F), Target(TM), Ctx(ctx) {
+                                 unsigned FunctionNum, MachineModuleInfo &mmi)
+  : Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi) {
   if (TM.getRegisterInfo())
     RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
   else

Modified: llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp?rev=100414&r1=100413&r2=100414&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp Mon Apr  5 00:49:50 2010
@@ -38,7 +38,7 @@
 bool MachineFunctionAnalysis::runOnFunction(Function &F) {
   assert(!MF && "MachineFunctionAnalysis already initialized!");
   MF = new MachineFunction(&F, TM, NextFnNum++,
-                           getAnalysis<MachineModuleInfo>().getContext());
+                           getAnalysis<MachineModuleInfo>());
   return false;
 }
 





More information about the llvm-commits mailing list