Пример #1
0
    def pruneBasicBlock(self, basicBlock):
        newNode = BasicBlock()
        newNode.blockType = basicBlock.blockType

        dontExpand = False
        dontExpandLevel = -1
        lastRowType = None

        for row in basicBlock.rows:
            rowType = row[0]
            rowLevel = row[3]
            if dontExpand:
                if rowLevel > dontExpandLevel:
                    continue
                else:
                    dontExpand = False

            if not self.pruneRow(row):
                rowAsString = self.row2StringConverter.convert(row)

                if len(
                        newNode.rows
                ) > 0 and lastRowType in self.mergeRows and rowType in self.mergeRows:
                    newNode.rows[-1] += (rowAsString)
                else:
                    newNode.rows.append(rowAsString)

            lastRowType = rowType

            if rowType in self.dontExpandNodes:
                dontExpand = True
                dontExpandLevel = rowLevel
        return newNode
Пример #2
0
 def pruneBasicBlock(self, basicBlock):
     newNode = BasicBlock()
     newNode.blockType = basicBlock.blockType
     
     dontExpand = False
     dontExpandLevel = -1
     lastRowType = None
     
     for row in basicBlock.rows:
         rowType = row[0]
         rowLevel = row[3]
         if dontExpand:
             if rowLevel > dontExpandLevel:
                 continue
             else:
                 dontExpand = False
         
         
         if not self.pruneRow(row):
             rowAsString = self.row2StringConverter.convert(row)   
             
             if len(newNode.rows) > 0 and lastRowType in self.mergeRows and rowType in self.mergeRows:
                     newNode.rows[-1] += (rowAsString)
             else:
                 newNode.rows.append(rowAsString)
         
         lastRowType = rowType
         
         if rowType in self.dontExpandNodes:
             dontExpand = True
             dontExpandLevel = rowLevel    
     return newNode
Пример #3
0
 def createAndConnectNode(self, row = None, conditionStr=None):
     newBasicBlock = BasicBlock(row)
     if row: newBasicBlock.blockType = row[0]
     newNodeId = self.currentCFG.addNode(newBasicBlock)
     self.currentCFG.addEdge(newNodeId - 1, newNodeId, conditionStr)