Index: courgette/assembly_program.cc |
diff --git a/courgette/assembly_program.cc b/courgette/assembly_program.cc |
index f20ed67ea3fa3e6a462f7d99e49153b7eec3d22c..23d74859d57186e90749bf709a7b8910a9ae540c 100644 |
--- a/courgette/assembly_program.cc |
+++ b/courgette/assembly_program.cc |
@@ -217,28 +217,15 @@ Label* AssemblyProgram::FindRel32Label(RVA rva) { |
return rel32_label_manager_.Find(rva); |
} |
-Label* AssemblyProgram::InstructionAbs32Label( |
- const Instruction* instruction) const { |
- if (instruction->op() == ABS32) |
- return static_cast<const InstructionWithLabel*>(instruction)->label(); |
- return NULL; |
-} |
- |
-Label* AssemblyProgram::InstructionAbs64Label( |
- const Instruction* instruction) const { |
- if (instruction->op() == ABS64) |
- return static_cast<const InstructionWithLabel*>(instruction)->label(); |
- return NULL; |
-} |
- |
-Label* AssemblyProgram::InstructionRel32Label( |
- const Instruction* instruction) const { |
- if (instruction->op() == REL32 || instruction->op() == REL32ARM) { |
- Label* label = |
- static_cast<const InstructionWithLabel*>(instruction)->label(); |
- return label; |
+void AssemblyProgram::DispatchInstructionLabels( |
+ const AssemblyProgram::LabelDispatcherMap& dispatcher) const { |
+ for (const Instruction* instruction : instructions_) { |
+ LabelDispatcherMap::const_iterator it = dispatcher.find(instruction->op()); |
+ if (it != dispatcher.end()) { |
+ it->second.Run( |
+ static_cast<const InstructionWithLabel*>(instruction)->label()); |
+ } |
} |
- return NULL; |
} |
CheckBool AssemblyProgram::Emit(ScopedInstruction instruction) { |