Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm 19.1.0 #71

Merged
merged 1 commit into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/llvm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type
comdat {.pure, final.} = object
opaqueModuleFlagEntry {.pure, final.} = object
OpaqueBinary {.pure, final.} = object
OpaqueDbgRecord {.pure, final.} = object
OpaqueError {.pure, final.} = object
OpaquePassBuilderOptions {.pure, final.} = object

Expand Down
2 changes: 1 addition & 1 deletion llvm/llvm.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.1.8
19.1.0
453 changes: 406 additions & 47 deletions llvm/llvm/Core.nim

Large diffs are not rendered by default.

88 changes: 62 additions & 26 deletions llvm/llvm/DebugInfo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ type DIFlags* {.size: sizeof(cint).} = enum
DIFlagNoReturn = 1 shl 20
DIFlagTypePassByValue = 1 shl 22
DIFlagTypePassByReference = 1 shl 23
DIFlagEnumClass = 1 shl 24 #DIFlagFixedEnum = DIFlagEnumClass, ## Deprecated.
DIFlagEnumClass = 1 shl 24 #DIFlagFixedEnum = dIFlagEnumClass ## Deprecated.
DIFlagThunk = 1 shl 25
DIFlagNonTrivial = 1 shl 26
DIFlagBigEndian = 1 shl 27
DIFlagLittleEndian = 1 shl 28
# DIFlagIndirectVirtualBase = (1 shl 2) or (1 shl 5),
# DIFlagAccessibility = DIFlagPrivate or DIFlagProtected or DIFlagPublic, DIFlagPtrToMemberRep = DIFlagSingleInheritance or
# DIFlagMultipleInheritance or
# DIFlagVirtualInheritance
# DIFlagIndirectVirtualBase = (1 shl 2) or (1 shl 5)
# DIFlagAccessibility = dIFlagPrivate or dIFlagProtected or dIFlagPublic
# DIFlagPtrToMemberRep =
# dIFlagSingleInheritance or dIFlagMultipleInheritance or dIFlagVirtualInheritance

##
## Source languages known by DWARF.
Expand Down Expand Up @@ -111,7 +111,19 @@ type DWARFSourceLanguage* {.size: sizeof(cint).} = enum
DWARFSourceLanguageFortran18
DWARFSourceLanguageAda2005
DWARFSourceLanguageAda2012
DWARFSourceLanguageMojo ## Vendor extensions:
DWARFSourceLanguageHIP
DWARFSourceLanguageAssembly
DWARFSourceLanguageC_sharp
DWARFSourceLanguageMojo
DWARFSourceLanguageGLSL
DWARFSourceLanguageGLSL_ES
DWARFSourceLanguageHLSL
DWARFSourceLanguageOpenCL_CPP
DWARFSourceLanguageCPP_forOpenCL
DWARFSourceLanguageSYCL
DWARFSourceLanguageRuby
DWARFSourceLanguageMove
DWARFSourceLanguageHylo ## Vendor extensions:
DWARFSourceLanguageMipsAssembler
DWARFSourceLanguageGOOGLE_RenderScript
DWARFSourceLanguageBORLAND_Delphi
Expand Down Expand Up @@ -1576,84 +1588,108 @@ proc dIBuilderCreateTempGlobalVariableFwdDecl*(
.}

##
## Insert a new llvm.dbg.declare intrinsic call before the given instruction.
## Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
## See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
##
## The debug format can be switched later after inserting the records using
## LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
##
## Insert a Declare DbgRecord before the given instruction.
## \param Builder The DIBuilder.
## \param Storage The storage of the variable to declare.
## \param VarInfo The variable's debug info descriptor.
## \param Expr A complex location expression for the variable.
## \param DebugLoc Debug info location.
## \param Instr Instruction acting as a location for the new intrinsic.
## \param Instr Instruction acting as a location for the new record.
##

proc dIBuilderInsertDeclareBefore*(
proc dIBuilderInsertDeclareRecordBefore*(
builder: DIBuilderRef,
storage: ValueRef,
varInfo: MetadataRef,
expr: MetadataRef,
debugLoc: MetadataRef,
instr: ValueRef,
): ValueRef {.importc: "LLVMDIBuilderInsertDeclareBefore", dynlib: LLVMLib.}
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDeclareRecordBefore", dynlib: LLVMLib.}

##
## Insert a new llvm.dbg.declare intrinsic call at the end of the given basic
## block. If the basic block has a terminator instruction, the intrinsic is
## inserted before that terminator instruction.
## Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
## See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
##
## The debug format can be switched later after inserting the records using
## LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
##
## Insert a Declare DbgRecord at the end of the given basic block. If the basic
## block has a terminator instruction, the record is inserted before that
## terminator instruction.
## \param Builder The DIBuilder.
## \param Storage The storage of the variable to declare.
## \param VarInfo The variable's debug info descriptor.
## \param Expr A complex location expression for the variable.
## \param DebugLoc Debug info location.
## \param Block Basic block acting as a location for the new intrinsic.
## \param Block Basic block acting as a location for the new record.
##

proc dIBuilderInsertDeclareAtEnd*(
proc dIBuilderInsertDeclareRecordAtEnd*(
builder: DIBuilderRef,
storage: ValueRef,
varInfo: MetadataRef,
expr: MetadataRef,
debugLoc: MetadataRef,
`block`: BasicBlockRef,
): ValueRef {.importc: "LLVMDIBuilderInsertDeclareAtEnd", dynlib: LLVMLib.}
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDeclareRecordAtEnd", dynlib: LLVMLib.}

##
## Insert a new llvm.dbg.value intrinsic call before the given instruction.
## Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
## See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
##
## The debug format can be switched later after inserting the records using
## LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
##
## Insert a new debug record before the given instruction.
## \param Builder The DIBuilder.
## \param Val The value of the variable.
## \param VarInfo The variable's debug info descriptor.
## \param Expr A complex location expression for the variable.
## \param DebugLoc Debug info location.
## \param Instr Instruction acting as a location for the new intrinsic.
## \param Instr Instruction acting as a location for the new record.
##

proc dIBuilderInsertDbgValueBefore*(
proc dIBuilderInsertDbgValueRecordBefore*(
builder: DIBuilderRef,
val: ValueRef,
varInfo: MetadataRef,
expr: MetadataRef,
debugLoc: MetadataRef,
instr: ValueRef,
): ValueRef {.importc: "LLVMDIBuilderInsertDbgValueBefore", dynlib: LLVMLib.}
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDbgValueRecordBefore", dynlib: LLVMLib.}

##
## Insert a new llvm.dbg.value intrinsic call at the end of the given basic
## block. If the basic block has a terminator instruction, the intrinsic is
## inserted before that terminator instruction.
## Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
## See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
##
## The debug format can be switched later after inserting the records using
## LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
##
## Insert a new debug record at the end of the given basic block. If the
## basic block has a terminator instruction, the record is inserted before
## that terminator instruction.
## \param Builder The DIBuilder.
## \param Val The value of the variable.
## \param VarInfo The variable's debug info descriptor.
## \param Expr A complex location expression for the variable.
## \param DebugLoc Debug info location.
## \param Block Basic block acting as a location for the new intrinsic.
## \param Block Basic block acting as a location for the new record.
##

proc dIBuilderInsertDbgValueAtEnd*(
proc dIBuilderInsertDbgValueRecordAtEnd*(
builder: DIBuilderRef,
val: ValueRef,
varInfo: MetadataRef,
expr: MetadataRef,
debugLoc: MetadataRef,
`block`: BasicBlockRef,
): ValueRef {.importc: "LLVMDIBuilderInsertDbgValueAtEnd", dynlib: LLVMLib.}
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDbgValueRecordAtEnd", dynlib: LLVMLib.}

##
## Create a new descriptor for a local auto variable.
Expand Down
66 changes: 25 additions & 41 deletions llvm/llvm/Orc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ type OrcCDependenceMapPair* {.bycopy.} = object

type OrcCDependenceMapPairs* = ptr OrcCDependenceMapPair

##
## A set of symbols that share dependencies.
##

type OrcCSymbolDependenceGroup* {.bycopy.} = object
symbols*: OrcCSymbolsList
dependencies*: OrcCDependenceMapPairs
numDependencies*: csize_t

##
## Lookup kind. This can be used by definition generators when deciding whether
## to produce a definition for a requested symbol.
Expand Down Expand Up @@ -920,6 +929,19 @@ proc orcMaterializationResponsibilityNotifyResolved*(
## that all symbols covered by this MaterializationResponsibility instance
## have been emitted.
##
## This function takes ownership of the symbols in the Dependencies struct.
## This allows the following pattern...
##
## LLVMOrcSymbolStringPoolEntryRef Names[] = {...};
## LLVMOrcCDependenceMapPair Dependence = {JD, {Names, sizeof(Names)}}
## LLVMOrcMaterializationResponsibilityAddDependencies(JD, Name, &Dependence,
## 1);
##
## ... without requiring cleanup of the elements of the Names array afterwards.
##
## The client is still responsible for deleting the Dependencies.Names arrays,
## and the Dependencies array itself.
##
## This method will return an error if any symbols being resolved have been
## moved to the error state due to the failure of a dependency. If this
## method returns an error then clients should log it and call
Expand All @@ -930,7 +952,9 @@ proc orcMaterializationResponsibilityNotifyResolved*(
##

proc orcMaterializationResponsibilityNotifyEmitted*(
mr: OrcMaterializationResponsibilityRef
mr: OrcMaterializationResponsibilityRef,
symbolDepGroups: ptr OrcCSymbolDependenceGroup,
numSymbolDepGroups: csize_t,
): ErrorRef {.
importc: "LLVMOrcMaterializationResponsibilityNotifyEmitted", dynlib: LLVMLib
.}
Expand Down Expand Up @@ -999,46 +1023,6 @@ proc orcMaterializationResponsibilityDelegate*(
result: ptr OrcMaterializationResponsibilityRef,
): ErrorRef {.importc: "LLVMOrcMaterializationResponsibilityDelegate", dynlib: LLVMLib.}

##
## Adds dependencies to a symbol that the MaterializationResponsibility is
## responsible for.
##
## This function takes ownership of Dependencies struct. The Names
## array have been retained for this function. This allows the following
## pattern...
##
## LLVMOrcSymbolStringPoolEntryRef Names[] = {...};
## LLVMOrcCDependenceMapPair Dependence = {JD, {Names, sizeof(Names)}}
## LLVMOrcMaterializationResponsibilityAddDependencies(JD, Name, &Dependence,
## 1);
##
## ... without requiring cleanup of the elements of the Names array afterwards.
##
## The client is still responsible for deleting the Dependencies.Names array
## itself.
##

proc orcMaterializationResponsibilityAddDependencies*(
mr: OrcMaterializationResponsibilityRef,
name: OrcSymbolStringPoolEntryRef,
dependencies: OrcCDependenceMapPairs,
numPairs: csize_t,
) {.importc: "LLVMOrcMaterializationResponsibilityAddDependencies", dynlib: LLVMLib.}

##
## Adds dependencies to all symbols that the MaterializationResponsibility is
## responsible for. See LLVMOrcMaterializationResponsibilityAddDependencies for
## notes about memory responsibility.
##

proc orcMaterializationResponsibilityAddDependenciesForAll*(
mr: OrcMaterializationResponsibilityRef,
dependencies: OrcCDependenceMapPairs,
numPairs: csize_t,
) {.
importc: "LLVMOrcMaterializationResponsibilityAddDependenciesForAll", dynlib: LLVMLib
.}

##
## Create a "bare" JITDylib.
##
Expand Down
6 changes: 6 additions & 0 deletions llvm/llvm/Types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ type JITEventListenerRef* = ptr OpaqueJITEventListener

type BinaryRef* = ptr OpaqueBinary

##
## @see llvm::DbgRecord
##

type DbgRecordRef* = ptr OpaqueDbgRecord

##
## @}
##
2 changes: 2 additions & 0 deletions llvm/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ for a in $HEADERS; do

sed -i -e "s/uintptrT/uint/" $OUT

nph llvm

done
10 changes: 5 additions & 5 deletions nlvm/llgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ proc debugVariable(g: LLGen, sym: PSym, v: llvm.ValueRef, argNo = -1) =
scope, g.llName(sym), argNo.cuint, df, line, dt, false, 0
)

discard g.d.dIBuilderInsertDeclareAtEnd(
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
v,
vd,
g.d.dIBuilderCreateExpression(nil, 0),
Expand Down Expand Up @@ -2670,7 +2670,7 @@ proc genMarkerProcBody(g: LLGen, f: llvm.ValueRef, typ: PType) =
vd = g.d.dIBuilderCreateParameterVariable(
llf.ds, $v.getValueName(), 1, df, line, dt, false, 0
)
discard g.d.dIBuilderInsertDeclareAtEnd(
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
vs,
vd,
g.d.dIBuilderCreateExpression(nil, 0),
Expand All @@ -2681,7 +2681,7 @@ proc genMarkerProcBody(g: LLGen, f: llvm.ValueRef, typ: PType) =
let opd = g.d.dIBuilderCreateParameterVariable(
llf.ds, $op.getValueName(), 2, df, line, g.dtypes[tyInt], false, 0
)
discard g.d.dIBuilderInsertDeclareAtEnd(
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
ops,
opd,
g.d.dIBuilderCreateExpression(nil, 0),
Expand Down Expand Up @@ -10202,7 +10202,7 @@ proc genMain(g: LLGen) =
false,
0,
)
discard g.d.dIBuilderInsertDeclareAtEnd(
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
argc, vd0, g.d.dIBuilderCreateExpression(nil, 0), dl, g.b.getInsertBlock()
)

Expand All @@ -10216,7 +10216,7 @@ proc genMain(g: LLGen) =
false,
0,
)
discard g.d.dIBuilderInsertDeclareAtEnd(
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
argv, vd1, g.d.dIBuilderCreateExpression(nil, 0), dl, g.b.getInsertBlock()
)

Expand Down