Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/libbuiltin/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ config COMPILER_RT_HAS_BFLOAT16
bool "Enable support for bfloat16 in Compiler-rt"
default n

config COMPILER_RT_PROFILE
bool "Enable profiling support in Compiler-rt"
default n

endif # BUILTIN_COMPILER_RT
40 changes: 40 additions & 0 deletions libs/libbuiltin/compiler-rt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,46 @@ if(CONFIG_BUILTIN_COMPILER_RT)
list(APPEND RT_BUILTIN_SRCS floatundidf.c floatundisf.c floatundixf.c)
endif()

if(CONFIG_COMPILER_RT_PROFILE)

target_include_directories(
compiler-rt PRIVATE ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile)

target_compile_options(
compiler-rt
PRIVATE -DCOMPILER_RT_HAS_UNAME
-Wno-cleardeprecated-pragma
-Wno-deprecated-pragma
-Wno-incompatible-pointer-types
-Wno-shadow
-Wno-strict-prototypes
-Wno-undef
-Wno-unknown-warning-option)

set(RT_PROFILE_SRCS
GCDAProfiling.c
InstrProfiling.c
InstrProfilingBuffer.c
InstrProfilingFile.c
InstrProfilingInternal.c
InstrProfilingMerge.c
InstrProfilingMergeFile.c
InstrProfilingNameVar.c
InstrProfilingUtil.c
InstrProfilingValue.c
InstrProfilingVersionVar.c
InstrProfilingWriter.c
InstrProfilingRuntime.cpp)

foreach(src ${RT_PROFILE_SRCS})
string(PREPEND src ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile/)
list(APPEND COMPILER_RT_SRCS ${src})
endforeach()

list(APPEND COMPILER_RT_SRCS InstrProfilingPlatform.c)

endif()

list(APPEND INCDIR
${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${RT_BUILTIN_ARCH})

Expand Down
129 changes: 129 additions & 0 deletions libs/libbuiltin/compiler-rt/InstrProfilingPlatform.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/****************************************************************************
* libs/libbuiltin/compiler-rt/InstrProfilingPlatform.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/

/****************************************************************************
* Included Files
****************************************************************************/

#include <stdlib.h>
#include <stdio.h>

#include "InstrProfiling.h"
#include "InstrProfilingInternal.h"

/****************************************************************************
* Public Data
****************************************************************************/

extern char __start__llvm_prf_names[];
extern char __end__llvm_prf_names[];
extern char __start__llvm_prf_data[];
extern char __end__llvm_prf_data[];
extern char __start__llvm_prf_cnts[];
extern char __end__llvm_prf_cnts[];

COMPILER_RT_VISIBILITY ValueProfNode *CurrentVNode = 0;
COMPILER_RT_VISIBILITY ValueProfNode *EndVNode = 0;

/****************************************************************************
* Public Functions
****************************************************************************/

COMPILER_RT_VISIBILITY
void __llvm_profile_register_function(void *Data_)
{
}

COMPILER_RT_VISIBILITY
void __llvm_profile_register_names_function(void *NamesStart,
uint64_t NamesSize)
{
}

COMPILER_RT_VISIBILITY
const __llvm_profile_data *__llvm_profile_begin_data(void)
{
return &__start__llvm_prf_data;
}

COMPILER_RT_VISIBILITY
const __llvm_profile_data *__llvm_profile_end_data(void)
{
return &__end__llvm_prf_data;
}

COMPILER_RT_VISIBILITY
const char *__llvm_profile_begin_names(void)
{
return &__start__llvm_prf_names;
}

COMPILER_RT_VISIBILITY
const char *__llvm_profile_end_names(void)
{
return &__end__llvm_prf_names;
}

COMPILER_RT_VISIBILITY
char *__llvm_profile_begin_counters(void)
{
return &__start__llvm_prf_cnts;
}

COMPILER_RT_VISIBILITY
char *__llvm_profile_end_counters(void)
{
return &__end__llvm_prf_cnts;
}

COMPILER_RT_VISIBILITY
char *__llvm_profile_begin_bitmap(void)
{
return 0;
}

COMPILER_RT_VISIBILITY
char *__llvm_profile_end_bitmap(void)
{
return 0;
}

COMPILER_RT_VISIBILITY
uint32_t *__llvm_profile_begin_orderfile(void)
{
return 0;
}

COMPILER_RT_VISIBILITY
ValueProfNode *__llvm_profile_begin_vnodes(void)
{
return 0;
}

COMPILER_RT_VISIBILITY
ValueProfNode *__llvm_profile_end_vnodes(void)
{
return 0;
}

COMPILER_RT_VISIBILITY int __llvm_write_binary_ids(ProfDataWriter *Writer)
{
return 0;
}
33 changes: 33 additions & 0 deletions libs/libbuiltin/compiler-rt/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,36 @@ else
CSRCS += floatundidf.c floatundisf.c floatundixf.c
endif

ifeq ($(CONFIG_COMPILER_RT_PROFILE),y)

# Include paths
FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/profile

# Suppress specific warnings
FLAGS += -Wno-cleardeprecated-pragma -Wno-deprecated-pragma -Wno-incompatible-pointer-types
FLAGS += -Wno-shadow -Wno-strict-prototypes -Wno-undef -Wno-unknown-warning-option

# Define compiler-specific macros
FLAGS += -DCOMPILER_RT_HAS_UNAME

# Disable code coverage analysis for the library
FLAGS += -fno-profile-generate

# Profile support source files
CSRCS += GCDAProfiling.c InstrProfilingBuffer.c InstrProfiling.c InstrProfilingFile.c InstrProfilingInternal.c
Comment thread
xiaoxiang781216 marked this conversation as resolved.
CSRCS += InstrProfilingMerge.c InstrProfilingMergeFile.c InstrProfilingNameVar.c
CSRCS += InstrProfilingUtil.c InstrProfilingValue.c InstrProfilingVersionVar.c InstrProfilingWriter.c
CPPSRCS += InstrProfilingRuntime.cpp

# Profile platform support
CSRCS += InstrProfilingPlatform.c

# Dependency and search paths
DEPPATH += --dep-path compiler-rt/compiler-rt/lib/profile
VPATH += :compiler-rt/compiler-rt/lib/profile

endif

FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins/${ARCH}

AFLAGS += $(FLAGS)
Expand All @@ -160,3 +190,6 @@ VPATH += :compiler-rt/compiler-rt/lib/builtins/${ARCH}

DEPPATH += --dep-path compiler-rt/compiler-rt/lib/builtins
VPATH += :compiler-rt/compiler-rt/lib/builtins

DEPPATH += --dep-path compiler-rt
VPATH += :compiler-rt
7 changes: 7 additions & 0 deletions tools/nxstyle.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,13 @@ static const char *g_white_files[] =
"arm-acle-compat.h",
"arm_asm.h",

/* Skip Mixed case
* Ref:
* libs/libbuiltin/
*/

"InstrProfilingPlatform.c",

/* Skip Mixed case
* arch/arm/src/phy62xx/uart.c:1229:13: error: Mixed case identifier found
*/
Expand Down