[llvm-commits] [llvm] r109167 - in /llvm/trunk: include/llvm/ExecutionEngine/JITMemoryManager.h include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TargetInstrInfoImpl.cpp lib/ExecutionEngine/JIT/JITEmitter.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h

Chris Lattner sabre at nondot.org
Thu Jul 22 14:17:55 PDT 2010


Author: lattner
Date: Thu Jul 22 16:17:55 2010
New Revision: 109167

URL: http://llvm.org/viewvc/llvm-project?rev=109167&view=rev
Log:
remove the JIT "NeedsExactSize" feature and supporting logic.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h
    llvm/trunk/include/llvm/Target/TargetInstrInfo.h
    llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
    llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
    llvm/trunk/lib/Target/X86/X86InstrInfo.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h?rev=109167&r1=109166&r2=109167&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/JITMemoryManager.h Thu Jul 22 16:17:55 2010
@@ -29,10 +29,9 @@
 class JITMemoryManager {
 protected:
   bool HasGOT;
-  bool SizeRequired;
 public:
 
-  JITMemoryManager() : HasGOT(false), SizeRequired(false) {}
+  JITMemoryManager() : HasGOT(false) {}
   virtual ~JITMemoryManager();
   
   /// CreateDefaultMemManager - This is used to create the default
@@ -71,12 +70,6 @@
   /// return a pointer to its base.
   virtual uint8_t *getGOTBase() const = 0;
   
-  /// NeedsExactSize - If the memory manager requires to know the size of the
-  /// objects to be emitted
-  bool NeedsExactSize() const {
-    return SizeRequired;
-  }
-
   //===--------------------------------------------------------------------===//
   // Main Allocation Functions
   //===--------------------------------------------------------------------===//

Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=109167&r1=109166&r2=109167&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Thu Jul 22 16:17:55 2010
@@ -573,11 +573,6 @@
     return 0;
   }
 
-  /// GetFunctionSizeInBytes - Returns the size of the specified
-  /// MachineFunction.
-  /// 
-  virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const = 0;
-  
   /// Measure the specified inline asm to determine an approximation of its
   /// length.
   virtual unsigned getInlineAsmLength(const char *Str,
@@ -621,7 +616,6 @@
   virtual bool isSchedulingBoundary(const MachineInstr *MI,
                                     const MachineBasicBlock *MBB,
                                     const MachineFunction &MF) const;
-  virtual unsigned GetFunctionSizeInBytes(const MachineFunction &MF) const;
 
   virtual ScheduleHazardRecognizer *
   CreateTargetPostRAHazardRecognizer(const InstrItineraryData&) const;

Modified: llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp?rev=109167&r1=109166&r2=109167&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetInstrInfoImpl.cpp Thu Jul 22 16:17:55 2010
@@ -178,19 +178,6 @@
   return MF.CloneMachineInstr(Orig);
 }
 
-unsigned
-TargetInstrInfoImpl::GetFunctionSizeInBytes(const MachineFunction &MF) const {
-  unsigned FnSize = 0;
-  for (MachineFunction::const_iterator MBBI = MF.begin(), E = MF.end();
-       MBBI != E; ++MBBI) {
-    const MachineBasicBlock &MBB = *MBBI;
-    for (MachineBasicBlock::const_iterator I = MBB.begin(),E = MBB.end();
-         I != E; ++I)
-      FnSize += GetInstSizeInBytes(I);
-  }
-  return FnSize;
-}
-
 // If the COPY instruction in MI can be folded to a stack operation, return
 // the register class to use.
 static const TargetRegisterClass *canFoldCopy(const MachineInstr *MI,

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=109167&r1=109166&r2=109167&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Jul 22 16:17:55 2010
@@ -831,7 +831,7 @@
   if (DL.isUnknown()) return;
   if (!BeforePrintingInsn) return;
   
-  const LLVMContext& Context = EmissionDetails.MF->getFunction()->getContext();
+  const LLVMContext &Context = EmissionDetails.MF->getFunction()->getContext();
 
   if (DL.getScope(Context) != 0 && PrevDL != DL) {
     JITEvent_EmittedFunctionDetails::LineStart NextLine;
@@ -859,23 +859,6 @@
   return Size;
 }
 
-static unsigned GetJumpTableSizeInBytes(MachineJumpTableInfo *MJTI, JIT *jit) {
-  const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
-  if (JT.empty()) return 0;
-
-  unsigned NumEntries = 0;
-  for (unsigned i = 0, e = JT.size(); i != e; ++i)
-    NumEntries += JT[i].MBBs.size();
-
-  return NumEntries * MJTI->getEntrySize(*jit->getTargetData());
-}
-
-static uintptr_t RoundUpToAlign(uintptr_t Size, unsigned Alignment) {
-  if (Alignment == 0) Alignment = 1;
-  // Since we do not know where the buffer will be allocated, be pessimistic.
-  return Size + Alignment;
-}
-
 /// addSizeOfGlobal - add the size of the global (plus any alignment padding)
 /// into the running total Size.
 
@@ -1044,43 +1027,8 @@
   uintptr_t ActualSize = 0;
   // Set the memory writable, if it's not already
   MemMgr->setMemoryWritable();
-  if (MemMgr->NeedsExactSize()) {
-    DEBUG(dbgs() << "JIT: ExactSize\n");
-    const TargetInstrInfo* TII = F.getTarget().getInstrInfo();
-    MachineConstantPool *MCP = F.getConstantPool();
-
-    // Ensure the constant pool/jump table info is at least 4-byte aligned.
-    ActualSize = RoundUpToAlign(ActualSize, 16);
-
-    // Add the alignment of the constant pool
-    ActualSize = RoundUpToAlign(ActualSize, MCP->getConstantPoolAlignment());
-
-    // Add the constant pool size
-    ActualSize += GetConstantPoolSizeInBytes(MCP, TheJIT->getTargetData());
-
-    if (MachineJumpTableInfo *MJTI = F.getJumpTableInfo()) {
-      // Add the aligment of the jump table info
-      ActualSize = RoundUpToAlign(ActualSize,
-                             MJTI->getEntryAlignment(*TheJIT->getTargetData()));
-
-      // Add the jump table size
-      ActualSize += GetJumpTableSizeInBytes(MJTI, TheJIT);
-    }
-
-    // Add the alignment for the function
-    ActualSize = RoundUpToAlign(ActualSize,
-                                std::max(F.getFunction()->getAlignment(), 8U));
-
-    // Add the function size
-    ActualSize += TII->GetFunctionSizeInBytes(F);
-
-    DEBUG(dbgs() << "JIT: ActualSize before globals " << ActualSize << "\n");
-    // Add the size of the globals that will be allocated after this function.
-    // These are all the ones referenced from this function that were not
-    // previously allocated.
-    ActualSize += GetSizeOfGlobalsInBytes(F);
-    DEBUG(dbgs() << "JIT: ActualSize after globals " << ActualSize << "\n");
-  } else if (SizeEstimate > 0) {
+  
+  if (SizeEstimate > 0) {
     // SizeEstimate will be non-zero on reallocation attempts.
     ActualSize = SizeEstimate;
   }
@@ -1268,9 +1216,6 @@
     SavedBufferEnd = BufferEnd;
     SavedCurBufferPtr = CurBufferPtr;
 
-    if (MemMgr->NeedsExactSize())
-      ActualSize = DE->GetDwarfTableSizeInBytes(F, *this, FnStart, FnEnd);
-
     BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
                                                              ActualSize);
     BufferEnd = BufferBegin+ActualSize;

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=109167&r1=109166&r2=109167&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Thu Jul 22 16:17:55 2010
@@ -2945,11 +2945,6 @@
   return false;
 }
 
-unsigned X86InstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const {
-  assert(0 && "X86InstrInfo::GetInstSizeInBytes isn't implemented");
-  abort();
-}
-
 /// getGlobalBaseReg - Return a virtual register initialized with the
 /// the global base register value. Output instructions required to
 /// initialize the register in the function entry block, if necessary.

Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=109167&r1=109166&r2=109167&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Thu Jul 22 16:17:55 2010
@@ -825,10 +825,6 @@
   /// higher) register?  e.g. r8, xmm8, xmm13, etc.
   static bool isX86_64ExtendedReg(unsigned RegNo);
 
-  /// GetInstSize - Returns the size of the specified MachineInstr.
-  ///
-  virtual unsigned GetInstSizeInBytes(const MachineInstr *MI) const;
-
   /// getGlobalBaseReg - Return a virtual register initialized with the
   /// the global base register value. Output instructions required to
   /// initialize the register in the function entry block, if necessary.





More information about the llvm-commits mailing list