51 #ifndef ETISS_INCLUDE_CODEPART_H_
52 #define ETISS_INCLUDE_CODEPART_H_
62 #include "etiss/jit/types.h"
85 inline RegisterPart(
const std::string &
name,
unsigned registerWidth, etiss::uintMax
bits = (uintMax)((intMax)-1))
89 for (
unsigned i = 0; i <
regWidth; i++)
91 mask |= ((uintMax)1) << i;
97 this->name = cpy.
name;
108 if (this->name != rp.
name)
113 std::cout <<
"Serve Warning: RegisterPart definitions exist with same name (=same register) but different "
114 "register width values"
126 if (this->name != rp.
name)
131 std::cout <<
"Serve Warning: RegisterPart definitions exist with same name (=same register) but different "
132 "register width values"
178 std::cout <<
"Serve Warning: RegisterPart definitions exist with same name (=same register) but different "
179 "register width values"
226 std::set<RegisterPart, lex_compare>::iterator iter =
set_.find(rp);
227 if (iter !=
set_.end())
243 inline void add(
const std::string &name,
unsigned registerWidth, etiss::uintMax bits = (uintMax)((intMax)-1))
252 std::set<RegisterPart, lex_compare>::iterator iter =
set_.begin();
253 std::set<RegisterPart, lex_compare>::const_iterator oiter;
254 while (iter !=
set_.end())
256 oiter = rs.
set_.find(*iter);
257 if (oiter != rs.
set_.end())
259 iter->applyShadow(*oiter);
281 std::set<RegisterPart, lex_compare>::const_iterator iter = rs.
set_.begin();
282 while (iter != rs.
set_.end())
293 std::set<RegisterPart, lex_compare>::iterator iter =
set_.begin();
294 while (iter !=
set_.end())
296 std::set<RegisterPart, lex_compare>::const_iterator f = rs.
set_.find(*iter);
297 if (f != rs.
set_.end())
320 std::set<RegisterPart, lex_compare>::const_iterator iter =
set_.begin();
321 while (iter !=
set_.end())
323 std::set<RegisterPart, lex_compare>::const_iterator f = rs.
set_.find(*iter);
324 if (f != rs.
set_.end())
337 std::set<RegisterPart, lex_compare>::const_iterator iter =
set_.begin();
338 while (iter !=
set_.end())
340 std::set<RegisterPart, lex_compare>::const_iterator oiter = rs.
set_.find(*iter);
341 if (oiter != rs.
set_.end())
343 if (!iter->maskedBy(*oiter))
363 std::stringstream ss;
364 std::set<RegisterPart, lex_compare>::const_iterator iter =
set_.begin();
365 while (iter !=
set_.end())
367 ss << iter->getName() <<
": " << std::hex << iter->getAffectedBits() <<
"\n";
374 std::set<RegisterPart, lex_compare>
set_;
417 inline const std::string &
code()
const {
return code_; }
497 std::cout <<
"ERROR: etiss::CodePart::append called with invalid etiss::CodePart::TYPE parameter"
526 std::cout <<
"ERROR: etiss::CodePart::prepend called with invalid etiss::CodePart::TYPE parameter"
606 void toCode(std::stringstream &out,
const std::string &funcname, std::set<std::string> *fileglobalcode);
general configuration and logging
equivalent of a translated instruction
const etiss::uint64 & getAddress()
void toCode(std::stringstream &out, const std::string &funcname, std::set< std::string > *fileglobalcode)
std::set< std::string > functionglobal_code
std::set< std::string > & functionglobalCode()
std::vector< Line > lines_
std::set< std::string > & fileglobalCode()
Line & append(etiss::uint64 addr)
etiss::uint64 endaddress_
Line & get(unsigned index)
CodeBlock(etiss::uint64 startindex)
etiss::uint64 startindex_
std::set< std::string > fileglobal_code
Contains a small code snipped.
const std::string & getCode() const
TYPE
defines position,optionality and the ability to return a code for a CodePart.
@ APPENDEDRETURNINGREQUIRED
@ PREINITIALDEBUGRETURNING
RegisterSet & getRegisterDependencies()
CodePart(const std::string &code, const RegisterSet ®isterDependencies=RegisterSet(), const RegisterSet &affectedRegisters=RegisterSet())
RegisterSet & getAffectedRegisters()
const std::string & code() const
const RegisterSet & getRegisterDependencies() const
const RegisterSet & getAffectedRegisters() const
RegisterSet registerDependencies_
RegisterSet affectedRegisters_
const bool & fullRegistersDependency() const
std::string toString(RegisterSet &ignored, bool &ok) const
writes the contained CodeParts as needed with respect to the given RegisterSet of bits that are not r...
std::list< CodePart > appretreq_parts_
std::list< CodePart > midopt_parts_
CodePart & append(CodePart::TYPE type)
std::list< CodePart > pindbgretreq_parts_
std::list< CodePart > appreq_parts_
CodeSet(const CodeSet &cs)
std::list< CodePart > inireq_parts_
void append(const CodePart &part, CodePart::TYPE type)
static void writeCodeParts(std::string &code, const std::list< CodePart > &parts, bool required, RegisterSet &ignored, bool intersect)
CodePart & prepend(CodePart::TYPE type)
std::list< CodePart > appopt_parts_
abstract description of needed or affected register bits.
void intersect(const RegisterPart &rp) const
this is not a const function in the usual sense.
RegisterPart(const RegisterPart &cpy)
const etiss::uintMax & getAffectedBits() const
bool contains(const RegisterPart &rp) const
check if passed RegisterPart is a subset of relevant bits of the same register
bool matches(const RegisterPart &rp) const
check for equality
void applyShadow(const RegisterPart &rp) const
this is not a const function in the usual sense.
void merge(const RegisterPart &rp) const
this is not a const function in the usual sense.
RegisterPart(const std::string &name, unsigned registerWidth, etiss::uintMax bits=(uintMax)((intMax) -1))
bool isEmpty() const
true if unnamed or no relevant bits
bool operator<(const RegisterPart &other) const
const unsigned & getRegisterWidth() const
bool maskedBy(const RegisterPart &rp) const
bool operator==(const RegisterPart &other) const
same as matches(const RegisterPart & other)
const std::string & getName() const
void add(const std::string &name, unsigned registerWidth, etiss::uintMax bits=(uintMax)((intMax) -1))
bool disjoint(const RegisterSet &rs) const
void applyShadow(const RegisterSet &rs)
any register bits set in the passed RegisterSet won't be set in this RegisterSet
void merge(const RegisterSet &rs)
any register bits set in the passed RegisterSet will be set in this RegisterSet (plus previously set ...
std::set< RegisterPart, lex_compare > set_
bool maskedBy(const RegisterSet &rs) const
void add(const RegisterPart &rp)
add a registerPart to the set or just its relevant bits if a register with the same name is already p...
RegisterSet(const RegisterSet &rs)
void intersect(const RegisterSet &rs)
only register bits set in this AND the passed RegisterSet remain set in this RegisterSet
std::string _dbg_print() const
writes a human readable string listing all set bit of every register in this RegisterSet
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
special comparison function that only takes register name into account.
bool operator()(const RegisterPart &lhs, const RegisterPart &rhs) const