示例#1
0
文件: ast.py 项目: sorinasandu/ixcode
    def toBB(self, BBlist, cBB):
        firstBB = Expression('if (%s)' % self._cond).toBB(BBlist, cBB)
        lastBB = BB()
        ignore = False

        if self._true:
            newBB = self._true.toBB(BBlist, firstBB)
            if newBB.is_ignored():
                ignore = True
            else:
                newBB.add_link(lastBB)

        if self._false:
            newBB = self._false.toBB(BBlist, firstBB)
            if newBB.is_ignored() and ignore:
                lastBB.set_ignore()
            else:
                newBB.add_link(lastBB)
        else:
            if ignore:
                lastBB.set_ignore()
            firstBB.add_link(lastBB)

        BBlist.append(lastBB)
        return lastBB
示例#2
0
文件: ast.py 项目: sorinasandu/ixcode
 def toBB(self, BBlist, cBB):
     if cBB.instrs():
         newBB = BB()
         newBB.add_instruction(self)
         cBB.add_link(newBB)
         BBlist.append(newBB)
         return newBB
     cBB.add_instruction(self)
     return cBB
示例#3
0
文件: ast.py 项目: sorinasandu/ixcode
    def toBB(self, BBlist, cBB):
        if not self.is_leader() or not cBB.instrs():
            cBB.add_instruction(self._text);
            return cBB

        newBB = BB();
        newBB.add_instruction(self._text);
        cBB.add_link(newBB)
        BBlist.append(newBB)
        return newBB
示例#4
0
 def toBB(self, Labellist, cBB):
     if not cBB:
         cBB = BB()
     if cBB.instrs():
         newBB = BB()
         newBB.add_instruction(self)
         cBB.add_link(newBB)
         return newBB
     cBB.add_instruction(self)
     return cBB
示例#5
0
    def toBB(self, Labellist, cBB):
        if not cBB:
            cBB = BB()

        if not self.is_leader() or not cBB.instrs():
            cBB.add_instruction(self)
            return cBB

        newBB = BB();
        newBB.add_instruction(self)
        cBB.add_link(newBB)
        return newBB
示例#6
0
    def toBB(self, Labellist, cBB):
        firstBB = Instruction.toBB(self, Labellist, cBB)
        lastBB = BB()

        if self._true:
            newBB = self._true.toBB(Labellist, firstBB)
            newBB.add_link(lastBB)

        if self._false:
            newBB = self._false.toBB(Labellist, firstBB)
            newBB.add_link(lastBB)
        else:
            firstBB.add_link(lastBB)

        return lastBB
示例#7
0
 def toBB(self, Labellist, cBB):
     cBB = Instruction.toBB(self, Labellist, cBB)
     lastBB = BB()
     cBB.add_link(lastBB)
     Labellist['%s' % self._label] = cBB
     return lastBB
示例#8
0
 def toBB(self, Labellist, cBB):
     cBB = Instruction.toBB(self, Labellist, cBB)
     lastBB = BB()
     cBB.add_link(lastBB)
     return lastBB
示例#9
0
    def toBB(self, Labellist, cBB):
        if not cBB:
            cBB = BB()

        if not self.is_leader() or not cBB.instrs():
            cBB.add_instruction(self)
            return cBB

        newBB = BB()
        newBB.add_instruction(self)
        cBB.add_link(newBB)
        return newBB
示例#10
0
 def toBB(self, Labellist, cBB):
     if not cBB:
         cBB = BB()
     if cBB.instrs():
         newBB = BB()
         newBB.add_instruction(self)
         cBB.add_link(newBB)
         return newBB
     cBB.add_instruction(self)
     return cBB