[K/N] Avoid string copying when setting up bridge debug info.
The name of the function was copied at least 4 times. This reduces a 56 seconds codegen phase in a non-optimized build by 2 seconds.
This commit is contained in:
@@ -81,11 +81,11 @@ DIModuleRef DICreateModule(DIBuilderRef builder, DIScopeOpaqueRef scope,
|
||||
return llvm::wrap(llvm::unwrap(builder)->createModule(llvm::unwrap(scope), name, configurationMacro, includePath, iSysRoot));
|
||||
}
|
||||
|
||||
DISubprogramRef DICreateFunction(DIBuilderRef builderRef, DIScopeOpaqueRef scope,
|
||||
const char* name, const char *linkageName,
|
||||
DIFileRef file, unsigned lineNo,
|
||||
DISubroutineTypeRef type, int isLocal,
|
||||
int isDefinition, unsigned scopeLine) {
|
||||
static DISubprogramRef DICreateFunctionShared(DIBuilderRef builderRef, DIScopeOpaqueRef scope,
|
||||
llvm::StringRef name, llvm::StringRef linkageName,
|
||||
DIFileRef file, unsigned lineNo,
|
||||
DISubroutineTypeRef type, int isLocal,
|
||||
int isDefinition, unsigned scopeLine) {
|
||||
auto builder = llvm::unwrap(builderRef);
|
||||
auto subprogram = builder->createFunction(llvm::unwrap(scope),
|
||||
name,
|
||||
@@ -102,6 +102,26 @@ DISubprogramRef DICreateFunction(DIBuilderRef builderRef, DIScopeOpaqueRef scope
|
||||
return llvm::wrap(subprogram);
|
||||
}
|
||||
|
||||
DISubprogramRef DICreateFunction(DIBuilderRef builderRef, DIScopeOpaqueRef scope,
|
||||
const char* name, const char *linkageName,
|
||||
DIFileRef file, unsigned lineNo,
|
||||
DISubroutineTypeRef type, int isLocal,
|
||||
int isDefinition, unsigned scopeLine) {
|
||||
return DICreateFunctionShared(builderRef, scope, name, linkageName, file, lineNo, type, isLocal, isDefinition, scopeLine);
|
||||
}
|
||||
|
||||
DISubprogramRef DICreateBridgeFunction(DIBuilderRef builderRef, DIScopeOpaqueRef scope,
|
||||
LLVMValueRef function,
|
||||
DIFileRef file, unsigned lineNo,
|
||||
DISubroutineTypeRef type, int isLocal,
|
||||
int isDefinition, unsigned scopeLine) {
|
||||
auto fn = llvm::cast<llvm::Function>(llvm::unwrap(function));
|
||||
auto name = fn->getName();
|
||||
auto subprogram = DICreateFunctionShared(builderRef, scope, name, name, file, lineNo, type, isLocal, isDefinition, scopeLine);
|
||||
fn->setSubprogram(llvm::unwrap(subprogram));
|
||||
return subprogram;
|
||||
}
|
||||
|
||||
DIScopeOpaqueRef DICreateLexicalBlockFile(DIBuilderRef builderRef, DIScopeOpaqueRef scopeRef, DIFileRef fileRef) {
|
||||
return llvm::wrap(llvm::unwrap(builderRef)->createLexicalBlockFile(llvm::unwrap(scopeRef), llvm::unwrap(fileRef)));
|
||||
}
|
||||
|
||||
@@ -93,6 +93,12 @@ DISubprogramRef DICreateFunction(DIBuilderRef builder, DIScopeOpaqueRef scope,
|
||||
DISubroutineTypeRef type, int isLocal,
|
||||
int isDefinition, unsigned scopeLine);
|
||||
|
||||
DISubprogramRef DICreateBridgeFunction(DIBuilderRef builder, DIScopeOpaqueRef scope,
|
||||
LLVMValueRef function,
|
||||
DIFileRef file, unsigned lineNo,
|
||||
DISubroutineTypeRef type, int isLocal,
|
||||
int isDefinition, unsigned scopeLine);
|
||||
|
||||
DISubroutineTypeRef DICreateSubroutineType(DIBuilderRef builder,
|
||||
DITypeOpaqueRef* types,
|
||||
unsigned typesCount);
|
||||
|
||||
Reference in New Issue
Block a user