Skip to content
Snippets Groups Projects
Commit c5180e9a authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

refactoring first draft

parent da0e50c4
No related branches found
No related tags found
No related merge requests found
...@@ -71,8 +71,8 @@ class DollopPatch_t : public Placeable_t { ...@@ -71,8 +71,8 @@ class DollopPatch_t : public Placeable_t {
class DollopEntry_t : public Placeable_t { class DollopEntry_t : public Placeable_t {
public: public:
DollopEntry_t(libIRDB::Instruction_t *insn, Dollop_t *member_of); DollopEntry_t(IRDB_SDK::Instruction_t *insn, Dollop_t *member_of);
libIRDB::Instruction_t *Instruction() const { return m_instruction; } IRDB_SDK::Instruction_t *Instruction() const { return m_instruction; }
void TargetDollop(Dollop_t *target) { m_target_dollop = target; } void TargetDollop(Dollop_t *target) { m_target_dollop = target; }
Dollop_t *TargetDollop() const { return m_target_dollop; } Dollop_t *TargetDollop() const { return m_target_dollop; }
Dollop_t *MemberOfDollop() const { return m_member_of_dollop; } Dollop_t *MemberOfDollop() const { return m_member_of_dollop; }
...@@ -82,16 +82,16 @@ class DollopEntry_t : public Placeable_t { ...@@ -82,16 +82,16 @@ class DollopEntry_t : public Placeable_t {
bool operator!=(const DollopEntry_t &); bool operator!=(const DollopEntry_t &);
friend std::ostream &operator<<(std::ostream &, const DollopEntry_t &); friend std::ostream &operator<<(std::ostream &, const DollopEntry_t &);
private: private:
libIRDB::Instruction_t *m_instruction; IRDB_SDK::Instruction_t *m_instruction;
Dollop_t *m_target_dollop, *m_member_of_dollop; Dollop_t *m_target_dollop, *m_member_of_dollop;
}; };
class Dollop_t : public Placeable_t, public std::list<DollopEntry_t*> { class Dollop_t : public Placeable_t, public std::list<DollopEntry_t*> {
public: public:
static Dollop_t *CreateNewDollop(libIRDB::Instruction_t *start, static Dollop_t *CreateNewDollop(IRDB_SDK::Instruction_t *start,
DollopManager_t *mgr = NULL); DollopManager_t *mgr = NULL);
Dollop_t(libIRDB::Instruction_t *start, DollopManager_t *); Dollop_t(IRDB_SDK::Instruction_t *start, DollopManager_t *);
Dollop_t() : Dollop_t() :
m_size(0), m_size(0),
m_fallthrough_dollop(NULL), m_fallthrough_dollop(NULL),
...@@ -101,20 +101,20 @@ class Dollop_t : public Placeable_t, public std::list<DollopEntry_t*> { ...@@ -101,20 +101,20 @@ class Dollop_t : public Placeable_t, public std::list<DollopEntry_t*> {
m_was_truncated(false), m_was_truncated(false),
m_dollop_mgr(NULL) {} m_dollop_mgr(NULL) {}
void SetDollopManager(DollopManager_t *mgr) { m_dollop_mgr = mgr; } void setDollopManager(DollopManager_t *mgr) { m_dollop_mgr = mgr; }
size_t GetSize() const { size_t getSize() const {
return m_size; return m_size;
} }
void SetSize(size_t size) { void SetSize(size_t size) {
m_size = size; m_size = size;
} }
size_t GetDollopEntryCount() const { size_t getDollopEntryCount() const {
return size(); return size();
} }
Dollop_t *Split(libIRDB::Instruction_t *split_point); Dollop_t *Split(IRDB_SDK::Instruction_t *split_point);
void RemoveDollopEntries(std::list<DollopEntry_t*>::iterator, void RemoveDollopEntries(std::list<DollopEntry_t*>::iterator,
std::list<DollopEntry_t*>::iterator); std::list<DollopEntry_t*>::iterator);
......
...@@ -41,7 +41,7 @@ namespace Zipr_SDK { ...@@ -41,7 +41,7 @@ namespace Zipr_SDK {
typedef std::set<Dollop_t*> DollopList_t; typedef std::set<Dollop_t*> DollopList_t;
typedef std::map<libIRDB::Instruction_t*,Dollop_t*> InsnToDollopMap_t; typedef std::map<IRDB_SDK::Instruction_t*,Dollop_t*> InsnToDollopMap_t;
typedef std::list<DollopPatch_t*> DollopPatchList_t; typedef std::list<DollopPatch_t*> DollopPatchList_t;
typedef std::map<Dollop_t*, DollopPatchList_t > DollopToDollopPatchListMap_t; typedef std::map<Dollop_t*, DollopPatchList_t > DollopToDollopPatchListMap_t;
...@@ -60,7 +60,7 @@ class DollopManager_t { ...@@ -60,7 +60,7 @@ class DollopManager_t {
/* /*
* Create new dollops from a particular start instruction. * Create new dollops from a particular start instruction.
*/ */
virtual Zipr_SDK::Dollop_t *AddNewDollops(libIRDB::Instruction_t *start)=0; virtual Zipr_SDK::Dollop_t *AddNewDollops(IRDB_SDK::Instruction_t *start)=0;
/* /*
* Return the number of dollops under management. * Return the number of dollops under management.
...@@ -70,8 +70,8 @@ class DollopManager_t { ...@@ -70,8 +70,8 @@ class DollopManager_t {
/* /*
* Return the dollop containing an instruction. * Return the dollop containing an instruction.
*/ */
virtual Zipr_SDK::Dollop_t *GetContainingDollop( virtual Zipr_SDK::Dollop_t *getContainingDollop(
libIRDB::Instruction_t *insn)=0; IRDB_SDK::Instruction_t *insn)=0;
/* /*
* Add a dollop patch to the dollop manager. * Add a dollop patch to the dollop manager.
......
...@@ -48,11 +48,11 @@ class MemorySpace_t : public std::map<RangeAddress_t,char> ...@@ -48,11 +48,11 @@ class MemorySpace_t : public std::map<RangeAddress_t,char>
virtual void MergeFreeRange(RangeAddress_t addr)=0; virtual void MergeFreeRange(RangeAddress_t addr)=0;
virtual void MergeFreeRange(Range_t range)=0; virtual void MergeFreeRange(Range_t range)=0;
virtual RangeSet_t::iterator FindFreeRange(RangeAddress_t addr)=0; virtual RangeSet_t::iterator FindFreeRange(RangeAddress_t addr)=0;
virtual Range_t GetFreeRange(int size)=0; virtual Range_t getFreeRange(int size)=0;
virtual Range_t GetInfiniteFreeRange()=0; virtual Range_t getInfiniteFreeRange()=0;
virtual std::list<Range_t> GetFreeRanges(size_t size = 0) = 0; virtual std::list<Range_t> getFreeRanges(size_t size = 0) = 0;
virtual std::pair<RangeSet_t::const_iterator,RangeSet_t::const_iterator> virtual std::pair<RangeSet_t::const_iterator,RangeSet_t::const_iterator>
GetNearbyFreeRanges(const RangeAddress_t hint, size_t count = 0) = 0; getNearbyFreeRanges(const RangeAddress_t hint, size_t count = 0) = 0;
virtual void AddFreeRange(Range_t newRange)=0; virtual void AddFreeRange(Range_t newRange)=0;
virtual void RemoveFreeRange(Range_t newRange)=0; virtual void RemoveFreeRange(Range_t newRange)=0;
virtual Range_t GetLargeRange(void)=0; virtual Range_t GetLargeRange(void)=0;
......
...@@ -44,8 +44,8 @@ class Range_t ...@@ -44,8 +44,8 @@ class Range_t
Range_t(RangeAddress_t p_s, RangeAddress_t p_e) : m_start(p_s), m_end(p_e) { } Range_t(RangeAddress_t p_s, RangeAddress_t p_e) : m_start(p_s), m_end(p_e) { }
Range_t() : m_start(0), m_end(0) { } Range_t() : m_start(0), m_end(0) { }
virtual RangeAddress_t GetStart() const { return m_start; } virtual RangeAddress_t getStart() const { return m_start; }
virtual RangeAddress_t GetEnd() const { return m_end; } virtual RangeAddress_t getEnd() const { return m_end; }
virtual void SetStart(RangeAddress_t s) { m_start=s; } virtual void SetStart(RangeAddress_t s) { m_start=s; }
virtual void SetEnd(RangeAddress_t e) { m_end=e; } virtual void SetEnd(RangeAddress_t e) { m_end=e; }
...@@ -72,7 +72,7 @@ struct Range_tCompare ...@@ -72,7 +72,7 @@ struct Range_tCompare
{ {
bool operator() (const Range_t first, const Range_t second) const bool operator() (const Range_t first, const Range_t second) const
{ {
return first.GetEnd() < second.GetStart(); return first.getEnd() < second.getStart();
} }
}; };
......
...@@ -67,10 +67,10 @@ class Zipr_t ...@@ -67,10 +67,10 @@ class Zipr_t
RangeAddress_t = 0) = 0; RangeAddress_t = 0) = 0;
virtual MemorySpace_t *GetMemorySpace()=0; virtual MemorySpace_t *GetMemorySpace()=0;
virtual ELFIO::elfio *GetELFIO()=0; virtual ELFIO::elfio *getELFIO()=0;
virtual libIRDB::FileIR_t *GetFileIR()=0; virtual IRDB_SDK::FileIR_t *getFileIR()=0;
virtual InstructionLocationMap_t *GetLocationMap()=0; virtual InstructionLocationMap_t *GetLocationMap()=0;
virtual DollopManager_t *GetDollopManager()=0; virtual DollopManager_t *getDollopManager()=0;
virtual PlacementQueue_t* GetPlacementQueue()=0; virtual PlacementQueue_t* GetPlacementQueue()=0;
virtual void ApplyPatch( virtual void ApplyPatch(
RangeAddress_t from_addr, RangeAddress_t from_addr,
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <string> #include <string>
#include <unistd.h> #include <unistd.h>
#include <libIRDB-core.hpp> #include <irdb-core>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
...@@ -90,7 +90,7 @@ class ZiprOption_t ...@@ -90,7 +90,7 @@ class ZiprOption_t
bool NeedsValue() { bool NeedsValue() {
return m_needs_value; return m_needs_value;
} }
void SetTakesValue(bool takes_value) { void setTakesValue(bool takes_value) {
m_takes_value = takes_value; m_takes_value = takes_value;
} }
bool TakesValue() { bool TakesValue() {
...@@ -112,7 +112,7 @@ class ZiprOption_t ...@@ -112,7 +112,7 @@ class ZiprOption_t
} }
void SetDescription(std::string description) { void setDescription(std::string description) {
m_description = description; m_description = description;
} }
......
namespace Zipr_SDK namespace Zipr_SDK
{ {
typedef std::map<libIRDB::Instruction_t*,Zipr_SDK::RangeAddress_t> InstructionLocationMap_t; typedef std::map<IRDB_SDK::Instruction_t*,Zipr_SDK::RangeAddress_t> InstructionLocationMap_t;
enum ZiprPreference { enum ZiprPreference {
None, None,
...@@ -35,12 +35,12 @@ class ZiprPluginInterface_t ...@@ -35,12 +35,12 @@ class ZiprPluginInterface_t
return None; return None;
} }
virtual bool WillPluginPlop(libIRDB::Instruction_t*) virtual bool WillPluginPlop(IRDB_SDK::Instruction_t*)
{ {
return false; return false;
} }
virtual size_t InsnSize(libIRDB::Instruction_t*, bool) virtual size_t InsnSize(IRDB_SDK::Instruction_t*, bool)
{ {
return 0; return 0;
} }
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
// IRDB includes // IRDB includes
#include <libIRDB-core.hpp> #include <irdb-core>
// elfio includes // elfio includes
#include "elfio/elfio.hpp" #include "elfio/elfio.hpp"
......
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