47 MachineCheck(
"Common helper functionality for minimal opset checks.") {
66 for (
int i = 0; i < fuNav.
count(); i++) {
76 TCETools::CIStringSet::const_iterator first1 =
minimalOpSet_.begin();
77 TCETools::CIStringSet::const_iterator last1 =
minimalOpSet_.end();
79 TCETools::CIStringSet::iterator first2 = opSet.begin();
80 TCETools::CIStringSet::iterator last2 = opSet.end();
83 while (first1 != last1 && first2 != last2) {
84 if (*first1 < *first2) {
86 }
else if (*first2 < *first1) {
93 if (first1 != last1) {
114 for (
int i = 0; i < fuNav.
count(); i++) {
119 TCETools::CIStringSet::iterator first1 =
minimalOpSet_.begin();
122 TCETools::CIStringSet::iterator first2 = opSet.begin();
123 TCETools::CIStringSet::iterator last2 = opSet.end();
125 std::string eMsg =
"Operation missing from the minimal operation set: ";
127 bool errorsAdded =
false;
129 while (first1 != last1 && first2 != last2) {
130 if (*first1 < *first2) {
131 results.
addError(*
this, eMsg.append(*first1++));
133 }
else if (*first2 < *first1) {
140 while (first1 != last1) {
141 results.
addError(*
this, eMsg.append(*first1++));
161 const std::set<std::string>& ignoreFUName)
const {
167 for (
int i = 0; i < fuNav.
count(); i++) {
169 if (ignoreFUName.find(fu->
name()) == ignoreFUName.end()) {
179 TCETools::CIStringSet::const_iterator first1 =
minimalOpSet_.begin();
180 TCETools::CIStringSet::const_iterator last1 =
minimalOpSet_.end();
182 TCETools::CIStringSet::iterator first2 = opSet.begin();
183 TCETools::CIStringSet::iterator last2 = opSet.end();
186 while (first1 != last1 && first2 != last2) {
187 if (*first1 < *first2) {
189 }
else if (*first2 < *first1) {
196 if (first1 != last1) {
215 std::vector<std::string>& missingOps)
const {
221 for (
int i = 0; i < fuNav.
count(); i++) {
226 TCETools::CIStringSet::const_iterator first1 =
minimalOpSet_.begin();
227 TCETools::CIStringSet::const_iterator last1 =
minimalOpSet_.end();
229 TCETools::CIStringSet::iterator first2 = opSet.begin();
230 TCETools::CIStringSet::iterator last2 = opSet.end();
233 while (first1 != last1 && first2 != last2) {
234 if (*first1 < *first2) {
235 missingOps.push_back(*first1++);
236 }
else if (*first2 < *first1) {
243 while (first1 != last1) {
244 missingOps.push_back(*first1++);
256 bool deleteMach =
false;
265 for (
int i = 0; i < fuNav.
count(); i++) {
299 std::vector<std::string> missingOps;
302 if (missingOps.size() < 1) {
303 const std::string errorMessage =
"No missing operations found.";
305 __FILE__, __LINE__,
__func__, errorMessage);
314 std::set<std::string> fuAdded;
317 for (
unsigned int moi = 0; moi < missingOps.size(); ++moi) {
318 for (
int fui = 0; fui < fuNav.
count(); ++fui) {
321 if (fuAdded.end() != fuAdded.find(fu->
name())) {
324 fuAdded.insert(fu->
name());
336 return "Operations were added to fulfill minimal opset requirements.";
TTAMachine::Machine * machine
the architecture definition of the estimated processor
static std::string minimalADF()
void connectFUPort(TTAMachine::FUPort &port) const
void addError(const MachineCheck &check, const std::string &errorMsg)
virtual std::string fix(TTAMachine::Machine &machine) const
void missingOperations(const TTAMachine::Machine &machine, std::vector< std::string > &missingOps) const
virtual bool check(const TTAMachine::Machine &machine, MachineCheckResults &results) const
virtual ~MinimalOpSetCheck()
TCETools::CIStringSet minimalOpSet() const
TCETools::CIStringSet minimalOpSet_
virtual bool canFix(const TTAMachine::Machine &mach) const
void buildMinimalOpSet(const TTAMachine::Machine *machine=NULL)
bool checkWithIgnore(const TTAMachine::Machine &machine, const std::set< std::string > &ignoreFUName) const
virtual TCEString name() const
virtual void operationNames(TCETools::CIStringSet &opNames) const
virtual FUPort * operationPort(const std::string &name) const
virtual void unsetMachine()
virtual bool hasOperation(const std::string &name) const
virtual int operationPortCount() const
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
virtual void addFunctionUnit(FunctionUnit &unit)
static Machine * loadFromADF(const std::string &adfFileName)