Example #1
0
        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);
        }
Example #2
0
        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));
            }
        }