Skip to content

Commit 3c7a869

Browse files
authored
llvm 19.1.0 (#71)
1 parent 102b519 commit 3c7a869

File tree

8 files changed

+508
-120
lines changed

8 files changed

+508
-120
lines changed

llvm/llvm.nim

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type
6868
comdat {.pure, final.} = object
6969
opaqueModuleFlagEntry {.pure, final.} = object
7070
OpaqueBinary {.pure, final.} = object
71+
OpaqueDbgRecord {.pure, final.} = object
7172
OpaqueError {.pure, final.} = object
7273
OpaquePassBuilderOptions {.pure, final.} = object
7374

llvm/llvm.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.1.8
1+
19.1.0

llvm/llvm/Core.nim

+406-47
Large diffs are not rendered by default.

llvm/llvm/DebugInfo.nim

+62-26
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ type DIFlags* {.size: sizeof(cint).} = enum
5050
DIFlagNoReturn = 1 shl 20
5151
DIFlagTypePassByValue = 1 shl 22
5252
DIFlagTypePassByReference = 1 shl 23
53-
DIFlagEnumClass = 1 shl 24 #DIFlagFixedEnum = DIFlagEnumClass, ## Deprecated.
53+
DIFlagEnumClass = 1 shl 24 #DIFlagFixedEnum = dIFlagEnumClass ## Deprecated.
5454
DIFlagThunk = 1 shl 25
5555
DIFlagNonTrivial = 1 shl 26
5656
DIFlagBigEndian = 1 shl 27
5757
DIFlagLittleEndian = 1 shl 28
58-
# DIFlagIndirectVirtualBase = (1 shl 2) or (1 shl 5),
59-
# DIFlagAccessibility = DIFlagPrivate or DIFlagProtected or DIFlagPublic, DIFlagPtrToMemberRep = DIFlagSingleInheritance or
60-
# DIFlagMultipleInheritance or
61-
# DIFlagVirtualInheritance
58+
# DIFlagIndirectVirtualBase = (1 shl 2) or (1 shl 5)
59+
# DIFlagAccessibility = dIFlagPrivate or dIFlagProtected or dIFlagPublic
60+
# DIFlagPtrToMemberRep =
61+
# dIFlagSingleInheritance or dIFlagMultipleInheritance or dIFlagVirtualInheritance
6262

6363
##
6464
## Source languages known by DWARF.
@@ -111,7 +111,19 @@ type DWARFSourceLanguage* {.size: sizeof(cint).} = enum
111111
DWARFSourceLanguageFortran18
112112
DWARFSourceLanguageAda2005
113113
DWARFSourceLanguageAda2012
114-
DWARFSourceLanguageMojo ## Vendor extensions:
114+
DWARFSourceLanguageHIP
115+
DWARFSourceLanguageAssembly
116+
DWARFSourceLanguageC_sharp
117+
DWARFSourceLanguageMojo
118+
DWARFSourceLanguageGLSL
119+
DWARFSourceLanguageGLSL_ES
120+
DWARFSourceLanguageHLSL
121+
DWARFSourceLanguageOpenCL_CPP
122+
DWARFSourceLanguageCPP_forOpenCL
123+
DWARFSourceLanguageSYCL
124+
DWARFSourceLanguageRuby
125+
DWARFSourceLanguageMove
126+
DWARFSourceLanguageHylo ## Vendor extensions:
115127
DWARFSourceLanguageMipsAssembler
116128
DWARFSourceLanguageGOOGLE_RenderScript
117129
DWARFSourceLanguageBORLAND_Delphi
@@ -1576,84 +1588,108 @@ proc dIBuilderCreateTempGlobalVariableFwdDecl*(
15761588
.}
15771589

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

1588-
proc dIBuilderInsertDeclareBefore*(
1606+
proc dIBuilderInsertDeclareRecordBefore*(
15891607
builder: DIBuilderRef,
15901608
storage: ValueRef,
15911609
varInfo: MetadataRef,
15921610
expr: MetadataRef,
15931611
debugLoc: MetadataRef,
15941612
instr: ValueRef,
1595-
): ValueRef {.importc: "LLVMDIBuilderInsertDeclareBefore", dynlib: LLVMLib.}
1613+
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDeclareRecordBefore", dynlib: LLVMLib.}
15961614

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

1609-
proc dIBuilderInsertDeclareAtEnd*(
1633+
proc dIBuilderInsertDeclareRecordAtEnd*(
16101634
builder: DIBuilderRef,
16111635
storage: ValueRef,
16121636
varInfo: MetadataRef,
16131637
expr: MetadataRef,
16141638
debugLoc: MetadataRef,
16151639
`block`: BasicBlockRef,
1616-
): ValueRef {.importc: "LLVMDIBuilderInsertDeclareAtEnd", dynlib: LLVMLib.}
1640+
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDeclareRecordAtEnd", dynlib: LLVMLib.}
16171641

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

1628-
proc dIBuilderInsertDbgValueBefore*(
1658+
proc dIBuilderInsertDbgValueRecordBefore*(
16291659
builder: DIBuilderRef,
16301660
val: ValueRef,
16311661
varInfo: MetadataRef,
16321662
expr: MetadataRef,
16331663
debugLoc: MetadataRef,
16341664
instr: ValueRef,
1635-
): ValueRef {.importc: "LLVMDIBuilderInsertDbgValueBefore", dynlib: LLVMLib.}
1665+
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDbgValueRecordBefore", dynlib: LLVMLib.}
16361666

16371667
##
1638-
## Insert a new llvm.dbg.value intrinsic call at the end of the given basic
1639-
## block. If the basic block has a terminator instruction, the intrinsic is
1640-
## inserted before that terminator instruction.
1668+
## Only use in "new debug format" (LLVMIsNewDbgInfoFormat() is true).
1669+
## See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
1670+
##
1671+
## The debug format can be switched later after inserting the records using
1672+
## LLVMSetIsNewDbgInfoFormat, if needed for legacy or transitionary reasons.
1673+
##
1674+
## Insert a new debug record at the end of the given basic block. If the
1675+
## basic block has a terminator instruction, the record is inserted before
1676+
## that terminator instruction.
16411677
## \param Builder The DIBuilder.
16421678
## \param Val The value of the variable.
16431679
## \param VarInfo The variable's debug info descriptor.
16441680
## \param Expr A complex location expression for the variable.
16451681
## \param DebugLoc Debug info location.
1646-
## \param Block Basic block acting as a location for the new intrinsic.
1682+
## \param Block Basic block acting as a location for the new record.
16471683
##
16481684

1649-
proc dIBuilderInsertDbgValueAtEnd*(
1685+
proc dIBuilderInsertDbgValueRecordAtEnd*(
16501686
builder: DIBuilderRef,
16511687
val: ValueRef,
16521688
varInfo: MetadataRef,
16531689
expr: MetadataRef,
16541690
debugLoc: MetadataRef,
16551691
`block`: BasicBlockRef,
1656-
): ValueRef {.importc: "LLVMDIBuilderInsertDbgValueAtEnd", dynlib: LLVMLib.}
1692+
): DbgRecordRef {.importc: "LLVMDIBuilderInsertDbgValueRecordAtEnd", dynlib: LLVMLib.}
16571693

16581694
##
16591695
## Create a new descriptor for a local auto variable.

llvm/llvm/Orc.nim

+25-41
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ type OrcCDependenceMapPair* {.bycopy.} = object
184184

185185
type OrcCDependenceMapPairs* = ptr OrcCDependenceMapPair
186186

187+
##
188+
## A set of symbols that share dependencies.
189+
##
190+
191+
type OrcCSymbolDependenceGroup* {.bycopy.} = object
192+
symbols*: OrcCSymbolsList
193+
dependencies*: OrcCDependenceMapPairs
194+
numDependencies*: csize_t
195+
187196
##
188197
## Lookup kind. This can be used by definition generators when deciding whether
189198
## to produce a definition for a requested symbol.
@@ -920,6 +929,19 @@ proc orcMaterializationResponsibilityNotifyResolved*(
920929
## that all symbols covered by this MaterializationResponsibility instance
921930
## have been emitted.
922931
##
932+
## This function takes ownership of the symbols in the Dependencies struct.
933+
## This allows the following pattern...
934+
##
935+
## LLVMOrcSymbolStringPoolEntryRef Names[] = {...};
936+
## LLVMOrcCDependenceMapPair Dependence = {JD, {Names, sizeof(Names)}}
937+
## LLVMOrcMaterializationResponsibilityAddDependencies(JD, Name, &Dependence,
938+
## 1);
939+
##
940+
## ... without requiring cleanup of the elements of the Names array afterwards.
941+
##
942+
## The client is still responsible for deleting the Dependencies.Names arrays,
943+
## and the Dependencies array itself.
944+
##
923945
## This method will return an error if any symbols being resolved have been
924946
## moved to the error state due to the failure of a dependency. If this
925947
## method returns an error then clients should log it and call
@@ -930,7 +952,9 @@ proc orcMaterializationResponsibilityNotifyResolved*(
930952
##
931953
932954
proc orcMaterializationResponsibilityNotifyEmitted*(
933-
mr: OrcMaterializationResponsibilityRef
955+
mr: OrcMaterializationResponsibilityRef,
956+
symbolDepGroups: ptr OrcCSymbolDependenceGroup,
957+
numSymbolDepGroups: csize_t,
934958
): ErrorRef {.
935959
importc: "LLVMOrcMaterializationResponsibilityNotifyEmitted", dynlib: LLVMLib
936960
.}
@@ -999,46 +1023,6 @@ proc orcMaterializationResponsibilityDelegate*(
9991023
result: ptr OrcMaterializationResponsibilityRef,
10001024
): ErrorRef {.importc: "LLVMOrcMaterializationResponsibilityDelegate", dynlib: LLVMLib.}
10011025
1002-
##
1003-
## Adds dependencies to a symbol that the MaterializationResponsibility is
1004-
## responsible for.
1005-
##
1006-
## This function takes ownership of Dependencies struct. The Names
1007-
## array have been retained for this function. This allows the following
1008-
## pattern...
1009-
##
1010-
## LLVMOrcSymbolStringPoolEntryRef Names[] = {...};
1011-
## LLVMOrcCDependenceMapPair Dependence = {JD, {Names, sizeof(Names)}}
1012-
## LLVMOrcMaterializationResponsibilityAddDependencies(JD, Name, &Dependence,
1013-
## 1);
1014-
##
1015-
## ... without requiring cleanup of the elements of the Names array afterwards.
1016-
##
1017-
## The client is still responsible for deleting the Dependencies.Names array
1018-
## itself.
1019-
##
1020-
1021-
proc orcMaterializationResponsibilityAddDependencies*(
1022-
mr: OrcMaterializationResponsibilityRef,
1023-
name: OrcSymbolStringPoolEntryRef,
1024-
dependencies: OrcCDependenceMapPairs,
1025-
numPairs: csize_t,
1026-
) {.importc: "LLVMOrcMaterializationResponsibilityAddDependencies", dynlib: LLVMLib.}
1027-
1028-
##
1029-
## Adds dependencies to all symbols that the MaterializationResponsibility is
1030-
## responsible for. See LLVMOrcMaterializationResponsibilityAddDependencies for
1031-
## notes about memory responsibility.
1032-
##
1033-
1034-
proc orcMaterializationResponsibilityAddDependenciesForAll*(
1035-
mr: OrcMaterializationResponsibilityRef,
1036-
dependencies: OrcCDependenceMapPairs,
1037-
numPairs: csize_t,
1038-
) {.
1039-
importc: "LLVMOrcMaterializationResponsibilityAddDependenciesForAll", dynlib: LLVMLib
1040-
.}
1041-
10421026
##
10431027
## Create a "bare" JITDylib.
10441028
##

llvm/llvm/Types.nim

+6
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ type JITEventListenerRef* = ptr OpaqueJITEventListener
180180

181181
type BinaryRef* = ptr OpaqueBinary
182182

183+
##
184+
## @see llvm::DbgRecord
185+
##
186+
187+
type DbgRecordRef* = ptr OpaqueDbgRecord
188+
183189
##
184190
## @}
185191
##

llvm/rebuild.sh

+2
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ for a in $HEADERS; do
2525

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

28+
nph llvm
29+
2830
done

nlvm/llgen.nim

+5-5
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ proc debugVariable(g: LLGen, sym: PSym, v: llvm.ValueRef, argNo = -1) =
18131813
scope, g.llName(sym), argNo.cuint, df, line, dt, false, 0
18141814
)
18151815

1816-
discard g.d.dIBuilderInsertDeclareAtEnd(
1816+
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
18171817
v,
18181818
vd,
18191819
g.d.dIBuilderCreateExpression(nil, 0),
@@ -2670,7 +2670,7 @@ proc genMarkerProcBody(g: LLGen, f: llvm.ValueRef, typ: PType) =
26702670
vd = g.d.dIBuilderCreateParameterVariable(
26712671
llf.ds, $v.getValueName(), 1, df, line, dt, false, 0
26722672
)
2673-
discard g.d.dIBuilderInsertDeclareAtEnd(
2673+
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
26742674
vs,
26752675
vd,
26762676
g.d.dIBuilderCreateExpression(nil, 0),
@@ -2681,7 +2681,7 @@ proc genMarkerProcBody(g: LLGen, f: llvm.ValueRef, typ: PType) =
26812681
let opd = g.d.dIBuilderCreateParameterVariable(
26822682
llf.ds, $op.getValueName(), 2, df, line, g.dtypes[tyInt], false, 0
26832683
)
2684-
discard g.d.dIBuilderInsertDeclareAtEnd(
2684+
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
26852685
ops,
26862686
opd,
26872687
g.d.dIBuilderCreateExpression(nil, 0),
@@ -10202,7 +10202,7 @@ proc genMain(g: LLGen) =
1020210202
false,
1020310203
0,
1020410204
)
10205-
discard g.d.dIBuilderInsertDeclareAtEnd(
10205+
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
1020610206
argc, vd0, g.d.dIBuilderCreateExpression(nil, 0), dl, g.b.getInsertBlock()
1020710207
)
1020810208

@@ -10216,7 +10216,7 @@ proc genMain(g: LLGen) =
1021610216
false,
1021710217
0,
1021810218
)
10219-
discard g.d.dIBuilderInsertDeclareAtEnd(
10219+
discard g.d.dIBuilderInsertDeclareRecordAtEnd(
1022010220
argv, vd1, g.d.dIBuilderCreateExpression(nil, 0), dl, g.b.getInsertBlock()
1022110221
)
1022210222

0 commit comments

Comments
 (0)