LLVMSwift
                                
                                 LLVMSwift copied to clipboard
                                
                                    LLVMSwift copied to clipboard
                            
                            
                            
                        Missing Functionality in LLVM C
This is a formatted list of APIs that cannot be wrapped or have been wrapped incorrectly in LLVM-C. There is necessarily overlap between this and #51.
API
- Everything in the C API that takes/returns raw C strings without taking/returning a length is wrong.
- LLVMCallFrameAlignmentOfType is redundant.
- LLVMThreadLocalMode should be called LLVMThreadLocalModel to match its cases (and the general usage of the term).
- LLVMGetRelocationValueString should do... something. Returning the empty string is probably not the right behavior.
- LLVMSetParamAlignment needs a getter
- LLVMSetInstrParamAlignment needs a getter
- (LLVMGetCurrentFunction?): A way to query the IRBuilder about the function it is currently building.
- Support for the sanitizers needs to be moved out of the Go bindings and into the general bindings
- LLVMAddAlias has a bizarre user model that requires the user pass a PointerType to the type they want just so the C bindings can strip off the pointer and the C++ API can put it back.
- A wrapper type for defining an optimizer pass entirely in C is sorely needed.
Proposed API
Passes
There are ~140 passes defined by LLVM 4.0. Of those, we and LLVM-C wrap about 50.
- [x] AggressiveDCE
- [x] BitTrackingDCE
- [x] ArgumentPromotion
- [x] AlignmentFromAssumptions
- [x] BasicAAWrapper
- [x] SCEVAAWrapper
- [x] TypeBasedAAWrapper
- [x] ScopedNoAliasAAWrapper
- [x] BreakCriticalEdges
- [x] CFGSimplification
- [ ] CFLAndersAAWrapper
- [ ] CFLSteensAAWrapper
- [x] StructurizeCFG
- [x] ConstantMerge
- [x] ConstantPropagation
- [x] DeadArgElimination
- [x] DeadInstElimination
- [x] DeadStoreElimination
- [x] FunctionInlining
- [x] GlobalDCE
- [x] GlobalOptimizer
- [x] GlobalsAAWrapper
- [x] IPConstantPropagation
- [x] IPSCCP
- [x] IndVarSimplify
- [x] InstructionCombining
- [x] Internalize
- [x] LCSSA
- [x] LICM
- [x] LoopExtractor
- [x] LoopInterchange
- [x] LoopStrengthReduce
- [x] LoopReroll
- [x] LoopUnroll
- [x] LoopUnrollAndJam
- [x] LoopUnswitch
- [x] LoopVersioningLICM
- [x] LoopIdiom
- [x] LoopRotate
- [x] LowerExpectIntrinsic
- [x] LowerSwitch
- [x] PromoteMemoryToRegister
- [x] DemoteRegisterToMemory
- [x] PruneEH
- [x] Reassociate
- [x] SROA
- [x] StripSymbols
- [x] StripNonDebugSymbols
- [x] StripDeadDebugInfo
- [x] StripDeadPrototypes
- [x] TailCallElimination
- [x] JumpThreading
- [x] EarlyCSE
- [x] GVN
- [x] NewGVN
- [x] LoopDeletion
- [x] InstructionNamer
- [x] MetaRenamer
- [x] MergeFunctions
- [x] CorrelatedValuePropagation
- [x] LoopVectorize
- [x] SLPVectorizer
- [x] BBVectorize
- [x] PartiallyInlineLibCalls
- [x] Scalarizer
- [x] SeparateConstOffsetFromGEP
- [x] StraightLineStrengthReduce
Function Passes
- [ ] ObjCARCAAWrapper
- [ ] ObjCARCAPElim
- [ ] ObjCARCExpand
- [ ] ObjCARCContract
- [ ] ObjCARCOpt
Legacy Passes
- [ ] BoundsChecking
- [ ] LibCallsShrinkWrap
- [ ] PGOInstrumentationGenLegacy
- [ ] PGOInstrumentationUseLegacy
- [ ] PGOIndirectCallPromotionLegacy
- [ ] InstructionSimplifier
- [ ] NaryReassociate
- [ ] EliminateAvailableExternally
- [ ] LoadStoreVectorizer
- [ ] SpeculativeExecution
- [ ] SpeculativeExecutionIfHasBranchDivergence
- [ ] GVNHoist
- [ ] SCCP
- [ ] Sinking
- [ ] LowerInvoke
- [ ] InductiveRangeCheckElimination
- [ ] MergedLoadStoreMotion
- [ ] LoopSink
- [ ] GuardWidening
- [ ] DeadCodeElimination
- [ ] LoopPredication
- [ ] AlwaysInlinerLegacy
- [ ] InstrProfilingLegacy
- [ ] FunctionImport
- [ ] DivergenceAnalysis
- [ ] ConstantHoisting
- [ ] PostOrderFunctionAttrsLegacy
- [ ] ReversePostOrderFunctionAttrs
- [ ] CostModelAnalysis
- [ ] DependenceAnalysisWrapper
- [ ] Float2Int
- [ ] RewriteSymbols
- [ ] PartialInlining
- [ ] MemCpyOpt
- [ ] CodeGenPrepare
Future Passes
- [ ] UnifyFunctionExitNodes
- [ ] SafeStack
- [ ] LowerAtomic
- [ ] LoopSimplify
- [ ] LoopSimplifyCFG
- [ ] AAEval
Printers/Informative Passes
- [ ] DomOnlyPrinter
- [ ] DomPrinter
- [ ] DomOnlyViewer
- [ ] DomViewer
- [ ] MemDerefPrinter
- [ ] MemDepPrinter
- [ ] PostDomOnlyPrinter
- [ ] PostDomPrinter
- [ ] PostDomOnlyViewer
- [ ] PostDomViewer
- [ ] RegionOnlyPrinter
- [ ] RegionOnlyViewer
- [ ] RegionPrinter
- [ ] RegionViewer
- [ ] Lint
- [ ] ModuleDebugInfoPrinter
- [ ] CallGraphDOTPrinter
- [ ] CallGraphViewer
- [ ] PrintModulePass(os)
- [ ] PrintFunctionPass(os)
- [ ] PrintBasicBlockPass(os)
- [ ] GCOVProfiler
- [ ] RegionInfo
- [ ] SingleLoopExtractor
- [ ] PostDomTree
- [ ] InstCount
- [ ] LazyValueInfo
- [ ] PAEval
https://reviews.llvm.org/D44496
https://reviews.llvm.org/rL323819
https://reviews.llvm.org/D38485
https://reviews.llvm.org/D43448
https://reviews.llvm.org/D45346
https://reviews.llvm.org/D45347
https://reviews.llvm.org/D46808
https://reviews.llvm.org/D46890
https://reviews.llvm.org/D52659
https://reviews.llvm.org/D53555
https://reviews.llvm.org/D56177
https://reviews.llvm.org/D56179
https://reviews.llvm.org/D56279
https://reviews.llvm.org/D56280
https://reviews.llvm.org/D59658