mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SwiftCompilerSources: add some module-level APIs
* `Context.lookupFunction` * `ModulePassContext.loadFunction` * `ModulePassContext.createSpecializedFunctionDeclaration` * `ModulePassContext.moveFunctionBody` * `ModulePassContext.mangle(withDeadArguments:)`
This commit is contained in:
@@ -215,6 +215,10 @@ struct BridgedPassContext {
|
||||
bool specializeAppliesInFunction(BridgedFunction function, bool isMandatory) const;
|
||||
SWIFT_IMPORT_UNSAFE BridgedOwnedString mangleOutlinedVariable(BridgedFunction function) const;
|
||||
SWIFT_IMPORT_UNSAFE BridgedOwnedString mangleAsyncRemoved(BridgedFunction function) const;
|
||||
SWIFT_IMPORT_UNSAFE BridgedOwnedString mangleWithDeadArgs(const SwiftInt * _Nullable deadArgs,
|
||||
SwiftInt numDeadArgs,
|
||||
BridgedFunction function) const;
|
||||
|
||||
SWIFT_IMPORT_UNSAFE BridgedGlobalVar createGlobalVariable(BridgedStringRef name, BridgedType type,
|
||||
bool isPrivate) const;
|
||||
void inlineFunction(BridgedInstruction apply, bool mandatoryInline) const;
|
||||
@@ -274,6 +278,7 @@ struct BridgedPassContext {
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedDefaultWitnessTable getFirstDefaultWitnessTableInModule() const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE static OptionalBridgedDefaultWitnessTable getNextDefaultWitnessTableInModule(
|
||||
BridgedDefaultWitnessTable table);
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedFunction lookupFunction(BridgedStringRef name) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE OptionalBridgedFunction loadFunction(BridgedStringRef name,
|
||||
bool loadCalleesRecursively) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE void loadFunction(BridgedFunction function, bool loadCalleesRecursively) const;
|
||||
@@ -281,6 +286,12 @@ struct BridgedPassContext {
|
||||
SWIFT_IMPORT_UNSAFE OptionalBridgedFunction lookUpNominalDeinitFunction(BridgedNominalTypeDecl nominal) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedSubstitutionMap getContextSubstitutionMap(BridgedType type) const;
|
||||
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getBuiltinIntegerType(SwiftInt bitWidth) const;
|
||||
SWIFT_IMPORT_UNSAFE BridgedFunction createSpecializedFunction(BridgedStringRef name,
|
||||
const BridgedParameterInfo * _Nullable bridgedParams,
|
||||
SwiftInt paramCount,
|
||||
bool hasSelfParam,
|
||||
BridgedFunction fromFunc) const;
|
||||
void moveFunctionBody(BridgedFunction sourceFunc, BridgedFunction destFunc) const;
|
||||
|
||||
// Passmanager housekeeping
|
||||
|
||||
|
||||
@@ -364,6 +364,11 @@ getNextDefaultWitnessTableInModule(BridgedDefaultWitnessTable table) {
|
||||
return {&*nextIter};
|
||||
}
|
||||
|
||||
OptionalBridgedFunction BridgedPassContext::lookupFunction(BridgedStringRef name) const {
|
||||
swift::SILModule *mod = invocation->getPassManager()->getModule();
|
||||
return {mod->lookUpFunction(name.unbridged())};
|
||||
}
|
||||
|
||||
OptionalBridgedFunction BridgedPassContext::loadFunction(BridgedStringRef name, bool loadCalleesRecursively) const {
|
||||
swift::SILModule *mod = invocation->getPassManager()->getModule();
|
||||
return {mod->loadFunction(name.unbridged(),
|
||||
|
||||
Reference in New Issue
Block a user