[sva-commits] r123721 - /safecode/trunk/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Mon Jan 17 20:19:13 CST 2011


Author: aggarwa4
Date: Mon Jan 17 20:19:13 2011
New Revision: 123721

URL: http://llvm.org/viewvc/llvm-project?rev=123721&view=rev
Log:
Formatting changes.

Modified:
    safecode/trunk/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp

Modified: safecode/trunk/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/safecode/trunk/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp?rev=123721&r1=123720&r2=123721&view=diff
==============================================================================
--- safecode/trunk/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp (original)
+++ safecode/trunk/lib/BaggyBoundsChecks/BaggyBoundsChecks.cpp Mon Jan 17 20:19:13 2011
@@ -31,6 +31,7 @@
 
 NAMESPACE_SC_BEGIN
 #define SLOT_SIZE 4
+#define SLOT 16
 // Identifier variable for the pass
 char InsertBaggyBoundsChecks::ID = 0;
 
@@ -84,10 +85,7 @@
                         
     unsigned char size = (unsigned char)ceil(log(i)/log(2));
     uintptr_t alignment = 1 << size; 
-    /*if(GV->getAlignment() && alignment %(GV->getAlignment())) { 
-     alignment = GV->getAlignment();
-    } */
-    if(alignment < 16) alignment = 16;
+    if(alignment < SLOT) alignment = SLOT;
     if(GV->getAlignment() > alignment) alignment = GV->getAlignment();
       if(i == alignment) {
         GV->setAlignment(alignment);
@@ -121,13 +119,13 @@
       AllocaInst *AI = cast<AllocaInst>(PeeledOperand);
       unsigned i = TD->getTypeAllocSize(AI->getAllocatedType());
       unsigned char size = (unsigned char)ceil(log(i)/log(2)); 
-      if(size < 4) {
-        size = 4;
+      if(size < SLOT_SIZE) {
+        size = SLOT_SIZE;
       }
       if(i == (unsigned)(1<<size)) {
         AI->setAlignment(1<<size);
-      } else if(size == 4) {
-        AI->setAlignment(16);
+      } else if(size == SLOT_SIZE) {
+        AI->setAlignment(SLOT);
       } else {
         BasicBlock::iterator InsertPt1 = AI;
         Instruction * iptI1 = ++InsertPt1;
@@ -142,7 +140,6 @@
         AI->replaceAllUsesWith(init);
         AI->removeFromParent(); 
         AI_new->setName(AI->getName());
-        //new AllocaInst(Int8Type->getPointerTo(), ConstantInt::get(Type::getInt32Ty(getGlobalContext()),((1<<size) - i)), "baggy."+AI->getName(), iptI1); 
       } 
     }
   }




More information about the sva-commits mailing list