Exemple #1
0
        public override LLVMValueRef Emit(EmittingContext pContext)
        {
            pContext.EmitDebugLocation(this);

            var variable = pContext.AllocateVariable("array_temp", this);

            var size   = Size.Emit(pContext);
            var length = pContext.GetArrayLength(variable);

            LLVM.BuildStore(pContext.Builder, size, length);

            var data         = pContext.AllocateArrayLiteral(Type.GetElementType(), size);
            var variableData = LLVM.BuildInBoundsGEP(pContext.Builder, variable, new LLVMValueRef[] { pContext.GetInt(0), pContext.GetInt(1) }, "");

            LLVM.BuildStore(pContext.Builder, data, variableData);

            return(variable);
        }