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()); }
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)); }
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)); }
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); }
public void SetInitialValue(LlvmValue value) { // Set the reference's initial value. LLVM.SetInitializer(this.reference, value.Unwrap()); }
public void PositionAt(LlvmValue instruction) { LLVM.PositionBuilder(this.reference, this.Block.Unwrap(), instruction.Unwrap()); }