34#ifndef TTA_TPEF_PROGRAM_FACTORY_HH
35#define TTA_TPEF_PROGRAM_FACTORY_HH
58 class InstructionTemplate;
65 class ImmediateElement;
134 HalfWord busId)
const;
138 HalfWord rfId)
const;
142 Byte immUnitId)
const;
146 HalfWord unitId, std::string tpefOpName =
"")
const;
151 std::string tpefOpName =
"",
152 int tpefOpIndex = 0)
const;
163 bool isInverted)
const;
197 HalfWord anUnitId, HalfWord anIndex) :
207 else if (
type_ > keyToCompare.
type_)
return false;
215 if (&
bus_ < &(keyToCompare.
bus_))
return true;
257 std::vector<SocketAllocation*> >& fixedSockets)
const;
262 std::vector<SocketAllocation*> >& fixedSockets)
const;
265 std::vector<SocketAllocation>& allocs)
const;
297 mutable std::map<const CacheKey, Terminal *>
cache_;
find Finds info of the inner loops in the program
Cache key for resources that are accessed from MOM(s)
TPEF::MoveElement::FieldType type_
Type of the accessed unit.
bool operator<(const CacheKey &keyToCompare) const
const TTAMachine::Bus & bus_
Bus that was used for transport.
TTAMachine::Socket::Direction direction_
Direction if the port was read or written.
HalfWord index_
Index of the corresponding TPEF resource element.
CacheKey(const TTAMachine::Bus &aBus, TTAMachine::Socket::Direction aDirection, TPEF::MoveElement::FieldType aType, HalfWord anUnitId, HalfWord anIndex)
HalfWord unitId_
unit id of the corresponding TPEF resource element.
std::vector< TPEF::ImmediateElement * > ImmediateVector
std::vector< TPEF::MoveElement * > MoveVector
const TTAMachine::Machine * machine_
Target machine of program.
TTAMachine::Bus & findBus(const TPEF::ResourceSection &resources, HalfWord busId) const
bool canDestinationBeAssigned(SocketAllocation &alloc, std::map< TTAMachine::Socket *, std::vector< SocketAllocation * > > &fixedSockets) const
std::string stringOfChunk(const TPEF::Chunk *chunk, const TPEF::Section *chunkOwner) const
std::map< HalfWord, SimValue * > InlineValues
bool canSourceBeAssigned(SocketAllocation &alloc, std::map< TTAMachine::Socket *, std::vector< SocketAllocation * > > &fixedSockets) const
TPEF::ASpaceElement * tpefInstrASpace_
Instruction address space element of TPEF.
TTAMachine::RegisterFile & findRegisterFile(const TPEF::ResourceSection &resources, HalfWord rfId) const
TTAMachine::AddressSpace & findAddressSpace(const TPEF::ASpaceElement *aSpace) const
std::set< HalfWord > allocatedBusses_
Busses that are already allocated by moves of current instruction.
void createDataRelocs(Program &prog)
std::string functionName(const TPEF::InstructionElement &instructionElement) const
std::map< ImmediateKey, TPEF::ImmediateElement * > ImmediateMap
const TPEF::Binary * binary_
Binary that is used for creating program.
TTAMachine::Guard & findGuard(const TPEF::ResourceSection &resources, TTAMachine::Bus &bus, TPEF::MoveElement::FieldType type, HalfWord unitId, HalfWord index, bool isInverted) const
bool isFunctionStart(const TPEF::InstructionElement &instructionElement) const
void createDataMemories(Program &prog)
std::list< std::shared_ptr< Immediate > > longInstructionImmediates_
Long immediates whose value terminals refers to instructions.
TTAMachine::ImmediateUnit & findImmediateUnit(const TPEF::ResourceSection &resources, Byte immUnitId) const
void seekFunctionStartPoints()
TTAMachine::AddressSpace * adfInstrASpace_
Instruction address space of machine.
void resolveSocketAllocations(std::vector< SocketAllocation > &allocs) const
TPEF::TPEFTools tpefTools_
TPEFTools object for helper functions.
std::map< const CacheKey, Terminal * > cache_
Cache map of terminals that are returned by different search parameters.
void addToCache(const CacheKey &key, Terminal *cachedTerm) const
virtual ~TPEFProgramFactory()
std::pair< Word, Word > ImmediateKey
Terminal * getFromCache(const CacheKey &key) const
void addProcedures(Program &program, const TTAMachine::AddressSpace &programASpace) const
TTAMachine::FunctionUnit & findFunctionUnit(const TPEF::ResourceSection &resources, HalfWord unitId, std::string tpefOpName="") const
void createLabels(Program &prog)
Instruction * createInstruction(const TPEF::ResourceSection &resources, MoveVector &moveElements, ImmediateVector &longImmediates, ImmediateMap &immElements) const
void clearResourceAllocations() const
Terminal * createTerminal(const TPEF::ResourceSection &resources, const TTAMachine::Bus *aBus, TTAMachine::Socket::Direction direction, TPEF::MoveElement::FieldType type, HalfWord unitId, HalfWord index, const ImmediateMap *immediateMap=NULL) const
TTAMachine::Port & findPort(const TTAMachine::Bus &bus, const TTAMachine::Unit &portParent, std::string tpefOpName="", int tpefOpIndex=0) const
UniversalMachine * universalMachine_
Universal machine of program.
std::map< TPEF::InstructionElement *, Instruction * > instructionMap_
Program instruction by TPEF instruction element.
TTAMachine::InstructionTemplate & findInstrTemplate(const TPEF::ResourceSection &resources, ImmediateVector &longImmediates, MoveVector &moves) const
std::list< std::shared_ptr< Move > > instructionImmediates_
Moves whose source terminals are addresses referring to instructions.
std::map< const TPEF::InstructionElement *, class FunctionStart * > functionStartPositions_
Stores information of start points of procedures that were found.
SocketAllocation(std::shared_ptr< Move > m, unsigned int anIndex)
std::shared_ptr< Move > move
std::vector< TTAMachine::Socket * > dstSocks
std::vector< TTAMachine::Socket * > srcSocks