mirror of
https://github.com/codex-storage/constantine.git
synced 2025-01-12 12:04:07 +00:00
Nvidia JIT fixes (#290)
* lib org change, need serialization/io_limbs import * fix unused variable and useless conversion warnings * Update LLVM bindings to LLVM-16
This commit is contained in:
parent
4ccd8aaab8
commit
67fbd8c699
@ -248,16 +248,20 @@ proc getGlobalPassRegistry(): PassRegistryRef {.importc: "LLVMGetGlobalPassRegis
|
|||||||
proc initializeCore(registry: PassRegistryRef) {.importc: "LLVMInitializeCore".}
|
proc initializeCore(registry: PassRegistryRef) {.importc: "LLVMInitializeCore".}
|
||||||
proc initializeTransformUtils(registry: PassRegistryRef) {.importc: "LLVMInitializeTransformUtils".}
|
proc initializeTransformUtils(registry: PassRegistryRef) {.importc: "LLVMInitializeTransformUtils".}
|
||||||
proc initializeScalarOpts(registry: PassRegistryRef) {.importc: "LLVMInitializeScalarOpts".}
|
proc initializeScalarOpts(registry: PassRegistryRef) {.importc: "LLVMInitializeScalarOpts".}
|
||||||
proc initializeObjCARCOpts(registry: PassRegistryRef) {.importc: "LLVMInitializeObjCARCOpts".}
|
|
||||||
proc initializeVectorization(registry: PassRegistryRef) {.importc: "LLVMInitializeVectorization".}
|
proc initializeVectorization(registry: PassRegistryRef) {.importc: "LLVMInitializeVectorization".}
|
||||||
proc initializeInstCombine(registry: PassRegistryRef) {.importc: "LLVMInitializeInstCombine".}
|
proc initializeInstCombine(registry: PassRegistryRef) {.importc: "LLVMInitializeInstCombine".}
|
||||||
proc initializeAggressiveInstCombiner(registry: PassRegistryRef) {.importc: "LLVMInitializeAggressiveInstCombiner".}
|
|
||||||
proc initializeIPO(registry: PassRegistryRef) {.importc: "LLVMInitializeIPO".}
|
proc initializeIPO(registry: PassRegistryRef) {.importc: "LLVMInitializeIPO".}
|
||||||
proc initializeInstrumentation(registry: PassRegistryRef) {.importc: "LLVMInitializeInstrumentation".}
|
|
||||||
proc initializeAnalysis(registry: PassRegistryRef) {.importc: "LLVMInitializeAnalysis".}
|
proc initializeAnalysis(registry: PassRegistryRef) {.importc: "LLVMInitializeAnalysis".}
|
||||||
proc initializeIPA(registry: PassRegistryRef) {.importc: "LLVMInitializeIPA".}
|
proc initializeIPA(registry: PassRegistryRef) {.importc: "LLVMInitializeIPA".}
|
||||||
proc initializeCodeGen(registry: PassRegistryRef) {.importc: "LLVMInitializeCodeGen".}
|
proc initializeCodeGen(registry: PassRegistryRef) {.importc: "LLVMInitializeCodeGen".}
|
||||||
proc initializeTarget(registry: PassRegistryRef) {.importc: "LLVMInitializeTarget".}
|
proc initializeTarget(registry: PassRegistryRef) {.importc: "LLVMInitializeTarget".}
|
||||||
|
|
||||||
|
# Removed in LLVM 16
|
||||||
|
# ------------------
|
||||||
|
# proc initializeObjCARCOpts(registry: PassRegistryRef) {.importc: "LLVMInitializeObjCARCOpts".}
|
||||||
|
# proc initializeAggressiveInstCombiner(registry: PassRegistryRef) {.importc: "LLVMInitializeAggressiveInstCombiner".}
|
||||||
|
# proc initializeInstrumentation(registry: PassRegistryRef) {.importc: "LLVMInitializeInstrumentation".}
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
||||||
# https://llvm.org/doxygen/group__LLVMCTarget.html
|
# https://llvm.org/doxygen/group__LLVMCTarget.html
|
||||||
|
@ -10,7 +10,7 @@ import
|
|||||||
../../math/config/[curves, precompute],
|
../../math/config/[curves, precompute],
|
||||||
../../math/io/io_bigints,
|
../../math/io/io_bigints,
|
||||||
../primitives, ../bithacks,
|
../primitives, ../bithacks,
|
||||||
../../serialization/[endians, codecs],
|
../../serialization/[endians, codecs, io_limbs],
|
||||||
./llvm
|
./llvm
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
|
@ -147,17 +147,20 @@ proc initializePasses* =
|
|||||||
registry.initializeCore()
|
registry.initializeCore()
|
||||||
registry.initializeTransformUtils()
|
registry.initializeTransformUtils()
|
||||||
registry.initializeScalarOpts()
|
registry.initializeScalarOpts()
|
||||||
registry.initializeObjCARCOpts()
|
|
||||||
registry.initializeVectorization()
|
registry.initializeVectorization()
|
||||||
registry.initializeInstCombine()
|
registry.initializeInstCombine()
|
||||||
registry.initializeAggressiveInstCombiner()
|
|
||||||
registry.initializeIPO()
|
registry.initializeIPO()
|
||||||
registry.initializeInstrumentation()
|
|
||||||
registry.initializeAnalysis()
|
registry.initializeAnalysis()
|
||||||
registry.initializeIPA()
|
registry.initializeIPA()
|
||||||
registry.initializeCodeGen()
|
registry.initializeCodeGen()
|
||||||
registry.initializeTarget()
|
registry.initializeTarget()
|
||||||
|
|
||||||
|
# Removed in LLVM 16
|
||||||
|
# --------------------------------
|
||||||
|
# registry.initializeObjCARCOpts()
|
||||||
|
# registry.initializeAggressiveInstCombiner()
|
||||||
|
# registry.initializeInstrumentation()
|
||||||
|
|
||||||
# Builder
|
# Builder
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ macro genInstr(body: untyped): untyped =
|
|||||||
let lhs = op[2][0][3][0]
|
let lhs = op[2][0][3][0]
|
||||||
|
|
||||||
instrBody.add quote do:
|
instrBody.add quote do:
|
||||||
let `ctx` = builder.getContext()
|
let `ctx` {.used.} = builder.getContext()
|
||||||
# lhs: ValueRef or uint32 or uint64
|
# lhs: ValueRef or uint32 or uint64
|
||||||
let `numBits` = when `lhs` is ValueRef|ConstValueRef: `lhs`.getTypeOf().getIntTypeWidth()
|
let `numBits` = when `lhs` is ValueRef|ConstValueRef: `lhs`.getTypeOf().getIntTypeWidth()
|
||||||
else: 8*sizeof(`lhs`)
|
else: 8*sizeof(`lhs`)
|
||||||
@ -226,12 +226,10 @@ macro genInstr(body: untyped): untyped =
|
|||||||
for op in operands:
|
for op in operands:
|
||||||
# when op is ValueRef: op
|
# when op is ValueRef: op
|
||||||
# else: constInt(uint64(op))
|
# else: constInt(uint64(op))
|
||||||
opArray.add newCall(
|
opArray.add nnkWhenStmt.newTree(
|
||||||
bindSym"ValueRef",
|
nnkElifBranch.newTree(nnkInfix.newTree(ident"is", op, bindSym"ValueRef"), op),
|
||||||
nnkWhenStmt.newTree(
|
nnkElifBranch.newTree(nnkInfix.newTree(ident"is", op, bindSym"ConstValueRef"), newCall(ident"ValueRef", op)),
|
||||||
nnkElifBranch.newTree(nnkInfix.newTree(ident"is", op, bindSym"AnyValueRef"), op),
|
nnkElse.newTree(newCall(ident"ValueRef", newCall(ident"constInt", regTy, newCall(ident"uint64", op))))
|
||||||
nnkElse.newTree(newCall(ident"constInt", regTy, newCall(ident"uint64", op)))
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
# builder.call2(ty, inlineASM, [lhs, rhs], name)
|
# builder.call2(ty, inlineASM, [lhs, rhs], name)
|
||||||
instrBody.add newCall(
|
instrBody.add newCall(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user