Erik Eckstein
1a933fc76e
Swift SIL: add Type.getIndexOfEnumCase(withName:)
...
... to get the enum case index with a given name.
2022-05-12 21:48:37 +02:00
Erik Eckstein
b0003d51da
Swift SIL: add an initializer to create an empty SubstitutionMap
2022-05-12 21:48:37 +02:00
Erik Eckstein
dd5d5f97c4
Swift SIL: add Function.hasSemanticsAttribute
2022-05-12 21:48:37 +02:00
Erik Eckstein
ad9dafc9bf
Swift SIL: add Value.definingBlock
...
and re-factor `Value.definingInstruction`
2022-05-12 21:48:37 +02:00
Erik Eckstein
3b43da9637
Swift Optimizer: improve ergonomics of Builder and PassContext
...
* split the PassUtils.swift file into PassContext.swift and Passes.swift
* rework `Builder` bridging allowing more insertion point variations, e.g. inserting at the end of a block.
* add Builder.create functions for more instructions
* add `PassContext.splitBlock`
* move SIL modification functions from PassContext to extensions of the relevant types (e.g. instructions).
* rename `Location.bridgedLocation` -> `Location.bridged`
2022-05-12 21:48:37 +02:00
Erik Eckstein
14b985d87e
Swift SIL: support ownership
...
* add the `Ownership` enum and the `Value.ownership` getter
* add `Function.hasOwnership`
2022-05-12 21:48:37 +02:00
Egor Zhdan
145ed33482
[cxx-interop][SwiftCompilerSources] Use std::string instead of BridgedStringRef
...
This reverts commit 2900dec7
2022-05-03 19:48:14 +01:00
Josh Soref
d767912be2
Spelling sil ( #42471 )
...
* spelling: accessible
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: accessories
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: allocated
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: amortizes
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: are
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: arguments
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: cacheable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: check
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: clazz
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: compatible
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: compilation
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: completely
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: construct
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: conversion
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: declarations
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: derivation
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: deserialization
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: destroyed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: determined
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: different
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: doesn't
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: equality
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: equivalent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: formation
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: forwards
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: global
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: guaranteed
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: have
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: identify
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: inaccessible
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: indeterminate
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: indices
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: inefficient
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: inheritance
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: instantaneous
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: instruction
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: intentionally
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: interior
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: intrinsic
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: introducing
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: irrelevant
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: message
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: multi
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: necessarily
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: object
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: one
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: optimization
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: otherwise
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: overridden
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: parameter
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: pattern
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: pipeline
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: possibility
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: postdominance
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: providing
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: reached
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: recognized
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: refrigerator
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: remaining
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: resilient
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: retrieve
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: scavenge
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: scheduled
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: separately
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: serializable
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: signature
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: simplicity
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: specifically
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: substituted
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: substitution
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: subtypes
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: supplement
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: syntax
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: the
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: there
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: these
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: this
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: though
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: through
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transitively
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: transpose
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: trivial
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: value
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: verification
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: visibility
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: weird
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
* spelling: whole
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com >
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com >
2022-04-22 15:11:09 -07:00
Erik Eckstein
a5ac6c2cff
TypeLowering: add a recursive property to check if a type contains a RawPointer
...
This is needed for the new escape analysis
2022-04-22 09:50:07 +02:00
Erik Eckstein
340efd9e6f
Swift SIL: add MultipleValueInstructionResult.index
...
And make DestructureStructInst and DestructureTupleInst a UnaryInstruction
2022-04-22 09:50:07 +02:00
Saleem Abdulrasool
218ef587e6
Revert "Merge pull request #42242 from eeckstein/escapeinfo"
...
This reverts commit c05e064cd8 , reversing
changes made to c1534d5af9 .
This caused a regression on Windows.
2022-04-21 20:33:37 -07:00
Erik Eckstein
3b2e409d41
TypeLowering: add a recursive property to check if a type contains a RawPointer
...
This is needed for the new escape analysis
2022-04-21 08:45:08 +02:00
Erik Eckstein
325a0b1f48
swift SIL: add some Instruction, Value and Type APIs
...
* instructions `RefToBridgeObjectInst`, `BridgeObjectToWordInst`, `StringLiteralInst`, `ProjectBoxInst`, `InitEnumDataAddrInst`, `UncheckedTakeEnumDataAddrInst`, `InjectEnumAddrInst`
* protocols `StoringInstruction` and `EnumInstruction`
* load/store-weak/unowned instructions
* `CopyAddrInst.isTakeOfSrc/isInitializationOfDest`
* `ApplySite.calleeArgIndex/callerArgIndex`
* `SILValue.definingInstruction/definingBlock/function`
* `Type.isReferenceCounted`
* `FunctionArgument.isExclusiveIndirectParameter`
* support `CondBranchInst` in `incomingPhiValues`
2022-03-30 14:45:58 +02:00
Rintaro Ishizaki
7486cd1c21
[SwiftCompiler] Move common bridging facilities to 'Basic'
...
A preparation for AST/DiagnosticEngine bridging
2022-02-20 22:06:39 -08:00
Erik Eckstein
603e837a8f
Swift optimizations: make isSwift51RuntimeAvailable sensitive to the resilience domain of the function.
2022-01-27 13:20:38 +01:00
Erik Eckstein
f09dfc93a9
Swift SIL: escape effects for function arguments.
...
Store a list of argument effects in a function, which specify if and how arguments escape.
Such effects can be specified in the Swift source code (for details see docs/ReferenceGuides/UnderscoredAttributes.md) or derived in an optimization pass.
For details see the documentation in SwiftCompilerSources/Sources/SIL/Effects.swift.
2022-01-25 11:29:44 +01:00
Erik Eckstein
93f5d9f176
swift SIL: Type.getStructFields -> Type.getNominalFields
...
To be able to get class fields as well as struct fields
2022-01-25 11:29:25 +01:00
Max Desiatov
1f53563780
libswift: remove Instruction.mayReadRefCount
2022-01-19 18:51:19 +00:00
Max Desiatov
d7144c0046
libswift: implement isFieldOnlyNonTrivialField
2022-01-19 18:51:19 +00:00
Max Desiatov
848fa70529
libswift: reimplement Instruction helpers in Swift
2022-01-19 18:51:19 +00:00
Erik Eckstein
cec4b82b39
swift SIL: add some SIL type related bridging
...
* `Function.argumentTypes` and `Function.resultType`
* `Type.isNominal`, `Type.isClass`, `Type.isTuple`, `Type.isStruct` and `Type.isEnum`
* `Type.getFieldIndexOfNominal`
* `Type.getFieldTypeOfNominal`
* `Type.tupleElements`
* `Type.description` for better debugging
# Conflicts:
# SwiftCompilerSources/Sources/SIL/Type.swift
# SwiftCompilerSources/Sources/SIL/Utils.swift
# SwiftCompilerSources/Sources/SIL/Value.swift
# include/swift/SIL/SILBridging.h
# lib/SIL/Utils/SILBridging.cpp
2022-01-19 18:51:19 +00:00
Max Desiatov
b964dba177
libswift: implement ReleaseDevirtualizer in Swift
2022-01-19 18:51:19 +00:00
Max Desiatov
7d961001d3
libswift: bridge more functions from SILBuilder
2022-01-19 18:51:18 +00:00
Erik Eckstein
24b62d4d7c
Swift SIL: add a few utilities and instructions
...
* instructions: function_ref, mark_dependence
* add `BuiltinInst.id`
* add isObjC and canAllocOnStack for alloc_ref and alloc_ref_dynamic
* add `ApplySite::referencedFunction`
* add `Builder.createDeallocStackRef`
* add == and != operators for `Function`
* add `List.first` and `ReverseList.first`
2022-01-12 15:47:15 +01:00
Max Desiatov
42e6fac1ea
libswift: reimplement AssumeSingleThreaded pass
2022-01-10 08:47:43 +00:00
Erik Eckstein
3540c01125
rename initializeLibSwift -> InitializeSwiftModules
...
and some updates in comments.
2021-12-22 11:31:52 +01:00
Erik Eckstein
2900dec755
Revert [cxx-interop][libswift] Use std::string instead of BridgedStringRef
...
This causes problem with the Windows build and also causes a deserialization crash on Linux.
2021-12-17 13:45:46 +01:00
Erik Eckstein
27dc5afb10
libswift: add a few utilities
...
* add the IntegerLiteralInst + the Builder function to create it
* add Value.nonDebugUses
* add a general utility Sequence.isEmpty
* add PassContext.replaceAllUses
* add a function to erase all `debug_value` uses in PassContext.erase
2021-11-29 09:41:05 +01:00
Erik Eckstein
fc772fff50
libswift: add more instructions and other small utilities
...
* ApplySite.arguments
* BasicBlock != operator
* some Function argument related properties
* Operand.isTypeDependent
* Type.isTrivial
* bridging of raw_ostream::write
2021-09-24 11:36:41 +02:00
zoecarver
f063701f84
[cxx-interop][libswift] Use std::string instead of BridgedStringRef.
...
The first C-bridge to be removed! 🚀
2021-09-22 16:13:44 -07:00
Erik Eckstein
90c71ad002
libswift: improve and simplify pass invocation
...
* unify FunctionPassContext and InstructionPassContext
* add a modification API: PassContext.setOperand
* automatic invalidation notifications when the SIL is modified
2021-08-23 10:21:12 +02:00
Erik Eckstein
b175436d07
libswift: add instructions, support block predecessors/successors
...
Add many new instruction classes in libswift, including all terminator instructions.
This allows to support BasicBlock predecessors and successors.
2021-07-01 16:15:44 +02:00
Erik Eckstein
46c3a17e3d
libswift: add Type.isAddress and Type.isObject
2021-07-01 15:23:08 +02:00
Erik Eckstein
891f53d1e3
libswift: bridge the MemoryBehavior enum instead of all the mayRead/Write instruction functions
2021-07-01 15:17:51 +02:00
Erik Eckstein
d49108da07
libswift: add the SIL Builder
...
And two example instruction building functions.
2021-06-09 11:31:06 +02:00
Erik Eckstein
8080465e77
libswift: basic SIL and SIL bridging
...
This is the initial version of a buildable SIL definition in libswift.
It defines an initial set of SIL classes, like Function, BasicBlock, Instruction, Argument, and a few instruction classes.
The interface between C++ and SIL is a bridging layer, implemented in C.
It contains all the required bridging data structures used to access various SIL data structures.
2021-06-09 11:28:57 +02:00