public FuncBuilderHints CloneSetValues(ReadOnlyDictionary newLiveLocalVariableNames, ReadOnlyDictionary newVariableNameToRepresentation, PassTraits newPassTraits) { var result=Clone(); result.liveLocalVariableNames=newLiveLocalVariableNames; result.VariableNameToRepresentation=newVariableNameToRepresentation; result.PassTraits=newPassTraits; return result; }
public bool EqualTo(PassTraits other) { return this.PreserveLinkRegister==other.PreserveLinkRegister && this.Scratch0.EqualTo(other.Scratch0) && this.Scratch1.EqualTo(other.Scratch1) && this.Scratch0Used==other.Scratch0Used && this.Scratch1Used==other.Scratch1Used && this.RegisterMask==other.RegisterMask && this.AllocatedVariableOffset==other.AllocatedVariableOffset; }
public bool EqualTo(PassTraits other) { return(this.PreserveLinkRegister == other.PreserveLinkRegister && this.Scratch0.EqualTo(other.Scratch0) && this.Scratch1.EqualTo(other.Scratch1) && this.Scratch0Used == other.Scratch0Used && this.Scratch1Used == other.Scratch1Used && this.RegisterMask == other.RegisterMask && this.AllocatedVariableOffset == other.AllocatedVariableOffset); }
public FuncBuilderHints RunOptimizer(bool scratch0Used, bool scratch1Used, out bool runAgain) { var liveLocalNonParameterVariableNames=new Hashtable(); var usedRegisterMask=0; foreach(TerminalName variableName in liveLocalVariableNames.Keys) { var rep=(Representation)pinnedVariables[variableName]; if(rep==null) { liveLocalNonParameterVariableNames.Add(variableName, null); } else { var register=rep as Register; if(register!=null) { usedRegisterMask|=1<<register.Index; } } } var allocableRegisterMask=((1<<Traits.NumAllocableRegisters)-1)&~usedRegisterMask; var result=VariableAllocator.Run(liveLocalNonParameterVariableNames.Keys, allocableRegisterMask, BuilderHints.VariableNameToRepresentation); var allUsedExcludingScratch=usedRegisterMask|result.UsedRegisterMask; //The reason for this is that scratch0 and scratch1 must not interfere with the calling convention var startingPoint=externalMethodWasInvoked ? 4 : 0; LowRegister scratch0=null; for(var i=startingPoint; i<Traits.NumLowRegisters; ++i) { if((allUsedExcludingScratch&(1<<i))==0) { var register=new LowRegister(i); if(scratch0==null) { scratch0=register; } else { var pt=new PassTraits(this.externalMethodWasInvoked, scratch0, register, scratch0Used, scratch1Used, allUsedExcludingScratch, result.AllocatedVariableOffset); runAgain=result.RunAgain || !pt.EqualTo(BuilderHints.PassTraits); return BuilderHints.CloneSetValues(liveLocalVariableNames.AsReadOnlyDictionary(), result.VariableNameToRepresentation, pt); } } } throw new Exception("never"); }
public FuncBuilderHints CloneSetValues(ReadOnlyDictionary newLiveLocalVariableNames, ReadOnlyDictionary newVariableNameToRepresentation, PassTraits newPassTraits) { var result = Clone(); result.liveLocalVariableNames = newLiveLocalVariableNames; result.VariableNameToRepresentation = newVariableNameToRepresentation; result.PassTraits = newPassTraits; return(result); }