[llvm-commits] [llvm] r58835 - in /llvm/trunk: include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp

Evan Cheng evan.cheng at apple.com
Fri Nov 7 01:02:17 PST 2008


Author: evancheng
Date: Fri Nov  7 03:02:17 2008
New Revision: 58835

URL: http://llvm.org/viewvc/llvm-project?rev=58835&view=rev
Log:
Jump tables may be emitted by target.

Modified:
    llvm/trunk/include/llvm/Target/TargetJITInfo.h
    llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp

Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=58835&r1=58834&r2=58835&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Fri Nov  7 03:02:17 2008
@@ -112,6 +112,10 @@
     /// pool address resolution is handled by the target.
     virtual bool hasCustomConstantPool() const { return false; }
 
+    /// hasCustomJumpTables - Allows a target to specify that jumptables
+    /// are emitted by the target.
+    virtual bool hasCustomJumpTables() const { return false; }
+
     /// allocateSeparateGVMemory - If true, globals should be placed in
     /// separately allocated heap memory rather than in the same
     /// code memory allocated by MachineCodeEmitter.

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58835&r1=58834&r2=58835&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Fri Nov  7 03:02:17 2008
@@ -35,9 +35,9 @@
 #include "llvm/System/Disassembler.h"
 #include "llvm/System/Memory.h"
 #include "llvm/Target/TargetInstrInfo.h"
+#include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/Statistic.h"
 #include <algorithm>
-#include <set>
 #ifndef NDEBUG
 #include <iomanip>
 #endif
@@ -485,7 +485,7 @@
     MachineModuleInfo* MMI;
 
     // GVSet - a set to keep track of which globals have been seen
-    std::set<const GlobalVariable*> GVSet;
+    SmallPtrSet<const GlobalVariable*, 8> GVSet;
 
   public:
     JITEmitter(JIT &jit, JITMemoryManager *JMM) : Resolver(jit) {
@@ -728,7 +728,7 @@
 
   if (C->getType()->getTypeID() == Type::PointerTyID)
     if (const GlobalVariable* GV = dyn_cast<GlobalVariable>(C))
-      if (GVSet.insert(GV).second)
+      if (GVSet.insert(GV))
         Size = addSizeOfGlobal(GV, Size);
 
   return Size;
@@ -780,7 +780,7 @@
           // assuming the addresses of the new globals in this module
           // start at 0 (or something) and adjusting them after codegen
           // complete.  Another possibility is to grab a marker bit in GV.
-          if (GVSet.insert(GV).second)
+          if (GVSet.insert(GV))
             // A variable as yet unseen.  Add in its size.
             Size = addSizeOfGlobal(GV, Size);
         }
@@ -790,7 +790,7 @@
   DOUT << "JIT: About to look through initializers\n";
   // Look for more globals that are referenced only from initializers.
   // GVSet.end is computed each time because the set can grow as we go.
-  for (std::set<const GlobalVariable *>::iterator I = GVSet.begin(); 
+  for (SmallPtrSet<const GlobalVariable *, 8>::iterator I = GVSet.begin(); 
        I != GVSet.end(); I++) {
     const GlobalVariable* GV = *I;
     if (GV->hasInitializer())
@@ -1022,11 +1022,9 @@
 }
 
 void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
-  if (TheJIT->getJITInfo().hasCustomConstantPool()) {
-    DOUT << "JIT: Target has custom constant pool handling. Omitting standard "
-            "constant pool\n";
+  if (TheJIT->getJITInfo().hasCustomConstantPool())
     return;
-  }
+
   const std::vector<MachineConstantPoolEntry> &Constants = MCP->getConstants();
   if (Constants.empty()) return;
 
@@ -1060,6 +1058,9 @@
 }
 
 void JITEmitter::initJumpTableInfo(MachineJumpTableInfo *MJTI) {
+  if (TheJIT->getJITInfo().hasCustomJumpTables())
+    return;
+
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   if (JT.empty()) return;
   
@@ -1077,6 +1078,9 @@
 }
 
 void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) {
+  if (TheJIT->getJITInfo().hasCustomJumpTables())
+    return;
+
   const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
   if (JT.empty() || JumpTableBase == 0) return;
   





More information about the llvm-commits mailing list