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 {
class DollopEntry_t : public Placeable_t {
public:
DollopEntry_t(libIRDB::Instruction_t *insn, Dollop_t *member_of);
libIRDB::Instruction_t *Instruction() const { return m_instruction; }
DollopEntry_t(IRDB_SDK::Instruction_t *insn, Dollop_t *member_of);
IRDB_SDK::Instruction_t *Instruction() const { return m_instruction; }
void TargetDollop(Dollop_t *target) { m_target_dollop = target; }
Dollop_t *TargetDollop() const { return m_target_dollop; }
Dollop_t *MemberOfDollop() const { return m_member_of_dollop; }
......@@ -82,16 +82,16 @@ class DollopEntry_t : public Placeable_t {
bool operator!=(const DollopEntry_t &);
friend std::ostream &operator<<(std::ostream &, const DollopEntry_t &);
private:
libIRDB::Instruction_t *m_instruction;
IRDB_SDK::Instruction_t *m_instruction;
Dollop_t *m_target_dollop, *m_member_of_dollop;
};
class Dollop_t : public Placeable_t, public std::list<DollopEntry_t*> {
public:
static Dollop_t *CreateNewDollop(libIRDB::Instruction_t *start,
static Dollop_t *CreateNewDollop(IRDB_SDK::Instruction_t *start,
DollopManager_t *mgr = NULL);
Dollop_t(libIRDB::Instruction_t *start, DollopManager_t *);
Dollop_t(IRDB_SDK::Instruction_t *start, DollopManager_t *);
Dollop_t() :
m_size(0),
m_fallthrough_dollop(NULL),
......@@ -101,20 +101,20 @@ class Dollop_t : public Placeable_t, public std::list<DollopEntry_t*> {
m_was_truncated(false),
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;
}
void SetSize(size_t size) {
m_size = size;
}
size_t GetDollopEntryCount() const {
size_t getDollopEntryCount() const {
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,
std::list<DollopEntry_t*>::iterator);
......
......@@ -41,7 +41,7 @@ namespace Zipr_SDK {
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::map<Dollop_t*, DollopPatchList_t > DollopToDollopPatchListMap_t;
......@@ -60,7 +60,7 @@ class DollopManager_t {
/*
* 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.
......@@ -70,8 +70,8 @@ class DollopManager_t {
/*
* Return the dollop containing an instruction.
*/
virtual Zipr_SDK::Dollop_t *GetContainingDollop(
libIRDB::Instruction_t *insn)=0;
virtual Zipr_SDK::Dollop_t *getContainingDollop(
IRDB_SDK::Instruction_t *insn)=0;
/*
* Add a dollop patch to the dollop manager.
......
......@@ -48,11 +48,11 @@ class MemorySpace_t : public std::map<RangeAddress_t,char>
virtual void MergeFreeRange(RangeAddress_t addr)=0;
virtual void MergeFreeRange(Range_t range)=0;
virtual RangeSet_t::iterator FindFreeRange(RangeAddress_t addr)=0;
virtual Range_t GetFreeRange(int size)=0;
virtual Range_t GetInfiniteFreeRange()=0;
virtual std::list<Range_t> GetFreeRanges(size_t size = 0) = 0;
virtual Range_t getFreeRange(int size)=0;
virtual Range_t getInfiniteFreeRange()=0;
virtual std::list<Range_t> getFreeRanges(size_t size = 0) = 0;
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 RemoveFreeRange(Range_t newRange)=0;
virtual Range_t GetLargeRange(void)=0;
......
......@@ -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() : m_start(0), m_end(0) { }
virtual RangeAddress_t GetStart() const { return m_start; }
virtual RangeAddress_t GetEnd() const { return m_end; }
virtual RangeAddress_t getStart() const { return m_start; }
virtual RangeAddress_t getEnd() const { return m_end; }
virtual void SetStart(RangeAddress_t s) { m_start=s; }
virtual void SetEnd(RangeAddress_t e) { m_end=e; }
......@@ -72,7 +72,7 @@ struct Range_tCompare
{
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
RangeAddress_t = 0) = 0;
virtual MemorySpace_t *GetMemorySpace()=0;
virtual ELFIO::elfio *GetELFIO()=0;
virtual libIRDB::FileIR_t *GetFileIR()=0;
virtual ELFIO::elfio *getELFIO()=0;
virtual IRDB_SDK::FileIR_t *getFileIR()=0;
virtual InstructionLocationMap_t *GetLocationMap()=0;
virtual DollopManager_t *GetDollopManager()=0;
virtual DollopManager_t *getDollopManager()=0;
virtual PlacementQueue_t* GetPlacementQueue()=0;
virtual void ApplyPatch(
RangeAddress_t from_addr,
......
......@@ -33,7 +33,7 @@
#include <string>
#include <unistd.h>
#include <libIRDB-core.hpp>
#include <irdb-core>
#include <iostream>
#include <sstream>
......@@ -90,7 +90,7 @@ class ZiprOption_t
bool NeedsValue() {
return m_needs_value;
}
void SetTakesValue(bool takes_value) {
void setTakesValue(bool takes_value) {
m_takes_value = takes_value;
}
bool TakesValue() {
......@@ -112,7 +112,7 @@ class ZiprOption_t
}
void SetDescription(std::string description) {
void setDescription(std::string description) {
m_description = description;
}
......
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 {
None,
......@@ -35,12 +35,12 @@ class ZiprPluginInterface_t
return None;
}
virtual bool WillPluginPlop(libIRDB::Instruction_t*)
virtual bool WillPluginPlop(IRDB_SDK::Instruction_t*)
{
return false;
}
virtual size_t InsnSize(libIRDB::Instruction_t*, bool)
virtual size_t InsnSize(IRDB_SDK::Instruction_t*, bool)
{
return 0;
}
......
......@@ -40,7 +40,7 @@
// IRDB includes
#include <libIRDB-core.hpp>
#include <irdb-core>
// elfio includes
#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