Skip to content
Snippets Groups Projects
Commit dbbbddf8 authored by jdh8d's avatar jdh8d
Browse files

zipr/irdb optimizer support

Former-commit-id: 5b5f871b59e360fb3b1b9cbd40ef0efd039d8177
parent 615fff12
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ namespace EXEIO
class exeio_backend_t
{
public:
virtual ~exeio_backend_t() { }
virtual void dump_header(std::ostream& stream) =0;
virtual void dump_section_headers(std::ostream& stream) =0;
virtual void load(exeio_t* main, char* filename) =0;
......@@ -76,7 +77,7 @@ namespace EXEIO
// constructors
exeio_t() { Init(); }
exeio_t(char* filename) { Init(); load(filename); }
~exeio_t() { delete backend; }
virtual ~exeio_t() { delete backend; }
virtual void load(std::string filename) { load((char*)filename.c_str()); }
......
......@@ -46,6 +46,7 @@ class InstructionPredecessors_t
private:
virtual void AddPred(const Instruction_t* before, const Instruction_t* after);
virtual void AddPreds(const Instruction_t* before, const InstructionSet_t& after);
PredMap_t pred_map;
};
......
......@@ -29,6 +29,14 @@ using namespace std;
void InstructionPredecessors_t::AddPreds(const Instruction_t* before, const InstructionSet_t& afterset)
{
for(InstructionSet_t::const_iterator it=afterset.begin(); it!=afterset.end(); ++it)
{
pred_map[*it].insert((libIRDB::Instruction_t*)before);
}
}
void InstructionPredecessors_t::AddPred(const Instruction_t* before, const Instruction_t* after)
{
assert(before);
......@@ -50,6 +58,9 @@ void InstructionPredecessors_t::AddFile(const FileIR_t* firp2)
Instruction_t* insn=*it;
AddPred(insn, insn->GetTarget());
AddPred(insn, insn->GetFallthrough());
}
if(insn->GetIBTargets())
AddPreds(insn, *insn->GetIBTargets());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment