Exemplo n.º 1
0
        public void Insert(LlvmValue instruction)
        {
            // Register the instruction locally.
            this.instructions.Add(instruction);

            // Append the instruction to the reference builder.
            LLVM.InsertIntoBuilder(this.reference, instruction.Unwrap());
        }
Exemplo n.º 2
0
        public LlvmValue CreateReturn(LlvmValue value)
        {
            // Invoke the native function and capture the resulting reference.
            LLVMValueRef reference = LLVM.BuildRet(this.reference, value.Unwrap());

            // Register the instruction.
            this.instructions.Add(reference.Wrap());

            // Wrap and return the reference.
            return(new LlvmValue(reference));
        }
Exemplo n.º 3
0
        public LlvmValue CreateAdd(LlvmValue leftSide, LlvmValue rightSide, string resultIdentifier)
        {
            // Invoke the native function and capture the resulting reference.
            LLVMValueRef reference = LLVM.BuildAdd(this.reference, leftSide.Unwrap(), rightSide.Unwrap(), resultIdentifier);

            // Register the instruction.
            this.instructions.Add(reference.Wrap());

            // Wrap and return the reference.
            return(new LlvmValue(reference));
        }
Exemplo n.º 4
0
        public LlvmValue CreateGlobalString(string value, string name, bool isPointer = false)
        {
            // Create the default creator.
            GlobalStringCreator creator = LLVM.BuildGlobalString;

            // Determine the final creator.
            if (isPointer)
            {
                creator = LLVM.BuildGlobalStringPtr;
            }

            // Create the global string reference.
            LlvmValue reference = creator(this.reference, value, name).Wrap();

            // Return the reference.
            return(reference);
        }
Exemplo n.º 5
0
 public void SetInitialValue(LlvmValue value)
 {
     // Set the reference's initial value.
     LLVM.SetInitializer(this.reference, value.Unwrap());
 }
Exemplo n.º 6
0
 public void PositionAt(LlvmValue instruction)
 {
     LLVM.PositionBuilder(this.reference, this.Block.Unwrap(), instruction.Unwrap());
 }