Inst buildCCall(Code& code, Value* origin, const Vector<Arg>& arguments) { Inst inst(Patch, origin, Arg::special(code.cCallSpecial())); inst.args.append(arguments[0]); inst.args.append(Tmp(GPRInfo::returnValueGPR)); inst.args.append(Tmp(GPRInfo::returnValueGPR2)); inst.args.append(Tmp(FPRInfo::returnValueFPR)); for (unsigned i = 1; i < arguments.size(); ++i) { Arg arg = arguments[i]; if (arg.isTmp()) inst.args.append(arg); } return inst; }
std::string CCopasiTimeVariable::isoFormat() const { std::stringstream Iso; bool first = true; if (mTime < LLONG_CONST(0)) { CCopasiTimeVariable Tmp(-mTime); Iso << "-"; Iso << Tmp.isoFormat(); return Iso.str(); } if (mTime >= LLONG_CONST(86400000000)) { Iso << LL2String(getDays()) << ":"; first = false; } if (mTime >= LLONG_CONST(3600000000)) Iso << LL2String(getHours(true), first ? 0 : 2) << ":"; if (mTime >= LLONG_CONST(60000000)) Iso << LL2String(getMinutes(true), first ? 0 : 2) << ":"; if (mTime >= LLONG_CONST(1000000)) Iso << LL2String(getSeconds(true), first ? 0 : 2) << "."; else Iso << "0."; Iso << LL2String(getMilliSeconds(true), 3) << LL2String(getMicroSeconds(true), 3); return Iso.str(); }
//--------------------------------------------------------- bool CPolygon_Intersection::Get_Intersection(CSG_Shapes *pShapes_A, CSG_Shapes *pShapes_B, int Mode) { CSG_Shape *pShape_A, *pShape_B, *pShape_AB; CSG_Shapes Tmp(SHAPE_TYPE_Polygon); m_Mode = Mode; pShape_A = Tmp.Add_Shape(); pShape_AB = Tmp.Add_Shape(); for(int iShape_A=0; iShape_A<pShapes_A->Get_Count() && Set_Progress(iShape_A, pShapes_A->Get_Count()); iShape_A++) { if( pShapes_B->Select(pShapes_A->Get_Shape(iShape_A)->Get_Extent()) ) { pShape_A = pShapes_A->Get_Shape(iShape_A); for(int iShape_B=0; iShape_B<pShapes_B->Get_Selection_Count(); iShape_B++) { pShape_B = pShapes_B->Get_Selection(iShape_B); if( GPC_Intersection(pShape_A, pShape_B, pShape_AB) ) { Add_Polygon(pShape_AB, iShape_A, pShape_B->Get_Index()); } } } } return( m_pShapes_AB->is_Valid() ); }
//--------------------------------------------------------- bool CSG_Matrix::Ins_Row(int iRow, double *Data) { if( iRow >= 0 && iRow <= m_ny ) { CSG_Matrix Tmp(*this); if( Create(Tmp.m_nx, Tmp.m_ny + 1) ) { for(int y=0, y_tmp=0; y<m_ny; y++) { if( y != iRow ) { memcpy(m_z[y], Tmp.m_z[y_tmp++], m_nx * sizeof(double)); } else if( Data ) { memcpy(m_z[y], Data, m_nx * sizeof(double)); } } return( true ); } } return( false ); }
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) { ListNode Tmp(-1); ListNode* p = &Tmp; ListNode *p1 = l1, *p2 = l2; for (; p1 != NULL&&p2 != NULL; ) { if (p1->val <= p2->val) { p->next = p1; p = p->next; p1 = p1->next; } else { p->next = p2; p = p->next; p2 = p2->next; } } if (p1 == NULL) { p->next = p2; } else { p->next = p1; } return Tmp.next; }
Tmp cCallResult(Type type) { switch (type) { case Void: return Tmp(); case Int32: case Int64: return Tmp(GPRInfo::returnValueGPR); case Float: case Double: return Tmp(FPRInfo::returnValueFPR); } RELEASE_ASSERT_NOT_REACHED(); return Tmp(); }
//--------------------------------------------------------- bool CSG_Matrix::Ins_Col(int iCol, double *Data) { if( iCol >= 0 && iCol <= m_nx ) { CSG_Matrix Tmp(*this); if( Create(Tmp.m_nx + 1, Tmp.m_ny) ) { for(int y=0; y<m_ny; y++) { double *pz = m_z[y], *pz_tmp = Tmp.m_z[y]; for(int x=0; x<m_nx; x++, pz++) { if( x != iCol ) { *pz = *pz_tmp; pz_tmp++; } else if( Data ) { *pz = Data[y]; } } } return( true ); } } return( false ); }
//--------------------------------------------------------- bool CSG_Matrix::Del_Row(int iRow) { if( m_ny == 1 ) { return( Destroy() ); } if( iRow >= 0 && iRow < m_ny ) { CSG_Matrix Tmp(*this); if( Create(Tmp.m_nx, Tmp.m_ny - 1) ) { for(int y=0, y_tmp=0; y_tmp<Tmp.m_ny; y_tmp++) { if( y_tmp != iRow ) { memcpy(m_z[y++], Tmp.m_z[y_tmp], m_nx * sizeof(double)); } } return( true ); } } return( false ); }
//--------------------------------------------------------- bool CSG_Matrix::Del_Col(int iCol) { if( m_nx == 1 ) { return( Destroy() ); } if( iCol >= 0 && iCol < m_nx ) { CSG_Matrix Tmp(*this); if( Create(Tmp.m_nx - 1, Tmp.m_ny) ) { for(int y=0; y<m_ny; y++) { double *pz = m_z[y], *pz_tmp = Tmp.m_z[y]; for(int x_tmp=0; x_tmp<Tmp.m_nx; x_tmp++, pz_tmp++) { if( x_tmp != iCol ) { *pz = *pz_tmp; pz++; } } } return( true ); } } return( false ); }
void wxsBitmapIconEditorDlg::OnTimer(cb_unused wxTimerEvent& event) { wxsBitmapIconData PreviewData; WriteData(PreviewData); wxSize PrevSize = Preview->GetSize(); wxBitmap Tmp(PrevSize.GetWidth(),PrevSize.GetHeight()); wxBitmap PreviewBmp = PreviewData.GetPreview(wxDefaultSize,DefaultClient); wxMemoryDC DC; DC.SelectObject(Tmp); DC.SetBrush(wxColour(0xC0,0xC0,0xC0)); DC.SetPen(wxColour(0xC0,0xC0,0xC0)); DC.DrawRectangle(0,0,PrevSize.GetWidth(),PrevSize.GetHeight()); if ( PreviewBmp.Ok() ) { wxSize BmpSize(PreviewBmp.GetWidth(),PreviewBmp.GetHeight()); int X = (PrevSize.GetWidth() - BmpSize.GetWidth() ) / 2; int Y = (PrevSize.GetHeight() - BmpSize.GetHeight()) / 2; if ( X < 0 ) X = 0; if ( Y < 0 ) Y = 0; DC.DrawBitmap(PreviewBmp,X,Y,true); } Preview->SetBitmap(Tmp); Preview->Refresh(); }
bool LineEditor::Write(const char *Path) { std::string Tmp(Path); Tmp += ".new"; std::ofstream out(Tmp.c_str()); if (!out.is_open()) { return false; } for (std::vector<std::string>::const_iterator p = impl->Lines.begin(), end = impl->Lines.end(); p != end; ++p) { out << *p << '\n'; if (!out) { break; } } out.close(); if (!out) { unlink(Tmp.c_str()); return false; } int ret = rename(Tmp.c_str(), Path); if (ret < 0) { unlink(Tmp.c_str()); return false; } return true; }
SymbolNameSet DynamicLibrarySearchGenerator:: operator()(JITDylib &JD, const SymbolNameSet &Names) { orc::SymbolNameSet Added; orc::SymbolMap NewSymbols; bool HasGlobalPrefix = (GlobalPrefix != '\0'); for (auto &Name : Names) { if ((*Name).empty()) continue; if (Allow && !Allow(Name)) continue; if (HasGlobalPrefix && (*Name).front() != GlobalPrefix) continue; std::string Tmp((*Name).data() + (HasGlobalPrefix ? 1 : 0), (*Name).size()); if (void *Addr = Dylib.getAddressOfSymbol(Tmp.c_str())) { Added.insert(Name); NewSymbols[Name] = JITEvaluatedSymbol( static_cast<JITTargetAddress>(reinterpret_cast<uintptr_t>(Addr)), JITSymbolFlags::Exported); } } // Add any new symbols to JD. Since the generator is only called for symbols // that are not already defined, this will never trigger a duplicate // definition error, so we can wrap this call in a 'cantFail'. if (!NewSymbols.empty()) cantFail(JD.define(absoluteSymbols(std::move(NewSymbols)))); return Added; }
Vec4D Vec4D::operator^(const Vec4D& v) const // Producto Cruz (el ultimo valor es 1) { Vec4D Tmp(coord[1]*v.coord[2] - v.coord[1]*coord[2], coord[2]*v.coord[0] - v.coord[2]*coord[0], coord[0]*v.coord[1] - v.coord[0]*coord[1], 1.f); return Tmp; }
bool CCallSpecial::isValid(Inst& inst) { if (inst.args.size() < argArgOffset) return false; for (unsigned i = 0; i < numCalleeArgs; ++i) { Arg& arg = inst.args[i + calleeArgOffset]; if (!arg.isGP()) return false; switch (arg.kind()) { case Arg::Imm: if (is32Bit()) break; return false; case Arg::Imm64: if (is64Bit()) break; return false; case Arg::Tmp: case Arg::Addr: case Arg::Stack: case Arg::CallArg: break; default: return false; } } // Return args need to be exact. if (inst.args[returnGPArgOffset + 0] != Tmp(GPRInfo::returnValueGPR)) return false; if (inst.args[returnGPArgOffset + 1] != Tmp(GPRInfo::returnValueGPR2)) return false; if (inst.args[returnFPArgOffset + 0] != Tmp(FPRInfo::returnValueFPR)) return false; for (unsigned i = argArgOffset; i < inst.args.size(); ++i) { if (!inst.args[i].isReg()) return false; if (inst.args[i] == Tmp(scratchRegister)) return false; } return true; }
//--------------------------------------------------------- bool CGW_Multi_Regression::Get_Predictors(void) { int i; CSG_Shapes *pPoints = Parameters("POINTS") ->asShapes(); CSG_Parameters *pAttributes = Parameters("PREDICTORS") ->asParameters(); m_nPredictors = 0; m_iPredictor = new int[pPoints->Get_Field_Count()]; for(i=0; i<pAttributes->Get_Count(); i++) { if( pAttributes->Get_Parameter(i)->asBool() ) { m_iPredictor[m_nPredictors++] = CSG_String(pAttributes->Get_Parameter(i)->Get_Identifier()).asInt(); } } CSG_Parameters *pGrids = Get_Parameters("GRID"), Tmp; Tmp.Assign(pGrids); pGrids->Create(this, Tmp.Get_Name(), Tmp.Get_Description(), Tmp.Get_Identifier(), false); m_Grid_Target.Add_Grid_Parameter(SG_T("QUALITY") , _TL("Quality") , false); m_Grid_Target.Add_Grid_Parameter(SG_T("INTERCEPT") , _TL("Intercept"), false); pGrids->Get_Parameter("QUALITY")->Get_Parent()->asGrid_System()->Assign(*Tmp("QUALITY")->Get_Parent()->asGrid_System()); pGrids->Get_Parameter("QUALITY") ->Set_Value(Tmp("QUALITY") ->asGrid()); pGrids->Get_Parameter("INTERCEPT")->Set_Value(Tmp("INTERCEPT")->asGrid()); for(i=0; i<m_nPredictors; i++) { m_Grid_Target.Add_Grid_Parameter(SG_Get_String(i, 0), CSG_String::Format(SG_T("%s [%s]"), _TL("Slope"), pPoints->Get_Field_Name(m_iPredictor[i])), false ); if( Tmp(SG_Get_String(i, 0)) ) { pGrids->Get_Parameter(SG_Get_String(i, 0))->Set_Value(Tmp(SG_Get_String(i, 0))->asGrid()); } } return( m_nPredictors > 0 ); }
int main() { { ConstructByValue cbv(Tmp(1)); std::cout << "------------------------" << std::endl; ConstructByCRef cbcr(Tmp(1)); std::cout << "------------------------" << std::endl; (void)cbv; (void)cbcr; } { const Tmp t(1); std::cout << "------------------------" << std::endl; ConstructByValue cbv(t); std::cout << "------------------------" << std::endl; ConstructByCRef cbcr(t); std::cout << "------------------------" << std::endl; (void)cbv; (void)cbcr; } }
bool CModelParameterSet::compareWithModel(const CModelParameter::Framework & framework) { if (mpModel == NULL) { return false; } CModelParameterSet Tmp("Current", mpModel); Tmp.createFromModel(); return (diff(Tmp, framework, true) == CModelParameter::Identical); }
Vector<Arg> computeCCallingConvention(Code& code, CCallValue* value) { Vector<Arg> result; result.append(Tmp(CCallSpecial::scratchRegister)); unsigned gpArgumentCount = 0; unsigned fpArgumentCount = 0; unsigned stackOffset = 0; for (unsigned i = 1; i < value->numChildren(); ++i) { result.append( marshallCCallArgument(gpArgumentCount, fpArgumentCount, stackOffset, value->child(i))); } code.requestCallArgAreaSizeInBytes(WTF::roundUpToMultipleOf(stackAlignmentBytes(), stackOffset)); return result; }
// parse: // 10:16, 16 Sep 2004 // 10:20, 2004 Sep 16 // 2005-07-07 20:30:35 // 23:24:07, 2005-07-10 // 9 July 2005 14:38 // 21:16, July 9, 2005 // 06:02, 10 July 2005 bool TStrUtil::GetTmFromStr(const char* TmStr, TSecTm& Tm) { static TStrV MonthV1, MonthV2; if (MonthV1.Empty()) { TStr("january|february|march|april|may|june|july|august|september|october|november|december").SplitOnAllCh('|', MonthV1); TStr("jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec").SplitOnAllCh('|', MonthV2); } TChA Tmp(TmStr); Tmp.ToLc(); TVec<char *> WrdV; const char* End = Tmp.CStr()+Tmp.Len(); int Col = -1, Cols=0; for (char *b = Tmp.CStr(); b <End; ) { WrdV.Add(b); while (*b && ! (*b==' ' || *b=='-' || *b==':' || *b==',')) { b++; } if (*b==':') { if(Col==-1) { Col=WrdV.Len(); } Cols++; } *b=0; b++; while (*b && (*b==' ' || *b=='-' || *b==':' || *b==',')) { b++; } } if (Cols == 2) { if (Col+1 >= WrdV.Len()) { return false; } WrdV.Del(Col+1); } if (Col<1) { return false; } const int Hr = atoi(WrdV[Col-1]); const int Min = atoi(WrdV[Col]); WrdV.Del(Col); WrdV.Del(Col-1); if (WrdV.Len() != 3) { return false; } int y=0,m=1,d=2, Mon=-1; if (TCh::IsAlpha(WrdV[0][0])) { y=2; m=0; d=1; } else if (TCh::IsAlpha(WrdV[1][0])) { y=2; m=1; d=0; } else if (TCh::IsAlpha(WrdV[2][0])) { y=0; m=2; d=1; } else { y=0; m=1; d=2; Mon = atoi(WrdV[m]); } int Day = atoi(WrdV[d]); if (Mon <= 0) { Mon = MonthV1.SearchForw(WrdV[m])+1; } if (Mon <= 0) { Mon = MonthV2.SearchForw(WrdV[m])+1; } if (Mon == 0) { return false; } int Year = atoi(WrdV[y]); if (Day > Year) { ::Swap(Day, Year); } //printf("%d-%02d-%02d %02d:%02d\n", Year, Mon, Day, Hr, Min); Tm = TSecTm(Year, Mon, Day, Hr, Min, 0); return true; }
bool CLinkMatrix::applyRowPivot(CMatrix< C_FLOAT64 > & matrix, const CVector< size_t > & pivots) const { if (matrix.numRows() < pivots.size()) { return false; } CVector< bool > Applied(pivots.size()); Applied = false; CVector< C_FLOAT64 > Tmp(matrix.numCols()); size_t i, imax = pivots.size(); size_t to; size_t from; size_t numCols = matrix.numCols(); for (i = 0; i < imax; i++) if (!Applied[i]) { to = i; from = pivots[to]; if (from != i) { memcpy(Tmp.array(), matrix[to], sizeof(C_FLOAT64) * numCols); while (from != i) { memcpy(matrix[to], matrix[from], sizeof(C_FLOAT64) * numCols); Applied[to] = true; to = from; from = pivots[to]; } memcpy(matrix[to], Tmp.array(), sizeof(C_FLOAT64) * numCols); } Applied[to] = true; } return true; }
/** * Deletes the last nCols columns. */ bool CSG_Matrix::Del_Cols(int nCols) { if( nCols > 0 && m_ny > 0 && nCols < m_nx ) { CSG_Matrix Tmp(*this); if( Create(Tmp.m_nx - nCols, Tmp.m_ny) ) { for(int y=0; y<Tmp.m_ny; y++) { memcpy(m_z[y], Tmp.m_z[y], m_nx * sizeof(double)); } return( true ); } } return( false ); }
inline SequenceSequenceT& iter_find( SequenceSequenceT& Result, RangeT& Input, FinderT Finder ) { BOOST_CONCEPT_ASSERT(( FinderConcept< FinderT, BOOST_STRING_TYPENAME range_iterator<RangeT>::type> )); iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(::geofeatures_boost::as_literal(Input)); typedef BOOST_STRING_TYPENAME range_iterator<RangeT>::type input_iterator_type; typedef find_iterator<input_iterator_type> find_iterator_type; typedef detail::copy_iterator_rangeF< BOOST_STRING_TYPENAME range_value<SequenceSequenceT>::type, input_iterator_type> copy_range_type; input_iterator_type InputEnd=::geofeatures_boost::end(lit_input); typedef transform_iterator<copy_range_type, find_iterator_type> transform_iter_type; transform_iter_type itBegin= ::geofeatures_boost::make_transform_iterator( find_iterator_type( ::geofeatures_boost::begin(lit_input), InputEnd, Finder ), copy_range_type()); transform_iter_type itEnd= ::geofeatures_boost::make_transform_iterator( find_iterator_type(), copy_range_type()); SequenceSequenceT Tmp(itBegin, itEnd); Result.swap(Tmp); return Result; }
void MAPIter(VecCl &Par,VecCl &MaxStep,MatrCl &DirMat,double &CurHi) { int Dim=DirMat.Dim(),k,i,k1,u; double Pos[4]={0,0.5,1,0}; double Hi[4],d;Hi[0]=CurHi; //double x=MAPHiFunc(Par);cout<<" External "<<x<<" Internal "<<CurHi<<" Dim "<<Dim<<"\n"; VecCl Step(Dim),Tmp(Dim);Tmp=MaxStep; for (int k0=1;k0<=Dim;k0++) { d=0;i=k0; for (k1=1;k1<=Dim;k1++) {if (fabs(Tmp[k1])>d) {i=k1;d=fabs(Tmp[k1]);}} k=i; if (fabs(MaxStep[k])>MathZer) { Step=MatrCl::GetCol(DirMat,k)*MaxStep[k]; Hi[2]=MAPHiFunc(Par+Step); u=0; while ((Hi[2]>Hi[0]) && (u<3)) {Step=Step*0.5;Hi[2]=MAPHiFunc(Par+Step);u++;} Hi[1]=MAPHiFunc(Par+Step*0.5); d=Hi[2]+Hi[0]-2*Hi[1]; if (fabs(d)>MathZer) d=1/d;else d=0; Pos[3]=((Hi[2]+3* Hi[0]-4*Hi[1])/4)*d; Hi[3]=MAPHiFunc(Par+Step*Pos[3]); i=0;d=Hi[0]; for (int k1=1;k1<=3;k1++) if (Hi[k1]<d) {i=k1;d=Hi[k1];} Par=Par+Step*Pos[i]; if ((fabs(Pos[i])<0.5) || (u!=0)) MaxStep[k]*=0.5; else MaxStep[k]*=Pos[i]; //cout<<" Posi "<<Pos[i]<<" k "<<k; //cout<<" dHi "<<Hi[0]-d<<" Hi "<<d<<"\n"; Hi[0]=d; } Tmp[k]=0; } //cout<<"\n"; // MaxStep=MaxStep*0.5; CurHi=Hi[0]; };
inline SequenceSequenceT& iter_find( SequenceSequenceT& Result, RangeT& Input, FinderT Finder ) { function_requires< FinderConcept<FinderT, BOOST_STRING_TYPENAME range_iterator<RangeT>::type> >(); iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(as_literal(Input)); typedef BOOST_STRING_TYPENAME range_iterator<RangeT>::type input_iterator_type; typedef find_iterator<input_iterator_type> find_iterator_type; typedef detail::copy_iterator_rangeF< BOOST_STRING_TYPENAME range_value<SequenceSequenceT>::type, input_iterator_type> copy_range_type; input_iterator_type InputEnd=end(lit_input); typedef transform_iterator<copy_range_type, find_iterator_type> transform_iter_type; transform_iter_type itBegin= make_transform_iterator( find_iterator_type( begin(lit_input), InputEnd, Finder ), copy_range_type()); transform_iter_type itEnd= make_transform_iterator( find_iterator_type(), copy_range_type()); SequenceSequenceT Tmp(itBegin, itEnd); Result.swap(Tmp); return Result; }
bool CMathObject::compileFlux(CMathContainer & container) { bool success = true; // The default value is NaN *mpValue = InvalidValue; // Reset the prerequisites mPrerequisites.clear(); const CReaction * pReaction = static_cast< const CReaction * >(mpDataObject->getObjectParent()); // We need to check whether this reaction is a single compartment reaction and scale it if true. // mFlux = *mScalingFactor * mpFunction->calcValue(mMap.getPointers()); // mScalingFactor = compartment volume or 1 pdelete(mpExpression); mpExpression = new CMathExpression(*pReaction->getFunction(), pReaction->getCallParameters(), container, !mIsInitialValue); if (pReaction->getScalingCompartment() != NULL && pReaction->getEffectiveKineticLawUnitType() == CReaction::ConcentrationPerTime) { CExpression Tmp(mpExpression->getObjectName(), &container); std::string Infix = pointerToString(container.getMathObject(pReaction->getScalingCompartment()->getValueReference())->getValuePointer()) + "*(" + mpExpression->getInfix() + ")"; success &= Tmp.setInfix(Infix); success &= Tmp.compile(); pdelete(mpExpression); mpExpression = new CMathExpression(Tmp, container, false); } compileExpression(); return success; }
bool CMathObject::compileFlux(CMathContainer & container) { bool success = true; // The default value is NaN *mpValue = InvalidValue; // Reset the prerequisites mPrerequisites.clear(); const CReaction * pReaction = static_cast< const CReaction * >(mpDataObject->getObjectParent()); // We need to check whether this reaction is a single compartment reaction and scale it if true. // mFlux = *mScalingFactor * mpFunction->calcValue(mMap.getPointers()); // mScalingFactor = compartment volume or 1 mpExpression = new CMathExpression(*pReaction->getFunction(), pReaction->getCallParameters(), container, !mIsInitialValue); std::set< const CCompartment * > Compartments = pReaction->getChemEq().getCompartments(); if (Compartments.size() == 1) { CExpression Tmp(mpExpression->getObjectName(), &container); std::string Infix = "<" + (*Compartments.begin())->getValueReference()->getCN() + ">*(" + mpExpression->getInfix() + ")"; success &= Tmp.setInfix(Infix); success &= Tmp.compile(); pdelete(mpExpression); mpExpression = new CMathExpression(Tmp, container, false); } compileExpression(); return success; }
//--------------------------------------------------------- bool CPolygon_Intersection::Get_Difference(CSG_Shapes *pShapes_A, CSG_Shapes *pShapes_B, int Mode) { CSG_Shape *pShape_A; CSG_Shapes Tmp(SHAPE_TYPE_Polygon); m_Mode = Mode; pShape_A = Tmp.Add_Shape(); for(int iShape_A=0; iShape_A<pShapes_A->Get_Count() && Set_Progress(iShape_A, pShapes_A->Get_Count()); iShape_A++) { if( pShapes_B->Select(pShapes_A->Get_Shape(iShape_A)->Get_Extent()) ) { int nIntersections = 0; pShape_A->Assign(pShapes_A->Get_Shape(iShape_A)); for(int iShape_B=0; iShape_B<pShapes_B->Get_Selection_Count(); iShape_B++) { if( GPC_Difference(pShape_A, pShapes_B->Get_Selection(iShape_B)) ) { nIntersections++; } } if( nIntersections && pShape_A->is_Valid() ) { Add_Polygon(pShape_A, iShape_A); } } else { Add_Polygon(pShapes_A->Get_Shape(iShape_A), iShape_A); } } return( m_pShapes_AB->is_Valid() ); }
int perf() { int Error = 0; std::size_t const Count(100000000); { std::vector<int> Result; Result.resize(Count); std::clock_t Begin = clock(); for(int i = 0; i < static_cast<int>(Count); ++i) Result[i] = glm::log2(static_cast<int>(i)); std::clock_t End = clock(); printf("glm::log2<int>: %ld clocks\n", End - Begin); } { std::vector<glm::ivec4> Result; Result.resize(Count); std::clock_t Begin = clock(); for(int i = 0; i < static_cast<int>(Count); ++i) Result[i] = glm::log2(glm::ivec4(i)); std::clock_t End = clock(); printf("glm::log2<ivec4>: %ld clocks\n", End - Begin); } # if GLM_HAS_BITSCAN_WINDOWS { std::vector<glm::ivec4> Result; Result.resize(Count); std::clock_t Begin = clock(); for(std::size_t i = 0; i < Count; ++i) { glm::tvec4<unsigned long, glm::defaultp> Tmp(glm::uninitialize); _BitScanReverse(&Tmp.x, i); _BitScanReverse(&Tmp.y, i); _BitScanReverse(&Tmp.z, i); _BitScanReverse(&Tmp.w, i); Result[i] = glm::ivec4(Tmp); } std::clock_t End = clock(); printf("glm::log2<ivec4> inlined: %ld clocks\n", End - Begin); } { std::vector<glm::tvec4<unsigned long, glm::defaultp> > Result; Result.resize(Count); std::clock_t Begin = clock(); for(std::size_t i = 0; i < Count; ++i) { _BitScanReverse(&Result[i].x, i); _BitScanReverse(&Result[i].y, i); _BitScanReverse(&Result[i].z, i); _BitScanReverse(&Result[i].w, i); } std::clock_t End = clock(); printf("glm::log2<ivec4> inlined no cast: %ld clocks\n", End - Begin); } { std::vector<glm::ivec4> Result; Result.resize(Count); std::clock_t Begin = clock(); for(std::size_t i = 0; i < Count; ++i) { _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].x), i); _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].y), i); _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].z), i); _BitScanReverse(reinterpret_cast<unsigned long*>(&Result[i].w), i); } std::clock_t End = clock(); printf("glm::log2<ivec4> reinterpret: %ld clocks\n", End - Begin); } # endif//GLM_HAS_BITSCAN_WINDOWS { std::vector<float> Result; Result.resize(Count); std::clock_t Begin = clock(); for(std::size_t i = 0; i < Count; ++i) Result[i] = glm::log2(static_cast<float>(i)); std::clock_t End = clock(); printf("glm::log2<float>: %ld clocks\n", End - Begin); } { std::vector<glm::vec4> Result; Result.resize(Count); std::clock_t Begin = clock(); for(int i = 0; i < static_cast<int>(Count); ++i) Result[i] = glm::log2(glm::vec4(i)); std::clock_t End = clock(); printf("glm::log2<vec4>: %ld clocks\n", End - Begin); } return Error; }
bool CFitProblem::calculateStatistics(const C_FLOAT64 & factor, const C_FLOAT64 & resolution) { // Set the current values to the solution values. unsigned C_INT32 i, imax = mSolutionVariables.size(); unsigned C_INT32 j, jmax = mExperimentDependentValues.size(); unsigned C_INT32 l; mRMS = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD.resize(imax); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mFisher = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mGradient.resize(imax); mGradient = std::numeric_limits<C_FLOAT64>::quiet_NaN(); // Recalcuate the best solution. for (i = 0; i < imax; i++) (*mUpdateMethods[i])(mSolutionVariables[i]); mStoreResults = true; calculate(); // Keep the results CVector< C_FLOAT64 > DependentValues = mExperimentDependentValues; if (mSolutionValue == mInfinity) return false; // The statistics need to be calculated for the result, i.e., now. mpExperimentSet->calculateStatistics(); if (jmax) mRMS = sqrt(mSolutionValue / jmax); if (jmax > imax) mSD = sqrt(mSolutionValue / (jmax - imax)); mHaveStatistics = true; CMatrix< C_FLOAT64 > dyp; bool CalculateFIM = true; try { dyp.resize(imax, jmax); } catch (CCopasiException Exception) { CalculateFIM = false; } C_FLOAT64 Current; C_FLOAT64 Delta; // Calculate the gradient for (i = 0; i < imax; i++) { Current = mSolutionVariables[i]; if (fabs(Current) > resolution) { (*mUpdateMethods[i])(Current *(1.0 + factor)); Delta = 1.0 / (Current * factor); } else { (*mUpdateMethods[i])(resolution); Delta = 1.0 / resolution; } calculate(); mGradient[i] = (mCalculateValue - mSolutionValue) * Delta; if (CalculateFIM) for (j = 0; j < jmax; j++) dyp(i, j) = (mExperimentDependentValues[j] - DependentValues[j]) * Delta; // Restore the value (*mUpdateMethods[i])(Current); } // This is necessary so that CExperiment::printResult shows the correct data. calculate(); mStoreResults = false; if (!CalculateFIM) { // Make sure the timer is acurate. (*mCPUTime.getRefresh())(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 13); return false; } // Construct the fisher information matrix for (i = 0; i < imax; i++) for (l = 0; l <= i; l++) { C_FLOAT64 & tmp = mFisher(i, l); tmp = 0.0; for (j = 0; j < jmax; j++) tmp += dyp(i, j) * dyp(l, j); tmp *= 2.0; if (l != i) mFisher(l, i) = tmp; } mCorrelation = mFisher; #ifdef XXXX /* int dgetrf_(integer *m, * integer *n, * doublereal *a, * integer * lda, * integer *ipiv, * integer *info) * * Purpose * ======= * * DGETRF computes an LU factorization of a general M-by-N matrix A * using partial pivoting with row interchanges. * * The factorization has the form * A = P * L * U * where P is a permutation matrix, L is lower triangular with unit * diagonal elements (lower trapezoidal if m > n), and U is upper * triangular (upper trapezoidal if m < n). * * This is the right-looking Level 3 BLAS version of the algorithm. * * Arguments * ========= * * m (input) INTEGER * The number of rows of the matrix A. m >= 0. * * n (input) INTEGER * The number of columns of the matrix A. n >= 0. * * a (input/output) DOUBLE PRECISION array, dimension (lda,n) * On entry, the m by n matrix to be factored. * On exit, the factors L and U from the factorization * A = P*L*U; the unit diagonal elements of L are not stored. * * lda (input) INTEGER * The leading dimension of the array A. lda >= max(1,m). * * ipiv (output) INTEGER array, dimension (min(m,n)) * The pivot indices; for 1 <= i <= min(m,n), row i of the * matrix was interchanged with row ipiv(i). * * info (output) INTEGER * = 0: successful exit * < 0: if info = -k, the k-th argument had an illegal value * > 0: if info = k, U(k,k) is exactly zero. The factorization * has been completed, but the factor U is exactly * singular, and division by zero will occur if it is used * to solve a system of equations. */ C_INT info = 0; C_INT N = imax; CVector< C_INT > ipiv(imax); dgetrf_(&N, &N, mCorrelation.array(), &N, ipiv.array(), &info); if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 1, info); return false; } /* dgetri_(integer *n, doublereal *a, integer *lda, integer *ipiv, * doublereal *work, integer *lwork, integer *info); * * * Purpose * ======= * * DGETRI computes the inverse of a matrix using the LU factorization * computed by DGETRF. * * This method inverts U and then computes inv(A) by solving the system * inv(A)*L = inv(U) for inv(A). * * Arguments * ========= * * N (input) INTEGER * The order of the matrix A. N >= 0. * * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) * On entry, the factors L and U from the factorization * A = P*L*U as computed by DGETRF. * On exit, if INFO = 0, the inverse of the original matrix A. * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,N). * * IPIV (input) INTEGER array, dimension (N) * The pivot indices from DGETRF; for 1<=i<=N, row i of the * matrix was interchanged with row IPIV(i). * * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK)) * On exit, if INFO=0, then WORK(1) returns the optimal LWORK. * * LWORK (input) INTEGER * The dimension of the array WORK. LWORK >= max(1,N). * For optimal performance LWORK >= N*NB, where NB is * the optimal blocksize returned by ILAENV. * * If LWORK = -1, then a workspace query is assumed; the routine * only calculates the optimal size of the WORK array, returns * this value as the first entry of the WORK array, and no error * message related to LWORK is issued by XERBLA. * * INFO (output) INTEGER * = 0: successful exit * < 0: if INFO = -i, the i-th argument had an illegal value * > 0: if INFO = i, U(i,i) is exactly zero; the matrix is * singular and its inverse could not be computed. * */ C_INT lwork = -1; // Instruct dgesvd_ to determine work array size. CVector< C_FLOAT64 > work; work.resize(1); dgetri_(&N, mCorrelation.array(), &N, ipiv.array(), work.array(), &lwork, &info); if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 1, info); return false; } lwork = (C_INT) work[0]; work.resize(lwork); dgetri_(&N, mCorrelation.array(), &N, ipiv.array(), work.array(), &lwork, &info); if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 1, info); return false; } #endif // XXXX // The Fisher Information matrix is a symmetric positive semidefinit matrix. /* int dpotrf_(char *uplo, integer *n, doublereal *a, * integer *lda, integer *info); * * * Purpose * ======= * * DPOTRF computes the Cholesky factorization of a real symmetric * positive definite matrix A. * * The factorization has the form * A = U**T * U, if UPLO = 'U', or * A = L * L**T, if UPLO = 'L', * where U is an upper triangular matrix and L is lower triangular. * * This is the block version of the algorithm, calling Level 3 BLAS. * * Arguments * ========= * * UPLO (input) CHARACTER*1 * = 'U': Upper triangle of A is stored; * = 'L': Lower triangle of A is stored. * * N (input) INTEGER * The order of the matrix A. N >= 0. * * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) * On entry, the symmetric matrix A. If UPLO = 'U', the leading * N-by-N upper triangular part of A contains the upper * triangular part of the matrix A, and the strictly lower * triangular part of A is not referenced. If UPLO = 'L', the * leading N-by-N lower triangular part of A contains the lower * triangular part of the matrix A, and the strictly upper * triangular part of A is not referenced. * * On exit, if INFO = 0, the factor U or L from the Cholesky * factorization A = U**T*U or A = L*L**T. * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,N). * * INFO (output) INTEGER * = 0: successful exit * < 0: if INFO = -i, the i-th argument had an illegal value * > 0: if INFO = i, the leading minor of order i is not * positive definite, and the factorization could not be * completed. * */ char U = 'U'; C_INT info = 0; C_INT N = imax; dpotrf_(&U, &N, mCorrelation.array(), &N, &info); if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 12); return false; } /* int dpotri_(char *uplo, integer *n, doublereal *a, * integer *lda, integer *info); * * * Purpose * ======= * * DPOTRI computes the inverse of a real symmetric positive definite * matrix A using the Cholesky factorization A = U**T*U or A = L*L**T * computed by DPOTRF. * * Arguments * ========= * * UPLO (input) CHARACTER*1 * = 'U': Upper triangle of A is stored; * = 'L': Lower triangle of A is stored. * * N (input) INTEGER * The order of the matrix A. N >= 0. * * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) * On entry, the triangular factor U or L from the Cholesky * factorization A = U**T*U or A = L*L**T, as computed by * DPOTRF. * On exit, the upper or lower triangle of the (symmetric) * inverse of A, overwriting the input factor U or L. * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,N). * * INFO (output) INTEGER * = 0: successful exit * < 0: if INFO = -i, the i-th argument had an illegal value * > 0: if INFO = i, the (i,i) element of the factor U or L is * zero, and the inverse could not be computed. * */ dpotri_(&U, &N, mCorrelation.array(), &N, &info); if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 1, info); return false; } // Assure that the inverse is completed. for (i = 0; i < imax; i++) for (l = 0; l < i; l++) mCorrelation(l, i) = mCorrelation(i, l); CVector< C_FLOAT64 > S(imax); #ifdef XXXX // We invert the Fisher information matrix with the help of singular // value decomposition. /* int dgesvd_(char *jobu, char *jobvt, integer *m, integer *n, * doublereal *a, integer *lda, doublereal *s, doublereal *u, * integer *ldu, doublereal *vt, integer *ldvt, * doublereal *work, integer *lwork, integer *info); * * * Purpose * ======= * * DGESVD computes the singular value decomposition (SVD) of a real * M-by-N matrix A, optionally computing the left and/or right singular * vectors. The SVD is written * * A = U * SIGMA * transpose(V) * * where SIGMA is an M-by-N matrix which is zero except for its * min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and * V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA * are the singular values of A; they are real and non-negative, and * are returned in descending order. The first min(m,n) columns of * U and V are the left and right singular vectors of A. * * Note that the routine returns V**T, not V. * * Arguments * ========= * * JOBU (input) CHARACTER*1 * Specifies options for computing all or part of the matrix U: * = 'A': all M columns of U are returned in array U: * = 'S': the first min(m,n) columns of U (the left singular * vectors) are returned in the array U; * = 'O': the first min(m,n) columns of U (the left singular * vectors) are overwritten on the array A; * = 'N': no columns of U (no left singular vectors) are * computed. * * JOBVT (input) CHARACTER*1 * Specifies options for computing all or part of the matrix * V**T: * = 'A': all N rows of V**T are returned in the array VT; * = 'S': the first min(m,n) rows of V**T (the right singular * vectors) are returned in the array VT; * = 'O': the first min(m,n) rows of V**T (the right singular * vectors) are overwritten on the array A; * = 'N': no rows of V**T (no right singular vectors) are * computed. * * JOBVT and JOBU cannot both be 'O'. * * M (input) INTEGER * The number of rows of the input matrix A. M >= 0. * * N (input) INTEGER * The number of columns of the input matrix A. N >= 0. * * A (input/output) DOUBLE PRECISION array, dimension (LDA,N) * On entry, the M-by-N matrix A. * On exit, * if JOBU = 'O', A is overwritten with the first min(m,n) * columns of U (the left singular vectors, * stored columnwise); * if JOBVT = 'O', A is overwritten with the first min(m,n) * rows of V**T (the right singular vectors, * stored rowwise); * if JOBU .ne. 'O' and JOBVT .ne. 'O', the contents of A * are destroyed. * * LDA (input) INTEGER * The leading dimension of the array A. LDA >= max(1,M). * * S (output) DOUBLE PRECISION array, dimension (min(M,N)) * The singular values of A, sorted so that S(i) >= S(i+1). * * U (output) DOUBLE PRECISION array, dimension (LDU,UCOL) * (LDU,M) if JOBU = 'A' or (LDU,min(M,N)) if JOBU = 'S'. * If JOBU = 'A', U contains the M-by-M orthogonal matrix U; * if JOBU = 'S', U contains the first min(m,n) columns of U * (the left singular vectors, stored columnwise); * if JOBU = 'N' or 'O', U is not referenced. * * LDU (input) INTEGER * The leading dimension of the array U. LDU >= 1; if * JOBU = 'S' or 'A', LDU >= M. * * VT (output) DOUBLE PRECISION array, dimension (LDVT,N) * If JOBVT = 'A', VT contains the N-by-N orthogonal matrix * V**T; * if JOBVT = 'S', VT contains the first min(m,n) rows of * V**T (the right singular vectors, stored rowwise); * if JOBVT = 'N' or 'O', VT is not referenced. * * LDVT (input) INTEGER * The leading dimension of the array VT. LDVT >= 1; if * JOBVT = 'A', LDVT >= N; if JOBVT = 'S', LDVT >= min(M,N). * * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK)) * On exit, if INFO = 0, WORK(1) returns the optimal LWORK; * if INFO > 0, WORK(2:MIN(M,N)) contains the unconverged * superdiagonal elements of an upper bidiagonal matrix B * whose diagonal is in S (not necessarily sorted). B * satisfies A = U * B * VT, so it has the same singular values * as A, and singular vectors related by U and VT. * * LWORK (input) INTEGER * The dimension of the array WORK. * LWORK >= MAX(1,3*MIN(M,N)+MAX(M,N),5*MIN(M,N)). * For good performance, LWORK should generally be larger. * * If LWORK = -1, then a workspace query is assumed; the routine * only calculates the optimal size of the WORK array, returns * this value as the first entry of the WORK array, and no error * message related to LWORK is issued by XERBLA. * * INFO (output) INTEGER * = 0: successful exit. * < 0: if INFO = -i, the i-th argument had an illegal value. * > 0: if DBDSQR did not converge, INFO specifies how many * superdiagonals of an intermediate bidiagonal form B * did not converge to zero. See the description of WORK * above for details. * */ char job = 'A'; C_INT info = 0; C_INT N = imax; CVector< C_FLOAT64 > S(imax); CMatrix< C_FLOAT64 > U(imax, imax); CMatrix< C_FLOAT64 > VT(imax, imax); C_INT lwork = -1; // Instruct dgesvd_ to determine work array size. CVector< C_FLOAT64 > work; work.resize(1); dgesvd_(&job, &job, &N, &N, mCorrelation.array(), &N, S.array(), U.array(), &N, VT.array(), &N, work.array(), &lwork, &info); if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 1, info); return false; } lwork = (C_INT) work[0]; work.resize(lwork); // This actually calculates the SVD of mCorrelation^T, since dgesvd uses // fortran notation, i.e., mCorrelation = V^T * B^T * U dgesvd_(&job, &job, &N, &N, mCorrelation.array(), &N, S.array(), U.array(), &N, VT.array(), &N, work.array(), &lwork, &info); // Even if info is not zero we are still able to invert if (info) { mCorrelation = std::numeric_limits<C_FLOAT64>::quiet_NaN(); mParameterSD = std::numeric_limits<C_FLOAT64>::quiet_NaN(); CCopasiMessage(CCopasiMessage::WARNING, MCFitting + 1, info); return false; } // Now we invert the Fisher Information Matrix. Please note, // that we are calculating a pseudo inverse in the case that one or // more singular values are zero. mCorrelation = 0.0; for (i = 0; i < imax; i++) if (S[i] == 0.0) mCorrelation(i, i) = 0.0; else mCorrelation(i, i) = 1.0 / S[i]; CMatrix< C_FLOAT64 > Tmp(imax, imax); char opN = 'N'; C_FLOAT64 Alpha = 1.0; C_FLOAT64 Beta = 0.0; dgemm_(&opN, &opN, &N, &N, &N, &Alpha, U.array(), &N, mCorrelation.array(), &N, &Beta, Tmp.array(), &N); dgemm_(&opN, &opN, &N, &N, &N, &Alpha, Tmp.array(), &N, VT.array(), &N, &Beta, mCorrelation.array(), &N); #endif // XXXX // rescale the lower bound of the covariant matrix to have unit diagonal for (i = 0; i < imax; i++) { C_FLOAT64 & tmp = S[i]; if (mCorrelation(i, i) > 0.0) { tmp = 1.0 / sqrt(mCorrelation(i, i)); mParameterSD[i] = mSD / tmp; } else if (mCorrelation(i, i) < 0.0) { tmp = 1.0 / sqrt(- mCorrelation(i, i)); mParameterSD[i] = mSD / tmp; } else { mParameterSD[i] = mInfinity; tmp = 1.0; mCorrelation(i, i) = 1.0; } } for (i = 0; i < imax; i++) for (l = 0; l < imax; l++) mCorrelation(i, l) *= S[i] * S[l]; // Make sure the timer is acurate. (*mCPUTime.getRefresh())(); return true; }
void fixPartialRegisterStalls(Code& code) { if (!isX86()) return; PhaseScope phaseScope(code, "fixPartialRegisterStalls"); Vector<BasicBlock*> candidates; for (BasicBlock* block : code) { for (const Inst& inst : *block) { if (hasPartialXmmRegUpdate(inst)) { candidates.append(block); break; } } } // Fortunately, Partial Stalls are rarely used. Return early if no block // cares about them. if (candidates.isEmpty()) return; // For each block, this provides the distance to the last instruction setting each register // on block *entry*. IndexMap<BasicBlock, FPDefDistance> lastDefDistance(code.size()); // Blocks with dirty distance at head. IndexSet<BasicBlock> dirty; // First, we compute the local distance for each block and push it to the successors. for (BasicBlock* block : code) { FPDefDistance localDistance; unsigned distanceToBlockEnd = block->size(); for (Inst& inst : *block) updateDistances(inst, localDistance, distanceToBlockEnd); for (BasicBlock* successor : block->successorBlocks()) { if (lastDefDistance[successor].updateFromPrecessor(localDistance)) dirty.add(successor); } } // Now we propagate the minimums accross blocks. bool changed; do { changed = false; for (BasicBlock* block : code) { if (!dirty.remove(block)) continue; // Little shortcut: if the block is big enough, propagating it won't add any information. if (block->size() >= minimumSafeDistance) continue; unsigned blockSize = block->size(); FPDefDistance& blockDistance = lastDefDistance[block]; for (BasicBlock* successor : block->successorBlocks()) { if (lastDefDistance[successor].updateFromPrecessor(blockDistance, blockSize)) { dirty.add(successor); changed = true; } } } } while (changed); // Finally, update each block as needed. InsertionSet insertionSet(code); for (BasicBlock* block : candidates) { unsigned distanceToBlockEnd = block->size(); FPDefDistance& localDistance = lastDefDistance[block]; for (unsigned i = 0; i < block->size(); ++i) { Inst& inst = block->at(i); if (hasPartialXmmRegUpdate(inst)) { RegisterSet defs; RegisterSet uses; inst.forEachTmp([&] (Tmp& tmp, Arg::Role role, Arg::Type) { if (tmp.isFPR()) { if (Arg::isDef(role)) defs.set(tmp.fpr()); if (Arg::isAnyUse(role)) uses.set(tmp.fpr()); } }); // We only care about values we define but not use. Otherwise we have to wait // for the value to be resolved anyway. defs.exclude(uses); defs.forEach([&] (Reg reg) { if (localDistance.distance[MacroAssembler::fpRegisterIndex(reg.fpr())] < minimumSafeDistance) insertionSet.insert(i, MoveZeroToDouble, inst.origin, Tmp(reg)); }); } updateDistances(inst, localDistance, distanceToBlockEnd); } insertionSet.execute(block); } }