public LLVMBasicBlockRef InsertBasicBlock(string Name) { using (var marshaledName = new MarshaledString(Name)) { return(LLVM.InsertBasicBlock(this, marshaledName)); } }
public bool TryFindFunction(string Name, out LLVMValueRef OutFn) { using (var marshaledName = new MarshaledString(Name)) fixed(LLVMValueRef *pOutFn = &OutFn) { return(LLVM.FindFunction(this, marshaledName, (LLVMOpaqueValue **)pOutFn) == 0); } }
public LLVMTargetMachineRef CreateTargetMachine(string triple, string cpu, string features, LLVMCodeGenOptLevel level, LLVMRelocMode reloc, LLVMCodeModel codeModel) { using (var marshaledTriple = new MarshaledString(triple)) using (var marshaledCPU = new MarshaledString(cpu)) using (var marshaledFeatures = new MarshaledString(features)) { return(LLVM.CreateTargetMachine(this, marshaledTriple, marshaledCPU, marshaledFeatures, level, reloc, codeModel)); } }
public LLVMValueRef[] GetNamedMetadataOperands(string Name) { using (var marshaledName = new MarshaledString(Name)) { var Dest = new LLVMValueRef[LLVM.GetNamedMetadataNumOperands(this, marshaledName)]; fixed(LLVMValueRef *pDest = Dest) { LLVM.GetNamedMetadataOperands(this, marshaledName, (LLVMOpaqueValue **)pDest); } return(Dest); } }
public MarshaledStringArray(ReadOnlySpan <string> inputs) { if (inputs.IsEmpty) { Count = 0; Values = null; } else { Count = inputs.Length; Values = new MarshaledString[Count]; for (int i = 0; i < Count; i++) { Values[i] = new MarshaledString(inputs[i].AsSpan()); } } }
public bool TryPrintToFile(string Filename, out string ErrorMessage) { using (var marshaledFilename = new MarshaledString(Filename)) { sbyte *pErrorMessage; var result = LLVM.PrintModuleToFile(this, marshaledFilename, &pErrorMessage); if (pErrorMessage is null) { ErrorMessage = string.Empty; } else { var span = new ReadOnlySpan <byte>(pErrorMessage, int.MaxValue); ErrorMessage = span.Slice(0, span.IndexOf((byte)'\0')).AsString(); } return(result == 0); } }
public bool TryEmitToFile(LLVMModuleRef module, string fileName, LLVMCodeGenFileType codegen, out string message) { using (var marshaledFileName = new MarshaledString(fileName)) { sbyte *errorMessage; int result = LLVM.TargetMachineEmitToFile(this, module, marshaledFileName, codegen, &errorMessage); if (errorMessage is null) { message = string.Empty; } else { var span = new ReadOnlySpan <byte>(errorMessage, int.MaxValue); message = span.Slice(0, span.IndexOf((byte)'\0')).AsString(); LLVM.DisposeErrorMessage(errorMessage); } return(result == 0); } }