internal override void Store(LLFunction pFunction, LLLocation pSource) { LLLocation locationLocal = LLLocalLocation.Create(pFunction.Locals[Temporary.Name]); LLLocation locationSource = pFunction.CurrentBlock.EmitConversion(pSource, locationLocal.Type.PointerDepthMinusOne); pFunction.CurrentBlock.EmitStore(locationLocal, locationSource); }
internal override LLLocation Load(LLFunction pFunction) { LLLocation locationLocal = LLLocalLocation.Create(pFunction.Locals[Temporary.Name]); LLLocation locationTemporary = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationLocal.Type.PointerDepthMinusOne)); pFunction.CurrentBlock.EmitLoad(locationTemporary, locationLocal); return(locationTemporary); }
internal override LLLocation Load(LLFunction pFunction) { if (!Parameter.RequiresAddressing) { throw new NotSupportedException(); } return(LLLocalLocation.Create(Parameter.AddressableLocal)); }
internal override LLLocation Load(LLFunction pFunction) { LLLocation location = LLLocalLocation.Create(pFunction.Locals[Local.Name]); if (mLocal.IsReference) { location = location.Load(pFunction.CurrentBlock); } return(location); }
internal override void Store(LLFunction pFunction, LLLocation pSource) { if (!Parameter.RequiresAddressing) { throw new NotSupportedException(); } LLLocation locationLocal = LLLocalLocation.Create(Parameter.AddressableLocal); LLLocation locationSource = pFunction.CurrentBlock.EmitConversion(pSource, locationLocal.Type.PointerDepthMinusOne); pFunction.CurrentBlock.EmitStore(locationLocal, locationSource); }
internal override LLLocation Load(LLFunction pFunction) { LLLocation locationTemporary = null; if (!Parameter.RequiresAddressing) { locationTemporary = LLParameterLocation.Create(pFunction.Parameters[Parameter.Name]); } else { LLLocation locationLocal = LLLocalLocation.Create(Parameter.AddressableLocal); locationTemporary = LLTemporaryLocation.Create(pFunction.CreateTemporary(locationLocal.Type.PointerDepthMinusOne)); pFunction.CurrentBlock.EmitLoad(locationTemporary, locationLocal); } return(locationTemporary); }
internal void Transform() { Labels.ForEach(l => LLFunction.CreateLabel(l.Identifier)); foreach (HLInstructionBlock hl in Blocks) { LLInstructionBlock ll = LLFunction.CreateBlock(LLFunction.Labels.GetByIdentifier(hl.StartLabel.Identifier)); LLFunction.CurrentBlock = ll; if (hl == Blocks.First()) { foreach (HLParameter parameter in Parameters.Where(p => p.RequiresAddressing)) { LLFunction.CurrentBlock.EmitStore(LLLocalLocation.Create(parameter.AddressableLocal), LLParameterLocation.Create(LLFunction.Parameters[parameter.Name])); } } hl.Instructions.ForEach(i => i.Transform(LLFunction)); } }
public LLInstructionBlock CreateBlock(LLLabel pStartLabel) { if (mBlocks == null) { mBlocks = new List <LLInstructionBlock>(); } LLInstructionBlock block = LLInstructionBlock.Create(this, pStartLabel); mBlocks.Add(block); if (mBlocks.Count == 1) { if (mLocals != null) { foreach (LLLocal local in mLocals) { block.EmitAllocate(LLLocalLocation.Create(local)); } } } return(block); }
internal override LLLocation Load(LLFunction pFunction) { return(LLLocalLocation.Create(pFunction.Locals[Temporary.Name])); }