std::string ContextGen::printable(const SourceMap& val) { Color col(getColorMode()); std::string ret; if(val.empty()) return "(empty map)"; else ret = "(map)"; for(SourceMap::const_iterator it = val.begin(); it != val.end(); ++it) { ret.append("\n * "); switch(it->second) { case LanguageAsssembler: ret.append(col.blue("[ASM] ")); break; case LanguageC: ret.append(col.blue("[ C ] ")); break; case LanguageCpp: ret.append(col.blue("[C++] ")); break; default: throw Exception("disallowed source file type found in %s: %d", it->first.get().c_str(), it->second); } ret.append(it->first.get()); } return ret; }
void MachineCopyPropagation::SourceNoLongerAvailable(unsigned Reg, SourceMap &SrcMap, DenseMap<unsigned, MachineInstr*> &AvailCopyMap) { for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) { SourceMap::iterator SI = SrcMap.find(*AI); if (SI != SrcMap.end()) { const DestList& Defs = SI->second; for (DestList::const_iterator I = Defs.begin(), E = Defs.end(); I != E; ++I) { unsigned MappedDef = *I; // Source of copy is no longer available for propagation. AvailCopyMap.erase(MappedDef); for (MCSubRegIterator SR(MappedDef, TRI); SR.isValid(); ++SR) AvailCopyMap.erase(*SR); } } } }
void Input::parse (ticpp::Element *element, SourceMap &sources) { /* get input properties */ std::string uri = element->GetAttribute ("source"); std::string semantic = element->GetAttribute ("semantic"); element->GetAttributeOrDefault ("offset", &mOffset, 0); mSemantic = parseSemantic (semantic); /* couldn't find input source */ if (sources.find (uri) == sources.end()) { std::string error = "Parsing failed: No source named '" + uri + "' found"; throw std::runtime_error (error.c_str()); } /* attach input to source */ mSource = sources[uri]; }