Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM ABI Annotations #67502

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ccd01b6
Support/Threading: Include Support/thread.h before api implementations
tstellar Jul 31, 2023
c6d7d87
Passes: Consolidate EnableKnowledgeRetention declarations into a head…
tstellar Aug 5, 2023
62f4a9f
Manual: Add missing Passes.h include
tstellar Oct 12, 2023
9cebda4
XXX: Manual add missing Scalar.h header
tstellar Oct 12, 2023
e287163
XXX: Manual: Add missing TargetRegistry.h include
tstellar Oct 12, 2023
3d866d7
XXX: Manual add missing Passes.h header
tstellar Oct 12, 2023
95f5a2c
Fix up for AssumeBundleBuilder.h header
tstellar Oct 10, 2023
54648ce
Add llvm/Support/Compiler.h include to all files
tstellar Jul 11, 2023
2278b19
Automated Annotations: bash run-users.sh 03418e88a15e292d901b0acbc168…
tstellar Nov 7, 2023
c173f78
Add empty macros
tstellar Oct 1, 2023
7858d71
CMake changes
tstellar Jul 21, 2023
b46e8ab
XXX: Manual: Tablegen updates
tstellar Oct 11, 2023
d85db82
XXX: Manual: abi-breaking.h.cmake
tstellar Oct 12, 2023
1eaeeca
XXX: manual: Domtree Functions
tstellar Oct 12, 2023
db26c38
XXX: Manual PassManager
tstellar Oct 12, 2023
0e93234
XXX: Manual LLVM-C IsA*
tstellar Oct 12, 2023
d41366a
XXX: Manual ELFFile
tstellar Oct 12, 2023
d43a5a0
XXX: Manual XCOFFObjectFile
tstellar Oct 12, 2023
c25058d
XXX: Manual DomTree template
tstellar Oct 12, 2023
d18dc31
XXX: Manual: LoopInfoBase Template
tstellar Oct 12, 2023
fdd3f3f
XXX: Manual add annotation to templated function
tstellar Oct 13, 2023
b203ceb
XXX: Manual add annotations for symbols used by unit tests
tstellar Oct 13, 2023
684c1fc
XXX: manual unittests fixes
tstellar Oct 13, 2023
7d6ebab
XXX: Manual unit tests
tstellar Oct 13, 2023
51d763c
XXX: manual unit tests
tstellar Oct 13, 2023
e31467c
XXX: Manual unittest
tstellar Oct 13, 2023
920c558
XXX: Manual __jit_debug_descriptor
tstellar Oct 14, 2023
969c140
XXX: Workflow changes to enable testing
tstellar Jul 21, 2023
7ffc290
Manual: Add annotation to RegAlloc cl opts used by unittests
tstellar Aug 5, 2023
3e8b2c4
Manual: Add annotation to JITLink functions used by unittests
tstellar Nov 8, 2023
8955c78
Manual: [FunctionPropertiesAnalysis] Add annotation to cl opts used b…
tstellar Nov 8, 2023
413f292
Manual: PassBuilder: Add annotation to PrintPiplinePasses
tstellar Jul 21, 2023
d76fca4
Manual: Add ABI annotations to cl opts used by MemoryProfile unittests
tstellar Nov 8, 2023
707e610
Consolidate MemoryProfile cl declaration into headers
tstellar Nov 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/llvm-project-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-latest
#- ubuntu-latest
# Use windows-2019 due to:
# https://developercommunity.visualstudio.com/t/Prev-Issue---with-__assume-isnan-/1597317
- windows-2019
# We're using a specific version of macOS due to:
# https://github.com/actions/virtual-environments/issues/5900
- macOS-11
#- macOS-11
steps:
- name: Setup Windows
if: startsWith(matrix.os, 'windows')
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:
# This should be a no-op for non-mac OSes
PKG_CONFIG_PATH: /usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig//12
with:
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache'
cmake_args: '-GNinja -DLLVM_ENABLE_PROJECTS="${{ inputs.projects }}" -DCMAKE_BUILD_TYPE=Release -DLLDB_INCLUDE_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DLLVM_TARGETS_TO_BUILD=X86'
build_target: '${{ inputs.build_target }}'

- name: Build and Test libclc
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/llvm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ permissions:
on:
workflow_dispatch:
push:
branches:
- 'release/**'
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
- '.github/workflows/llvm-project-tests.yml'
pull_request:
branches:
- 'release/**'
paths:
- 'llvm/**'
- '.github/workflows/llvm-tests.yml'
- '.github/workflows/llvm-project-tests.yml'

concurrency:
# Skip intermediate builds: always.
Expand All @@ -28,7 +15,6 @@ concurrency:

jobs:
check_all:
if: github.repository_owner == 'llvm'
name: Test llvm,clang,libclc
uses: ./.github/workflows/llvm-project-tests.yml
with:
Expand Down
12 changes: 6 additions & 6 deletions libunwind/include/mach-o/compact_unwind_encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ enum {
//

#define UNWIND_SECTION_VERSION 1
struct unwind_info_section_header
struct LLVM_CLASS_ABI unwind_info_section_header
{
uint32_t version; // UNWIND_SECTION_VERSION
uint32_t commonEncodingsArraySectionOffset;
Expand All @@ -421,14 +421,14 @@ struct unwind_info_section_header
// unwind_info_section_header_lsda_index_entry[]
};

struct unwind_info_section_header_index_entry
struct LLVM_CLASS_ABI unwind_info_section_header_index_entry
{
uint32_t functionOffset;
uint32_t secondLevelPagesSectionOffset; // section offset to start of regular or compress page
uint32_t lsdaIndexArraySectionOffset; // section offset to start of lsda_index array for this range
};

struct unwind_info_section_header_lsda_index_entry
struct LLVM_CLASS_ABI unwind_info_section_header_lsda_index_entry
{
uint32_t functionOffset;
uint32_t lsdaOffset;
Expand All @@ -441,14 +441,14 @@ struct unwind_info_section_header_lsda_index_entry
// 511 entries.
//

struct unwind_info_regular_second_level_entry
struct LLVM_CLASS_ABI unwind_info_regular_second_level_entry
{
uint32_t functionOffset;
compact_unwind_encoding_t encoding;
};

#define UNWIND_SECOND_LEVEL_REGULAR 2
struct unwind_info_regular_second_level_page_header
struct LLVM_CLASS_ABI unwind_info_regular_second_level_page_header
{
uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR
uint16_t entryPageOffset;
Expand All @@ -457,7 +457,7 @@ struct unwind_info_regular_second_level_page_header
};

#define UNWIND_SECOND_LEVEL_COMPRESSED 3
struct unwind_info_compressed_second_level_page_header
struct LLVM_CLASS_ABI unwind_info_compressed_second_level_page_header
{
uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED
uint16_t entryPageOffset;
Expand Down
19 changes: 19 additions & 0 deletions llvm/cmake/modules/AddLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,21 @@ function(llvm_add_library name)

if(ARG_COMPONENT_LIB)
set_target_properties(${name} PROPERTIES LLVM_COMPONENT TRUE)
#target_compile_definitions(${name} PRIVATE LLVM_ABI_EXPORTS)
target_compile_options(${name} PRIVATE -DLLVM_ABI_EXPORTS)

# When building shared objects for each target there are some internal APIs
# that are used across shared objects which we can't hide.
if (NOT BUILD_SHARED_LIBS AND NOT APPLE AND
(NOT (WIN32 OR CYGWIN) OR (MINGW AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")) AND
NOT (${CMAKE_SYSTEM_NAME} MATCHES "AIX") AND
NOT DEFINED CMAKE_CXX_VISIBILITY_PRESET)

set_target_properties(${name} PROPERTIES
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN YES)
endif()
set_property(GLOBAL APPEND PROPERTY LLVM_COMPONENT_LIBS ${name})
endif()

Expand Down Expand Up @@ -1038,6 +1053,10 @@ macro(add_llvm_executable name)
endif()

llvm_codesign(${name} ENTITLEMENTS ${ARG_ENTITLEMENTS} BUNDLE_PATH ${ARG_BUNDLE_PATH})

if (LLVM_LINK_LLVM_DYLIB AND NOT DISABLE_LLVM_LINK_LLVM_DYLIB)
target_compile_options(${name} PRIVATE -DLLVM_DLL_IMPORT)
endif()
endmacro(add_llvm_executable name)

# add_llvm_pass_plugin(name [NO_MODULE] ...)
Expand Down
9 changes: 5 additions & 4 deletions llvm/include/llvm-c/Analysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef LLVM_C_ANALYSIS_H
#define LLVM_C_ANALYSIS_H

#include "llvm/Support/Compiler.h"
#include "llvm-c/ExternC.h"
#include "llvm-c/Types.h"

Expand All @@ -41,17 +42,17 @@ typedef enum {
/* Verifies that a module is valid, taking the specified action if not.
Optionally returns a human-readable description of any invalid constructs.
OutMessage must be disposed with LLVMDisposeMessage. */
LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
LLVM_FUNC_ABI LLVMBool LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
char **OutMessage);

/* Verifies that a single function is valid, taking the specified action. Useful
for debugging. */
LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);
LLVM_FUNC_ABI LLVMBool LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action);

/* Open up a ghostview window that displays the CFG of the current function.
Useful for debugging. */
void LLVMViewFunctionCFG(LLVMValueRef Fn);
void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);
LLVM_FUNC_ABI void LLVMViewFunctionCFG(LLVMValueRef Fn);
LLVM_FUNC_ABI void LLVMViewFunctionCFGOnly(LLVMValueRef Fn);

/**
* @}
Expand Down
17 changes: 9 additions & 8 deletions llvm/include/llvm-c/BitReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef LLVM_C_BITREADER_H
#define LLVM_C_BITREADER_H

#include "llvm/Support/Compiler.h"
#include "llvm-c/ExternC.h"
#include "llvm-c/Types.h"

Expand All @@ -36,28 +37,28 @@ LLVM_C_EXTERN_C_BEGIN
Optionally returns a human-readable error message via OutMessage.

This is deprecated. Use LLVMParseBitcode2. */
LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule,
LLVM_FUNC_ABI LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule,
char **OutMessage);

/* Builds a module from the bitcode in the specified memory buffer, returning a
reference to the module via the OutModule parameter. Returns 0 on success. */
LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf,
LLVM_FUNC_ABI LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule);

/* This is deprecated. Use LLVMParseBitcodeInContext2. */
LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
LLVM_FUNC_ABI LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule, char **OutMessage);

LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef,
LLVM_FUNC_ABI LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutModule);

/** Reads a module from the specified path, returning via the OutMP parameter
a module provider which performs lazy deserialization. Returns 0 on success.
Optionally returns a human-readable error message via OutMessage.
This is deprecated. Use LLVMGetBitcodeModuleInContext2. */
LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
LLVM_FUNC_ABI LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutM, char **OutMessage);

Expand All @@ -68,15 +69,15 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
*
* Takes ownership of \p MemBuf if (and only if) the module was read
* successfully. */
LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef,
LLVM_FUNC_ABI LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef,
LLVMMemoryBufferRef MemBuf,
LLVMModuleRef *OutM);

/* This is deprecated. Use LLVMGetBitcodeModule2. */
LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
LLVM_FUNC_ABI LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
char **OutMessage);

LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM);
LLVM_FUNC_ABI LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM);

/**
* @}
Expand Down
9 changes: 5 additions & 4 deletions llvm/include/llvm-c/BitWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#ifndef LLVM_C_BITWRITER_H
#define LLVM_C_BITWRITER_H

#include "llvm/Support/Compiler.h"
#include "llvm-c/ExternC.h"
#include "llvm-c/Types.h"

Expand All @@ -34,18 +35,18 @@ LLVM_C_EXTERN_C_BEGIN
/*===-- Operations on modules ---------------------------------------------===*/

/** Writes a module to the specified path. Returns 0 on success. */
int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);
LLVM_FUNC_ABI int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);

/** Writes a module to an open file descriptor. Returns 0 on success. */
int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
LLVM_FUNC_ABI int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
int Unbuffered);

/** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file
descriptor. Returns 0 on success. Closes the Handle. */
int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
LLVM_FUNC_ABI int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);

/** Writes a module to a new memory buffer and returns it. */
LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M);
LLVM_FUNC_ABI LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M);

/**
* @}
Expand Down
11 changes: 6 additions & 5 deletions llvm/include/llvm-c/Comdat.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "llvm-c/ExternC.h"
#include "llvm-c/Types.h"
#include "llvm/Support/Compiler.h"

LLVM_C_EXTERN_C_BEGIN

Expand Down Expand Up @@ -43,35 +44,35 @@ typedef enum {
*
* @see llvm::Module::getOrInsertComdat()
*/
LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name);
LLVM_FUNC_ABI LLVMComdatRef LLVMGetOrInsertComdat(LLVMModuleRef M, const char *Name);

/**
* Get the Comdat assigned to the given global object.
*
* @see llvm::GlobalObject::getComdat()
*/
LLVMComdatRef LLVMGetComdat(LLVMValueRef V);
LLVM_FUNC_ABI LLVMComdatRef LLVMGetComdat(LLVMValueRef V);

/**
* Assign the Comdat to the given global object.
*
* @see llvm::GlobalObject::setComdat()
*/
void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);
LLVM_FUNC_ABI void LLVMSetComdat(LLVMValueRef V, LLVMComdatRef C);

/*
* Get the conflict resolution selection kind for the Comdat.
*
* @see llvm::Comdat::getSelectionKind()
*/
LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
LLVM_FUNC_ABI LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);

/*
* Set the conflict resolution selection kind for the Comdat.
*
* @see llvm::Comdat::setSelectionKind()
*/
void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);
LLVM_FUNC_ABI void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);

/**
* @}
Expand Down
Loading
Loading