Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • opensrc/zipr-sdk
1 result
Show changes
Commits on Source (3)
*.swp
...@@ -8,119 +8,87 @@ namespace Zipr_SDK ...@@ -8,119 +8,87 @@ namespace Zipr_SDK
class Dollop_t; class Dollop_t;
class DollopManager_t; class DollopManager_t;
class DollopEntry_t;
using DollopEntryList_t = list<DollopEntry_t*>;
class Placeable_t class Placeable_t
{ {
public:
Placeable_t() : m_is_placed(false), m_placed_address(0) {}
void Place(RangeAddress_t place) {
assert(!m_is_placed);
m_is_placed = true;
m_placed_address = place;
};
RangeAddress_t getPlace() { return m_placed_address; }
bool isPlaced() const { return m_is_placed; }
protected: protected:
bool m_is_placed; Placeable_t() {}
RangeAddress_t m_placed_address; Placeable_t(const Placeable_t& copy) = delete;
public:
virtual void Place(RangeAddress_t place) = 0;
virtual RangeAddress_t getPlace() const = 0;
virtual bool isPlaced() const = 0;
friend ostream &operator<<(ostream &, const Placeable_t &); friend ostream &operator<<(ostream &, const Placeable_t &);
}; };
class DollopPatch_t : public Placeable_t class DollopPatch_t : virtual public Placeable_t
{ {
protected:
DollopPatch_t() { }
DollopPatch_t(const DollopPatch_t& copy) = delete;
public: public:
DollopPatch_t(Dollop_t *target) : m_target(target) {};
DollopPatch_t() : m_target(NULL) { };
Dollop_t *getTarget() const { return m_target; } virtual Dollop_t* getTarget() const = 0 ;
void setTarget(Dollop_t *target) { m_target = target; } virtual void setTarget(Dollop_t *target) = 0 ;
friend ostream &operator<<(ostream &, const DollopPatch_t &); friend ostream &operator<<(ostream &, const DollopPatch_t &);
private:
Dollop_t *m_target;
}; };
class DollopEntry_t : public Placeable_t class DollopEntry_t : virtual public Placeable_t
{ {
protected:
DollopEntry_t() { }
DollopEntry_t(const DollopEntry_t& copy) = delete;
public: public:
DollopEntry_t(IRDB_SDK::Instruction_t *insn, Dollop_t *member_of); virtual void setTargetDollop(Dollop_t *target) = 0 ;
IRDB_SDK::Instruction_t *getInstruction() const { return m_instruction; } virtual void MemberOfDollop(Dollop_t *member_of) = 0 ;
void setTargetDollop(Dollop_t *target) { m_target_dollop = target; }
Dollop_t *getTargetDollop() const { return m_target_dollop; } virtual Instruction_t* getInstruction() const = 0 ;
Dollop_t *getMemberOfDollop() const { return m_member_of_dollop; } virtual Dollop_t* getTargetDollop() const = 0 ;
void MemberOfDollop(Dollop_t *member_of) { m_member_of_dollop = member_of; } virtual Dollop_t* getMemberOfDollop() const = 0 ;
bool operator==(const DollopEntry_t &); virtual bool operator==(const DollopEntry_t &);
bool operator!=(const DollopEntry_t &); virtual bool operator!=(const DollopEntry_t &);
private:
IRDB_SDK::Instruction_t *m_instruction;
Dollop_t *m_target_dollop, *m_member_of_dollop;
friend ostream &operator<<(ostream &, const DollopEntry_t &); friend ostream &operator<<(ostream &, const DollopEntry_t &);
}; };
class Dollop_t : public Placeable_t, public list<DollopEntry_t*>
class Dollop_t : virtual public Placeable_t, virtual public DollopEntryList_t
{ {
protected:
Dollop_t() {}
Dollop_t(const Dollop_t& copy) = delete;
public: public:
static Dollop_t *createNewDollop(IRDB_SDK::Instruction_t *start,
DollopManager_t *mgr = NULL); virtual size_t getSize() const = 0;
virtual size_t getDollopEntryCount() const = 0;
Dollop_t(IRDB_SDK::Instruction_t *start, DollopManager_t *); virtual Dollop_t* getFallbackDollop() const = 0;
Dollop_t() : virtual Dollop_t* getFallthroughDollop() const = 0;
m_size(0), virtual bool isFallthroughPatched() const = 0;
m_fallthrough_dollop(NULL), virtual bool wasTruncated() const = 0;
m_fallback_dollop(NULL), virtual bool wasCoalesced() const = 0;
m_fallthrough_patched(false), virtual DollopEntry_t*
m_coalesced(false), getFallthroughDollopEntry(DollopEntry_t *) const = 0;
m_was_truncated(false),
m_dollop_mgr(NULL) {} virtual void setDollopManager(DollopManager_t *mgr) = 0;
virtual void setSize(size_t size) = 0;
void setDollopManager(DollopManager_t *mgr) { m_dollop_mgr = mgr; } virtual void setCoalesced(bool coalesced) = 0;
virtual void setFallthroughPatched(bool patched) = 0;
size_t getSize() const { virtual void setFallthroughDollop(Dollop_t *fallthrough) = 0;
return m_size; virtual void setFallbackDollop(Dollop_t *fallback) = 0;
} virtual void setTruncated(bool trunc) = 0;
void setSize(size_t size) {
m_size = size; virtual void reCalculateSize() = 0 ;
} virtual Dollop_t *split(Instruction_t *split_point) = 0 ;
virtual void removeDollopEntries(DollopEntryList_t::iterator, DollopEntryList_t::iterator) = 0;
size_t getDollopEntryCount() const {
return size();
}
Dollop_t *split(IRDB_SDK::Instruction_t *split_point);
void removeDollopEntries(list<DollopEntry_t*>::iterator,
list<DollopEntry_t*>::iterator);
void setFallbackDollop(Dollop_t *fallback) { m_fallback_dollop = fallback; }
Dollop_t *getFallbackDollop(void) const { return m_fallback_dollop; }
void setFallthroughDollop(Dollop_t *fallthrough) { m_fallthrough_dollop = fallthrough; }
Dollop_t *getFallthroughDollop(void) const { return m_fallthrough_dollop; }
bool isFallthroughPatched(void) const { return m_fallthrough_patched; }
void setFallthroughPatched(bool patched);
DollopEntry_t *setFallthroughDollopEntry(DollopEntry_t *) const;
void wasTruncated(bool truncated) { m_was_truncated = truncated; }
bool wasTruncated(void) const { return m_was_truncated; }
void setCoalesced(bool coalesced);
bool wasCoalesced(void) const { return m_coalesced; }
void reCalculateSize();
private:
size_t CalculateSize();
size_t m_size;
Dollop_t *m_fallthrough_dollop, *m_fallback_dollop;
bool m_fallthrough_patched;
bool m_coalesced;
bool m_was_truncated;
DollopManager_t *m_dollop_mgr;
friend ostream &operator<<(ostream &, const Dollop_t &); friend ostream &operator<<(ostream &, const Dollop_t &);
}; };
......
...@@ -12,33 +12,32 @@ namespace Zipr_SDK ...@@ -12,33 +12,32 @@ namespace Zipr_SDK
public: public:
// range operatations // range operatations
virtual void splitFreeRange(RangeAddress_t addr) = 0; virtual void splitFreeRange(RangeAddress_t addr) = 0;
virtual void splitFreeRange(Range_t range) = 0; virtual void splitFreeRange(Range_t range) = 0;
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 virtual RangeSet_t::iterator
findFreeRange(RangeAddress_t addr) = 0; 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 list<Range_t> getFreeRanges(size_t size = 0) = 0; virtual list<Range_t> getFreeRanges(size_t size = 0) = 0;
virtual RangeSetBounds_t virtual RangeSetBounds_t 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;
// queries about free areas. // queries about free areas.
virtual bool areBytesFree(RangeAddress_t addr, int num_bytes)=0; virtual bool areBytesFree(RangeAddress_t addr, int num_bytes) = 0;
virtual bool isByteFree(RangeAddress_t addr) = 0; virtual bool isByteFree(RangeAddress_t addr) = 0;
virtual bool isValidRange(RangeSet_t::iterator it) = 0; virtual bool isValidRange(RangeSet_t::iterator it) = 0;
virtual int getRangeCount() = 0; virtual int getRangeCount() = 0;
virtual void printMemorySpace(ostream &out) = 0; virtual void printMemorySpace(ostream &out) = 0;
virtual void plopBytes(RangeAddress_t addr, const char the_byte[], int num)=0; virtual void plopBytes(RangeAddress_t addr, const char the_byte[], int num) = 0;
virtual void plopByte(RangeAddress_t addr, char the_byte)=0; virtual void plopByte(RangeAddress_t addr, char the_byte) = 0;
virtual void plopJump(RangeAddress_t addr) = 0; virtual void plopJump(RangeAddress_t addr) = 0;
virtual RangeAddress_t getMinPlopped() const = 0; virtual RangeAddress_t getMinPlopped() const = 0;
virtual RangeAddress_t getMaxPlopped() const = 0; virtual RangeAddress_t getMaxPlopped() const = 0;
}; };
......
...@@ -11,36 +11,39 @@ namespace Zipr_SDK ...@@ -11,36 +11,39 @@ namespace Zipr_SDK
class Zipr_t class Zipr_t
{ {
protected:
Zipr_t() { }
Zipr_t(const Zipr_t& copy) = delete;
public: public:
/* /*
* These are public functions that the SDK user way want to use. * These are public functions that the SDK user way want to use.
*/ */
virtual size_t determineDollopEntrySize( virtual size_t determineDollopEntrySize(
DollopEntry_t*, DollopEntry_t*,
bool account_for_fallthrough) = 0; bool account_for_fallthrough) = 0;
virtual RangeAddress_t plopDollopEntry( virtual RangeAddress_t plopDollopEntry(
DollopEntry_t *, DollopEntry_t *,
RangeAddress_t = 0, RangeAddress_t = 0,
RangeAddress_t = 0) = 0; RangeAddress_t = 0) = 0;
virtual RangeAddress_t plopDollopEntryWithTarget( virtual RangeAddress_t plopDollopEntryWithTarget(
DollopEntry_t *, DollopEntry_t *,
RangeAddress_t = 0, RangeAddress_t = 0,
RangeAddress_t = 0) = 0; RangeAddress_t = 0) = 0;
virtual RangeAddress_t plopDollopEntryWithCallback( virtual RangeAddress_t plopDollopEntryWithCallback(
DollopEntry_t *, DollopEntry_t *,
RangeAddress_t = 0) = 0; RangeAddress_t = 0) = 0;
virtual MemorySpace_t *getMemorySpace()=0;
virtual IRDB_SDK::FileIR_t *getFileIR()=0;
virtual InstructionLocationMap_t *getLocationMap()=0;
virtual DollopManager_t *getDollopManager()=0;
virtual PlacementQueue_t* getPlacementQueue()=0;
virtual void applyPatch( virtual void applyPatch(
RangeAddress_t from_addr, RangeAddress_t from_addr,
RangeAddress_t to_addr)=0; RangeAddress_t to_addr) = 0;
virtual MemorySpace_t* getMemorySpace() = 0;
virtual IRDB_SDK::FileIR_t* getFileIR() = 0;
virtual InstructionLocationMap_t* getLocationMap() = 0;
virtual DollopManager_t* getDollopManager() = 0;
virtual PlacementQueue_t* getPlacementQueue() = 0;
}; };
......
...@@ -6,11 +6,11 @@ namespace Zipr_SDK ...@@ -6,11 +6,11 @@ namespace Zipr_SDK
using InstructionLocationMap_t = map<Instruction_t*,RangeAddress_t>; using InstructionLocationMap_t = map<Instruction_t*,RangeAddress_t>;
enum ZiprPreference using ZiprPreference_t = enum ZiprPreference
{ {
None, None,
Must, Must,
}; };
class ZiprPluginInterface_t class ZiprPluginInterface_t
{ {
...@@ -22,7 +22,7 @@ namespace Zipr_SDK ...@@ -22,7 +22,7 @@ namespace Zipr_SDK
virtual void doCallbackLinkingBegin() { } virtual void doCallbackLinkingBegin() { }
virtual void doCallbackLinkingEnd() { } virtual void doCallbackLinkingEnd() { }
virtual ZiprPreference addressDollop(const Dollop_t *dollop, const RangeAddress_t &source, Range_t &place, bool &coalesce, bool &fallthrough_ok) virtual ZiprPreference_t addressDollop(const Dollop_t *dollop, const RangeAddress_t &source, Range_t &place, bool &coalesce, bool &fallthrough_ok)
{ return None; } { return None; }
virtual bool willPluginPlop(Instruction_t*) virtual bool willPluginPlop(Instruction_t*)
...@@ -88,10 +88,10 @@ namespace Zipr_SDK ...@@ -88,10 +88,10 @@ namespace Zipr_SDK
virtual ZiprOptionsNamespace_t *registerOptions(ZiprOptionsNamespace_t *) virtual ZiprOptionsNamespace_t *registerOptions(ZiprOptionsNamespace_t *)
{ return new ZiprOptionsNamespace_t(""); } { return new ZiprOptionsNamespace_t(""); }
virtual ZiprPreference retargetPin(const RangeAddress_t &, const Dollop_t *, RangeAddress_t &) virtual ZiprPreference_t retargetPin(const RangeAddress_t &, const Dollop_t *, RangeAddress_t &)
{ return None; } { return None; }
virtual ZiprPreference retargetCallback(const RangeAddress_t &, const DollopEntry_t *, RangeAddress_t &) virtual ZiprPreference_t retargetCallback(const RangeAddress_t &, const DollopEntry_t *, RangeAddress_t &)
{ return None; } { return None; }
virtual RangeAddress_t doPlaceScoopsBegin(const RangeAddress_t max_addr) virtual RangeAddress_t doPlaceScoopsBegin(const RangeAddress_t max_addr)
......