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
class Dollop_t;
class DollopManager_t;
class DollopEntry_t;
using DollopEntryList_t = list<DollopEntry_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:
bool m_is_placed;
RangeAddress_t m_placed_address;
Placeable_t() {}
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 &);
};
class DollopPatch_t : public Placeable_t
class DollopPatch_t : virtual public Placeable_t
{
protected:
DollopPatch_t() { }
DollopPatch_t(const DollopPatch_t& copy) = delete;
public:
DollopPatch_t(Dollop_t *target) : m_target(target) {};
DollopPatch_t() : m_target(NULL) { };
Dollop_t *getTarget() const { return m_target; }
void setTarget(Dollop_t *target) { m_target = target; }
virtual Dollop_t* getTarget() const = 0 ;
virtual void setTarget(Dollop_t *target) = 0 ;
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:
DollopEntry_t(IRDB_SDK::Instruction_t *insn, Dollop_t *member_of);
IRDB_SDK::Instruction_t *getInstruction() const { return m_instruction; }
void setTargetDollop(Dollop_t *target) { m_target_dollop = target; }
Dollop_t *getTargetDollop() const { return m_target_dollop; }
Dollop_t *getMemberOfDollop() const { return m_member_of_dollop; }
void MemberOfDollop(Dollop_t *member_of) { m_member_of_dollop = member_of; }
bool operator==(const DollopEntry_t &);
bool operator!=(const DollopEntry_t &);
private:
IRDB_SDK::Instruction_t *m_instruction;
Dollop_t *m_target_dollop, *m_member_of_dollop;
virtual void setTargetDollop(Dollop_t *target) = 0 ;
virtual void MemberOfDollop(Dollop_t *member_of) = 0 ;
virtual Instruction_t* getInstruction() const = 0 ;
virtual Dollop_t* getTargetDollop() const = 0 ;
virtual Dollop_t* getMemberOfDollop() const = 0 ;
virtual bool operator==(const DollopEntry_t &);
virtual bool operator!=(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:
static Dollop_t *createNewDollop(IRDB_SDK::Instruction_t *start,
DollopManager_t *mgr = NULL);
Dollop_t(IRDB_SDK::Instruction_t *start, DollopManager_t *);
Dollop_t() :
m_size(0),
m_fallthrough_dollop(NULL),
m_fallback_dollop(NULL),
m_fallthrough_patched(false),
m_coalesced(false),
m_was_truncated(false),
m_dollop_mgr(NULL) {}
void setDollopManager(DollopManager_t *mgr) { m_dollop_mgr = mgr; }
size_t getSize() const {
return m_size;
}
void setSize(size_t size) {
m_size = size;
}
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;
virtual size_t getSize() const = 0;
virtual size_t getDollopEntryCount() const = 0;
virtual Dollop_t* getFallbackDollop() const = 0;
virtual Dollop_t* getFallthroughDollop() const = 0;
virtual bool isFallthroughPatched() const = 0;
virtual bool wasTruncated() const = 0;
virtual bool wasCoalesced() const = 0;
virtual DollopEntry_t*
getFallthroughDollopEntry(DollopEntry_t *) const = 0;
virtual void setDollopManager(DollopManager_t *mgr) = 0;
virtual void setSize(size_t size) = 0;
virtual void setCoalesced(bool coalesced) = 0;
virtual void setFallthroughPatched(bool patched) = 0;
virtual void setFallthroughDollop(Dollop_t *fallthrough) = 0;
virtual void setFallbackDollop(Dollop_t *fallback) = 0;
virtual void setTruncated(bool trunc) = 0;
virtual void reCalculateSize() = 0 ;
virtual Dollop_t *split(Instruction_t *split_point) = 0 ;
virtual void removeDollopEntries(DollopEntryList_t::iterator, DollopEntryList_t::iterator) = 0;
friend ostream &operator<<(ostream &, const Dollop_t &);
};
......
......@@ -12,33 +12,32 @@ namespace Zipr_SDK
public:
// range operatations
virtual void splitFreeRange(RangeAddress_t addr) = 0;
virtual void splitFreeRange(Range_t range) = 0;
virtual void mergeFreeRange(RangeAddress_t addr) = 0;
virtual void mergeFreeRange(Range_t range) = 0;
virtual void splitFreeRange(RangeAddress_t addr) = 0;
virtual void splitFreeRange(Range_t range) = 0;
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 list<Range_t> getFreeRanges(size_t size = 0) = 0;
virtual RangeSetBounds_t
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;
findFreeRange(RangeAddress_t addr) = 0;
virtual Range_t getFreeRange(int size) = 0;
virtual Range_t getInfiniteFreeRange() = 0;
virtual list<Range_t> getFreeRanges(size_t size = 0) = 0;
virtual RangeSetBounds_t 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;
// queries about free areas.
virtual bool areBytesFree(RangeAddress_t addr, int num_bytes)=0;
virtual bool isByteFree(RangeAddress_t addr) = 0;
virtual bool isValidRange(RangeSet_t::iterator it) = 0;
virtual int getRangeCount() = 0;
virtual void printMemorySpace(ostream &out) = 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 plopJump(RangeAddress_t addr) = 0;
virtual RangeAddress_t getMinPlopped() const = 0;
virtual RangeAddress_t getMaxPlopped() const = 0;
virtual bool areBytesFree(RangeAddress_t addr, int num_bytes) = 0;
virtual bool isByteFree(RangeAddress_t addr) = 0;
virtual bool isValidRange(RangeSet_t::iterator it) = 0;
virtual int getRangeCount() = 0;
virtual void printMemorySpace(ostream &out) = 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 plopJump(RangeAddress_t addr) = 0;
virtual RangeAddress_t getMinPlopped() const = 0;
virtual RangeAddress_t getMaxPlopped() const = 0;
};
......
......@@ -11,36 +11,39 @@ namespace Zipr_SDK
class Zipr_t
{
protected:
Zipr_t() { }
Zipr_t(const Zipr_t& copy) = delete;
public:
/*
* These are public functions that the SDK user way want to use.
*/
virtual size_t determineDollopEntrySize(
DollopEntry_t*,
bool account_for_fallthrough) = 0;
bool account_for_fallthrough) = 0;
virtual RangeAddress_t plopDollopEntry(
DollopEntry_t *,
RangeAddress_t = 0,
RangeAddress_t = 0) = 0;
RangeAddress_t = 0) = 0;
virtual RangeAddress_t plopDollopEntryWithTarget(
DollopEntry_t *,
RangeAddress_t = 0,
RangeAddress_t = 0) = 0;
RangeAddress_t = 0) = 0;
virtual RangeAddress_t plopDollopEntryWithCallback(
DollopEntry_t *,
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;
RangeAddress_t = 0) = 0;
virtual void applyPatch(
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
using InstructionLocationMap_t = map<Instruction_t*,RangeAddress_t>;
enum ZiprPreference
{
None,
Must,
};
using ZiprPreference_t = enum ZiprPreference
{
None,
Must,
};
class ZiprPluginInterface_t
{
......@@ -22,7 +22,7 @@ namespace Zipr_SDK
virtual void doCallbackLinkingBegin() { }
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; }
virtual bool willPluginPlop(Instruction_t*)
......@@ -88,10 +88,10 @@ namespace Zipr_SDK
virtual ZiprOptionsNamespace_t *registerOptions(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; }
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; }
virtual RangeAddress_t doPlaceScoopsBegin(const RangeAddress_t max_addr)
......