Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonje committed Apr 17, 2013
1 parent 7f41743 commit e2e7173
Show file tree
Hide file tree
Showing 7 changed files with 457 additions and 494 deletions.
64 changes: 30 additions & 34 deletions assignment1/basic_block.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
class BasicBlock
attr_accessor :sucs, :preds, :instructions, :id, :visited, :topo_id, :postorder_id, :dom_processed, :idom

def initialize(insts, first, last)
@sucs = []
@preds = []
@instructions = []
for i in first..last
@instructions.push insts[i]
end
@visited = :unvisited
@dom_processed = false
@idom = self
end


def id
if @instructions.empty?
return -1
else
return instructions[0].id
end
end

def ignore
if @instructions.empty?
return false
else
return instructions[0].nop
end
end




attr_accessor :sucs, :preds, :instructions, :id, :visited, :topo_id, :postorder_id, :dom_processed, :idom

def initialize(insts, first, last)
@sucs = []
@preds = []
@instructions = []
for i in first..last
@instructions.push insts[i]
end
@visited = :unvisited
@dom_processed = false
@idom = self
end


def id
if @instructions.empty?
return -1
else
return instructions[0].id
end
end

def ignore
if @instructions.empty?
return false
else
return instructions[0].nop
end
end

end
Loading

0 comments on commit e2e7173

Please sign in to comment.