diff options
114 files changed, 1741 insertions, 10207 deletions
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh index 219979dd..5fb8f69 100755 --- a/.ci/monolithic-windows.sh +++ b/.ci/monolithic-windows.sh @@ -23,8 +23,8 @@ runtimes_targets="${4}" start-group "CMake" pip install -q -r "${MONOREPO_ROOT}"/.ci/all_requirements.txt -export CC=cl -export CXX=cl +export CC=C:/clang/clang-msvc/bin/clang-cl.exe +export CXX=C:/clang/clang-msvc/bin/clang-cl.exe export LD=link # The CMAKE_*_LINKER_FLAGS to disable the manifest come from research @@ -49,6 +49,7 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \ -D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \ -D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \ -D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \ + -D CMAKE_CXX_FLAGS="-Wno-c++98-compat -Wno-c++14-compat -Wno-unsafe-buffer-usage -Wno-old-style-cast" \ -D LLVM_ENABLE_RUNTIMES="${runtimes}" start-group "ninja" diff --git a/.ci/premerge_advisor_upload.py b/.ci/premerge_advisor_upload.py index 1fc2423d..cb379b0 100644 --- a/.ci/premerge_advisor_upload.py +++ b/.ci/premerge_advisor_upload.py @@ -12,9 +12,12 @@ import requests import generate_test_report_lib -PREMERGE_ADVISOR_URL = ( - "http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/upload" -) +# These are IP addresses of the two premerge advisor instances. They should +# eventually be updated to domain names. +PREMERGE_ADVISOR_URLS = [ + "http://34.82.126.63:5000/upload", + "http://136.114.125.23:5000/upload", +] def main(commit_sha, workflow_run_number, build_log_files): @@ -41,7 +44,8 @@ def main(commit_sha, workflow_run_number, build_log_files): ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs) for name, failure_message in ninja_failures: failure_info["failures"].append({"name": name, "message": failure_message}) - requests.post(PREMERGE_ADVISOR_URL, json=failure_info) + for premerge_advisor_url in PREMERGE_ADVISOR_URLS: + requests.post(premerge_advisor_url, json=failure_info) if __name__ == "__main__": diff --git a/.ci/utils.sh b/.ci/utils.sh index dc8ce9b..540acfa 100644 --- a/.ci/utils.sh +++ b/.ci/utils.sh @@ -40,13 +40,17 @@ function at-exit { fi if [[ "$retcode" != "0" ]]; then - python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \ - $(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \ - "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log if [[ "$GITHUB_ACTIONS" != "" ]]; then python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \ $(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \ "${MONOREPO_ROOT}"/ninja*.log + python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \ + $(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \ + "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log + else + python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \ + $(git rev-parse HEAD) $BUILDBOT_BUILDNUMBER \ + "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log fi fi } diff --git a/clang/lib/CIR/CodeGen/CIRGenCall.cpp b/clang/lib/CIR/CodeGen/CIRGenCall.cpp index 88aef89..50d4c03 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCall.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenCall.cpp @@ -671,9 +671,12 @@ RValue CIRGenFunction::emitCall(const CIRGenFunctionInfo &funcInfo, return RValue::get(results[0]); } - case cir::TEK_Complex: - cgm.errorNYI(loc, "unsupported evaluation kind of function call result"); - return getUndefRValue(retTy); + case cir::TEK_Complex: { + mlir::ResultRange results = theCall->getOpResults(); + assert(!results.empty() && + "Expected at least one result for complex rvalue"); + return RValue::getComplex(results[0]); + } } llvm_unreachable("Invalid evaluation kind"); } diff --git a/clang/lib/CIR/CodeGen/CIRGenCleanup.h b/clang/lib/CIR/CodeGen/CIRGenCleanup.h index 9acf8b1..61a09a5 100644 --- a/clang/lib/CIR/CodeGen/CIRGenCleanup.h +++ b/clang/lib/CIR/CodeGen/CIRGenCleanup.h @@ -15,6 +15,7 @@ #define CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H #include "Address.h" +#include "CIRGenModule.h" #include "EHScopeStack.h" #include "mlir/IR/Value.h" @@ -257,5 +258,53 @@ inline void EHScopeStack::popCatch() { deallocate(EHCatchScope::getSizeForNumHandlers(scope.getNumHandlers())); } +/// The exceptions personality for a function. +struct EHPersonality { + const char *personalityFn = nullptr; + + // If this is non-null, this personality requires a non-standard + // function for rethrowing an exception after a catchall cleanup. + // This function must have prototype void(void*). + const char *catchallRethrowFn = nullptr; + + static const EHPersonality &get(CIRGenModule &cgm, + const clang::FunctionDecl *fd); + static const EHPersonality &get(CIRGenFunction &cgf); + + static const EHPersonality GNU_C; + static const EHPersonality GNU_C_SJLJ; + static const EHPersonality GNU_C_SEH; + static const EHPersonality GNU_ObjC; + static const EHPersonality GNU_ObjC_SJLJ; + static const EHPersonality GNU_ObjC_SEH; + static const EHPersonality GNUstep_ObjC; + static const EHPersonality GNU_ObjCXX; + static const EHPersonality NeXT_ObjC; + static const EHPersonality GNU_CPlusPlus; + static const EHPersonality GNU_CPlusPlus_SJLJ; + static const EHPersonality GNU_CPlusPlus_SEH; + static const EHPersonality MSVC_except_handler; + static const EHPersonality MSVC_C_specific_handler; + static const EHPersonality MSVC_CxxFrameHandler3; + static const EHPersonality GNU_Wasm_CPlusPlus; + static const EHPersonality XL_CPlusPlus; + static const EHPersonality ZOS_CPlusPlus; + + /// Does this personality use landingpads or the family of pad instructions + /// designed to form funclets? + bool usesFuncletPads() const { + return isMSVCPersonality() || isWasmPersonality(); + } + + bool isMSVCPersonality() const { + return this == &MSVC_except_handler || this == &MSVC_C_specific_handler || + this == &MSVC_CxxFrameHandler3; + } + + bool isWasmPersonality() const { return this == &GNU_Wasm_CPlusPlus; } + + bool isMSVCXXPersonality() const { return this == &MSVC_CxxFrameHandler3; } +}; + } // namespace clang::CIRGen #endif // CLANG_LIB_CIR_CODEGEN_CIRGENCLEANUP_H diff --git a/clang/lib/CIR/CodeGen/CIRGenException.cpp b/clang/lib/CIR/CodeGen/CIRGenException.cpp index 717a3e0..67f46ff 100644 --- a/clang/lib/CIR/CodeGen/CIRGenException.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenException.cpp @@ -18,6 +18,171 @@ using namespace clang; using namespace clang::CIRGen; +const EHPersonality EHPersonality::GNU_C = {"__gcc_personality_v0", nullptr}; +const EHPersonality EHPersonality::GNU_C_SJLJ = {"__gcc_personality_sj0", + nullptr}; +const EHPersonality EHPersonality::GNU_C_SEH = {"__gcc_personality_seh0", + nullptr}; +const EHPersonality EHPersonality::NeXT_ObjC = {"__objc_personality_v0", + nullptr}; +const EHPersonality EHPersonality::GNU_CPlusPlus = {"__gxx_personality_v0", + nullptr}; +const EHPersonality EHPersonality::GNU_CPlusPlus_SJLJ = { + "__gxx_personality_sj0", nullptr}; +const EHPersonality EHPersonality::GNU_CPlusPlus_SEH = { + "__gxx_personality_seh0", nullptr}; +const EHPersonality EHPersonality::GNU_ObjC = {"__gnu_objc_personality_v0", + "objc_exception_throw"}; +const EHPersonality EHPersonality::GNU_ObjC_SJLJ = { + "__gnu_objc_personality_sj0", "objc_exception_throw"}; +const EHPersonality EHPersonality::GNU_ObjC_SEH = { + "__gnu_objc_personality_seh0", "objc_exception_throw"}; +const EHPersonality EHPersonality::GNU_ObjCXX = { + "__gnustep_objcxx_personality_v0", nullptr}; +const EHPersonality EHPersonality::GNUstep_ObjC = { + "__gnustep_objc_personality_v0", nullptr}; +const EHPersonality EHPersonality::MSVC_except_handler = {"_except_handler3", + nullptr}; +const EHPersonality EHPersonality::MSVC_C_specific_handler = { + "__C_specific_handler", nullptr}; +const EHPersonality EHPersonality::MSVC_CxxFrameHandler3 = { + "__CxxFrameHandler3", nullptr}; +const EHPersonality EHPersonality::GNU_Wasm_CPlusPlus = { + "__gxx_wasm_personality_v0", nullptr}; +const EHPersonality EHPersonality::XL_CPlusPlus = {"__xlcxx_personality_v1", + nullptr}; +const EHPersonality EHPersonality::ZOS_CPlusPlus = {"__zos_cxx_personality_v2", + nullptr}; + +static const EHPersonality &getCPersonality(const TargetInfo &target, + const CodeGenOptions &cgOpts) { + const llvm::Triple &triple = target.getTriple(); + if (triple.isWindowsMSVCEnvironment()) + return EHPersonality::MSVC_CxxFrameHandler3; + if (cgOpts.hasSjLjExceptions()) + return EHPersonality::GNU_C_SJLJ; + if (cgOpts.hasDWARFExceptions()) + return EHPersonality::GNU_C; + if (cgOpts.hasSEHExceptions()) + return EHPersonality::GNU_C_SEH; + return EHPersonality::GNU_C; +} + +static const EHPersonality &getObjCPersonality(const TargetInfo &target, + const LangOptions &langOpts, + const CodeGenOptions &cgOpts) { + const llvm::Triple &triple = target.getTriple(); + if (triple.isWindowsMSVCEnvironment()) + return EHPersonality::MSVC_CxxFrameHandler3; + + switch (langOpts.ObjCRuntime.getKind()) { + case ObjCRuntime::FragileMacOSX: + return getCPersonality(target, cgOpts); + case ObjCRuntime::MacOSX: + case ObjCRuntime::iOS: + case ObjCRuntime::WatchOS: + return EHPersonality::NeXT_ObjC; + case ObjCRuntime::GNUstep: + if (langOpts.ObjCRuntime.getVersion() >= VersionTuple(1, 7)) + return EHPersonality::GNUstep_ObjC; + [[fallthrough]]; + case ObjCRuntime::GCC: + case ObjCRuntime::ObjFW: + if (cgOpts.hasSjLjExceptions()) + return EHPersonality::GNU_ObjC_SJLJ; + if (cgOpts.hasSEHExceptions()) + return EHPersonality::GNU_ObjC_SEH; + return EHPersonality::GNU_ObjC; + } + llvm_unreachable("bad runtime kind"); +} + +static const EHPersonality &getCXXPersonality(const TargetInfo &target, + const CodeGenOptions &cgOpts) { + const llvm::Triple &triple = target.getTriple(); + if (triple.isWindowsMSVCEnvironment()) + return EHPersonality::MSVC_CxxFrameHandler3; + if (triple.isOSAIX()) + return EHPersonality::XL_CPlusPlus; + if (cgOpts.hasSjLjExceptions()) + return EHPersonality::GNU_CPlusPlus_SJLJ; + if (cgOpts.hasDWARFExceptions()) + return EHPersonality::GNU_CPlusPlus; + if (cgOpts.hasSEHExceptions()) + return EHPersonality::GNU_CPlusPlus_SEH; + if (cgOpts.hasWasmExceptions()) + return EHPersonality::GNU_Wasm_CPlusPlus; + return EHPersonality::GNU_CPlusPlus; +} + +/// Determines the personality function to use when both C++ +/// and Objective-C exceptions are being caught. +static const EHPersonality &getObjCXXPersonality(const TargetInfo &target, + const LangOptions &langOpts, + const CodeGenOptions &cgOpts) { + if (target.getTriple().isWindowsMSVCEnvironment()) + return EHPersonality::MSVC_CxxFrameHandler3; + + switch (langOpts.ObjCRuntime.getKind()) { + // In the fragile ABI, just use C++ exception handling and hope + // they're not doing crazy exception mixing. + case ObjCRuntime::FragileMacOSX: + return getCXXPersonality(target, cgOpts); + + // The ObjC personality defers to the C++ personality for non-ObjC + // handlers. Unlike the C++ case, we use the same personality + // function on targets using (backend-driven) SJLJ EH. + case ObjCRuntime::MacOSX: + case ObjCRuntime::iOS: + case ObjCRuntime::WatchOS: + return getObjCPersonality(target, langOpts, cgOpts); + + case ObjCRuntime::GNUstep: + return EHPersonality::GNU_ObjCXX; + + // The GCC runtime's personality function inherently doesn't support + // mixed EH. Use the ObjC personality just to avoid returning null. + case ObjCRuntime::GCC: + case ObjCRuntime::ObjFW: + return getObjCPersonality(target, langOpts, cgOpts); + } + llvm_unreachable("bad runtime kind"); +} + +static const EHPersonality &getSEHPersonalityMSVC(const llvm::Triple &triple) { + return triple.getArch() == llvm::Triple::x86 + ? EHPersonality::MSVC_except_handler + : EHPersonality::MSVC_C_specific_handler; +} + +const EHPersonality &EHPersonality::get(CIRGenModule &cgm, + const FunctionDecl *fd) { + const llvm::Triple &triple = cgm.getTarget().getTriple(); + const LangOptions &langOpts = cgm.getLangOpts(); + const CodeGenOptions &cgOpts = cgm.getCodeGenOpts(); + const TargetInfo &target = cgm.getTarget(); + + // Functions using SEH get an SEH personality. + if (fd && fd->usesSEHTry()) + return getSEHPersonalityMSVC(triple); + + if (langOpts.ObjC) { + return langOpts.CPlusPlus ? getObjCXXPersonality(target, langOpts, cgOpts) + : getObjCPersonality(target, langOpts, cgOpts); + } + return langOpts.CPlusPlus ? getCXXPersonality(target, cgOpts) + : getCPersonality(target, cgOpts); +} + +const EHPersonality &EHPersonality::get(CIRGenFunction &cgf) { + const auto *fg = cgf.curCodeDecl; + // For outlined finallys and filters, use the SEH personality in case they + // contain more SEH. This mostly only affects finallys. Filters could + // hypothetically use gnu statement expressions to sneak in nested SEH. + fg = fg ? fg : cgf.curSEHParent.getDecl(); + return get(cgf.cgm, dyn_cast_or_null<FunctionDecl>(fg)); +} + void CIRGenFunction::emitCXXThrowExpr(const CXXThrowExpr *e) { const llvm::Triple &triple = getTarget().getTriple(); if (cgm.getLangOpts().OpenMPIsTargetDevice && diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h index d791130..c3fcd1a6 100644 --- a/clang/lib/CIR/CodeGen/CIRGenFunction.h +++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h @@ -120,6 +120,8 @@ public: /// Tracks function scope overall cleanup handling. EHScopeStack ehStack; + GlobalDecl curSEHParent; + llvm::DenseMap<const clang::ValueDecl *, clang::FieldDecl *> lambdaCaptureFields; clang::FieldDecl *lambdaThisCaptureField = nullptr; diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index a8a9c51..1d0dfd0b 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -3791,18 +3791,12 @@ static bool isFunctionDeclarationName(const LangOptions &LangOpts, if (Current.is(TT_FunctionDeclarationName)) return true; - if (!Current.Tok.getIdentifierInfo()) + if (Current.isNoneOf(tok::identifier, tok::kw_operator)) return false; const auto *Prev = Current.getPreviousNonComment(); assert(Prev); - if (Prev->is(tok::coloncolon)) - Prev = Prev->Previous; - - if (!Prev) - return false; - const auto &Previous = *Prev; if (const auto *PrevPrev = Previous.getPreviousNonComment(); @@ -3851,6 +3845,8 @@ static bool isFunctionDeclarationName(const LangOptions &LangOpts, // Find parentheses of parameter list. if (Current.is(tok::kw_operator)) { + if (Line.startsWith(tok::kw_friend)) + return true; if (Previous.Tok.getIdentifierInfo() && Previous.isNoneOf(tok::kw_return, tok::kw_co_return)) { return true; diff --git a/clang/test/CIR/CodeGen/complex.cpp b/clang/test/CIR/CodeGen/complex.cpp index 4e89af4..3fb78dc 100644 --- a/clang/test/CIR/CodeGen/complex.cpp +++ b/clang/test/CIR/CodeGen/complex.cpp @@ -1468,3 +1468,30 @@ void calling_function_with_default_arg() { // OGCG: store float 0x40019999A0000000, ptr %[[DEFAULT_ARG_IMAG_PTR]], align 4 // OGCG: %[[TMP_DEFAULT_ARG:.*]] = load <2 x float>, ptr %[[DEFAULT_ARG_ADDR]], align 4 // OGCG: call void @_Z33function_with_complex_default_argCf(<2 x float> {{.*}} %[[TMP_DEFAULT_ARG]]) + +void calling_function_that_return_complex() { + float _Complex a = complex_type_return_type(); +} + +// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a", init] +// CIR: %[[RESULT:.*]] = cir.call @_Z24complex_type_return_typev() : () -> !cir.complex<!cir.float> +// CIR: cir.store{{.*}} %[[RESULT]], %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>> + +// TODO(CIR): the difference between the CIR LLVM and OGCG is because the lack of calling convention lowering, + +// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4 +// LLVM: %[[RESULT:.*]] = call { float, float } @_Z24complex_type_return_typev() +// LLVM: store { float, float } %[[RESULT]], ptr %[[A_ADDR]], align 4 + +// OGCG: %[[A_ADDR:.*]] = alloca { float, float }, align 4 +// OGCG: %[[RESULT_ADDR:.*]] = alloca { float, float }, align 4 +// OGCG: %[[RESULT:.*]] = call noundef <2 x float> @_Z24complex_type_return_typev() +// OGCG: store <2 x float> %[[RESULT]], ptr %[[RESULT_ADDR]], align 4 +// OGCG: %[[RESULT_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[RESULT_ADDR]], i32 0, i32 0 +// OGCG: %[[RESULT_REAL:.*]] = load float, ptr %[[RESULT_REAL_PTR]], align 4 +// OGCG: %[[RESULT_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[RESULT_ADDR]], i32 0, i32 1 +// OGCG: %[[RESULT_IMAG:.*]] = load float, ptr %[[RESULT_IMAG_PTR]], align 4 +// OGCG: %[[A_REAL_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 0 +// OGCG: %[[A_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[A_ADDR]], i32 0, i32 1 +// OGCG: store float %[[RESULT_REAL]], ptr %[[A_REAL_PTR]], align 4 +// OGCG: store float %[[RESULT_IMAG]], ptr %[[A_IMAG_PTR]], align 4 diff --git a/clang/unittests/Format/TokenAnnotatorTest.cpp b/clang/unittests/Format/TokenAnnotatorTest.cpp index f363738..ca99940 100644 --- a/clang/unittests/Format/TokenAnnotatorTest.cpp +++ b/clang/unittests/Format/TokenAnnotatorTest.cpp @@ -1129,6 +1129,11 @@ TEST_F(TokenAnnotatorTest, UnderstandsOverloadedOperators) { ASSERT_EQ(Tokens.size(), 7u) << Tokens; // Not TT_FunctionDeclarationName. EXPECT_TOKEN(Tokens[3], tok::kw_operator, TT_Unknown); + + Tokens = annotate("SomeAPI::operator()();"); + ASSERT_EQ(Tokens.size(), 9u) << Tokens; + // Not TT_FunctionDeclarationName. + EXPECT_TOKEN(Tokens[2], tok::kw_operator, TT_Unknown); } TEST_F(TokenAnnotatorTest, OverloadedOperatorInTemplate) { diff --git a/libc/include/llvm-libc-macros/gpu/signal-macros.h b/libc/include/llvm-libc-macros/gpu/signal-macros.h index f0d49ea..76488e9 100644 --- a/libc/include/llvm-libc-macros/gpu/signal-macros.h +++ b/libc/include/llvm-libc-macros/gpu/signal-macros.h @@ -9,6 +9,8 @@ #ifndef LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H #define LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H +#include "__llvm-libc-common.h" + #define SIGINT 2 #define SIGILL 4 #define SIGABRT 6 @@ -16,9 +18,10 @@ #define SIGSEGV 11 #define SIGTERM 15 -#define SIG_DFL ((void (*)(int))(0)) -#define SIG_IGN ((void (*)(int))(1)) -#define SIG_ERR ((void (*)(int))(-1)) +#define SIG_ERR __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), -1) +#define SIG_DFL __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 0) +#define SIG_IGN __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 1) +#define SIG_HOLD __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 2) // Max signal number #define NSIG 64 diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h index d220241..e7f268d 100644 --- a/libc/include/llvm-libc-macros/linux/signal-macros.h +++ b/libc/include/llvm-libc-macros/linux/signal-macros.h @@ -9,6 +9,8 @@ #ifndef LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H #define LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H +#include "__llvm-libc-common.h" + #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 @@ -86,9 +88,10 @@ #error "Signal stack sizes not defined for your platform." #endif -#define SIG_DFL ((void (*)(int))0) -#define SIG_IGN ((void (*)(int))1) -#define SIG_ERR ((void (*)(int))(-1)) +#define SIG_ERR __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), -1) +#define SIG_DFL __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 0) +#define SIG_IGN __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 1) +#define SIG_HOLD __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 2) // SIGCHLD si_codes #define CLD_EXITED 1 // child has exited diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index f4a0923..c375df2 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1356,7 +1356,11 @@ public: StopHook(const StopHook &rhs); virtual ~StopHook() = default; - enum class StopHookKind : uint32_t { CommandBased = 0, ScriptBased }; + enum class StopHookKind : uint32_t { + CommandBased = 0, + ScriptBased, + CodeBased, + }; enum class StopHookResult : uint32_t { KeepStopped = 0, RequestContinue, @@ -1403,6 +1407,12 @@ public: bool GetRunAtInitialStop() const { return m_at_initial_stop; } + void SetSuppressOutput(bool suppress_output) { + m_suppress_output = suppress_output; + } + + bool GetSuppressOutput() const { return m_suppress_output; } + void GetDescription(Stream &s, lldb::DescriptionLevel level) const; virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const = 0; @@ -1414,6 +1424,7 @@ public: bool m_active = true; bool m_auto_continue = false; bool m_at_initial_stop = true; + bool m_suppress_output = false; StopHook(lldb::TargetSP target_sp, lldb::user_id_t uid); }; @@ -1433,8 +1444,8 @@ public: private: StringList m_commands; - // Use CreateStopHook to make a new empty stop hook. The GetCommandPointer - // and fill it with commands, and SetSpecifier to set the specifier shared + // Use CreateStopHook to make a new empty stop hook. Use SetActionFromString + // to fill it with commands, and SetSpecifier to set the specifier shared // pointer (can be null, that will match anything.) StopHookCommandLine(lldb::TargetSP target_sp, lldb::user_id_t uid) : StopHook(target_sp, uid) {} @@ -1460,19 +1471,56 @@ public: StructuredDataImpl m_extra_args; lldb::ScriptedStopHookInterfaceSP m_interface_sp; - /// Use CreateStopHook to make a new empty stop hook. The GetCommandPointer - /// and fill it with commands, and SetSpecifier to set the specifier shared - /// pointer (can be null, that will match anything.) + /// Use CreateStopHook to make a new empty stop hook. Use SetScriptCallback + /// to set the script to execute, and SetSpecifier to set the specifier + /// shared pointer (can be null, that will match anything.) StopHookScripted(lldb::TargetSP target_sp, lldb::user_id_t uid) : StopHook(target_sp, uid) {} friend class Target; }; + class StopHookCoded : public StopHook { + public: + ~StopHookCoded() override = default; + + using HandleStopCallback = StopHookResult(ExecutionContext &exc_ctx, + lldb::StreamSP output); + + void SetCallback(llvm::StringRef name, HandleStopCallback *callback) { + m_name = name; + m_callback = callback; + } + + StopHookResult HandleStop(ExecutionContext &exc_ctx, + lldb::StreamSP output) override { + return m_callback(exc_ctx, output); + } + + void GetSubclassDescription(Stream &s, + lldb::DescriptionLevel level) const override { + s.Indent(); + s.Printf("%s (built-in)\n", m_name.c_str()); + } + + private: + std::string m_name; + HandleStopCallback *m_callback; + + /// Use CreateStopHook to make a new empty stop hook. Use SetCallback to set + /// the callback to execute, and SetSpecifier to set the specifier shared + /// pointer (can be null, that will match anything.) + StopHookCoded(lldb::TargetSP target_sp, lldb::user_id_t uid) + : StopHook(target_sp, uid) {} + friend class Target; + }; + + void RegisterInternalStopHooks(); + typedef std::shared_ptr<StopHook> StopHookSP; /// Add an empty stop hook to the Target's stop hook list, and returns a - /// shared pointer to it in new_hook. Returns the id of the new hook. - StopHookSP CreateStopHook(StopHook::StopHookKind kind); + /// shared pointer to the new hook. + StopHookSP CreateStopHook(StopHook::StopHookKind kind, bool internal = false); /// If you tried to create a stop hook, and that failed, call this to /// remove the stop hook, as it will also reset the stop hook counter. @@ -1484,8 +1532,6 @@ public: // control over the process for the first time. bool RunStopHooks(bool at_initial_stop = false); - size_t GetStopHookSize(); - bool SetSuppresStopHooks(bool suppress) { bool old_value = m_suppress_stop_hooks; m_suppress_stop_hooks = suppress; @@ -1504,19 +1550,7 @@ public: void SetAllStopHooksActiveState(bool active_state); - size_t GetNumStopHooks() const { return m_stop_hooks.size(); } - - StopHookSP GetStopHookAtIndex(size_t index) { - if (index >= GetNumStopHooks()) - return StopHookSP(); - StopHookCollection::iterator pos = m_stop_hooks.begin(); - - while (index > 0) { - pos++; - index--; - } - return (*pos).second; - } + const std::vector<StopHookSP> GetStopHooks(bool internal = false) const; lldb::PlatformSP GetPlatform() { return m_platform_sp; } @@ -1656,6 +1690,7 @@ protected: typedef std::map<lldb::user_id_t, StopHookSP> StopHookCollection; StopHookCollection m_stop_hooks; lldb::user_id_t m_stop_hook_next_id; + std::vector<StopHookSP> m_internal_stop_hooks; uint32_t m_latest_stop_hook_id; /// This records the last natural stop at /// which we ran a stop-hook. bool m_valid; diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp index b2fc893..c60d303 100644 --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -777,13 +777,11 @@ void CommandCompletions::StopHookIDs(CommandInterpreter &interpreter, if (!target_sp) return; - const size_t num = target_sp->GetNumStopHooks(); - for (size_t idx = 0; idx < num; ++idx) { + for (auto &stophook_sp : target_sp->GetStopHooks()) { StreamString strm; // The value 11 is an offset to make the completion description looks // neater. strm.SetIndentLevel(11); - const Target::StopHookSP stophook_sp = target_sp->GetStopHookAtIndex(idx); stophook_sp->GetDescription(strm, lldb::eDescriptionLevelInitial); request.TryCompleteCurrentArg(std::to_string(stophook_sp->GetID()), strm.GetString()); diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index de0a7e7..5a55126 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -1114,9 +1114,7 @@ public: CommandObjectBreakpointList(CommandInterpreter &interpreter) : CommandObjectParsed( interpreter, "breakpoint list", - "List some or all breakpoints at configurable levels of detail.", - nullptr) { - CommandArgumentData bp_id_arg; + "List some or all breakpoints at configurable levels of detail.") { // Define the first (and only) variant of this arg. AddSimpleArgumentList(eArgTypeBreakpointID, eArgRepeatOptional); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index c59d028..8de6521 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -5223,33 +5223,72 @@ private: #pragma mark CommandObjectTargetStopHookList // CommandObjectTargetStopHookList +#define LLDB_OPTIONS_target_stop_hook_list +#include "CommandOptions.inc" class CommandObjectTargetStopHookList : public CommandObjectParsed { public: CommandObjectTargetStopHookList(CommandInterpreter &interpreter) : CommandObjectParsed(interpreter, "target stop-hook list", - "List all stop-hooks.", "target stop-hook list") {} + "List all stop-hooks.") {} ~CommandObjectTargetStopHookList() override = default; + Options *GetOptions() override { return &m_options; } + + class CommandOptions : public Options { + public: + CommandOptions() = default; + ~CommandOptions() override = default; + + Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, + ExecutionContext *execution_context) override { + Status error; + const int short_option = m_getopt_table[option_idx].val; + + switch (short_option) { + case 'i': + m_internal = true; + break; + default: + llvm_unreachable("Unimplemented option"); + } + + return error; + } + + void OptionParsingStarting(ExecutionContext *execution_context) override { + m_internal = false; + } + + llvm::ArrayRef<OptionDefinition> GetDefinitions() override { + return llvm::ArrayRef(g_target_stop_hook_list_options); + } + + // Instance variables to hold the values for command options. + bool m_internal = false; + }; + protected: void DoExecute(Args &command, CommandReturnObject &result) override { Target &target = GetTarget(); - size_t num_hooks = target.GetNumStopHooks(); - if (num_hooks == 0) { - result.GetOutputStream().PutCString("No stop hooks.\n"); - } else { - for (size_t i = 0; i < num_hooks; i++) { - Target::StopHookSP this_hook = target.GetStopHookAtIndex(i); - if (i > 0) - result.GetOutputStream().PutCString("\n"); - this_hook->GetDescription(result.GetOutputStream(), - eDescriptionLevelFull); - } + bool printed_hook = false; + for (auto &hook : target.GetStopHooks(m_options.m_internal)) { + if (printed_hook) + result.GetOutputStream().PutCString("\n"); + hook->GetDescription(result.GetOutputStream(), eDescriptionLevelFull); + printed_hook = true; } + + if (!printed_hook) + result.GetOutputStream().PutCString("No stop hooks.\n"); + result.SetStatus(eReturnStatusSuccessFinishResult); } + +private: + CommandOptions m_options; }; #pragma mark CommandObjectMultiwordTargetStopHooks diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td index a9f054e..ed06131 100644 --- a/lldb/source/Commands/Options.td +++ b/lldb/source/Commands/Options.td @@ -77,7 +77,7 @@ let Command = "breakpoint list" in { // FIXME: We need to add an "internal" command, and then add this sort of // thing to it. But I need to see it for now, and don't want to wait. def blist_internal : Option<"internal", "i">, - Desc<"Show debugger ${i}nternal breakpoints">; + Desc<"Show debugger ${i}nternal breakpoints.">; def blist_brief : Option<"brief", "b">, Group<1>, Desc<"Give a ${b}rief description of the breakpoint (no " @@ -1686,7 +1686,7 @@ let Command = "target modules lookup" in { "match, if a best match is available.">; } -let Command = "target stop hook add" in { +let Command = "target stop_hook add" in { def target_stop_hook_add_one_liner : Option<"one-liner", "o">, GroupRange<1, 3>, @@ -1762,6 +1762,12 @@ let Command = "target stop hook add" in { "Defaults to true.">; } +let Command = "target stop_hook list" in { + def target_stop_hook_list_internal + : Option<"internal", "i">, + Desc<"Show debugger ${i}nternal stop hooks.">; +} + let Command = "thread backtrace" in { def thread_backtrace_count : Option<"count", "c">, Group<1>, diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index e224a12..d070c3d 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -183,8 +183,8 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, m_watchpoint_list(), m_process_sp(), m_search_filter_sp(), m_image_search_paths(ImageSearchPathsChanged, this), m_source_manager_up(), m_stop_hooks(), m_stop_hook_next_id(0), - m_latest_stop_hook_id(0), m_valid(true), m_suppress_stop_hooks(false), - m_is_dummy_target(is_dummy_target), + m_internal_stop_hooks(), m_latest_stop_hook_id(0), m_valid(true), + m_suppress_stop_hooks(false), m_is_dummy_target(is_dummy_target), m_target_unique_id(g_target_unique_id++), m_frame_recognizer_manager_up( std::make_unique<StackFrameRecognizerManager>()) { @@ -217,6 +217,7 @@ Target::~Target() { void Target::PrimeFromDummyTarget(Target &target) { m_stop_hooks = target.m_stop_hooks; m_stop_hook_next_id = target.m_stop_hook_next_id; + m_internal_stop_hooks = target.m_internal_stop_hooks; for (const auto &breakpoint_sp : target.m_breakpoint_list.Breakpoints()) { if (breakpoint_sp->IsInternal()) @@ -383,6 +384,7 @@ void Target::Destroy() { m_image_search_paths.Clear(notify); m_stop_hooks.clear(); m_stop_hook_next_id = 0; + m_internal_stop_hooks.clear(); m_suppress_stop_hooks = false; m_repl_map.clear(); Args signal_args; @@ -3041,8 +3043,9 @@ SourceManager &Target::GetSourceManager() { return *m_source_manager_up; } -Target::StopHookSP Target::CreateStopHook(StopHook::StopHookKind kind) { - lldb::user_id_t new_uid = ++m_stop_hook_next_id; +Target::StopHookSP Target::CreateStopHook(StopHook::StopHookKind kind, + bool internal) { + user_id_t new_uid = (internal ? LLDB_INVALID_UID : ++m_stop_hook_next_id); Target::StopHookSP stop_hook_sp; switch (kind) { case StopHook::StopHookKind::CommandBased: @@ -3051,8 +3054,14 @@ Target::StopHookSP Target::CreateStopHook(StopHook::StopHookKind kind) { case StopHook::StopHookKind::ScriptBased: stop_hook_sp.reset(new StopHookScripted(shared_from_this(), new_uid)); break; + case StopHook::StopHookKind::CodeBased: + stop_hook_sp.reset(new StopHookCoded(shared_from_this(), new_uid)); + break; } - m_stop_hooks[new_uid] = stop_hook_sp; + if (internal) + m_internal_stop_hooks.push_back(stop_hook_sp); + else + m_stop_hooks[new_uid] = stop_hook_sp; return stop_hook_sp; } @@ -3098,6 +3107,23 @@ void Target::SetAllStopHooksActiveState(bool active_state) { } } +// FIXME: Ideally we would like to return a `const &` (const reference) instead +// of creating copy here, but that is not possible due to different container +// types. In C++20, we should be able to use `std::ranges::views::values` to +// adapt the key-pair entries in the `std::map` (behind `StopHookCollection`) +// to avoid creating the copy. +const std::vector<Target::StopHookSP> +Target::GetStopHooks(bool internal) const { + if (internal) + return m_internal_stop_hooks; + + std::vector<StopHookSP> stop_hooks; + for (auto &[_, hook] : m_stop_hooks) + stop_hooks.push_back(hook); + + return stop_hooks; +} + bool Target::RunStopHooks(bool at_initial_stop) { if (m_suppress_stop_hooks) return false; @@ -3111,16 +3137,20 @@ bool Target::RunStopHooks(bool at_initial_stop) { if (!(state == eStateStopped || state == eStateAttaching)) return false; - if (m_stop_hooks.empty()) - return false; + auto is_active = [at_initial_stop](StopHookSP hook) { + bool should_run_now = (!at_initial_stop || hook->GetRunAtInitialStop()); + return hook->IsActive() && should_run_now; + }; - bool no_active_hooks = - llvm::none_of(m_stop_hooks, [at_initial_stop](auto &p) { - bool should_run_now = - !at_initial_stop || p.second->GetRunAtInitialStop(); - return p.second->IsActive() && should_run_now; - }); - if (no_active_hooks) + // Create list of active internal and user stop hooks. + std::vector<StopHookSP> active_hooks; + llvm::copy_if(m_internal_stop_hooks, std::back_inserter(active_hooks), + is_active); + for (auto &[_, hook] : m_stop_hooks) { + if (is_active(hook)) + active_hooks.push_back(hook); + } + if (active_hooks.empty()) return false; // Make sure we check that we are not stopped because of us running a user @@ -3169,24 +3199,21 @@ bool Target::RunStopHooks(bool at_initial_stop) { StreamSP output_sp = m_debugger.GetAsyncOutputStream(); auto on_exit = llvm::make_scope_exit([output_sp] { output_sp->Flush(); }); - bool print_hook_header = (m_stop_hooks.size() != 1); - bool print_thread_header = (num_exe_ctx != 1); + size_t num_hooks_with_output = llvm::count_if( + active_hooks, [](auto h) { return !h->GetSuppressOutput(); }); + bool print_hook_header = (num_hooks_with_output > 1); + bool print_thread_header = (num_exe_ctx > 1); bool should_stop = false; bool requested_continue = false; - for (auto stop_entry : m_stop_hooks) { - StopHookSP cur_hook_sp = stop_entry.second; - if (!cur_hook_sp->IsActive()) - continue; - if (at_initial_stop && !cur_hook_sp->GetRunAtInitialStop()) - continue; - + for (auto cur_hook_sp : active_hooks) { bool any_thread_matched = false; for (auto exc_ctx : exc_ctx_with_reasons) { if (!cur_hook_sp->ExecutionContextPasses(exc_ctx)) continue; - if (print_hook_header && !any_thread_matched) { + bool suppress_output = cur_hook_sp->GetSuppressOutput(); + if (print_hook_header && !any_thread_matched && !suppress_output) { StreamString s; cur_hook_sp->GetDescription(s, eDescriptionLevelBrief); if (s.GetSize() != 0) @@ -3197,7 +3224,7 @@ bool Target::RunStopHooks(bool at_initial_stop) { any_thread_matched = true; } - if (print_thread_header) + if (print_thread_header && !suppress_output) output_sp->Printf("-- Thread %d\n", exc_ctx.GetThreadPtr()->GetIndexID()); diff --git a/lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test b/lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test new file mode 100644 index 0000000..42d0a67 --- /dev/null +++ b/lldb/test/Shell/ExecControl/StopHook/stop-hook-list.test @@ -0,0 +1,70 @@ +# Test stop hook user ID assignment, ordering, and printing. +# +# RUN: %lldb -b -s %s | FileCheck %s + +# Create some stop hooks +target stop-hook add -o 'print "Hello"' +target stop-hook add -o 'print "world,"' +target stop-hook add -o 'print "nice"' +target stop-hook add -o 'print "weather"' +target stop-hook add -o 'print "today!"' + +# Print hooks +target stop-hook list + +# CHECK: (lldb) target stop-hook list +# CHECK: Hook: 1 +# CHECK: "Hello" +# CHECK: Hook: 2 +# CHECK: "world," +# CHECK: Hook: 3 +# CHECK: "nice" +# CHECK: Hook: 4 +# CHECK: "weather" +# CHECK: Hook: 5 +# CHECK: "today!" + +# Delete last hook, then add new one +target stop-hook delete 5 +target stop-hook add -o 'print "Sunshine,"' + +# Stop hook gets new user ID (it is not reused) +# CHECK: (lldb) target stop-hook add -o 'print "Sunshine,"' +# CHECK: Stop hook #6 added. + +target stop-hook list +# CHECK: (lldb) target stop-hook list +# CHECK: Hook: 4 +# CHECK-NOT: Hook: 5 +# CHECK: Hook: 6 + +# Add a few more hooks +target stop-hook add -o 'print "rain,"' +target stop-hook add -o 'print "and wind!"' +target stop-hook add -o 'print "It is all okay!"' +# CHECK: Stop hook #7 added. +# CHECK: Stop hook #8 added. +# CHECK: Stop hook #9 added. + +# Delete a few hooks +target stop-hook delete 1 +target stop-hook delete 3 +target stop-hook delete 7 +target stop-hook delete 9 + +# Check that the list is still well-ordered +target stop-hook list +# CHECK: (lldb) target stop-hook list +# CHECK-NOT: Hook: 1 +# CHECK: Hook: 2 +# CHECK: "world," +# CHECK-NOT: Hook: 3 +# CHECK: Hook: 4 +# CHECK: "weather" +# CHECK-NOT: Hook: 5 +# CHECK: Hook: 6 +# CHECK: "Sunshine," +# CHECK-NOT: Hook: 7 +# CHECK: Hook: 8 +# CHECK: "and wind!" +# CHECK-NOT: Hook: 9 diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst index 9cdac9c..d99b584 100644 --- a/llvm/docs/ProgrammersManual.rst +++ b/llvm/docs/ProgrammersManual.rst @@ -2161,6 +2161,16 @@ that are not simple pointers (use :ref:`SmallPtrSet <dss_smallptrset>` for pointers). Note that ``DenseSet`` has the same requirements for the value type that :ref:`DenseMap <dss_densemap>` has. +.. _dss_radixtree: + +llvm/ADT/RadixTree.h +^^^^^^^^^^^^^^^^^^^^ + +``RadixTree`` is a trie-based data structure that stores range-like keys and +their associated values. It is particularly efficient for storing keys that +share common prefixes, as it can compress these prefixes to save memory. It +supports efficient search of matching prefixes. + .. _dss_sparseset: llvm/ADT/SparseSet.h diff --git a/llvm/include/llvm/ADT/RadixTree.h b/llvm/include/llvm/ADT/RadixTree.h new file mode 100644 index 0000000..a65acdd --- /dev/null +++ b/llvm/include/llvm/ADT/RadixTree.h @@ -0,0 +1,351 @@ +//===-- llvm/ADT/RadixTree.h - Radix Tree implementation --------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +//===----------------------------------------------------------------------===// +// +// This file implements a Radix Tree. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_RADIXTREE_H +#define LLVM_ADT_RADIXTREE_H + +#include "llvm/ADT/ADL.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/iterator.h" +#include "llvm/ADT/iterator_range.h" +#include <cassert> +#include <cstddef> +#include <iterator> +#include <limits> +#include <list> +#include <utility> +#include <vector> + +namespace llvm { + +/// \brief A Radix Tree implementation. +/// +/// A Radix Tree (also known as a compact prefix tree or radix trie) is a +/// data structure that stores a dynamic set or associative array where keys +/// are strings and values are associated with these keys. Unlike a regular +/// trie, the edges of a radix tree can be labeled with sequences of characters +/// as well as single characters. This makes radix trees more efficient for +/// storing sparse data sets, where many nodes in a regular trie would have +/// only one child. +/// +/// This implementation supports arbitrary key types that can be iterated over +/// (e.g., `std::string`, `std::vector<char>`, `ArrayRef<char>`). The key type +/// must provide `begin()` and `end()` for iteration. +/// +/// The tree stores `std::pair<const KeyType, T>` as its value type. +/// +/// Example usage: +/// \code +/// llvm::RadixTree<StringRef, int> Tree; +/// Tree.emplace("apple", 1); +/// Tree.emplace("grapefruit", 2); +/// Tree.emplace("grape", 3); +/// +/// // Find prefixes +/// for (const auto &[Key, Value] : Tree.find_prefixes("grapefruit juice")) { +/// // pair will be {"grape", 3} +/// // pair will be {"grapefruit", 2} +/// llvm::outs() << Key << ": " << Value << "\n"; +/// } +/// +/// // Iterate over all elements +/// for (const auto &[Key, Value] : Tree) +/// llvm::outs() << Key << ": " << Value << "\n"; +/// \endcode +/// +/// \note +/// The `RadixTree` takes ownership of the `KeyType` and `T` objects +/// inserted into it. When an element is removed or the tree is destroyed, +/// these objects will be destructed. +/// However, if `KeyType` is a reference-like type, e.g., StringRef or range, +/// the user must guarantee that the referenced data has a lifetime longer than +/// the tree. +template <typename KeyType, typename T> class RadixTree { +public: + using key_type = KeyType; + using mapped_type = T; + using value_type = std::pair<const KeyType, mapped_type>; + +private: + using KeyConstIteratorType = + decltype(adl_begin(std::declval<const key_type &>())); + using KeyConstIteratorRangeType = iterator_range<KeyConstIteratorType>; + using KeyValueType = + remove_cvref_t<decltype(*adl_begin(std::declval<key_type &>()))>; + using ContainerType = std::list<value_type>; + + /// Represents an internal node in the Radix Tree. + struct Node { + KeyConstIteratorRangeType Key{KeyConstIteratorType{}, + KeyConstIteratorType{}}; + std::vector<Node> Children; + + /// An iterator to the value associated with this node. + /// + /// If this node does not have a value (i.e., it's an internal node that + /// only serves as a path to other values), this iterator will be equal + /// to default constructed `ContainerType::iterator()`. + typename ContainerType::iterator Value; + + /// The first character of the Key. Used for fast child lookup. + KeyValueType KeyFront; + + Node() = default; + Node(const KeyConstIteratorRangeType &Key) + : Key(Key), KeyFront(*Key.begin()) { + assert(!Key.empty()); + } + + Node(Node &&) = default; + Node &operator=(Node &&) = default; + + Node(const Node &) = delete; + Node &operator=(const Node &) = delete; + + const Node *findChild(const KeyConstIteratorRangeType &Key) const { + if (Key.empty()) + return nullptr; + for (const Node &Child : Children) { + assert(!Child.Key.empty()); // Only root can be empty. + if (Child.KeyFront == *Key.begin()) + return &Child; + } + return nullptr; + } + + Node *findChild(const KeyConstIteratorRangeType &Query) { + const Node *This = this; + return const_cast<Node *>(This->findChild(Query)); + } + + size_t countNodes() const { + size_t R = 1; + for (const Node &C : Children) + R += C.countNodes(); + return R; + } + + /// + /// Splits the current node into two. + /// + /// This function is used when a new key needs to be inserted that shares + /// a common prefix with the current node's key, but then diverges. + /// The current `Key` is truncated to the common prefix, and a new child + /// node is created for the remainder of the original node's `Key`. + /// + /// \param SplitPoint An iterator pointing to the character in the current + /// `Key` where the split should occur. + void split(KeyConstIteratorType SplitPoint) { + Node Child(make_range(SplitPoint, Key.end())); + Key = make_range(Key.begin(), SplitPoint); + + Children.swap(Child.Children); + std::swap(Value, Child.Value); + + Children.emplace_back(std::move(Child)); + } + }; + + /// Root always corresponds to the empty key, which is the shortest possible + /// prefix for everything. + Node Root; + ContainerType KeyValuePairs; + + /// Finds or creates a new tail or leaf node corresponding to the `Key`. + Node &findOrCreate(KeyConstIteratorRangeType Key) { + Node *Curr = &Root; + if (Key.empty()) + return *Curr; + + for (;;) { + auto [I1, I2] = llvm::mismatch(Key, Curr->Key); + Key = make_range(I1, Key.end()); + + if (I2 != Curr->Key.end()) { + // Match is partial. Either query is too short, or there is mismatching + // character. Split either way, and put new node in between of the + // current and its children. + Curr->split(I2); + + // Split was caused by mismatch, so `findChild` would fail. + break; + } + + Node *Child = Curr->findChild(Key); + if (!Child) + break; + + // Move to child with the same first character. + Curr = Child; + } + + if (Key.empty()) { + // The current node completely matches the key, return it. + return *Curr; + } + + // `Key` is a suffix of original `Key` unmatched by path from the `Root` to + // the `Curr`, and we have no candidate in the children to match more. + // Create a new one. + return Curr->Children.emplace_back(Key); + } + + /// + /// An iterator for traversing prefixes search results. + /// + /// This iterator is used by `find_prefixes` to traverse the tree and find + /// elements that are prefixes to the given key. It's a forward iterator. + /// + /// \tparam MappedType The type of the value pointed to by the iterator. + /// This will be `value_type` for non-const iterators + /// and `const value_type` for const iterators. + template <typename MappedType> + class IteratorImpl + : public iterator_facade_base<IteratorImpl<MappedType>, + std::forward_iterator_tag, MappedType> { + const Node *Curr = nullptr; + KeyConstIteratorRangeType Query{KeyConstIteratorType{}, + KeyConstIteratorType{}}; + + void findNextValid() { + while (Curr && Curr->Value == typename ContainerType::iterator()) + advance(); + } + + void advance() { + assert(Curr); + if (Query.empty()) { + Curr = nullptr; + return; + } + + Curr = Curr->findChild(Query); + if (!Curr) { + Curr = nullptr; + return; + } + + auto [I1, I2] = llvm::mismatch(Query, Curr->Key); + if (I2 != Curr->Key.end()) { + Curr = nullptr; + return; + } + Query = make_range(I1, Query.end()); + } + + friend class RadixTree; + IteratorImpl(const Node *C, const KeyConstIteratorRangeType &Q) + : Curr(C), Query(Q) { + findNextValid(); + } + + public: + IteratorImpl() = default; + + MappedType &operator*() const { return *Curr->Value; } + + IteratorImpl &operator++() { + advance(); + findNextValid(); + return *this; + } + + bool operator==(const IteratorImpl &Other) const { + return Curr == Other.Curr; + } + }; + +public: + RadixTree() = default; + RadixTree(RadixTree &&) = default; + RadixTree &operator=(RadixTree &&) = default; + + using prefix_iterator = IteratorImpl<value_type>; + using const_prefix_iterator = IteratorImpl<const value_type>; + + using iterator = typename ContainerType::iterator; + using const_iterator = typename ContainerType::const_iterator; + + /// Returns true if the tree is empty. + bool empty() const { return KeyValuePairs.empty(); } + + /// Returns the number of elements in the tree. + size_t size() const { return KeyValuePairs.size(); } + + /// Returns the number of nodes in the tree. + /// + /// This function counts all internal nodes in the tree. It can be useful for + /// understanding the memory footprint or complexity of the tree structure. + size_t countNodes() const { return Root.countNodes(); } + + /// Returns an iterator to the first element. + iterator begin() { return KeyValuePairs.begin(); } + const_iterator begin() const { return KeyValuePairs.begin(); } + + /// Returns an iterator to the end of the tree. + iterator end() { return KeyValuePairs.end(); } + const_iterator end() const { return KeyValuePairs.end(); } + + /// Constructs and inserts a new element into the tree. + /// + /// This function constructs an element in place within the tree. If an + /// element with the same key already exists, the insertion fails and the + /// function returns an iterator to the existing element along with `false`. + /// Otherwise, the new element is inserted and the function returns an + /// iterator to the new element along with `true`. + /// + /// \param Key The key of the element to construct. + /// \param Args Arguments to forward to the constructor of the mapped_type. + /// \return A pair consisting of an iterator to the inserted element (or to + /// the element that prevented insertion) and a boolean value + /// indicating whether the insertion took place. + template <typename... Ts> + std::pair<iterator, bool> emplace(key_type &&Key, Ts &&...Args) { + // We want to make new `Node` to refer key in the container, not the one + // from the argument. + // FIXME: Determine that we need a new node, before expanding + // `KeyValuePairs`. + const value_type &NewValue = KeyValuePairs.emplace_front( + std::move(Key), T(std::forward<Ts>(Args)...)); + Node &Node = findOrCreate(NewValue.first); + bool HasValue = Node.Value != typename ContainerType::iterator(); + if (!HasValue) + Node.Value = KeyValuePairs.begin(); + else + KeyValuePairs.pop_front(); + return {Node.Value, !HasValue}; + } + + /// + /// Finds all elements whose keys are prefixes of the given `Key`. + /// + /// This function returns an iterator range over all elements in the tree + /// whose keys are prefixes of the provided `Key`. For example, if the tree + /// contains "abcde", "abc", "abcdefgh", and `Key` is "abcde", this function + /// would return iterators to "abcde" and "abc". + /// + /// \param Key The key to search for prefixes of. + /// \return An `iterator_range` of `const_prefix_iterator`s, allowing + /// iteration over the found prefix elements. + /// \note The returned iterators reference the `Key` provided by the caller. + /// The caller must ensure that `Key` remains valid for the lifetime + /// of the iterators. + iterator_range<const_prefix_iterator> + find_prefixes(const key_type &Key) const { + return iterator_range<const_prefix_iterator>{ + const_prefix_iterator(&Root, KeyConstIteratorRangeType(Key)), + const_prefix_iterator{}}; + } +}; + +} // namespace llvm + +#endif // LLVM_ADT_RADIXTREE_H diff --git a/llvm/include/llvm/CodeGen/Passes.h b/llvm/include/llvm/CodeGen/Passes.h index 9fddd47..a852555 100644 --- a/llvm/include/llvm/CodeGen/Passes.h +++ b/llvm/include/llvm/CodeGen/Passes.h @@ -610,14 +610,6 @@ LLVM_ABI ModulePass *createCheckDebugMachineModulePass(); /// caller saved registers with stack slots. LLVM_ABI extern char &FixupStatepointCallerSavedID; -/// The pass transforms load/store <256 x i32> to AMX load/store intrinsics -/// or split the data to two <128 x i32>. -LLVM_ABI FunctionPass *createX86LowerAMXTypePass(); - -/// The pass transforms amx intrinsics to scalar operation if the function has -/// optnone attribute or it is O0. -LLVM_ABI FunctionPass *createX86LowerAMXIntrinsicsPass(); - /// When learning an eviction policy, extract score(reward) information, /// otherwise this does nothing LLVM_ABI FunctionPass *createRegAllocScoringPass(); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index f05febf..24a0cb7 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -1768,7 +1768,7 @@ private: // FIXME: We should be able to derive FailedSymsForQuery from each query once // we fix how the detach operation works. struct EmitQueries { - JITDylib::AsynchronousSymbolQuerySet Updated; + JITDylib::AsynchronousSymbolQuerySet Completed; JITDylib::AsynchronousSymbolQuerySet Failed; DenseMap<AsynchronousSymbolQuery *, std::shared_ptr<SymbolDependenceMap>> FailedSymsForQuery; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h deleted file mode 100644 index 5170893..0000000 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h +++ /dev/null @@ -1,173 +0,0 @@ -//===- SymbolFilter.h - Utilities for Symbol Filtering ---------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_EXECUTIONENGINE_ORC_SHARED_SYMBOLFILTER_H -#define LLVM_EXECUTIONENGINE_ORC_SHARED_SYMBOLFILTER_H - -#include "llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h" - -#include <cmath> -#include <type_traits> -#include <vector> - -namespace llvm { -namespace orc { - -namespace shared { -using SPSBloomFilter = - SPSTuple<bool, uint32_t, uint32_t, uint32_t, SPSSequence<uint64_t>>; -} - -class BloomFilter { -public: - using HashFunc = std::function<uint32_t(StringRef)>; - - BloomFilter() = default; - BloomFilter(BloomFilter &&) noexcept = default; - BloomFilter &operator=(BloomFilter &&) noexcept = default; - BloomFilter(const BloomFilter &) = delete; - BloomFilter &operator=(const BloomFilter &) = delete; - - BloomFilter(uint32_t SymbolCount, float FalsePositiveRate, HashFunc hashFn) - : HashFn(std::move(hashFn)) { - initialize(SymbolCount, FalsePositiveRate); - } - bool isInitialized() const { return Initialized; } - - void add(StringRef Sym) { - assert(Initialized); - addHash(HashFn(Sym)); - } - - bool mayContain(StringRef Sym) const { - return !isEmpty() && testHash(HashFn(Sym)); - } - - bool isEmpty() const { return SymbolCount == 0; } - -private: - friend class shared::SPSSerializationTraits<shared::SPSBloomFilter, - BloomFilter>; - static constexpr uint32_t BitsPerEntry = 64; - - bool Initialized = false; - uint32_t SymbolCount = 0; - uint32_t BloomSize = 0; - uint32_t BloomShift = 0; - std::vector<uint64_t> BloomTable; - HashFunc HashFn; - - void initialize(uint32_t SymCount, float FalsePositiveRate) { - assert(SymCount > 0); - SymbolCount = SymCount; - Initialized = true; - - float ln2 = std::log(2.0f); - float M = -1.0f * SymbolCount * std::log(FalsePositiveRate) / (ln2 * ln2); - BloomSize = static_cast<uint32_t>(std::ceil(M / BitsPerEntry)); - BloomShift = std::min(6u, log2ceil(SymbolCount)); - BloomTable.resize(BloomSize, 0); - } - - void addHash(uint32_t Hash) { - uint32_t Hash2 = Hash >> BloomShift; - uint32_t N = (Hash / BitsPerEntry) % BloomSize; - uint64_t Mask = - (1ULL << (Hash % BitsPerEntry)) | (1ULL << (Hash2 % BitsPerEntry)); - BloomTable[N] |= Mask; - } - - bool testHash(uint32_t Hash) const { - uint32_t Hash2 = Hash >> BloomShift; - uint32_t N = (Hash / BitsPerEntry) % BloomSize; - uint64_t Mask = - (1ULL << (Hash % BitsPerEntry)) | (1ULL << (Hash2 % BitsPerEntry)); - return (BloomTable[N] & Mask) == Mask; - } - - static constexpr uint32_t log2ceil(uint32_t V) { - return V <= 1 ? 0 : 32 - countl_zero(V - 1); - } -}; - -class BloomFilterBuilder { -public: - using HashFunc = BloomFilter::HashFunc; - - BloomFilterBuilder() = default; - - BloomFilterBuilder &setFalsePositiveRate(float Rate) { - assert(Rate > 0.0f && Rate < 1.0f); - FalsePositiveRate = Rate; - return *this; - } - - BloomFilterBuilder &setHashFunction(HashFunc Fn) { - HashFn = std::move(Fn); - return *this; - } - - BloomFilter build(ArrayRef<StringRef> Symbols) const { - assert(!Symbols.empty() && "Cannot build filter from empty symbol list."); - BloomFilter F(static_cast<uint32_t>(Symbols.size()), FalsePositiveRate, - HashFn); - for (const auto &Sym : Symbols) - F.add(Sym); - - return F; - } - -private: - float FalsePositiveRate = 0.02f; - HashFunc HashFn = [](StringRef S) -> uint32_t { - uint32_t H = 5381; - for (char C : S) - H = ((H << 5) + H) + static_cast<uint8_t>(C); // H * 33 + C - return H; - }; -}; - -namespace shared { - -template <> class SPSSerializationTraits<SPSBloomFilter, BloomFilter> { -public: - static size_t size(const BloomFilter &Filter) { - return SPSBloomFilter::AsArgList::size( - Filter.Initialized, Filter.SymbolCount, Filter.BloomSize, - Filter.BloomShift, Filter.BloomTable); - } - - static bool serialize(SPSOutputBuffer &OB, const BloomFilter &Filter) { - return SPSBloomFilter::AsArgList::serialize( - OB, Filter.Initialized, Filter.SymbolCount, Filter.BloomSize, - Filter.BloomShift, Filter.BloomTable); - } - - static bool deserialize(SPSInputBuffer &IB, BloomFilter &Filter) { - bool IsInitialized; - uint32_t SymbolCount = 0, BloomSize = 0, BloomShift = 0; - std::vector<uint64_t> BloomTable; - - if (!SPSBloomFilter::AsArgList::deserialize( - IB, IsInitialized, SymbolCount, BloomSize, BloomShift, BloomTable)) - return false; - - Filter.Initialized = IsInitialized; - Filter.SymbolCount = SymbolCount; - Filter.BloomSize = BloomSize; - Filter.BloomShift = BloomShift; - Filter.BloomTable = std::move(BloomTable); - - return true; - } -}; - -} // end namespace shared -} // end namespace orc -} // end namespace llvm -#endif // LLVM_EXECUTIONENGINE_ORC_SHARED_SYMBOLFILTER_H diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h deleted file mode 100644 index 50d4f6d041..0000000 --- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h +++ /dev/null @@ -1,514 +0,0 @@ -//===- LibraryResolver.h - Automatic Library Symbol Resolution -*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file provides support for automatically searching symbols across -// dynamic libraries that have not yet been loaded. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_LIBRARYRESOLVER_H -#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_LIBRARYRESOLVER_H - -#include "llvm/ADT/FunctionExtras.h" -#include "llvm/ExecutionEngine/Orc/Shared/SymbolFilter.h" -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h" -#include "llvm/Support/Path.h" - -#include <atomic> -#include <shared_mutex> -#include <unordered_map> - -namespace llvm { -namespace orc { - -/// Manages library metadata and state for symbol resolution. -/// -/// Tracks libraries by load state and kind (user/system), and stores -/// associated Bloom filters and hash maps to speed up symbol lookups. -/// Thread-safe for concurrent access. -class LibraryManager { -public: - enum class LibState : uint8_t { Unloaded = 0, Loaded = 1, Queried = 2 }; - - class LibraryInfo { - public: - LibraryInfo(const LibraryInfo &) = delete; - LibraryInfo &operator=(const LibraryInfo &) = delete; - - LibraryInfo(std::string FilePath, LibState S, PathType K, - std::optional<BloomFilter> Filter = std::nullopt) - : FilePath(std::move(FilePath)), S(S), K(K), Filter(std::move(Filter)) { - } - - StringRef getBasePath() const { return sys::path::parent_path(FilePath); } - StringRef getFileName() const { return sys::path::filename(FilePath); } - - std::string getFullPath() const { return FilePath; } - - bool setFilter(BloomFilter F) { - std::lock_guard<std::shared_mutex> Lock(Mtx); - if (Filter) - return false; - Filter.emplace(std::move(F)); - return true; - } - - bool ensureFilterBuilt(const BloomFilterBuilder &FB, - ArrayRef<StringRef> Symbols) { - std::lock_guard<std::shared_mutex> Lock(Mtx); - if (Filter) - return false; - Filter.emplace(FB.build(Symbols)); - return true; - } - - bool mayContain(StringRef Symbol) const { - assert(hasFilter()); - std::shared_lock<std::shared_mutex> Lock(Mtx); - return Filter->mayContain(Symbol); - } - - bool hasFilter() const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - return Filter.has_value(); - } - - LibState getState() const { return S.load(); } - PathType getKind() const { return K; } - - void setState(LibState s) { S.store(s); } - - bool operator==(const LibraryInfo &other) const { - return FilePath == other.FilePath; - } - - private: - std::string FilePath; - std::atomic<LibState> S; - PathType K; - std::optional<BloomFilter> Filter; - mutable std::shared_mutex Mtx; - }; - - /// A read-only view of libraries filtered by state and kind. - /// - /// Lets you loop over only the libraries in a map that match a given State - /// and PathType. - class FilteredView { - public: - using Map = StringMap<std::shared_ptr<LibraryInfo>>; - using Iterator = typename Map::const_iterator; - class FilterIterator { - public: - FilterIterator(Iterator it_, Iterator end_, LibState S, PathType K) - : it(it_), end(end_), S(S), K(K) { - advance(); - } - - bool operator!=(const FilterIterator &other) const { - return it != other.it; - } - - const std::shared_ptr<LibraryInfo> &operator*() const { - return it->second; - } - - FilterIterator &operator++() { - ++it; - advance(); - return *this; - } - - private: - void advance() { - for (; it != end; ++it) - if (it->second->getState() == S && it->second->getKind() == K) - break; - } - Iterator it; - Iterator end; - LibState S; - PathType K; - }; - FilteredView(Iterator begin, Iterator end, LibState s, PathType k) - : mapBegin(begin), mapEnd(end), state(s), kind(k) {} - - FilterIterator begin() const { - return FilterIterator(mapBegin, mapEnd, state, kind); - } - - FilterIterator end() const { - return FilterIterator(mapEnd, mapEnd, state, kind); - } - - private: - Iterator mapBegin; - Iterator mapEnd; - LibState state; - PathType kind; - }; - -private: - StringMap<std::shared_ptr<LibraryInfo>> Libraries; - mutable std::shared_mutex Mtx; - -public: - using LibraryVisitor = std::function<bool(const LibraryInfo &)>; - - LibraryManager() = default; - ~LibraryManager() = default; - - bool addLibrary(std::string Path, PathType Kind, - std::optional<BloomFilter> Filter = std::nullopt) { - std::unique_lock<std::shared_mutex> Lock(Mtx); - if (Libraries.count(Path) > 0) - return false; - Libraries.insert({std::move(Path), - std::make_shared<LibraryInfo>(Path, LibState::Unloaded, - Kind, std::move(Filter))}); - return true; - } - - bool hasLibrary(StringRef Path) const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - if (Libraries.count(Path) > 0) - return true; - return false; - } - - bool removeLibrary(StringRef Path) { - std::unique_lock<std::shared_mutex> Lock(Mtx); - auto I = Libraries.find(Path); - if (I == Libraries.end()) - return false; - Libraries.erase(I); - return true; - } - - void markLoaded(StringRef Path) { - std::unique_lock<std::shared_mutex> Lock(Mtx); - if (auto It = Libraries.find(Path); It != Libraries.end()) - It->second->setState(LibState::Loaded); - } - - void markQueried(StringRef Path) { - std::unique_lock<std::shared_mutex> Lock(Mtx); - if (auto It = Libraries.find(Path); It != Libraries.end()) - It->second->setState(LibState::Queried); - } - - std::shared_ptr<LibraryInfo> getLibrary(StringRef Path) { - std::shared_lock<std::shared_mutex> Lock(Mtx); - if (auto It = Libraries.find(Path); It != Libraries.end()) - return It->second; - return nullptr; - } - - FilteredView getView(LibState S, PathType K) const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - return FilteredView(Libraries.begin(), Libraries.end(), S, K); - } - - void forEachLibrary(const LibraryVisitor &visitor) const { - std::unique_lock<std::shared_mutex> Lock(Mtx); - for (const auto &[_, entry] : Libraries) { - if (!visitor(*entry)) - break; - } - } - - bool isLoaded(StringRef Path) const { - std::unique_lock<std::shared_mutex> Lock(Mtx); - if (auto It = Libraries.find(Path.str()); It != Libraries.end()) - return It->second->getState() == LibState::Loaded; - return false; - } - - bool isQueried(StringRef Path) const { - std::unique_lock<std::shared_mutex> Lock(Mtx); - if (auto It = Libraries.find(Path.str()); It != Libraries.end()) - return It->second->getState() == LibState::Queried; - return false; - } - - void clear() { - std::unique_lock<std::shared_mutex> Lock(Mtx); - Libraries.clear(); - } -}; - -using LibraryInfo = LibraryManager::LibraryInfo; - -struct SearchPlanEntry { - LibraryManager::LibState State; // Loaded, Queried, Unloaded - PathType Type; // User, System -}; - -struct SearchPolicy { - std::vector<SearchPlanEntry> Plan; - - static SearchPolicy defaultPlan() { - return {{{LibraryManager::LibState::Loaded, PathType::User}, - {LibraryManager::LibState::Queried, PathType::User}, - {LibraryManager::LibState::Unloaded, PathType::User}, - {LibraryManager::LibState::Loaded, PathType::System}, - {LibraryManager::LibState::Queried, PathType::System}, - {LibraryManager::LibState::Unloaded, PathType::System}}}; - } -}; - -struct SymbolEnumeratorOptions { - enum Filter : uint32_t { - None = 0, - IgnoreUndefined = 1 << 0, - IgnoreWeak = 1 << 1, - IgnoreIndirect = 1 << 2, - IgnoreHidden = 1 << 3, - IgnoreNonGlobal = 1 << 4 - }; - - static SymbolEnumeratorOptions defaultOptions() { - return {Filter::IgnoreUndefined | Filter::IgnoreWeak | - Filter::IgnoreIndirect}; - } - uint32_t FilterFlags = Filter::None; -}; - -struct SearchConfig { - SearchPolicy Policy; - SymbolEnumeratorOptions Options; - - SearchConfig() - : Policy(SearchPolicy::defaultPlan()), // default plan - Options(SymbolEnumeratorOptions::defaultOptions()) {} -}; - -/// Scans libraries and resolves Symbols across user and system paths. -/// -/// Supports symbol enumeration and filtering via SymbolEnumerator, and tracks -/// symbol resolution results through SymbolQuery. Thread-safe and uses -/// LibraryScanHelper for efficient path resolution and caching. -class LibraryResolver { - friend class LibraryResolutionDriver; - -public: - class SymbolEnumerator { - public: - enum class EnumerateResult { Continue, Stop, Error }; - - using OnEachSymbolFn = std::function<EnumerateResult(StringRef Sym)>; - - static bool enumerateSymbols(StringRef Path, OnEachSymbolFn OnEach, - const SymbolEnumeratorOptions &Opts); - }; - - /// Tracks a set of symbols and the libraries where they are resolved. - /// - /// SymbolQuery is used to keep track of which symbols have been resolved - /// to which libraries. It supports concurrent read/write access using a - /// shared mutex, allowing multiple readers or a single writer at a time. - class SymbolQuery { - public: - /// Holds the result for a single symbol. - struct Result { - std::string Name; - std::string ResolvedLibPath; - }; - - private: - mutable std::shared_mutex Mtx; - StringMap<Result> Results; - std::atomic<size_t> ResolvedCount = 0; - - public: - explicit SymbolQuery(const std::vector<std::string> &Symbols) { - for (const auto &s : Symbols) { - if (!Results.contains(s)) - Results.insert({s, Result{s, ""}}); - } - } - - SmallVector<StringRef> getUnresolvedSymbols() const { - SmallVector<StringRef> Unresolved; - std::shared_lock<std::shared_mutex> Lock(Mtx); - for (const auto &[name, res] : Results) { - if (res.ResolvedLibPath.empty()) - Unresolved.push_back(name); - } - return Unresolved; - } - - void resolve(StringRef Sym, const std::string &LibPath) { - std::unique_lock<std::shared_mutex> Lock(Mtx); - auto It = Results.find(Sym); - if (It != Results.end() && It->second.ResolvedLibPath.empty()) { - It->second.ResolvedLibPath = LibPath; - ResolvedCount.fetch_add(1, std::memory_order_relaxed); - } - } - - bool allResolved() const { - return ResolvedCount.load(std::memory_order_relaxed) == Results.size(); - } - - bool hasUnresolved() const { - return ResolvedCount.load(std::memory_order_relaxed) < Results.size(); - } - - std::optional<StringRef> getResolvedLib(StringRef Sym) const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - auto It = Results.find(Sym); - if (It != Results.end() && !It->second.ResolvedLibPath.empty()) - return StringRef(It->second.ResolvedLibPath); - return std::nullopt; - } - - bool isResolved(StringRef Sym) const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - auto It = Results.find(Sym.str()); - return It != Results.end() && !It->second.ResolvedLibPath.empty(); - } - - std::vector<const Result *> getAllResults() const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - std::vector<const Result *> Out; - Out.reserve(Results.size()); - for (const auto &[_, res] : Results) - Out.push_back(&res); - return Out; - } - }; - - struct Setup { - std::vector<std::string> BasePaths; - std::shared_ptr<LibraryPathCache> Cache; - std::shared_ptr<PathResolver> PResolver; - - size_t ScanBatchSize = 0; - - LibraryScanner::ShouldScanFn ShouldScanCall = [](StringRef) { - return true; - }; - - BloomFilterBuilder FilterBuilder = BloomFilterBuilder(); - - static Setup - create(std::vector<std::string> BasePaths, - std::shared_ptr<LibraryPathCache> existingCache = nullptr, - std::shared_ptr<PathResolver> existingResolver = nullptr, - LibraryScanner::ShouldScanFn customShouldScan = nullptr) { - Setup S; - S.BasePaths = std::move(BasePaths); - - S.Cache = - existingCache ? existingCache : std::make_shared<LibraryPathCache>(); - - S.PResolver = existingResolver ? existingResolver - : std::make_shared<PathResolver>(S.Cache); - - if (customShouldScan) - S.ShouldScanCall = std::move(customShouldScan); - - return S; - } - }; - - LibraryResolver() = delete; - explicit LibraryResolver(const Setup &S); - ~LibraryResolver() = default; - - using OnSearchComplete = unique_function<void(SymbolQuery &)>; - - void dump() { - int i = 0; - LibMgr.forEachLibrary([&](const LibraryInfo &Lib) -> bool { - dbgs() << ++i << ". Library Path : " << Lib.getFullPath() << " -> \n\t\t:" - << " ({Type : (" - << (Lib.getKind() == PathType::User ? "User" : "System") - << ") }, { State : " - << (Lib.getState() == LibraryManager::LibState::Loaded - ? "Loaded" - : "Unloaded") - << "})\n"; - return true; - }); - } - - void searchSymbolsInLibraries(std::vector<std::string> &SymList, - OnSearchComplete OnComplete, - const SearchConfig &Config = SearchConfig()); - -private: - bool scanLibrariesIfNeeded(PathType K, size_t BatchSize = 0); - void resolveSymbolsInLibrary(LibraryInfo &Lib, SymbolQuery &Q, - const SymbolEnumeratorOptions &Opts); - bool - symbolExistsInLibrary(const LibraryInfo &Lib, StringRef Sym, - std::vector<std::string> *MatchedSymbols = nullptr); - - bool symbolExistsInLibrary(const LibraryInfo &Lib, StringRef SymName, - std::vector<std::string> *AllSymbols, - const SymbolEnumeratorOptions &Opts); - - std::shared_ptr<LibraryPathCache> LibPathCache; - std::shared_ptr<PathResolver> LibPathResolver; - LibraryScanHelper ScanHelper; - BloomFilterBuilder FB; - LibraryManager LibMgr; - LibraryScanner::ShouldScanFn ShouldScanCall; - size_t scanBatchSize; -}; - -using SymbolEnumerator = LibraryResolver::SymbolEnumerator; -using SymbolQuery = LibraryResolver::SymbolQuery; -using EnumerateResult = SymbolEnumerator::EnumerateResult; - -class LibraryResolutionDriver { -public: - static std::unique_ptr<LibraryResolutionDriver> - create(const LibraryResolver::Setup &S); - - void addScanPath(const std::string &Path, PathType Kind); - bool markLibraryLoaded(StringRef Path); - bool markLibraryUnLoaded(StringRef Path); - bool isLibraryLoaded(StringRef Path) const { - return LR->LibMgr.isLoaded(Path); - } - - void resetAll() { - LR->LibMgr.clear(); - LR->ScanHelper.resetToScan(); - LR->LibPathCache->clear(); - } - - void scanAll(size_t BatchSize = 0) { - LR->scanLibrariesIfNeeded(PathType::User, BatchSize); - LR->scanLibrariesIfNeeded(PathType::System, BatchSize); - } - - void scan(PathType PK, size_t BatchSize = 0) { - LR->scanLibrariesIfNeeded(PK, BatchSize); - } - - void resolveSymbols(std::vector<std::string> Symbols, - LibraryResolver::OnSearchComplete OnCompletion, - const SearchConfig &Config = SearchConfig()); - - ~LibraryResolutionDriver() = default; - -private: - LibraryResolutionDriver(std::unique_ptr<LibraryResolver> L) - : LR(std::move(L)) {} - - std::unique_ptr<LibraryResolver> LR; -}; - -} // end namespace orc -} // end namespace llvm - -#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_LIBRARYRESOLVER_H diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h deleted file mode 100644 index d1c2013..0000000 --- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h +++ /dev/null @@ -1,474 +0,0 @@ -//===- LibraryScanner.h - Scanner for Shared Libraries ---------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// This file provides functionality for scanning dynamic (shared) libraries. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_LIBRARYSCANNER_H -#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_LIBRARYSCANNER_H - -#include "llvm/ADT/FunctionExtras.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSet.h" -#include "llvm/Object/ObjectFile.h" -#include "llvm/Support/Allocator.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/StringSaver.h" - -#include <atomic> -#include <mutex> -#include <queue> -#include <shared_mutex> -#include <string> -#include <unordered_map> -#include <unordered_set> - -namespace llvm { -namespace orc { - -class LibraryManager; - -class LibraryPathCache { - friend class PathResolver; - -public: - LibraryPathCache() = default; - - void clear(bool isRealPathCache = false) { - std::unique_lock<std::shared_mutex> lock(Mtx); - Seen.clear(); - if (isRealPathCache) { - RealPathCache.clear(); -#ifndef _WIN32 - ReadlinkCache.clear(); - LstatCache.clear(); -#endif - } - } - - void markSeen(const std::string &CanonPath) { - std::unique_lock<std::shared_mutex> lock(Mtx); - Seen.insert(CanonPath); - } - - bool hasSeen(StringRef CanonPath) const { - std::shared_lock<std::shared_mutex> lock(Mtx); - return Seen.contains(CanonPath); - } - - bool hasSeenOrMark(StringRef CanonPath) { - std::string s = CanonPath.str(); - { - std::shared_lock<std::shared_mutex> lock(Mtx); - if (Seen.contains(s)) - return true; - } - { - std::unique_lock<std::shared_mutex> lock(Mtx); - Seen.insert(s); - } - return false; - } - -private: - mutable std::shared_mutex Mtx; - - struct PathInfo { - std::string canonicalPath; - std::error_code ErrnoCode; - }; - - void insert_realpath(StringRef Path, const PathInfo &Info) { - std::unique_lock<std::shared_mutex> lock(Mtx); - RealPathCache.insert({Path, Info}); - } - - std::optional<PathInfo> read_realpath(StringRef Path) const { - std::shared_lock<std::shared_mutex> lock(Mtx); - auto It = RealPathCache.find(Path); - if (It != RealPathCache.end()) - return It->second; - - return std::nullopt; - } - - StringSet<> Seen; - StringMap<PathInfo> RealPathCache; - -#ifndef _WIN32 - StringMap<std::string> ReadlinkCache; - StringMap<mode_t> LstatCache; - - void insert_link(StringRef Path, const std::string &s) { - std::unique_lock<std::shared_mutex> lock(Mtx); - ReadlinkCache.insert({Path, s}); - } - - std::optional<std::string> read_link(StringRef Path) const { - std::shared_lock<std::shared_mutex> lock(Mtx); - auto It = ReadlinkCache.find(Path); - if (It != ReadlinkCache.end()) - return It->second; - - return std::nullopt; - } - - void insert_lstat(StringRef Path, mode_t m) { - std::unique_lock<std::shared_mutex> lock(Mtx); - LstatCache.insert({Path, m}); - } - - std::optional<mode_t> read_lstat(StringRef Path) const { - std::shared_lock<std::shared_mutex> lock(Mtx); - auto It = LstatCache.find(Path); - if (It != LstatCache.end()) - return It->second; - - return std::nullopt; - } - -#endif -}; - -/// Resolves file system paths with optional caching of results. -/// -/// Supports lstat, readlink, and realpath operations. Can resolve paths -/// relative to a base and handle symbolic links. Caches results to reduce -/// repeated system calls when enabled. -class PathResolver { -private: - std::shared_ptr<LibraryPathCache> LibPathCache; - -public: - PathResolver(std::shared_ptr<LibraryPathCache> cache) - : LibPathCache(std::move(cache)) {} - - std::optional<std::string> resolve(StringRef Path, std::error_code &ec) { - return realpathCached(Path, ec); - } -#ifndef _WIN32 - mode_t lstatCached(StringRef Path); - std::optional<std::string> readlinkCached(StringRef Path); -#endif - std::optional<std::string> realpathCached(StringRef Path, std::error_code &ec, - StringRef base = "", - bool baseIsResolved = false, - long symloopLevel = 40); -}; - -/// Performs placeholder substitution in dynamic library paths. -/// -/// Configures known placeholders (like @loader_path) and replaces them -/// in input paths with their resolved values. -class DylibSubstitutor { -public: - void configure(StringRef loaderPath); - - std::string substitute(StringRef input) const { - for (const auto &[ph, value] : Placeholders) { - if (input.starts_with_insensitive(ph)) - return (Twine(value) + input.drop_front(ph.size())).str(); - } - return input.str(); - } - -private: - StringMap<std::string> Placeholders; -}; - -/// Validates and normalizes dynamic library paths. -/// -/// Uses a `PathResolver` to resolve paths to their canonical form and -/// checks whether they point to valid shared libraries. -class DylibPathValidator { -public: - DylibPathValidator(PathResolver &PR) : LibPathResolver(PR) {} - - static bool isSharedLibrary(StringRef Path); - - std::optional<std::string> normalize(StringRef Path) const { - std::error_code ec; - auto real = LibPathResolver.resolve(Path, ec); - if (!real || ec) - return std::nullopt; - - return real; - } - - /// Validate the given path as a shared library. - std::optional<std::string> validate(StringRef Path) const { - auto realOpt = normalize(Path); - if (!realOpt) - return std::nullopt; - - if (!isSharedLibrary(*realOpt)) - return std::nullopt; - - return realOpt; - } - -private: - PathResolver &LibPathResolver; -}; - -enum class SearchPathType { - RPath, - UsrOrSys, - RunPath, -}; - -struct SearchPathConfig { - ArrayRef<StringRef> Paths; - SearchPathType type; -}; - -class SearchPathResolver { -public: - SearchPathResolver(const SearchPathConfig &Cfg, - StringRef PlaceholderPrefix = "") - : Kind(Cfg.type), PlaceholderPrefix(PlaceholderPrefix) { - for (auto &path : Cfg.Paths) - Paths.emplace_back(path.str()); - } - - std::optional<std::string> resolve(StringRef libStem, - const DylibSubstitutor &Subst, - DylibPathValidator &Validator) const; - SearchPathType searchPathType() const { return Kind; } - -private: - std::vector<std::string> Paths; - SearchPathType Kind; - std::string PlaceholderPrefix; -}; - -class DylibResolverImpl { -public: - DylibResolverImpl(DylibSubstitutor Substitutor, DylibPathValidator &Validator, - std::vector<SearchPathResolver> Resolvers) - : Substitutor(std::move(Substitutor)), Validator(Validator), - Resolvers(std::move(Resolvers)) {} - - std::optional<std::string> resolve(StringRef Stem, - bool VariateLibStem = false) const; - -private: - std::optional<std::string> tryWithExtensions(StringRef libstem) const; - - DylibSubstitutor Substitutor; - DylibPathValidator &Validator; - std::vector<SearchPathResolver> Resolvers; -}; - -class DylibResolver { -public: - DylibResolver(DylibPathValidator &Validator) : Validator(Validator) {} - - void configure(StringRef loaderPath, - ArrayRef<SearchPathConfig> SearchPathCfg) { - DylibSubstitutor Substitutor; - Substitutor.configure(loaderPath); - - std::vector<SearchPathResolver> Resolvers; - for (const auto &cfg : SearchPathCfg) { - Resolvers.emplace_back(cfg, - cfg.type == SearchPathType::RPath ? "@rpath" : ""); - } - - impl_ = std::make_unique<DylibResolverImpl>( - std::move(Substitutor), Validator, std::move(Resolvers)); - } - - std::optional<std::string> resolve(StringRef libStem, - bool VariateLibStem = false) const { - if (!impl_) - return std::nullopt; - return impl_->resolve(libStem, VariateLibStem); - } - - static std::string resolvelinkerFlag(StringRef libStem, - StringRef loaderPath) { - DylibSubstitutor Substitutor; - Substitutor.configure(loaderPath); - return Substitutor.substitute(libStem); - } - -private: - DylibPathValidator &Validator; - std::unique_ptr<DylibResolverImpl> impl_; -}; - -enum class PathType : uint8_t { User, System, Unknown }; - -enum class ScanState : uint8_t { NotScanned, Scanning, Scanned }; - -struct LibrarySearchPath { - std::string BasePath; // Canonical base directory path - PathType Kind; // User or System - std::atomic<ScanState> State; - - LibrarySearchPath(std::string Base, PathType K) - : BasePath(std::move(Base)), Kind(K), State(ScanState::NotScanned) {} -}; - -/// Scans and tracks libraries for symbol resolution. -/// -/// Maintains a list of library paths to scan, caches scanned units, -/// and resolves paths canonically for consistent tracking. -class LibraryScanHelper { -public: - explicit LibraryScanHelper(const std::vector<std::string> &SPaths, - std::shared_ptr<LibraryPathCache> LibPathCache, - std::shared_ptr<PathResolver> LibPathResolver) - : LibPathCache(std::move(LibPathCache)), - LibPathResolver(std::move(LibPathResolver)) { - DEBUG_WITH_TYPE( - "orc", dbgs() << "LibraryScanHelper::LibraryScanHelper: base paths : " - << SPaths.size() << "\n";); - for (const auto &p : SPaths) - addBasePath(p); - } - - void - addBasePath(const std::string &P, - PathType Kind = - PathType::Unknown); // Add a canonical directory for scanning - std::vector<std::shared_ptr<LibrarySearchPath>> - getNextBatch(PathType Kind, size_t batchSize); - - bool leftToScan(PathType K) const; - void resetToScan(); - - bool isTrackedBasePath(StringRef P) const; - std::vector<std::shared_ptr<LibrarySearchPath>> getAllUnits() const; - - SmallVector<StringRef> getSearchPaths() const { - SmallVector<StringRef> SearchPaths; - for (const auto &[_, SP] : LibSearchPaths) - SearchPaths.push_back(SP->BasePath); - return SearchPaths; - } - - PathResolver &getPathResolver() const { return *LibPathResolver; } - - LibraryPathCache &getCache() const { return *LibPathCache; } - - bool hasSeenOrMark(StringRef P) const { - return LibPathCache->hasSeenOrMark(P); - } - - std::optional<std::string> resolve(StringRef P, std::error_code &ec) const { - return LibPathResolver->resolve(P.str(), ec); - } - -private: - std::string resolveCanonical(StringRef P, std::error_code &ec) const; - PathType classifyKind(StringRef P) const; - - mutable std::shared_mutex Mtx; - std::shared_ptr<LibraryPathCache> LibPathCache; - std::shared_ptr<PathResolver> LibPathResolver; - - StringMap<std::shared_ptr<LibrarySearchPath>> - LibSearchPaths; // key: canonical path - std::deque<StringRef> UnscannedUsr; - std::deque<StringRef> UnscannedSys; -}; - -/// Loads an object file and provides access to it. -/// -/// Owns the underlying `ObjectFile` and ensures it is valid. -/// Any errors encountered during construction are stored and -/// returned when attempting to access the file. -class ObjectFileLoader { -public: - /// Construct an object file loader from the given path. - explicit ObjectFileLoader(StringRef Path) { - auto ObjOrErr = loadObjectFileWithOwnership(Path); - if (ObjOrErr) - Obj = std::move(*ObjOrErr); - else { - consumeError(std::move(Err)); - Err = ObjOrErr.takeError(); - } - } - - ObjectFileLoader(const ObjectFileLoader &) = delete; - ObjectFileLoader &operator=(const ObjectFileLoader &) = delete; - - ObjectFileLoader(ObjectFileLoader &&) = default; - ObjectFileLoader &operator=(ObjectFileLoader &&) = default; - - /// Get the loaded object file, or return an error if loading failed. - Expected<object::ObjectFile &> getObjectFile() { - if (Err) - return std::move(Err); - return *Obj.getBinary(); - } - - static bool isArchitectureCompatible(const object::ObjectFile &Obj); - -private: - object::OwningBinary<object::ObjectFile> Obj; - Error Err = Error::success(); - - static Expected<object::OwningBinary<object::ObjectFile>> - loadObjectFileWithOwnership(StringRef FilePath); -}; - -/// Scans libraries, resolves dependencies, and registers them. -class LibraryScanner { -public: - using ShouldScanFn = std::function<bool(StringRef)>; - - LibraryScanner( - LibraryScanHelper &H, LibraryManager &LibMgr, - ShouldScanFn ShouldScanCall = [](StringRef path) { return true; }) - : ScanHelper(H), LibMgr(LibMgr), - ShouldScanCall(std::move(ShouldScanCall)) {} - - void scanNext(PathType Kind, size_t batchSize = 1); - - /// Dependency info for a library. - struct LibraryDepsInfo { - llvm::BumpPtrAllocator Alloc; - llvm::StringSaver Saver{Alloc}; - - SmallVector<StringRef, 2> rpath; - SmallVector<StringRef, 2> runPath; - SmallVector<StringRef, 4> deps; - bool isPIE = false; - - void addRPath(StringRef s) { rpath.push_back(Saver.save(s)); } - - void addRunPath(StringRef s) { runPath.push_back(Saver.save(s)); } - - void addDep(StringRef s) { deps.push_back(Saver.save(s)); } - }; - -private: - LibraryScanHelper &ScanHelper; - LibraryManager &LibMgr; - ShouldScanFn ShouldScanCall; - - std::optional<std::string> shouldScan(StringRef FilePath); - Expected<LibraryDepsInfo> extractDeps(StringRef FilePath); - - void handleLibrary(StringRef P, PathType K, int level = 1); - - void scanBaseDir(std::shared_ptr<LibrarySearchPath> U); -}; - -using LibraryDepsInfo = LibraryScanner::LibraryDepsInfo; - -} // end namespace orc -} // end namespace llvm - -#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_LIBRARYSCANNER_H diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h index ead7655..a235975 100644 --- a/llvm/include/llvm/Support/SpecialCaseList.h +++ b/llvm/include/llvm/Support/SpecialCaseList.h @@ -13,7 +13,10 @@ #define LLVM_SUPPORT_SPECIALCASELIST_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/RadixTree.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/iterator_range.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/GlobPattern.h" @@ -162,6 +165,10 @@ private: }; std::vector<GlobMatcher::Glob> Globs; + + RadixTree<iterator_range<StringRef::const_iterator>, + SmallVector<const GlobMatcher::Glob *, 1>> + PrefixToGlob; }; /// Represents a set of patterns and their line numbers diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 9e78ec9..8ea1326 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -4030,7 +4030,6 @@ bool PhiNodeSetIterator::operator!=(const PhiNodeSetIterator &RHS) const { /// if it is simplified. class SimplificationTracker { DenseMap<Value *, Value *> Storage; - const SimplifyQuery &SQ; // Tracks newly created Phi nodes. The elements are iterated by insertion // order. PhiNodeSet AllPhiNodes; @@ -4038,8 +4037,6 @@ class SimplificationTracker { SmallPtrSet<SelectInst *, 32> AllSelectNodes; public: - SimplificationTracker(const SimplifyQuery &sq) : SQ(sq) {} - Value *Get(Value *V) { do { auto SV = Storage.find(V); @@ -4049,30 +4046,6 @@ public: } while (true); } - Value *Simplify(Value *Val) { - SmallVector<Value *, 32> WorkList; - SmallPtrSet<Value *, 32> Visited; - WorkList.push_back(Val); - while (!WorkList.empty()) { - auto *P = WorkList.pop_back_val(); - if (!Visited.insert(P).second) - continue; - if (auto *PI = dyn_cast<Instruction>(P)) - if (Value *V = simplifyInstruction(cast<Instruction>(PI), SQ)) { - for (auto *U : PI->users()) - WorkList.push_back(cast<Value>(U)); - Put(PI, V); - PI->replaceAllUsesWith(V); - if (auto *PHI = dyn_cast<PHINode>(PI)) - AllPhiNodes.erase(PHI); - if (auto *Select = dyn_cast<SelectInst>(PI)) - AllSelectNodes.erase(Select); - PI->eraseFromParent(); - } - } - return Get(Val); - } - void Put(Value *From, Value *To) { Storage.insert({From, To}); } void ReplacePhi(PHINode *From, PHINode *To) { @@ -4133,8 +4106,7 @@ private: /// Common Type for all different fields in addressing modes. Type *CommonType = nullptr; - /// SimplifyQuery for simplifyInstruction utility. - const SimplifyQuery &SQ; + const DataLayout &DL; /// Original Address. Value *Original; @@ -4143,8 +4115,8 @@ private: Value *CommonValue = nullptr; public: - AddressingModeCombiner(const SimplifyQuery &_SQ, Value *OriginalValue) - : SQ(_SQ), Original(OriginalValue) {} + AddressingModeCombiner(const DataLayout &DL, Value *OriginalValue) + : DL(DL), Original(OriginalValue) {} ~AddressingModeCombiner() { eraseCommonValueIfDead(); } @@ -4256,7 +4228,7 @@ private: // Keep track of keys where the value is null. We will need to replace it // with constant null when we know the common type. SmallVector<Value *, 2> NullValue; - Type *IntPtrTy = SQ.DL.getIntPtrType(AddrModes[0].OriginalValue->getType()); + Type *IntPtrTy = DL.getIntPtrType(AddrModes[0].OriginalValue->getType()); for (auto &AM : AddrModes) { Value *DV = AM.GetFieldAsValue(DifferentField, IntPtrTy); if (DV) { @@ -4306,7 +4278,7 @@ private: // simplification is possible only if original phi/selects were not // simplified yet. // Using this mapping we can find the current value in AddrToBase. - SimplificationTracker ST(SQ); + SimplificationTracker ST; // First step, DFS to create PHI nodes for all intermediate blocks. // Also fill traverse order for the second step. @@ -4465,7 +4437,6 @@ private: PHI->addIncoming(ST.Get(Map[PV]), B); } } - Map[Current] = ST.Simplify(V); } } @@ -5856,8 +5827,7 @@ bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr, // the graph are compatible. bool PhiOrSelectSeen = false; SmallVector<Instruction *, 16> AddrModeInsts; - const SimplifyQuery SQ(*DL, TLInfo); - AddressingModeCombiner AddrModes(SQ, Addr); + AddressingModeCombiner AddrModes(*DL, Addr); TypePromotionTransaction TPT(RemovedInsts); TypePromotionTransaction::ConstRestorationPt LastKnownGood = TPT.getRestorationPoint(); diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index 8d413a3..d029ac5 100644 --- a/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -2901,13 +2901,23 @@ ExecutionSession::IL_emit(MaterializationResponsibility &MR, for (auto &SN : ER.Ready) IL_collectQueries( - EQ.Updated, SN->defs(), + EQ.Completed, SN->defs(), [](JITDylib::SymbolTableEntry &E) { E.setState(SymbolState::Ready); }, [](AsynchronousSymbolQuery &Q, JITDylib &JD, NonOwningSymbolStringPtr Name, JITDylib::SymbolTableEntry &E) { Q.notifySymbolMetRequiredState(SymbolStringPtr(Name), E.getSymbol()); }); + // std::erase_if is not available in C++17, and llvm::erase_if does not work + // here. + for (auto it = EQ.Completed.begin(), end = EQ.Completed.end(); it != end;) { + if ((*it)->isComplete()) { + ++it; + } else { + it = EQ.Completed.erase(it); + } + } + #ifdef EXPENSIVE_CHECKS verifySessionState("exiting ExecutionSession::IL_emit"); #endif @@ -3043,9 +3053,8 @@ Error ExecutionSession::OL_notifyEmitted( } } - for (auto &UQ : EmitQueries->Updated) - if (UQ->isComplete()) - UQ->handleComplete(*this); + for (auto &UQ : EmitQueries->Completed) + UQ->handleComplete(*this); // If there are any bad dependencies then return an error. if (!BadDeps.empty()) { diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt index ca8192b..9275586 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt @@ -16,11 +16,9 @@ add_llvm_component_library(LLVMOrcTargetProcess ExecutorSharedMemoryMapperService.cpp DefaultHostBootstrapValues.cpp ExecutorResolver.cpp - LibraryResolver.cpp JITLoaderGDB.cpp JITLoaderPerf.cpp JITLoaderVTune.cpp - LibraryScanner.cpp OrcRTBootstrap.cpp RegisterEHFrames.cpp SimpleExecutorDylibManager.cpp @@ -38,8 +36,6 @@ add_llvm_component_library(LLVMOrcTargetProcess LINK_COMPONENTS ${intel_jit_profiling} - BinaryFormat - Object OrcShared Support TargetParser diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/LibraryResolver.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/LibraryResolver.cpp deleted file mode 100644 index 9d25b74..0000000 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/LibraryResolver.cpp +++ /dev/null @@ -1,369 +0,0 @@ -//===- LibraryResolver.cpp - Library Resolution of Unresolved Symbols ---===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -// Library resolution impl for unresolved symbols -// -//===----------------------------------------------------------------------===// - -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h" -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h" - -#include "llvm/ADT/StringSet.h" - -#include "llvm/BinaryFormat/MachO.h" -#include "llvm/Object/COFF.h" -#include "llvm/Object/ELF.h" -#include "llvm/Object/ELFObjectFile.h" -#include "llvm/Object/MachO.h" -#include "llvm/Object/ObjectFile.h" -#include "llvm/Support/Error.h" - -#include <mutex> -#include <thread> - -#define DEBUG_TYPE "orc-resolver" - -namespace llvm::orc { - -LibraryResolver::LibraryResolver(const LibraryResolver::Setup &S) - : LibPathCache(S.Cache ? S.Cache : std::make_shared<LibraryPathCache>()), - LibPathResolver(S.PResolver - ? S.PResolver - : std::make_shared<PathResolver>(LibPathCache)), - ScanHelper(S.BasePaths, LibPathCache, LibPathResolver), - FB(S.FilterBuilder), LibMgr(), - ShouldScanCall(S.ShouldScanCall ? S.ShouldScanCall - : [](StringRef) -> bool { return true; }), - scanBatchSize(S.ScanBatchSize) { - - if (ScanHelper.getAllUnits().empty()) { - LLVM_DEBUG(dbgs() << "Warning: No base paths provided for scanning.\n"); - } -} - -std::unique_ptr<LibraryResolutionDriver> -LibraryResolutionDriver::create(const LibraryResolver::Setup &S) { - auto LR = std::make_unique<LibraryResolver>(S); - return std::unique_ptr<LibraryResolutionDriver>( - new LibraryResolutionDriver(std::move(LR))); -} - -void LibraryResolutionDriver::addScanPath(const std::string &Path, PathType K) { - LR->ScanHelper.addBasePath(Path, K); -} - -bool LibraryResolutionDriver::markLibraryLoaded(StringRef Path) { - auto Lib = LR->LibMgr.getLibrary(Path); - if (!Lib) - return false; - - Lib->setState(LibraryManager::LibState::Loaded); - - return true; -} - -bool LibraryResolutionDriver::markLibraryUnLoaded(StringRef Path) { - auto Lib = LR->LibMgr.getLibrary(Path); - if (!Lib) - return false; - - Lib->setState(LibraryManager::LibState::Unloaded); - - return true; -} - -void LibraryResolutionDriver::resolveSymbols( - std::vector<std::string> Syms, - LibraryResolver::OnSearchComplete OnCompletion, - const SearchConfig &Config) { - LR->searchSymbolsInLibraries(Syms, std::move(OnCompletion), Config); -} - -static bool shouldIgnoreSymbol(const object::SymbolRef &Sym, - uint32_t IgnoreFlags) { - Expected<uint32_t> FlagsOrErr = Sym.getFlags(); - if (!FlagsOrErr) { - consumeError(FlagsOrErr.takeError()); - return true; - } - - uint32_t Flags = *FlagsOrErr; - - using Filter = SymbolEnumeratorOptions; - if ((IgnoreFlags & Filter::IgnoreUndefined) && - (Flags & object::SymbolRef::SF_Undefined)) - return true; - if ((IgnoreFlags & Filter::IgnoreIndirect) && - (Flags & object::SymbolRef::SF_Indirect)) - return true; - if ((IgnoreFlags & Filter::IgnoreWeak) && - (Flags & object::SymbolRef::SF_Weak)) - return true; - - return false; -} - -bool SymbolEnumerator::enumerateSymbols(StringRef Path, OnEachSymbolFn OnEach, - const SymbolEnumeratorOptions &Opts) { - if (Path.empty()) - return false; - - ObjectFileLoader ObjLoader(Path); - - auto ObjOrErr = ObjLoader.getObjectFile(); - if (!ObjOrErr) { - std::string ErrMsg; - handleAllErrors(ObjOrErr.takeError(), - [&](const ErrorInfoBase &EIB) { ErrMsg = EIB.message(); }); - LLVM_DEBUG(dbgs() << "Failed loading object file: " << Path - << "\nError: " << ErrMsg << "\n"); - return false; - } - - object::ObjectFile *Obj = &ObjOrErr.get(); - - auto processSymbolRange = - [&](object::ObjectFile::symbol_iterator_range Range) -> EnumerateResult { - for (const auto &Sym : Range) { - if (shouldIgnoreSymbol(Sym, Opts.FilterFlags)) - continue; - - auto NameOrErr = Sym.getName(); - if (!NameOrErr) { - consumeError(NameOrErr.takeError()); - continue; - } - - StringRef Name = *NameOrErr; - if (Name.empty()) - continue; - - EnumerateResult Res = OnEach(Name); - if (Res != EnumerateResult::Continue) - return Res; - } - return EnumerateResult::Continue; - }; - - EnumerateResult Res = processSymbolRange(Obj->symbols()); - if (Res != EnumerateResult::Continue) - return Res == EnumerateResult::Stop; - - if (Obj->isELF()) { - const auto *ElfObj = cast<object::ELFObjectFileBase>(Obj); - Res = processSymbolRange(ElfObj->getDynamicSymbolIterators()); - if (Res != EnumerateResult::Continue) - return Res == EnumerateResult::Stop; - } else if (Obj->isCOFF()) { - const auto *CoffObj = cast<object::COFFObjectFile>(Obj); - for (auto I = CoffObj->export_directory_begin(), - E = CoffObj->export_directory_end(); - I != E; ++I) { - StringRef Name; - if (I->getSymbolName(Name)) - continue; - if (Name.empty()) - continue; - - if (OnEach(Name) != EnumerateResult::Continue) - return false; - } - } else if (Obj->isMachO()) { - } - - return true; -} - -class SymbolSearchContext { -public: - SymbolSearchContext(SymbolQuery &Q) : Q(Q) {} - - bool hasSearched(LibraryInfo *Lib) const { return Searched.count(Lib); } - - void markSearched(LibraryInfo *Lib) { Searched.insert(Lib); } - - inline bool allResolved() const { return Q.allResolved(); } - - SymbolQuery &query() { return Q; } - -private: - SymbolQuery &Q; - DenseSet<LibraryInfo *> Searched; -}; - -void LibraryResolver::resolveSymbolsInLibrary( - LibraryInfo &Lib, SymbolQuery &UnresolvedSymbols, - const SymbolEnumeratorOptions &Opts) { - LLVM_DEBUG(dbgs() << "Checking unresolved symbols " - << " in library : " << Lib.getFileName() << "\n";); - StringSet<> DiscoveredSymbols; - - if (!UnresolvedSymbols.hasUnresolved()) { - LLVM_DEBUG(dbgs() << "Skipping library: " << Lib.getFullPath() - << " — unresolved symbols exist.\n";); - return; - } - - bool HasEnumerated = false; - auto enumerateSymbolsIfNeeded = [&]() { - if (HasEnumerated) - return; - - HasEnumerated = true; - - LLVM_DEBUG(dbgs() << "Enumerating symbols in library: " << Lib.getFullPath() - << "\n";); - SymbolEnumerator::enumerateSymbols( - Lib.getFullPath(), - [&](StringRef sym) { - DiscoveredSymbols.insert(sym); - return EnumerateResult::Continue; - }, - Opts); - - if (DiscoveredSymbols.empty()) { - LLVM_DEBUG(dbgs() << " No symbols and remove library : " - << Lib.getFullPath() << "\n";); - LibMgr.removeLibrary(Lib.getFullPath()); - return; - } - }; - - if (!Lib.hasFilter()) { - LLVM_DEBUG(dbgs() << "Building filter for library: " << Lib.getFullPath() - << "\n";); - enumerateSymbolsIfNeeded(); - SmallVector<StringRef> SymbolVec; - SymbolVec.reserve(DiscoveredSymbols.size()); - for (const auto &KV : DiscoveredSymbols) - SymbolVec.push_back(KV.first()); - - Lib.ensureFilterBuilt(FB, SymbolVec); - LLVM_DEBUG({ - dbgs() << "DiscoveredSymbols : " << DiscoveredSymbols.size() << "\n"; - for (const auto &KV : DiscoveredSymbols) - dbgs() << "DiscoveredSymbols : " << KV.first() << "\n"; - }); - } - - const auto &Unresolved = UnresolvedSymbols.getUnresolvedSymbols(); - bool HadAnySym = false; - LLVM_DEBUG(dbgs() << "Total unresolved symbols : " << Unresolved.size() - << "\n";); - for (const auto &Sym : Unresolved) { - if (Lib.mayContain(Sym)) { - LLVM_DEBUG(dbgs() << "Checking symbol '" << Sym - << "' in library: " << Lib.getFullPath() << "\n";); - enumerateSymbolsIfNeeded(); - if (DiscoveredSymbols.count(Sym) > 0) { - LLVM_DEBUG(dbgs() << " Resolved symbol: " << Sym - << " in library: " << Lib.getFullPath() << "\n";); - UnresolvedSymbols.resolve(Sym, Lib.getFullPath()); - HadAnySym = true; - } - } - } - - using LibraryState = LibraryManager::LibState; - if (HadAnySym && Lib.getState() != LibraryState::Loaded) - Lib.setState(LibraryState::Queried); -} - -void LibraryResolver::searchSymbolsInLibraries( - std::vector<std::string> &SymbolList, OnSearchComplete OnComplete, - const SearchConfig &Config) { - SymbolQuery Q(SymbolList); - - using LibraryState = LibraryManager::LibState; - using LibraryType = PathType; - auto tryResolveFrom = [&](LibraryState S, LibraryType K) { - LLVM_DEBUG(dbgs() << "Trying resolve from state=" << static_cast<int>(S) - << " type=" << static_cast<int>(K) << "\n";); - - SymbolSearchContext Ctx(Q); - while (!Ctx.allResolved()) { - - for (auto &Lib : LibMgr.getView(S, K)) { - if (Ctx.hasSearched(Lib.get())) - continue; - - // can use Async here? - resolveSymbolsInLibrary(*Lib, Ctx.query(), Config.Options); - Ctx.markSearched(Lib.get()); - - if (Ctx.allResolved()) - return; - } - - if (Ctx.allResolved()) - return; - - if (!scanLibrariesIfNeeded(K, scanBatchSize)) - break; // no more new libs to scan - } - }; - - for (const auto &[St, Ty] : Config.Policy.Plan) { - tryResolveFrom(St, Ty); - if (Q.allResolved()) - break; - } - - // done: - LLVM_DEBUG({ - dbgs() << "Search complete.\n"; - for (const auto &r : Q.getAllResults()) - dbgs() << "Resolved Symbol:" << r->Name << " -> " << r->ResolvedLibPath - << "\n"; - }); - - OnComplete(Q); -} - -bool LibraryResolver::scanLibrariesIfNeeded(PathType PK, size_t BatchSize) { - LLVM_DEBUG(dbgs() << "LibraryResolver::scanLibrariesIfNeeded: Scanning for " - << (PK == PathType::User ? "User" : "System") - << " libraries\n";); - if (!ScanHelper.leftToScan(PK)) - return false; - - LibraryScanner Scanner(ScanHelper, LibMgr, ShouldScanCall); - Scanner.scanNext(PK, BatchSize); - return true; -} - -bool LibraryResolver::symbolExistsInLibrary(const LibraryInfo &Lib, - StringRef SymName, - std::vector<std::string> *AllSyms) { - SymbolEnumeratorOptions Opts; - return symbolExistsInLibrary(Lib, SymName, AllSyms, Opts); -} - -bool LibraryResolver::symbolExistsInLibrary( - const LibraryInfo &Lib, StringRef SymName, - std::vector<std::string> *AllSyms, const SymbolEnumeratorOptions &Opts) { - bool Found = false; - - SymbolEnumerator::enumerateSymbols( - Lib.getFullPath(), - [&](StringRef Sym) { - if (AllSyms) - AllSyms->emplace_back(Sym.str()); - - if (Sym == SymName) { - Found = true; - } - - return EnumerateResult::Continue; - }, - Opts); - - return Found; -} - -} // end namespace llvm::orc diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/LibraryScanner.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/LibraryScanner.cpp deleted file mode 100644 index f1e8b5d..0000000 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/LibraryScanner.cpp +++ /dev/null @@ -1,1161 +0,0 @@ -//===- LibraryScanner.cpp - Provide Library Scanning Implementation ----===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h" -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h" - -#include "llvm/ADT/StringExtras.h" -#include "llvm/Object/COFF.h" -#include "llvm/Object/ELF.h" -#include "llvm/Object/ELFObjectFile.h" -#include "llvm/Object/ELFTypes.h" -#include "llvm/Object/MachO.h" -#include "llvm/Object/MachOUniversal.h" -#include "llvm/Object/ObjectFile.h" -#include "llvm/Support/Error.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/Program.h" -#include "llvm/TargetParser/Host.h" -#include "llvm/TargetParser/Triple.h" - -#ifdef LLVM_ON_UNIX -#include <sys/stat.h> -#include <unistd.h> -#endif // LLVM_ON_UNIX - -#ifdef __APPLE__ -#include <sys/stat.h> -#undef LC_LOAD_DYLIB -#undef LC_RPATH -#endif // __APPLE__ - -#define DEBUG_TYPE "orc-scanner" - -namespace llvm::orc { - -void handleError(Error Err, StringRef context = "") { - consumeError(handleErrors(std::move(Err), [&](const ErrorInfoBase &EIB) { - dbgs() << "LLVM Error"; - if (!context.empty()) - dbgs() << " [" << context << "]"; - dbgs() << ": " << EIB.message() << "\n"; - })); -} - -bool ObjectFileLoader::isArchitectureCompatible(const object::ObjectFile &Obj) { - Triple HostTriple(sys::getDefaultTargetTriple()); - Triple ObjTriple = Obj.makeTriple(); - - LLVM_DEBUG({ - dbgs() << "Host triple: " << HostTriple.str() - << ", Object triple: " << ObjTriple.str() << "\n"; - }); - - if (ObjTriple.getArch() != Triple::UnknownArch && - HostTriple.getArch() != ObjTriple.getArch()) - return false; - - if (ObjTriple.getOS() != Triple::UnknownOS && - HostTriple.getOS() != ObjTriple.getOS()) - return false; - - if (ObjTriple.getEnvironment() != Triple::UnknownEnvironment && - HostTriple.getEnvironment() != Triple::UnknownEnvironment && - HostTriple.getEnvironment() != ObjTriple.getEnvironment()) - return false; - - return true; -} - -Expected<object::OwningBinary<object::ObjectFile>> -ObjectFileLoader::loadObjectFileWithOwnership(StringRef FilePath) { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Attempting to open file " << FilePath - << "\n";); - auto BinOrErr = object::createBinary(FilePath); - if (!BinOrErr) { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Failed to open file " << FilePath - << "\n";); - return BinOrErr.takeError(); - } - - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Successfully opened file " << FilePath - << "\n";); - - auto OwningBin = BinOrErr->takeBinary(); - object::Binary *Bin = OwningBin.first.get(); - - if (Bin->isArchive()) { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: File is an archive, not supported: " - << FilePath << "\n";); - return createStringError(std::errc::invalid_argument, - "Archive files are not supported: %s", - FilePath.str().c_str()); - } - -#if defined(__APPLE__) - if (auto *UB = dyn_cast<object::MachOUniversalBinary>(Bin)) { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Detected Mach-O universal binary: " - << FilePath << "\n";); - for (auto ObjForArch : UB->objects()) { - auto ObjOrErr = ObjForArch.getAsObjectFile(); - if (!ObjOrErr) { - LLVM_DEBUG( - dbgs() - << "ObjectFileLoader: Skipping invalid architecture slice\n";); - - consumeError(ObjOrErr.takeError()); - continue; - } - - std::unique_ptr<object::ObjectFile> Obj = std::move(ObjOrErr.get()); - if (isArchitectureCompatible(*Obj)) { - LLVM_DEBUG( - dbgs() << "ObjectFileLoader: Found compatible object slice\n";); - - return object::OwningBinary<object::ObjectFile>( - std::move(Obj), std::move(OwningBin.second)); - - } else { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Incompatible architecture " - "slice skipped\n";); - } - } - LLVM_DEBUG(dbgs() << "ObjectFileLoader: No compatible slices found in " - "universal binary\n";); - return createStringError(inconvertibleErrorCode(), - "No compatible object found in fat binary: %s", - FilePath.str().c_str()); - } -#endif - - auto ObjOrErr = - object::ObjectFile::createObjectFile(Bin->getMemoryBufferRef()); - if (!ObjOrErr) { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Failed to create object file\n";); - return ObjOrErr.takeError(); - } - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Detected object file\n";); - - std::unique_ptr<object::ObjectFile> Obj = std::move(*ObjOrErr); - if (!isArchitectureCompatible(*Obj)) { - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Incompatible architecture: " - << FilePath << "\n";); - return createStringError(inconvertibleErrorCode(), - "Incompatible object file: %s", - FilePath.str().c_str()); - } - - LLVM_DEBUG(dbgs() << "ObjectFileLoader: Object file is compatible\n";); - - return object::OwningBinary<object::ObjectFile>(std::move(Obj), - std::move(OwningBin.second)); -} - -template <class ELFT> -bool isELFSharedLibrary(const object::ELFFile<ELFT> &ELFObj) { - if (ELFObj.getHeader().e_type != ELF::ET_DYN) - return false; - - auto PHOrErr = ELFObj.program_headers(); - if (!PHOrErr) { - consumeError(PHOrErr.takeError()); - return true; - } - - for (auto Phdr : *PHOrErr) { - if (Phdr.p_type == ELF::PT_INTERP) - return false; - } - - return true; -} - -bool isSharedLibraryObject(object::ObjectFile &Obj) { - if (Obj.isELF()) { - if (auto *ELF32LE = dyn_cast<object::ELF32LEObjectFile>(&Obj)) - return isELFSharedLibrary(ELF32LE->getELFFile()); - if (auto *ELF64LE = dyn_cast<object::ELF64LEObjectFile>(&Obj)) - return isELFSharedLibrary(ELF64LE->getELFFile()); - if (auto *ELF32BE = dyn_cast<object::ELF32BEObjectFile>(&Obj)) - return isELFSharedLibrary(ELF32BE->getELFFile()); - if (auto *ELF64BE = dyn_cast<object::ELF64BEObjectFile>(&Obj)) - return isELFSharedLibrary(ELF64BE->getELFFile()); - } else if (Obj.isMachO()) { - const object::MachOObjectFile *MachO = - dyn_cast<object::MachOObjectFile>(&Obj); - if (!MachO) { - LLVM_DEBUG(dbgs() << "Failed to cast to MachOObjectFile.\n";); - return false; - } - LLVM_DEBUG({ - bool Result = - MachO->getHeader().filetype == MachO::HeaderFileType::MH_DYLIB; - dbgs() << "Mach-O filetype: " << MachO->getHeader().filetype - << " (MH_DYLIB == " << MachO::HeaderFileType::MH_DYLIB - << "), shared: " << Result << "\n"; - }); - - return MachO->getHeader().filetype == MachO::HeaderFileType::MH_DYLIB; - } else if (Obj.isCOFF()) { - const object::COFFObjectFile *coff = dyn_cast<object::COFFObjectFile>(&Obj); - if (!coff) - return false; - return coff->getCharacteristics() & COFF::IMAGE_FILE_DLL; - } else { - LLVM_DEBUG(dbgs() << "Binary is not an ObjectFile.\n";); - } - - return false; -} - -bool DylibPathValidator::isSharedLibrary(StringRef Path) { - LLVM_DEBUG(dbgs() << "Checking if path is a shared library: " << Path - << "\n";); - - auto FileType = sys::fs::get_file_type(Path, /*Follow*/ true); - if (FileType != sys::fs::file_type::regular_file) { - LLVM_DEBUG(dbgs() << "File type is not a regular file for path: " << Path - << "\n";); - return false; - } - - file_magic MagicCode; - identify_magic(Path, MagicCode); - - // Skip archives. - if (MagicCode == file_magic::archive) - return false; - - // Universal binary handling. -#if defined(__APPLE__) - if (MagicCode == file_magic::macho_universal_binary) { - ObjectFileLoader ObjLoader(Path); - auto ObjOrErr = ObjLoader.getObjectFile(); - if (!ObjOrErr) { - consumeError(ObjOrErr.takeError()); - return false; - } - return isSharedLibraryObject(ObjOrErr.get()); - } -#endif - - // Object file inspection for PE/COFF, ELF, and Mach-O - bool NeedsObjectInspection = -#if defined(_WIN32) - (MagicCode == file_magic::pecoff_executable); -#elif defined(__APPLE__) - (MagicCode == file_magic::macho_fixed_virtual_memory_shared_lib || - MagicCode == file_magic::macho_dynamically_linked_shared_lib || - MagicCode == file_magic::macho_dynamically_linked_shared_lib_stub); -#elif defined(LLVM_ON_UNIX) -#ifdef __CYGWIN__ - (MagicCode == file_magic::pecoff_executable); -#else - (MagicCode == file_magic::elf_shared_object); -#endif -#else -#error "Unsupported platform." -#endif - - if (NeedsObjectInspection) { - ObjectFileLoader ObjLoader(Path); - auto ObjOrErr = ObjLoader.getObjectFile(); - if (!ObjOrErr) { - consumeError(ObjOrErr.takeError()); - return false; - } - return isSharedLibraryObject(ObjOrErr.get()); - } - - LLVM_DEBUG(dbgs() << "Path is not identified as a shared library: " << Path - << "\n";); - return false; -} - -void DylibSubstitutor::configure(StringRef LoaderPath) { - SmallString<512> ExecPath(sys::fs::getMainExecutable(nullptr, nullptr)); - sys::path::remove_filename(ExecPath); - - SmallString<512> LoaderDir; - if (LoaderPath.empty()) { - LoaderDir = ExecPath; - } else { - LoaderDir = LoaderPath.str(); - if (!sys::fs::is_directory(LoaderPath)) - sys::path::remove_filename(LoaderDir); - } - -#ifdef __APPLE__ - Placeholders["@loader_path"] = std::string(LoaderDir); - Placeholders["@executable_path"] = std::string(ExecPath); -#else - Placeholders["$origin"] = std::string(LoaderDir); -#endif -} - -std::optional<std::string> -SearchPathResolver::resolve(StringRef Stem, const DylibSubstitutor &Subst, - DylibPathValidator &Validator) const { - for (const auto &SP : Paths) { - std::string Base = Subst.substitute(SP); - - SmallString<512> FullPath(Base); - if (!PlaceholderPrefix.empty() && - Stem.starts_with_insensitive(PlaceholderPrefix)) - FullPath.append(Stem.drop_front(PlaceholderPrefix.size())); - else - sys::path::append(FullPath, Stem); - - LLVM_DEBUG(dbgs() << "SearchPathResolver::resolve FullPath = " << FullPath - << "\n";); - - if (auto Valid = Validator.validate(FullPath.str())) - return Valid; - } - - return std::nullopt; -} - -std::optional<std::string> -DylibResolverImpl::tryWithExtensions(StringRef LibStem) const { - LLVM_DEBUG(dbgs() << "tryWithExtensions: baseName = " << LibStem << "\n";); - SmallVector<SmallString<256>, 8> Candidates; - - // Add extensions by platform -#if defined(__APPLE__) - Candidates.emplace_back(LibStem); - Candidates.back() += ".dylib"; -#elif defined(_WIN32) - Candidates.emplace_back(LibStem); - Candidates.back() += ".dll"; -#else - Candidates.emplace_back(LibStem); - Candidates.back() += ".so"; -#endif - - // Optionally try "lib" prefix if not already there - StringRef FileName = sys::path::filename(LibStem); - StringRef Base = sys::path::parent_path(LibStem); - if (!FileName.starts_with("lib")) { - SmallString<256> WithPrefix(Base); - if (!WithPrefix.empty()) - sys::path::append(WithPrefix, ""); // ensure separator if needed - WithPrefix += "lib"; - WithPrefix += FileName; - -#if defined(__APPLE__) - WithPrefix += ".dylib"; -#elif defined(_WIN32) - WithPrefix += ".dll"; -#else - WithPrefix += ".so"; -#endif - - Candidates.push_back(std::move(WithPrefix)); - } - - LLVM_DEBUG({ - dbgs() << " Candidates to try:\n"; - for (const auto &C : Candidates) - dbgs() << " " << C << "\n"; - }); - - // Try all variants using tryAllPaths - for (const auto &Name : Candidates) { - - LLVM_DEBUG(dbgs() << " Trying candidate: " << Name << "\n";); - - for (const auto &R : Resolvers) { - if (auto Res = R.resolve(Name, Substitutor, Validator)) - return Res; - } - } - - LLVM_DEBUG(dbgs() << " -> No candidate Resolved.\n";); - - return std::nullopt; -} - -std::optional<std::string> -DylibResolverImpl::resolve(StringRef LibStem, bool VariateLibStem) const { - LLVM_DEBUG(dbgs() << "Resolving library stem: " << LibStem << "\n";); - - // If it is an absolute path, don't try iterate over the paths. - if (sys::path::is_absolute(LibStem)) { - LLVM_DEBUG(dbgs() << " -> Absolute path detected.\n";); - return Validator.validate(LibStem); - } - - if (!LibStem.starts_with_insensitive("@rpath")) { - if (auto norm = Validator.validate(Substitutor.substitute(LibStem))) { - LLVM_DEBUG(dbgs() << " -> Resolved after substitution: " << *norm - << "\n";); - - return norm; - } - } - - for (const auto &R : Resolvers) { - LLVM_DEBUG(dbgs() << " -> Resolving via search path ... \n";); - if (auto Result = R.resolve(LibStem, Substitutor, Validator)) { - LLVM_DEBUG(dbgs() << " -> Resolved via search path: " << *Result - << "\n";); - - return Result; - } - } - - // Expand libStem with paths, extensions, etc. - // std::string foundName; - if (VariateLibStem) { - LLVM_DEBUG(dbgs() << " -> Trying with extensions...\n";); - - if (auto Norm = tryWithExtensions(LibStem)) { - LLVM_DEBUG(dbgs() << " -> Resolved via tryWithExtensions: " << *Norm - << "\n";); - - return Norm; - } - } - - LLVM_DEBUG(dbgs() << " -> Could not resolve: " << LibStem << "\n";); - - return std::nullopt; -} - -#ifndef _WIN32 -mode_t PathResolver::lstatCached(StringRef Path) { - // If already cached - retun cached result - if (auto Cache = LibPathCache->read_lstat(Path)) - return *Cache; - - // Not cached: perform lstat and store - struct stat buf{}; - mode_t st_mode = (lstat(Path.str().c_str(), &buf) == -1) ? 0 : buf.st_mode; - - LibPathCache->insert_lstat(Path, st_mode); - - return st_mode; -} - -std::optional<std::string> PathResolver::readlinkCached(StringRef Path) { - // If already cached - retun cached result - if (auto Cache = LibPathCache->read_link(Path)) - return Cache; - - // If result not in cache - call system function and cache result - char buf[PATH_MAX]; - ssize_t len; - if ((len = readlink(Path.str().c_str(), buf, sizeof(buf))) != -1) { - buf[len] = '\0'; - std::string s(buf); - LibPathCache->insert_link(Path, s); - return s; - } - return std::nullopt; -} - -void createComponent(StringRef Path, StringRef BasePath, bool BaseIsResolved, - SmallVector<StringRef, 16> &Component) { - StringRef Separator = sys::path::get_separator(); - if (!BaseIsResolved) { - if (Path[0] == '~' && - (Path.size() == 1 || sys::path::is_separator(Path[1]))) { - static SmallString<128> HomeP; - if (HomeP.str().empty()) - sys::path::home_directory(HomeP); - StringRef(HomeP).split(Component, Separator, /*MaxSplit*/ -1, - /*KeepEmpty*/ false); - } else if (BasePath.empty()) { - static SmallString<256> CurrentPath; - if (CurrentPath.str().empty()) - sys::fs::current_path(CurrentPath); - StringRef(CurrentPath) - .split(Component, Separator, /*MaxSplit*/ -1, /*KeepEmpty*/ false); - } else { - BasePath.split(Component, Separator, /*MaxSplit*/ -1, - /*KeepEmpty*/ false); - } - } - - Path.split(Component, Separator, /*MaxSplit*/ -1, /*KeepEmpty*/ false); -} - -void normalizePathSegments(SmallVector<StringRef, 16> &PathParts) { - SmallVector<StringRef, 16> NormalizedPath; - for (auto &Part : PathParts) { - if (Part == ".") { - continue; - } else if (Part == "..") { - if (!NormalizedPath.empty() && NormalizedPath.back() != "..") { - NormalizedPath.pop_back(); - } else { - NormalizedPath.push_back(".."); - } - } else { - NormalizedPath.push_back(Part); - } - } - PathParts.swap(NormalizedPath); -} -#endif - -std::optional<std::string> PathResolver::realpathCached(StringRef Path, - std::error_code &EC, - StringRef Base, - bool BaseIsResolved, - long SymLoopLevel) { - EC.clear(); - - if (Path.empty()) { - EC = std::make_error_code(std::errc::no_such_file_or_directory); - LLVM_DEBUG(dbgs() << "PathResolver::realpathCached: Empty path\n";); - - return std::nullopt; - } - - if (SymLoopLevel <= 0) { - EC = std::make_error_code(std::errc::too_many_symbolic_link_levels); - LLVM_DEBUG( - dbgs() << "PathResolver::realpathCached: Too many Symlink levels: " - << Path << "\n";); - - return std::nullopt; - } - - // If already cached - retun cached result - bool isRelative = sys::path::is_relative(Path); - if (!isRelative) { - if (auto Cached = LibPathCache->read_realpath(Path)) { - EC = Cached->ErrnoCode; - if (EC) { - LLVM_DEBUG(dbgs() << "PathResolver::realpathCached: Cached (error) for " - << Path << "\n";); - } else { - LLVM_DEBUG( - dbgs() << "PathResolver::realpathCached: Cached (success) for " - << Path << " => " << Cached->canonicalPath << "\n";); - } - return Cached->canonicalPath.empty() - ? std::nullopt - : std::make_optional(Cached->canonicalPath); - } - } - - LLVM_DEBUG(dbgs() << "PathResolver::realpathCached: Resolving path: " << Path - << "\n";); - - // If result not in cache - call system function and cache result - - StringRef Separator(sys::path::get_separator()); - SmallString<256> Resolved(Separator); -#ifndef _WIN32 - SmallVector<StringRef, 16> Components; - - if (isRelative) { - if (BaseIsResolved) { - Resolved.assign(Base); - LLVM_DEBUG(dbgs() << " Using Resolved base: " << Base << "\n";); - } - createComponent(Path, Base, BaseIsResolved, Components); - } else { - Path.split(Components, Separator, /*MaxSplit*/ -1, /*KeepEmpty*/ false); - } - - normalizePathSegments(Components); - LLVM_DEBUG({ - for (auto &C : Components) - dbgs() << " " << C << " "; - - dbgs() << "\n"; - }); - - // Handle path list items - for (const auto &Component : Components) { - if (Component == ".") - continue; - if (Component == "..") { - // collapse "a/b/../c" to "a/c" - size_t S = Resolved.rfind(Separator); - if (S != llvm::StringRef::npos) - Resolved.resize(S); - if (Resolved.empty()) - Resolved = Separator; - continue; - } - - size_t oldSize = Resolved.size(); - sys::path::append(Resolved, Component); - const char *ResolvedPath = Resolved.c_str(); - LLVM_DEBUG(dbgs() << " Processing Component: " << Component << " => " - << ResolvedPath << "\n";); - mode_t st_mode = lstatCached(ResolvedPath); - - if (S_ISLNK(st_mode)) { - LLVM_DEBUG(dbgs() << " Found symlink: " << ResolvedPath << "\n";); - - auto SymlinkOpt = readlinkCached(ResolvedPath); - if (!SymlinkOpt) { - EC = std::make_error_code(std::errc::no_such_file_or_directory); - LibPathCache->insert_realpath(Path, LibraryPathCache::PathInfo{"", EC}); - LLVM_DEBUG(dbgs() << " Failed to read symlink: " << ResolvedPath - << "\n";); - - return std::nullopt; - } - - StringRef Symlink = *SymlinkOpt; - LLVM_DEBUG(dbgs() << " Symlink points to: " << Symlink << "\n";); - - std::string resolvedBase = ""; - if (sys::path::is_relative(Symlink)) { - Resolved.resize(oldSize); - resolvedBase = Resolved.str().str(); - } - - auto RealSymlink = - realpathCached(Symlink, EC, resolvedBase, - /*BaseIsResolved=*/true, SymLoopLevel - 1); - if (!RealSymlink) { - LibPathCache->insert_realpath(Path, LibraryPathCache::PathInfo{"", EC}); - LLVM_DEBUG(dbgs() << " Failed to resolve symlink target: " << Symlink - << "\n";); - - return std::nullopt; - } - - Resolved.assign(*RealSymlink); - LLVM_DEBUG(dbgs() << " Symlink Resolved to: " << Resolved << "\n";); - - } else if (st_mode == 0) { - EC = std::make_error_code(std::errc::no_such_file_or_directory); - LibPathCache->insert_realpath(Path, LibraryPathCache::PathInfo{"", EC}); - LLVM_DEBUG(dbgs() << " Component does not exist: " << ResolvedPath - << "\n";); - - return std::nullopt; - } - } -#else - sys::fs::real_path(Path, Resolved); // Windows fallback -#endif - - std::string Canonical = Resolved.str().str(); - { - LibPathCache->insert_realpath(Path, LibraryPathCache::PathInfo{ - Canonical, - std::error_code() // success - }); - } - LLVM_DEBUG(dbgs() << "PathResolver::realpathCached: Final Resolved: " << Path - << " => " << Canonical << "\n";); - return Canonical; -} - -void LibraryScanHelper::addBasePath(const std::string &Path, PathType K) { - std::error_code EC; - std::string Canon = resolveCanonical(Path, EC); - if (EC) { - LLVM_DEBUG( - dbgs() - << "LibraryScanHelper::addBasePath: Failed to canonicalize path: " - << Path << "\n";); - return; - } - std::unique_lock<std::shared_mutex> Lock(Mtx); - if (LibSearchPaths.count(Canon)) { - LLVM_DEBUG(dbgs() << "LibraryScanHelper::addBasePath: Already added: " - << Canon << "\n";); - return; - } - K = K == PathType::Unknown ? classifyKind(Canon) : K; - auto SP = std::make_shared<LibrarySearchPath>(Canon, K); - LibSearchPaths[Canon] = SP; - - if (K == PathType::User) { - LLVM_DEBUG(dbgs() << "LibraryScanHelper::addBasePath: Added User path: " - << Canon << "\n";); - UnscannedUsr.push_back(StringRef(SP->BasePath)); - } else { - LLVM_DEBUG(dbgs() << "LibraryScanHelper::addBasePath: Added System path: " - << Canon << "\n";); - UnscannedSys.push_back(StringRef(SP->BasePath)); - } -} - -std::vector<std::shared_ptr<LibrarySearchPath>> -LibraryScanHelper::getNextBatch(PathType K, size_t BatchSize) { - std::vector<std::shared_ptr<LibrarySearchPath>> Result; - auto &Queue = (K == PathType::User) ? UnscannedUsr : UnscannedSys; - - std::unique_lock<std::shared_mutex> Lock(Mtx); - - while (!Queue.empty() && (BatchSize == 0 || Result.size() < BatchSize)) { - StringRef Base = Queue.front(); - auto It = LibSearchPaths.find(Base); - if (It != LibSearchPaths.end()) { - auto &SP = It->second; - ScanState Expected = ScanState::NotScanned; - if (SP->State.compare_exchange_strong(Expected, ScanState::Scanning)) { - Result.push_back(SP); - } - } - Queue.pop_front(); - } - - return Result; -} - -bool LibraryScanHelper::isTrackedBasePath(StringRef Path) const { - std::error_code EC; - std::string Canon = resolveCanonical(Path, EC); - if (EC) - return false; - - std::shared_lock<std::shared_mutex> Lock(Mtx); - return LibSearchPaths.count(Canon) > 0; -} - -bool LibraryScanHelper::leftToScan(PathType K) const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - for (const auto &KV : LibSearchPaths) { - const auto &SP = KV.second; - if (SP->Kind == K && SP->State == ScanState::NotScanned) - return true; - } - return false; -} - -void LibraryScanHelper::resetToScan() { - std::shared_lock<std::shared_mutex> Lock(Mtx); - - for (auto &[_, SP] : LibSearchPaths) { - ScanState Expected = ScanState::Scanned; - - if (!SP->State.compare_exchange_strong(Expected, ScanState::NotScanned)) - continue; - - auto &TargetList = - (SP->Kind == PathType::User) ? UnscannedUsr : UnscannedSys; - TargetList.emplace_back(SP->BasePath); - } -} - -std::vector<std::shared_ptr<LibrarySearchPath>> -LibraryScanHelper::getAllUnits() const { - std::shared_lock<std::shared_mutex> Lock(Mtx); - std::vector<std::shared_ptr<LibrarySearchPath>> Result; - Result.reserve(LibSearchPaths.size()); - for (const auto &[_, SP] : LibSearchPaths) { - Result.push_back(SP); - } - return Result; -} - -std::string LibraryScanHelper::resolveCanonical(StringRef Path, - std::error_code &EC) const { - auto Canon = LibPathResolver->resolve(Path, EC); - return EC ? Path.str() : *Canon; -} - -PathType LibraryScanHelper::classifyKind(StringRef Path) const { - // Detect home directory - const char *Home = getenv("HOME"); - if (Home && Path.find(Home) == 0) - return PathType::User; - - static const std::array<std::string, 5> UserPrefixes = { - "/usr/local", // often used by users for manual installs - "/opt/homebrew", // common on macOS - "/opt/local", // MacPorts - "/home", // Linux home dirs - "/Users", // macOS user dirs - }; - - for (const auto &Prefix : UserPrefixes) { - if (Path.find(Prefix) == 0) - return PathType::User; - } - - return PathType::System; -} - -Expected<LibraryDepsInfo> parseMachODeps(const object::MachOObjectFile &Obj) { - LibraryDepsInfo Libdeps; - LLVM_DEBUG(dbgs() << "Parsing Mach-O dependencies...\n";); - for (const auto &Command : Obj.load_commands()) { - switch (Command.C.cmd) { - case MachO::LC_LOAD_DYLIB: { - MachO::dylib_command dylibCmd = Obj.getDylibIDLoadCommand(Command); - const char *name = Command.Ptr + dylibCmd.dylib.name; - Libdeps.addDep(name); - LLVM_DEBUG(dbgs() << " Found LC_LOAD_DYLIB: " << name << "\n";); - } break; - case MachO::LC_LOAD_WEAK_DYLIB: - case MachO::LC_REEXPORT_DYLIB: - case MachO::LC_LOAD_UPWARD_DYLIB: - case MachO::LC_LAZY_LOAD_DYLIB: - break; - case MachO::LC_RPATH: { - // Extract RPATH - MachO::rpath_command rpathCmd = Obj.getRpathCommand(Command); - const char *rpath = Command.Ptr + rpathCmd.path; - LLVM_DEBUG(dbgs() << " Found LC_RPATH: " << rpath << "\n";); - - SmallVector<StringRef, 4> RawPaths; - SplitString(StringRef(rpath), RawPaths, - sys::EnvPathSeparator == ':' ? ":" : ";"); - - for (const auto &raw : RawPaths) { - Libdeps.addRPath(raw.str()); // Convert to std::string - LLVM_DEBUG(dbgs() << " Parsed RPATH entry: " << raw << "\n";); - } - break; - } - } - } - - return Expected<LibraryDepsInfo>(std::move(Libdeps)); -} - -template <class ELFT> -static Expected<StringRef> getDynamicStrTab(const object::ELFFile<ELFT> &Elf) { - auto DynamicEntriesOrError = Elf.dynamicEntries(); - if (!DynamicEntriesOrError) - return DynamicEntriesOrError.takeError(); - - for (const typename ELFT::Dyn &Dyn : *DynamicEntriesOrError) { - if (Dyn.d_tag == ELF::DT_STRTAB) { - auto MappedAddrOrError = Elf.toMappedAddr(Dyn.getPtr()); - if (!MappedAddrOrError) - return MappedAddrOrError.takeError(); - return StringRef(reinterpret_cast<const char *>(*MappedAddrOrError)); - } - } - - // If the dynamic segment is not present, we fall back on the sections. - auto SectionsOrError = Elf.sections(); - if (!SectionsOrError) - return SectionsOrError.takeError(); - - for (const typename ELFT::Shdr &Sec : *SectionsOrError) { - if (Sec.sh_type == ELF::SHT_DYNSYM) - return Elf.getStringTableForSymtab(Sec); - } - - return make_error<StringError>("dynamic string table not found", - inconvertibleErrorCode()); -} - -template <typename ELFT> -Expected<LibraryDepsInfo> parseELF(const object::ELFFile<ELFT> &Elf) { - LibraryDepsInfo Deps; - Expected<StringRef> StrTabOrErr = getDynamicStrTab(Elf); - if (!StrTabOrErr) - return StrTabOrErr.takeError(); - - const char *Data = StrTabOrErr->data(); - - auto DynamicEntriesOrError = Elf.dynamicEntries(); - if (!DynamicEntriesOrError) { - return DynamicEntriesOrError.takeError(); - } - - for (const typename ELFT::Dyn &Dyn : *DynamicEntriesOrError) { - switch (Dyn.d_tag) { - case ELF::DT_NEEDED: - Deps.addDep(Data + Dyn.d_un.d_val); - break; - case ELF::DT_RPATH: { - SmallVector<StringRef, 4> RawPaths; - SplitString(Data + Dyn.d_un.d_val, RawPaths, - sys::EnvPathSeparator == ':' ? ":" : ";"); - for (const auto &raw : RawPaths) - Deps.addRPath(raw.str()); - break; - } - case ELF::DT_RUNPATH: { - SmallVector<StringRef, 4> RawPaths; - SplitString(Data + Dyn.d_un.d_val, RawPaths, - sys::EnvPathSeparator == ':' ? ":" : ";"); - for (const auto &raw : RawPaths) - Deps.addRunPath(raw.str()); - break; - } - case ELF::DT_FLAGS_1: - // Check if this is not a pie executable. - if (Dyn.d_un.d_val & ELF::DF_1_PIE) - Deps.isPIE = true; - break; - // (Dyn.d_tag == ELF::DT_NULL) continue; - // (Dyn.d_tag == ELF::DT_AUXILIARY || Dyn.d_tag == ELF::DT_FILTER) - default: - break; - } - } - - return Expected<LibraryDepsInfo>(std::move(Deps)); -} - -Expected<LibraryDepsInfo> parseELFDeps(const object::ELFObjectFileBase &Obj) { - using namespace object; - LLVM_DEBUG(dbgs() << "parseELFDeps: Detected ELF object\n";); - if (const auto *ELF = dyn_cast<ELF32LEObjectFile>(&Obj)) - return parseELF(ELF->getELFFile()); - else if (const auto *ELF = dyn_cast<ELF32BEObjectFile>(&Obj)) - return parseELF(ELF->getELFFile()); - else if (const auto *ELF = dyn_cast<ELF64LEObjectFile>(&Obj)) - return parseELF(ELF->getELFFile()); - else if (const auto *ELF = dyn_cast<ELF64BEObjectFile>(&Obj)) - return parseELF(ELF->getELFFile()); - - LLVM_DEBUG(dbgs() << "parseELFDeps: Unknown ELF format\n";); - return createStringError(std::errc::not_supported, "Unknown ELF format"); -} - -Expected<LibraryDepsInfo> LibraryScanner::extractDeps(StringRef FilePath) { - LLVM_DEBUG(dbgs() << "extractDeps: Attempting to open file " << FilePath - << "\n";); - - ObjectFileLoader ObjLoader(FilePath); - auto ObjOrErr = ObjLoader.getObjectFile(); - if (!ObjOrErr) { - LLVM_DEBUG(dbgs() << "extractDeps: Failed to open " << FilePath << "\n";); - return ObjOrErr.takeError(); - } - - object::ObjectFile *Obj = &ObjOrErr.get(); - - if (auto *elfObj = dyn_cast<object::ELFObjectFileBase>(Obj)) { - LLVM_DEBUG(dbgs() << "extractDeps: File " << FilePath - << " is an ELF object\n";); - - return parseELFDeps(*elfObj); - } - - if (auto *macho = dyn_cast<object::MachOObjectFile>(Obj)) { - LLVM_DEBUG(dbgs() << "extractDeps: File " << FilePath - << " is a Mach-O object\n";); - return parseMachODeps(*macho); - } - - if (Obj->isCOFF()) { - // TODO: COFF support - return LibraryDepsInfo(); - } - - LLVM_DEBUG(dbgs() << "extractDeps: Unsupported binary format for file " - << FilePath << "\n";); - return createStringError(inconvertibleErrorCode(), - "Unsupported binary format: %s", - FilePath.str().c_str()); -} - -std::optional<std::string> LibraryScanner::shouldScan(StringRef FilePath) { - std::error_code EC; - - LLVM_DEBUG(dbgs() << "[shouldScan] Checking: " << FilePath << "\n";); - - // [1] Check file existence early - if (!sys::fs::exists(FilePath)) { - LLVM_DEBUG(dbgs() << " -> Skipped: file does not exist.\n";); - - return std::nullopt; - } - - // [2] Resolve to canonical path - auto CanonicalPathOpt = ScanHelper.resolve(FilePath, EC); - if (EC || !CanonicalPathOpt) { - LLVM_DEBUG(dbgs() << " -> Skipped: failed to resolve path (EC=" - << EC.message() << ").\n";); - - return std::nullopt; - } - - const std::string &CanonicalPath = *CanonicalPathOpt; - LLVM_DEBUG(dbgs() << " -> Canonical path: " << CanonicalPath << "\n"); - - // [3] Check if it's a directory — skip directories - if (sys::fs::is_directory(CanonicalPath)) { - LLVM_DEBUG(dbgs() << " -> Skipped: path is a directory.\n";); - - return std::nullopt; - } - - // [4] Skip if it's not a shared library. - if (!DylibPathValidator::isSharedLibrary(CanonicalPath)) { - LLVM_DEBUG(dbgs() << " -> Skipped: not a shared library.\n";); - return std::nullopt; - } - - // [5] Skip if we've already seen this path (via cache) - if (ScanHelper.hasSeenOrMark(CanonicalPath)) { - LLVM_DEBUG(dbgs() << " -> Skipped: already seen.\n";); - - return std::nullopt; - } - - // [6] Already tracked in LibraryManager? - if (LibMgr.hasLibrary(CanonicalPath)) { - LLVM_DEBUG(dbgs() << " -> Skipped: already tracked by LibraryManager.\n";); - - return std::nullopt; - } - - // [7] Run user-defined hook (default: always true) - if (!ShouldScanCall(CanonicalPath)) { - LLVM_DEBUG(dbgs() << " -> Skipped: user-defined hook rejected.\n";); - - return std::nullopt; - } - - LLVM_DEBUG(dbgs() << " -> Accepted: ready to scan " << CanonicalPath - << "\n";); - return CanonicalPath; -} - -void LibraryScanner::handleLibrary(StringRef FilePath, PathType K, int level) { - LLVM_DEBUG(dbgs() << "LibraryScanner::handleLibrary: Scanning: " << FilePath - << ", level=" << level << "\n";); - auto CanonPathOpt = shouldScan(FilePath); - if (!CanonPathOpt) { - LLVM_DEBUG(dbgs() << " Skipped (shouldScan returned false): " << FilePath - << "\n";); - - return; - } - const std::string CanonicalPath = *CanonPathOpt; - - auto DepsOrErr = extractDeps(CanonicalPath); - if (!DepsOrErr) { - LLVM_DEBUG(dbgs() << " Failed to extract deps for: " << CanonicalPath - << "\n";); - handleError(DepsOrErr.takeError()); - return; - } - - LibraryDepsInfo &Deps = *DepsOrErr; - - LLVM_DEBUG({ - dbgs() << " Found deps : \n"; - for (const auto &dep : Deps.deps) - dbgs() << " : " << dep << "\n"; - dbgs() << " Found @rpath : " << Deps.rpath.size() << "\n"; - for (const auto &r : Deps.rpath) - dbgs() << " : " << r << "\n"; - dbgs() << " Found @runpath : \n"; - for (const auto &r : Deps.runPath) - dbgs() << " : " << r << "\n"; - }); - - if (Deps.isPIE && level == 0) { - LLVM_DEBUG(dbgs() << " Skipped PIE executable at top level: " - << CanonicalPath << "\n";); - - return; - } - - bool Added = LibMgr.addLibrary(CanonicalPath, K); - if (!Added) { - LLVM_DEBUG(dbgs() << " Already added: " << CanonicalPath << "\n";); - return; - } - - // Heuristic 1: No RPATH/RUNPATH, skip deps - if (Deps.rpath.empty() && Deps.runPath.empty()) { - LLVM_DEBUG( - dbgs() << "LibraryScanner::handleLibrary: Skipping deps (Heuristic1): " - << CanonicalPath << "\n";); - return; - } - - // Heuristic 2: All RPATH and RUNPATH already tracked - auto allTracked = [&](const auto &Paths) { - LLVM_DEBUG(dbgs() << " Checking : " << Paths.size() << "\n";); - return std::all_of(Paths.begin(), Paths.end(), [&](StringRef P) { - LLVM_DEBUG(dbgs() << " Checking isTrackedBasePath : " << P << "\n";); - return ScanHelper.isTrackedBasePath( - DylibResolver::resolvelinkerFlag(P, CanonicalPath)); - }); - }; - - if (allTracked(Deps.rpath) && allTracked(Deps.runPath)) { - LLVM_DEBUG( - dbgs() << "LibraryScanner::handleLibrary: Skipping deps (Heuristic2): " - << CanonicalPath << "\n";); - return; - } - - DylibPathValidator Validator(ScanHelper.getPathResolver()); - DylibResolver Resolver(Validator); - Resolver.configure(CanonicalPath, - {{Deps.rpath, SearchPathType::RPath}, - {ScanHelper.getSearchPaths(), SearchPathType::UsrOrSys}, - {Deps.runPath, SearchPathType::RunPath}}); - for (StringRef Dep : Deps.deps) { - LLVM_DEBUG(dbgs() << " Resolving dep: " << Dep << "\n";); - auto DepFullOpt = Resolver.resolve(Dep); - if (!DepFullOpt) { - LLVM_DEBUG(dbgs() << " Failed to resolve dep: " << Dep << "\n";); - - continue; - } - LLVM_DEBUG(dbgs() << " Resolved dep to: " << *DepFullOpt << "\n";); - - handleLibrary(*DepFullOpt, K, level + 1); - } -} - -void LibraryScanner::scanBaseDir(std::shared_ptr<LibrarySearchPath> SP) { - if (!sys::fs::is_directory(SP->BasePath) || SP->BasePath.empty()) { - LLVM_DEBUG( - dbgs() << "LibraryScanner::scanBaseDir: Invalid or empty basePath: " - << SP->BasePath << "\n";); - return; - } - - LLVM_DEBUG(dbgs() << "LibraryScanner::scanBaseDir: Scanning directory: " - << SP->BasePath << "\n";); - std::error_code EC; - - SP->State.store(ScanState::Scanning); - - for (sys::fs::directory_iterator It(SP->BasePath, EC), end; It != end && !EC; - It.increment(EC)) { - auto Entry = *It; - if (!Entry.status()) - continue; - - auto Status = *Entry.status(); - if (sys::fs::is_regular_file(Status) || sys::fs::is_symlink_file(Status)) { - LLVM_DEBUG(dbgs() << " Found file: " << Entry.path() << "\n";); - // async support ? - handleLibrary(Entry.path(), SP->Kind); - } - } - - SP->State.store(ScanState::Scanned); -} - -void LibraryScanner::scanNext(PathType K, size_t BatchSize) { - LLVM_DEBUG(dbgs() << "LibraryScanner::scanNext: Scanning next batch of size " - << BatchSize << " for kind " - << (K == PathType::User ? "User" : "System") << "\n";); - - auto SearchPaths = ScanHelper.getNextBatch(K, BatchSize); - for (auto &SP : SearchPaths) { - LLVM_DEBUG(dbgs() << " Scanning unit with basePath: " << SP->BasePath - << "\n";); - - scanBaseDir(SP); - } -} - -} // end namespace llvm::orc diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp index f74e52a..c27f627 100644 --- a/llvm/lib/Support/SpecialCaseList.cpp +++ b/llvm/lib/Support/SpecialCaseList.cpp @@ -89,14 +89,32 @@ void SpecialCaseList::GlobMatcher::preprocess(bool BySize) { return A.Name.size() < B.Name.size(); }); } + + for (const auto &G : reverse(Globs)) { + StringRef Prefix = G.Pattern.prefix(); + + auto &V = PrefixToGlob.emplace(Prefix).first->second; + V.emplace_back(&G); + } } void SpecialCaseList::GlobMatcher::match( StringRef Query, llvm::function_ref<void(StringRef Rule, unsigned LineNo)> Cb) const { - for (const auto &G : reverse(Globs)) - if (G.Pattern.match(Query)) - return Cb(G.Name, G.LineNo); + if (!PrefixToGlob.empty()) { + for (const auto &[_, V] : PrefixToGlob.find_prefixes(Query)) { + for (const auto *G : V) { + if (G->Pattern.match(Query)) { + Cb(G->Name, G->LineNo); + // As soon as we find a match in the vector, we can break for this + // vector, since the globs are already sorted by priority within the + // prefix group. However, we continue searching other prefix groups in + // the map, as they may contain a better match overall. + break; + } + } + } + } } SpecialCaseList::Matcher::Matcher(bool UseGlobs, bool RemoveDotSlash) diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index d5117da..457e540 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -5151,7 +5151,15 @@ void AArch64InstrInfo::copyPhysReg(MachineBasicBlock &MBB, // GPR32 zeroing if (AArch64::GPR32spRegClass.contains(DestReg) && SrcReg == AArch64::WZR) { - if (Subtarget.hasZeroCycleZeroingGPR32()) { + if (Subtarget.hasZeroCycleZeroingGPR64() && + !Subtarget.hasZeroCycleZeroingGPR32()) { + MCRegister DestRegX = RI.getMatchingSuperReg(DestReg, AArch64::sub_32, + &AArch64::GPR64spRegClass); + assert(DestRegX.isValid() && "Destination super-reg not valid"); + BuildMI(MBB, I, DL, get(AArch64::MOVZXi), DestRegX) + .addImm(0) + .addImm(AArch64_AM::getShifterImm(AArch64_AM::LSL, 0)); + } else if (Subtarget.hasZeroCycleZeroingGPR32()) { BuildMI(MBB, I, DL, get(AArch64::MOVZWi), DestReg) .addImm(0) .addImm(AArch64_AM::getShifterImm(AArch64_AM::LSL, 0)); diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.td b/llvm/lib/Target/ARM/ARMInstrInfo.td index 53be167..10d4cd5 100644 --- a/llvm/lib/Target/ARM/ARMInstrInfo.td +++ b/llvm/lib/Target/ARM/ARMInstrInfo.td @@ -6546,23 +6546,25 @@ def KCFI_CHECK_ARM : PseudoInst<(outs), (ins GPR:$ptr, i32imm:$type), NoItinerary, []>, Sched<[]>, Requires<[IsARM]> { - let Size = 28; // 7 instructions (bic, ldr, 4x eor, beq, udf) + let Size = 40; // worst-case 10 instructions @ 4 bytes each + // (push, bic, ldr, 4x eor, pop, beq, udf) } def KCFI_CHECK_Thumb2 : PseudoInst<(outs), (ins GPR:$ptr, i32imm:$type), NoItinerary, []>, Sched<[]>, Requires<[IsThumb2]> { - let Size = - 32; // worst-case 9 instructions (push, bic, ldr, 4x eor, pop, beq.w, udf) + let Size = 34; // worst-case (push.w[2], bic[4], ldr[4], 4x eor[16], pop.w[2], + // beq.w[4], udf[2]) } def KCFI_CHECK_Thumb1 : PseudoInst<(outs), (ins GPR:$ptr, i32imm:$type), NoItinerary, []>, Sched<[]>, Requires<[IsThumb1Only]> { - let Size = 50; // worst-case 25 instructions (pushes, bic helper, type - // building, cmp, pops) + let Size = 38; // worst-case 19 instructions @ 2 bytes each + // (2x push, 3x bic-helper, subs+ldr, 13x type-building, cmp, + // 2x pop, beq, bkpt) } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/X86/X86.h b/llvm/lib/Target/X86/X86.h index 6261fad..706ab2b 100644 --- a/llvm/lib/Target/X86/X86.h +++ b/llvm/lib/Target/X86/X86.h @@ -160,6 +160,14 @@ FunctionPass *createX86PartialReductionPass(); /// // Analyzes and emits pseudos to support Win x64 Unwind V2. FunctionPass *createX86WinEHUnwindV2Pass(); +/// The pass transforms load/store <256 x i32> to AMX load/store intrinsics +/// or split the data to two <128 x i32>. +FunctionPass *createX86LowerAMXTypePass(); + +/// The pass transforms amx intrinsics to scalar operation if the function has +/// optnone attribute or it is O0. +FunctionPass *createX86LowerAMXIntrinsicsPass(); + InstructionSelector *createX86InstructionSelector(const X86TargetMachine &TM, const X86Subtarget &, const X86RegisterBankInfo &); diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 62073ec..4393f6e 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -4721,9 +4721,6 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) { if (!(Subtarget->hasVLX() || NVT.is512BitVector())) return false; - SDValue N0 = N->getOperand(0); - SDValue N1 = N->getOperand(1); - auto getFoldableLogicOp = [](SDValue Op) { // Peek through single use bitcast. if (Op.getOpcode() == ISD::BITCAST && Op.hasOneUse()) @@ -4740,13 +4737,47 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) { return SDValue(); }; - SDValue A, FoldableOp; - if ((FoldableOp = getFoldableLogicOp(N1))) { - A = N0; - } else if ((FoldableOp = getFoldableLogicOp(N0))) { - A = N1; - } else - return false; + SDValue N0, N1, A, FoldableOp; + + // Identify and (optionally) peel an outer NOT that wraps a pure logic tree + auto tryPeelOuterNotWrappingLogic = [&](SDNode *Op) { + if (Op->getOpcode() == ISD::XOR && Op->hasOneUse() && + ISD::isBuildVectorAllOnes(Op->getOperand(1).getNode())) { + SDValue InnerOp = Op->getOperand(0); + + if (!getFoldableLogicOp(InnerOp)) + return SDValue(); + + N0 = InnerOp.getOperand(0); + N1 = InnerOp.getOperand(1); + if ((FoldableOp = getFoldableLogicOp(N1))) { + A = N0; + return InnerOp; + } + if ((FoldableOp = getFoldableLogicOp(N0))) { + A = N1; + return InnerOp; + } + } + return SDValue(); + }; + + bool PeeledOuterNot = false; + SDNode *OriN = N; + if (SDValue InnerOp = tryPeelOuterNotWrappingLogic(N)) { + PeeledOuterNot = true; + N = InnerOp.getNode(); + } else { + N0 = N->getOperand(0); + N1 = N->getOperand(1); + + if ((FoldableOp = getFoldableLogicOp(N1))) + A = N0; + else if ((FoldableOp = getFoldableLogicOp(N0))) + A = N1; + else + return false; + } SDValue B = FoldableOp.getOperand(0); SDValue C = FoldableOp.getOperand(1); @@ -4798,7 +4829,10 @@ bool X86DAGToDAGISel::tryVPTERNLOG(SDNode *N) { case ISD::XOR: Imm ^= TernlogMagicA; break; } - return matchVPTERNLOG(N, ParentA, ParentB, ParentC, A, B, C, Imm); + if (PeeledOuterNot) + Imm = ~Imm; + + return matchVPTERNLOG(OriN, ParentA, ParentB, ParentC, A, B, C, Imm); } /// If the high bits of an 'and' operand are known zero, try setting the diff --git a/llvm/test/CodeGen/AArch64/arm64-copy-phys-zero-reg.mir b/llvm/test/CodeGen/AArch64/arm64-copy-phys-zero-reg.mir index f34d3ed..6b2a31b 100644 --- a/llvm/test/CodeGen/AArch64/arm64-copy-phys-zero-reg.mir +++ b/llvm/test/CodeGen/AArch64/arm64-copy-phys-zero-reg.mir @@ -35,7 +35,7 @@ body: | ; CHECK-NOZCZ-GPR32-ZCZ-GPR64-LABEL: name: f0 ; CHECK-NOZCZ-GPR32-ZCZ-GPR64: liveins: $x0, $lr ; CHECK-NOZCZ-GPR32-ZCZ-GPR64-NEXT: {{ $}} - ; CHECK-NOZCZ-GPR32-ZCZ-GPR64-NEXT: $w0 = ORRWrr $wzr, $wzr + ; CHECK-NOZCZ-GPR32-ZCZ-GPR64-NEXT: $x0 = MOVZXi 0, 0 ; CHECK-NOZCZ-GPR32-ZCZ-GPR64-NEXT: BL @f2, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w0 ; ; CHECK-ZCZ-GPR32-ZCZ-GPR64-LABEL: name: f0 diff --git a/llvm/test/CodeGen/AArch64/arm64-zero-cycle-zeroing-gpr.ll b/llvm/test/CodeGen/AArch64/arm64-zero-cycle-zeroing-gpr.ll index dc64306..0f284aa 100644 --- a/llvm/test/CodeGen/AArch64/arm64-zero-cycle-zeroing-gpr.ll +++ b/llvm/test/CodeGen/AArch64/arm64-zero-cycle-zeroing-gpr.ll @@ -1,41 +1,44 @@ -; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR +; RUN: llc < %s -mtriple=aarch64-linux-gnu | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR32-NOZCZ-GPR64 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -mattr=+zcz-gpr32 | FileCheck %s -check-prefixes=ALL,ZCZ-GPR32 -; RUN: llc < %s -mtriple=aarch64-linux-gnu -mattr=+zcz-gpr64 | FileCheck %s -check-prefixes=ALL,ZCZ-GPR64 -; RUN: llc < %s -mtriple=arm64-apple-macosx -mcpu=generic | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR +; RUN: llc < %s -mtriple=aarch64-linux-gnu -mattr=+zcz-gpr64 | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR32-ZCZ-GPR64 +; RUN: llc < %s -mtriple=arm64-apple-macosx -mcpu=generic | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR32-NOZCZ-GPR64 ; RUN: llc < %s -mtriple=arm64-apple-ios -mcpu=cyclone | FileCheck %s -check-prefixes=ALL,ZCZ-GPR32,ZCZ-GPR64 ; RUN: llc < %s -mtriple=arm64-apple-macosx -mcpu=apple-m1 | FileCheck %s -check-prefixes=ALL,ZCZ-GPR32,ZCZ-GPR64 -; RUN: llc < %s -mtriple=aarch64-linux-gnu -mcpu=exynos-m3 | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR +; RUN: llc < %s -mtriple=aarch64-linux-gnu -mcpu=exynos-m3 | FileCheck %s -check-prefixes=ALL,NOZCZ-GPR32-NOZCZ-GPR64 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -mcpu=kryo | FileCheck %s -check-prefixes=ALL,ZCZ-GPR32,ZCZ-GPR64 ; RUN: llc < %s -mtriple=aarch64-linux-gnu -mcpu=falkor | FileCheck %s -check-prefixes=ALL,ZCZ-GPR32,ZCZ-GPR64 define i8 @ti8() { entry: ; ALL-LABEL: ti8: -; NOZCZ-GPR: mov w0, wzr +; NOZCZ-GPR32-NOZCZ-GPR64: mov w0, wzr ; ZCZ-GPR32: mov w0, #0 +; NOZCZ-GPR32-ZCZ-GPR64: mov x0, #0 ret i8 0 } define i16 @ti16() { entry: ; ALL-LABEL: ti16: -; NOZCZ-GPR: mov w0, wzr +; NOZCZ-GPR32-NOZCZ-GPR64: mov w0, wzr ; ZCZ-GPR32: mov w0, #0 +; NOZCZ-GPR32-ZCZ-GPR64: mov x0, #0 ret i16 0 } define i32 @ti32() { entry: ; ALL-LABEL: ti32: -; NOZCZ-GPR: mov w0, wzr +; NOZCZ-GPR32-NOZCZ-GPR64: mov w0, wzr ; ZCZ-GPR32: mov w0, #0 +; NOZCZ-GPR32-ZCZ-GPR64: mov x0, #0 ret i32 0 } define i64 @ti64() { entry: ; ALL-LABEL: ti64: -; NOZCZ-GPR: mov x0, xzr +; NOZCZ-GPR32-NOZCZ-GPR64 mov x0, xzr ; ZCZ-GPR64: mov x0, #0 ret i64 0 } diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/br1.ll b/llvm/test/CodeGen/Mips/Fast-ISel/br1.ll index b5bdf84..9630dab 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/br1.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/br1.ll @@ -31,4 +31,4 @@ if.end: ; preds = %entry, %if.then } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/loadstore2.ll b/llvm/test/CodeGen/Mips/Fast-ISel/loadstore2.ll index a5c1cec0..d3d2e8b 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/loadstore2.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/loadstore2.ll @@ -80,6 +80,6 @@ entry: ret void } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/loadstrconst.ll b/llvm/test/CodeGen/Mips/Fast-ISel/loadstrconst.ll index bc6f2c5..e685465 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/loadstrconst.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/loadstrconst.ll @@ -17,5 +17,5 @@ entry: } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/logopm.ll b/llvm/test/CodeGen/Mips/Fast-ISel/logopm.ll index 90db1fd..f3b902b 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/logopm.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/logopm.ll @@ -590,8 +590,8 @@ entry: ret void } -attributes #0 = { noinline nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { noinline nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #2 = { nounwind } !llvm.module.flags = !{!0} diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/simplestorefp1.ll b/llvm/test/CodeGen/Mips/Fast-ISel/simplestorefp1.ll index d1a0574..eca0d16 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/simplestorefp1.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/simplestorefp1.ll @@ -51,4 +51,4 @@ entry: ret void } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/simplestorei.ll b/llvm/test/CodeGen/Mips/Fast-ISel/simplestorei.ll index ee174dd..33b4ef8 100644 --- a/llvm/test/CodeGen/Mips/Fast-ISel/simplestorei.ll +++ b/llvm/test/CodeGen/Mips/Fast-ISel/simplestorei.ll @@ -63,6 +63,6 @@ entry: ret void } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/beqzc.ll b/llvm/test/CodeGen/Mips/beqzc.ll index 28f3f8c..42eb392 100644 --- a/llvm/test/CodeGen/Mips/beqzc.ll +++ b/llvm/test/CodeGen/Mips/beqzc.ll @@ -14,7 +14,7 @@ entry: ret i32 0 } -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/beqzc1.ll b/llvm/test/CodeGen/Mips/beqzc1.ll index 915f34e..01bb5f1 100644 --- a/llvm/test/CodeGen/Mips/beqzc1.ll +++ b/llvm/test/CodeGen/Mips/beqzc1.ll @@ -19,6 +19,6 @@ if.end: ; preds = %if.then, %entry ret i32 0 } -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/brsize3.ll b/llvm/test/CodeGen/Mips/brsize3.ll index 1aea201..20aab184 100644 --- a/llvm/test/CodeGen/Mips/brsize3.ll +++ b/llvm/test/CodeGen/Mips/brsize3.ll @@ -33,7 +33,7 @@ x: ; preds = %x, %entry } -attributes #0 = { noreturn nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { noreturn nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #1 = { nounwind } !1 = !{i32 45} diff --git a/llvm/test/CodeGen/Mips/brsize3a.ll b/llvm/test/CodeGen/Mips/brsize3a.ll index de866f2..b1ebbd8 100644 --- a/llvm/test/CodeGen/Mips/brsize3a.ll +++ b/llvm/test/CodeGen/Mips/brsize3a.ll @@ -20,7 +20,7 @@ x: ; preds = %x, %entry } -attributes #0 = { noreturn nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { noreturn nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #1 = { nounwind } !1 = !{i32 45} diff --git a/llvm/test/CodeGen/Mips/ci2.ll b/llvm/test/CodeGen/Mips/ci2.ll index a949729..4901d8d 100644 --- a/llvm/test/CodeGen/Mips/ci2.ll +++ b/llvm/test/CodeGen/Mips/ci2.ll @@ -33,7 +33,7 @@ if.end: ; preds = %if.else, %if.then ; constisle .4byte 305419896 # 0x12345678 } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #1 = { nounwind } !1 = !{i32 103} diff --git a/llvm/test/CodeGen/Mips/cmplarge.ll b/llvm/test/CodeGen/Mips/cmplarge.ll index db7f37a..bfb6080 100644 --- a/llvm/test/CodeGen/Mips/cmplarge.ll +++ b/llvm/test/CodeGen/Mips/cmplarge.ll @@ -33,6 +33,6 @@ for.end: ; preds = %for.body, %entry ; cmp16: .end getSubImagesLuma declare i32 @iClip3(...) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } attributes #2 = { nounwind } diff --git a/llvm/test/CodeGen/Mips/const1.ll b/llvm/test/CodeGen/Mips/const1.ll index 750912d..7915d66 100644 --- a/llvm/test/CodeGen/Mips/const1.ll +++ b/llvm/test/CodeGen/Mips/const1.ll @@ -28,7 +28,7 @@ entry: ; CHECK: .4byte 262991277 } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } !llvm.ident = !{!0} diff --git a/llvm/test/CodeGen/Mips/const4a.ll b/llvm/test/CodeGen/Mips/const4a.ll index 245abbf..e88ffd3 100644 --- a/llvm/test/CodeGen/Mips/const4a.ll +++ b/llvm/test/CodeGen/Mips/const4a.ll @@ -172,8 +172,8 @@ declare void @goo(...) #1 declare void @hoo(...) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } !llvm.ident = !{!0} diff --git a/llvm/test/CodeGen/Mips/const6.ll b/llvm/test/CodeGen/Mips/const6.ll index f40eeef..480a958 100644 --- a/llvm/test/CodeGen/Mips/const6.ll +++ b/llvm/test/CodeGen/Mips/const6.ll @@ -154,8 +154,8 @@ entry: declare void @hoo(...) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } !llvm.ident = !{!0} diff --git a/llvm/test/CodeGen/Mips/const6a.ll b/llvm/test/CodeGen/Mips/const6a.ll index 720edd3a..eb62e27 100644 --- a/llvm/test/CodeGen/Mips/const6a.ll +++ b/llvm/test/CodeGen/Mips/const6a.ll @@ -23,7 +23,7 @@ entry: ret void } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #1 = { nounwind } !1 = !{i32 121} diff --git a/llvm/test/CodeGen/Mips/ctlz.ll b/llvm/test/CodeGen/Mips/ctlz.ll index 3cc1569..49eb36f 100644 --- a/llvm/test/CodeGen/Mips/ctlz.ll +++ b/llvm/test/CodeGen/Mips/ctlz.ll @@ -22,6 +22,6 @@ declare i32 @llvm.ctlz.i32(i32, i1) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #1 = { nounwind readnone } diff --git a/llvm/test/CodeGen/Mips/delay-slot-fill-forward.ll b/llvm/test/CodeGen/Mips/delay-slot-fill-forward.ll index 7c41641..43fd36b 100644 --- a/llvm/test/CodeGen/Mips/delay-slot-fill-forward.ll +++ b/llvm/test/CodeGen/Mips/delay-slot-fill-forward.ll @@ -161,7 +161,7 @@ if.end461: ; preds = %if.end436, %for.bod ret void } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="mips32r2" "target-features"="+mips32r2,+nooddspreg,+fpxx" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="mips32r2" "target-features"="+mips32r2,+nooddspreg,+fpxx" "use-soft-float"="false" } attributes #1 = { nounwind } !llvm.ident = !{!0} diff --git a/llvm/test/CodeGen/Mips/f16abs.ll b/llvm/test/CodeGen/Mips/f16abs.ll index 23bf402..242d8ff 100644 --- a/llvm/test/CodeGen/Mips/f16abs.ll +++ b/llvm/test/CodeGen/Mips/f16abs.ll @@ -29,8 +29,8 @@ declare double @fabs(double) #1 declare float @fabsf(float) #1 -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } -attributes #1 = { nounwind optsize readnone "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } +attributes #1 = { nounwind optsize readnone "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #2 = { nounwind optsize readnone } diff --git a/llvm/test/CodeGen/Mips/fp16instrinsmc.ll b/llvm/test/CodeGen/Mips/fp16instrinsmc.ll index 6c29c08..1582605 100644 --- a/llvm/test/CodeGen/Mips/fp16instrinsmc.ll +++ b/llvm/test/CodeGen/Mips/fp16instrinsmc.ll @@ -385,7 +385,7 @@ entry: ; Function Attrs: nounwind declare double @exp2(double) #0 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } +attributes #1 = { nounwind readnone "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #2 = { nounwind readnone } attributes #3 = { nounwind } diff --git a/llvm/test/CodeGen/Mips/fpneeded.ll b/llvm/test/CodeGen/Mips/fpneeded.ll index cc82f81..babfcad 100644 --- a/llvm/test/CodeGen/Mips/fpneeded.ll +++ b/llvm/test/CodeGen/Mips/fpneeded.ll @@ -131,7 +131,7 @@ entry: ; 32: .set reorder ; 32: .end foo3 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } define void @vv() #0 { entry: diff --git a/llvm/test/CodeGen/Mips/fpnotneeded.ll b/llvm/test/CodeGen/Mips/fpnotneeded.ll index 761ef30..2b98f7e 100644 --- a/llvm/test/CodeGen/Mips/fpnotneeded.ll +++ b/llvm/test/CodeGen/Mips/fpnotneeded.ll @@ -61,7 +61,7 @@ entry: ; cisle: .end foo -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } define float @fv() #0 { diff --git a/llvm/test/CodeGen/Mips/hf16call32.ll b/llvm/test/CodeGen/Mips/hf16call32.ll index e187b76..33353b6 100644 --- a/llvm/test/CodeGen/Mips/hf16call32.ll +++ b/llvm/test/CodeGen/Mips/hf16call32.ll @@ -1026,5 +1026,5 @@ declare { double, double } @dc_sf(float) #1 ; stel: jr $18 ; stel: .end __call_stub_fp_dc_sf -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/hf16call32_body.ll b/llvm/test/CodeGen/Mips/hf16call32_body.ll index 3bcb6f6..2eea4c3 100644 --- a/llvm/test/CodeGen/Mips/hf16call32_body.ll +++ b/llvm/test/CodeGen/Mips/hf16call32_body.ll @@ -303,4 +303,4 @@ entry: ; stel: $__fn_local_sf_df_df = sf_df_df ; stel: .end __fn_stub_sf_df_df -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/hfptrcall.ll b/llvm/test/CodeGen/Mips/hfptrcall.ll index 920c694..2babc67 100644 --- a/llvm/test/CodeGen/Mips/hfptrcall.ll +++ b/llvm/test/CodeGen/Mips/hfptrcall.ll @@ -118,8 +118,8 @@ entry: declare i32 @printf(ptr, ...) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/l3mc.ll b/llvm/test/CodeGen/Mips/l3mc.ll index 440da3a..dc68eaf 100644 --- a/llvm/test/CodeGen/Mips/l3mc.ll +++ b/llvm/test/CodeGen/Mips/l3mc.ll @@ -99,7 +99,7 @@ entry: ret void } -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } ; __call_stub_fp___fixunsdfsi: __call_stub_fp___fixunsdfsi: ; __call_stub_fp___floatdidf: __call_stub_fp___floatdidf: diff --git a/llvm/test/CodeGen/Mips/lcb2.ll b/llvm/test/CodeGen/Mips/lcb2.ll index 036de38..79f4b43 100644 --- a/llvm/test/CodeGen/Mips/lcb2.ll +++ b/llvm/test/CodeGen/Mips/lcb2.ll @@ -115,7 +115,7 @@ if.end: ; preds = %if.then, %entry ; lcb: .end btz ; lcbn: .end btz -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #1 = { nounwind } !llvm.ident = !{!0} diff --git a/llvm/test/CodeGen/Mips/lcb3c.ll b/llvm/test/CodeGen/Mips/lcb3c.ll index 40912f3..dd88924 100644 --- a/llvm/test/CodeGen/Mips/lcb3c.ll +++ b/llvm/test/CodeGen/Mips/lcb3c.ll @@ -51,7 +51,7 @@ if.end: ; preds = %if.else, %if.then ; lcb: jal $BB1_2 # branch ; lcb: $BB1_1: # %if.then -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #1 = { nounwind } diff --git a/llvm/test/CodeGen/Mips/lcb4a.ll b/llvm/test/CodeGen/Mips/lcb4a.ll index a0258b1..ad843bb 100644 --- a/llvm/test/CodeGen/Mips/lcb4a.ll +++ b/llvm/test/CodeGen/Mips/lcb4a.ll @@ -55,7 +55,7 @@ if.end: ; preds = %if.else, %if.then ; ci: nop ; ci: $BB1_1: # %if.else -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #1 = { nounwind } diff --git a/llvm/test/CodeGen/Mips/lcb5.ll b/llvm/test/CodeGen/Mips/lcb5.ll index 22baeba..0d479ff 100644 --- a/llvm/test/CodeGen/Mips/lcb5.ll +++ b/llvm/test/CodeGen/Mips/lcb5.ll @@ -216,7 +216,7 @@ if.end: ; preds = %if.then, %entry ; ci: .p2align 2 ; ci: .end z4 -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #1 = { nounwind } diff --git a/llvm/test/CodeGen/Mips/mbrsize4a.ll b/llvm/test/CodeGen/Mips/mbrsize4a.ll index b8d2e2d..e6c620a 100644 --- a/llvm/test/CodeGen/Mips/mbrsize4a.ll +++ b/llvm/test/CodeGen/Mips/mbrsize4a.ll @@ -30,8 +30,8 @@ declare i32 @foo(...) #1 declare i32 @printf(ptr, ...) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } attributes #2 = { nounwind } !1 = !{i32 68} diff --git a/llvm/test/CodeGen/Mips/micromips-attr.ll b/llvm/test/CodeGen/Mips/micromips-attr.ll index 8e70cc6..1915f3b 100644 --- a/llvm/test/CodeGen/Mips/micromips-attr.ll +++ b/llvm/test/CodeGen/Mips/micromips-attr.ll @@ -24,7 +24,7 @@ attributes #0 = { "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" - "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" + "stack-protector-buffer-size"="8" "use-soft-float"="false" } @@ -34,6 +34,6 @@ attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" - "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" + "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16-hf-attr-2.ll b/llvm/test/CodeGen/Mips/mips16-hf-attr-2.ll index 80294b5..eaa39e9 100644 --- a/llvm/test/CodeGen/Mips/mips16-hf-attr-2.ll +++ b/llvm/test/CodeGen/Mips/mips16-hf-attr-2.ll @@ -28,18 +28,18 @@ attributes #0 = { "less-precise-fpmad"="false" "frame-pointer"="all" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" - "unsafe-fp-math"="false" "use-soft-float"="false" + "use-soft-float"="false" } attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" - "unsafe-fp-math"="false" "use-soft-float"="true" + "use-soft-float"="true" } attributes #2 = { "less-precise-fpmad"="false" "frame-pointer"="all" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" - "unsafe-fp-math"="false" "use-soft-float"="true" + "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/mips16-hf-attr.ll b/llvm/test/CodeGen/Mips/mips16-hf-attr.ll index c8af712..cafa2d5 100644 --- a/llvm/test/CodeGen/Mips/mips16-hf-attr.ll +++ b/llvm/test/CodeGen/Mips/mips16-hf-attr.ll @@ -28,18 +28,18 @@ attributes #0 = { "less-precise-fpmad"="false" "frame-pointer"="all" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" - "unsafe-fp-math"="false" "use-soft-float"="false" + "use-soft-float"="false" } attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" - "unsafe-fp-math"="false" "use-soft-float"="true" + "use-soft-float"="true" } attributes #2 = { "less-precise-fpmad"="false" "frame-pointer"="all" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" - "unsafe-fp-math"="false" "use-soft-float"="true" + "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_1.ll b/llvm/test/CodeGen/Mips/mips16_32_1.ll index 0d02022..963fb58 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_1.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_1.ll @@ -10,4 +10,4 @@ entry: ; CHECK: .ent foo ; CHECK: jrc $ra ; CHECK: .end foo -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_10.ll b/llvm/test/CodeGen/Mips/mips16_32_10.ll index 86378ff..e0d6859 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_10.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_10.ll @@ -53,6 +53,6 @@ entry: -attributes #0 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_3.ll b/llvm/test/CodeGen/Mips/mips16_32_3.ll index ee33abc..dc2fe29 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_3.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_3.ll @@ -62,6 +62,6 @@ entry: ; 32: .set reorder ; 32: .end main -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_4.ll b/llvm/test/CodeGen/Mips/mips16_32_4.ll index da926342..2fed74d 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_4.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_4.ll @@ -56,6 +56,6 @@ entry: ; 32: .end main -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_5.ll b/llvm/test/CodeGen/Mips/mips16_32_5.ll index 6692460..2bbe778 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_5.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_5.ll @@ -73,6 +73,6 @@ entry: -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_6.ll b/llvm/test/CodeGen/Mips/mips16_32_6.ll index 5a464a2..0503b3f 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_6.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_6.ll @@ -80,6 +80,6 @@ entry: -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "nomips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_7.ll b/llvm/test/CodeGen/Mips/mips16_32_7.ll index 236f791..2b2dd8b 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_7.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_7.ll @@ -68,6 +68,6 @@ entry: -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_8.ll b/llvm/test/CodeGen/Mips/mips16_32_8.ll index 5c0cd32..1aff91c 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_8.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_8.ll @@ -67,7 +67,7 @@ entry: ; 32: .set reorder ; 32: .end main -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #3 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "use-soft-float"="false" } +attributes #2 = { "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #3 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/mips16_32_9.ll b/llvm/test/CodeGen/Mips/mips16_32_9.ll index 609f054..82d7727 100644 --- a/llvm/test/CodeGen/Mips/mips16_32_9.ll +++ b/llvm/test/CodeGen/Mips/mips16_32_9.ll @@ -44,6 +44,6 @@ entry: -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #2 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/nomips16.ll b/llvm/test/CodeGen/Mips/nomips16.ll index 62564f9..6b51eb9 100644 --- a/llvm/test/CodeGen/Mips/nomips16.ll +++ b/llvm/test/CodeGen/Mips/nomips16.ll @@ -33,6 +33,6 @@ entry: ; CHECK: .end nofoo -attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "mips16" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "nomips16" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/pbqp-reserved-physreg.ll b/llvm/test/CodeGen/Mips/pbqp-reserved-physreg.ll index 63a730c..a8eab07 100644 --- a/llvm/test/CodeGen/Mips/pbqp-reserved-physreg.ll +++ b/llvm/test/CodeGen/Mips/pbqp-reserved-physreg.ll @@ -31,5 +31,5 @@ bb35: ; preds = %bb unreachable } -attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/powif64_16.ll b/llvm/test/CodeGen/Mips/powif64_16.ll index 3443b62..914ef94 100644 --- a/llvm/test/CodeGen/Mips/powif64_16.ll +++ b/llvm/test/CodeGen/Mips/powif64_16.ll @@ -17,7 +17,7 @@ define double @foo_pow_f64(double %y, i32 %p) { ret double %1 } -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } attributes #1 = { nounwind readonly } !0 = !{!"double", !1} diff --git a/llvm/test/CodeGen/Mips/s2rem.ll b/llvm/test/CodeGen/Mips/s2rem.ll index fdf06ce..5d324cb 100644 --- a/llvm/test/CodeGen/Mips/s2rem.ll +++ b/llvm/test/CodeGen/Mips/s2rem.ll @@ -86,7 +86,7 @@ entry: declare void @vf(float) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/sel1c.ll b/llvm/test/CodeGen/Mips/sel1c.ll index 071f988..2aaf56d 100644 --- a/llvm/test/CodeGen/Mips/sel1c.ll +++ b/llvm/test/CodeGen/Mips/sel1c.ll @@ -16,6 +16,6 @@ entry: ; cond-b-short: bteqz $BB0_{{[0-9]+}} # 16 bit inst } -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/sel2c.ll b/llvm/test/CodeGen/Mips/sel2c.ll index 0c3b957..44de4ac9 100644 --- a/llvm/test/CodeGen/Mips/sel2c.ll +++ b/llvm/test/CodeGen/Mips/sel2c.ll @@ -16,6 +16,6 @@ entry: ret void } -attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/simplebr.ll b/llvm/test/CodeGen/Mips/simplebr.ll index cfe547f..ae09d85 100644 --- a/llvm/test/CodeGen/Mips/simplebr.ll +++ b/llvm/test/CodeGen/Mips/simplebr.ll @@ -31,7 +31,7 @@ declare void @goo(...) #1 declare void @hoo(...) #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="true" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="true" } diff --git a/llvm/test/CodeGen/Mips/sr1.ll b/llvm/test/CodeGen/Mips/sr1.ll index c6fa9fc..6c42d45 100644 --- a/llvm/test/CodeGen/Mips/sr1.ll +++ b/llvm/test/CodeGen/Mips/sr1.ll @@ -50,7 +50,7 @@ entry: declare float @xf() #1 -attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } +attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/Mips/tnaked.ll b/llvm/test/CodeGen/Mips/tnaked.ll index ac54f2f..287c009 100644 --- a/llvm/test/CodeGen/Mips/tnaked.ll +++ b/llvm/test/CodeGen/Mips/tnaked.ll @@ -25,5 +25,5 @@ entry: ; CHECK: .fmask 0x00000000,0 ; CHECK: addiu $sp, $sp, -8 -attributes #0 = { naked noinline nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } +attributes #0 = { naked noinline nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } +attributes #1 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "use-soft-float"="false" } diff --git a/llvm/test/CodeGen/X86/issue163738.ll b/llvm/test/CodeGen/X86/issue163738.ll new file mode 100644 index 0000000..61fe043 --- /dev/null +++ b/llvm/test/CodeGen/X86/issue163738.ll @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6 +; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefixes=CHECK + +define <8 x i64> @foo(<8 x i64> %a, <8 x i64> %b, <8 x i64> %c) { +; CHECK-LABEL: foo: +; CHECK: # %bb.0: +; CHECK-NEXT: vpternlogq {{.*#+}} zmm0 = ~(zmm0 | zmm2 | zmm1) +; CHECK-NEXT: retq + %and.demorgan = or <8 x i64> %b, %a + %and3.demorgan = or <8 x i64> %and.demorgan, %c + %and3 = xor <8 x i64> %and3.demorgan, splat (i64 -1) + ret <8 x i64> %and3 +} diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll index 63fd184..2570b3b 100644 --- a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll +++ b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrmode-base.ll @@ -951,3 +951,41 @@ fallthrough: %v = add i32 %v1, %v2 ret i32 %v } + +; Make sure we don't simplify an incomplete expression tree. +define i8 @pr163453(ptr %p, i1 %cond) { +; CHECK-LABEL: define i8 @pr163453( +; CHECK-SAME: ptr [[P:%.*]], i1 [[COND:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: [[P_ADDR_0:%.*]] = getelementptr i8, ptr [[P]], i64 1 +; CHECK-NEXT: [[TMP0:%.*]] = load i8, ptr [[P]], align 1 +; CHECK-NEXT: [[INCDEC_PTR11:%.*]] = getelementptr i8, ptr [[P]], i64 2 +; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[COND]], ptr [[P_ADDR_0]], ptr [[INCDEC_PTR11]] +; CHECK-NEXT: [[LOAD:%.*]] = load i8, ptr [[SPEC_SELECT]], align 1 +; CHECK-NEXT: ret i8 [[LOAD]] +; +entry: + br label %for.cond + +for.cond: + %p.pn = phi ptr [ %p, %entry ], [ %p.addr.0, %for.inc ] + %p.addr.0 = getelementptr i8, ptr %p.pn, i64 1 + br i1 false, label %exit, label %for.body + +for.body: + %1 = load i8, ptr %p.pn, align 1 + br i1 false, label %for.inc, label %if.else + +if.else: + %incdec.ptr11 = getelementptr i8, ptr %p.pn, i64 2 + %spec.select = select i1 %cond, ptr %p.addr.0, ptr %incdec.ptr11 + br label %exit + +for.inc: + br label %for.cond + +exit: + %p.addr.3 = phi ptr [ %spec.select, %if.else ], [ %p.addr.0, %for.cond ] + %load = load i8, ptr %p.addr.3, align 1 + ret i8 %load +} diff --git a/llvm/unittests/ADT/CMakeLists.txt b/llvm/unittests/ADT/CMakeLists.txt index 848ccba..af503d9 100644 --- a/llvm/unittests/ADT/CMakeLists.txt +++ b/llvm/unittests/ADT/CMakeLists.txt @@ -63,6 +63,7 @@ add_llvm_unittest(ADTTests PointerUnionTest.cpp PostOrderIteratorTest.cpp PriorityWorklistTest.cpp + RadixTreeTest.cpp RangeAdapterTest.cpp RewriteBufferTest.cpp SCCIteratorTest.cpp diff --git a/llvm/unittests/ADT/RadixTreeTest.cpp b/llvm/unittests/ADT/RadixTreeTest.cpp new file mode 100644 index 0000000..b2dd67c --- /dev/null +++ b/llvm/unittests/ADT/RadixTreeTest.cpp @@ -0,0 +1,379 @@ +//===- llvm/unittest/ADT/RadixTreeTest.cpp --------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "llvm/ADT/RadixTree.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringRef.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include <iterator> +#include <list> +#include <vector> + +using namespace llvm; +namespace { + +using ::testing::ElementsAre; +using ::testing::ElementsAreArray; +using ::testing::Pair; +using ::testing::UnorderedElementsAre; + +// Test with StringRef. + +TEST(RadixTreeTest, Empty) { + RadixTree<StringRef, int> T; + EXPECT_TRUE(T.empty()); + EXPECT_EQ(T.size(), 0u); + + EXPECT_TRUE(T.find_prefixes("").empty()); + EXPECT_TRUE(T.find_prefixes("A").empty()); + + EXPECT_EQ(T.countNodes(), 1u); +} + +TEST(RadixTreeTest, InsertEmpty) { + RadixTree<StringRef, int> T; + auto [It, IsNew] = T.emplace("", 4); + EXPECT_TRUE(!T.empty()); + EXPECT_EQ(T.size(), 1u); + EXPECT_TRUE(IsNew); + const auto &[K, V] = *It; + EXPECT_TRUE(K.empty()); + EXPECT_EQ(4, V); + + EXPECT_THAT(T, ElementsAre(Pair("", 4))); + + EXPECT_THAT(T.find_prefixes(""), ElementsAre(Pair("", 4))); + + EXPECT_THAT(T.find_prefixes("a"), ElementsAre(Pair("", 4))); + + EXPECT_EQ(T.countNodes(), 1u); +} + +TEST(RadixTreeTest, Complex) { + RadixTree<StringRef, int> T; + T.emplace("abcd", 1); + EXPECT_EQ(T.countNodes(), 2u); + T.emplace("abklm", 2); + EXPECT_EQ(T.countNodes(), 4u); + T.emplace("123abklm", 3); + EXPECT_EQ(T.countNodes(), 5u); + T.emplace("123abklm", 4); + EXPECT_EQ(T.countNodes(), 5u); + T.emplace("ab", 5); + EXPECT_EQ(T.countNodes(), 5u); + T.emplace("1234567", 6); + EXPECT_EQ(T.countNodes(), 7u); + T.emplace("123456", 7); + EXPECT_EQ(T.countNodes(), 8u); + T.emplace("123456789", 8); + EXPECT_EQ(T.countNodes(), 9u); + + EXPECT_THAT(T, UnorderedElementsAre(Pair("abcd", 1), Pair("abklm", 2), + Pair("123abklm", 3), Pair("ab", 5), + Pair("1234567", 6), Pair("123456", 7), + Pair("123456789", 8))); + + EXPECT_THAT(T.find_prefixes("1234567890"), + UnorderedElementsAre(Pair("1234567", 6), Pair("123456", 7), + Pair("123456789", 8))); + + EXPECT_THAT(T.find_prefixes("123abklm"), + UnorderedElementsAre(Pair("123abklm", 3))); + + EXPECT_THAT(T.find_prefixes("abcdefg"), + UnorderedElementsAre(Pair("abcd", 1), Pair("ab", 5))); + + EXPECT_EQ(T.countNodes(), 9u); +} + +TEST(RadixTreeTest, ValueWith2Parameters) { + RadixTree<StringRef, std::pair<std::string, int>> T; + T.emplace("abcd", "a", 3); + + EXPECT_THAT(T, UnorderedElementsAre(Pair("abcd", Pair("a", 3)))); +} + +// Test different types, less readable. + +template <typename T> struct TestData { + static const T Data1[]; + static const T Data2[]; +}; + +template <> const char TestData<char>::Data1[] = "abcdedcba"; +template <> const char TestData<char>::Data2[] = "abCDEDCba"; + +template <> const int TestData<int>::Data1[] = {1, 2, 3, 4, 5, 4, 3, 2, 1}; +template <> const int TestData<int>::Data2[] = {1, 2, 4, 8, 16, 8, 4, 2, 1}; + +template <typename T> class RadixTreeTypeTest : public ::testing::Test { +public: + using IteratorType = decltype(adl_begin(std::declval<const T &>())); + using CharType = remove_cvref_t<decltype(*adl_begin(std::declval<T &>()))>; + + T make(const CharType *Data, size_t N) { return T(StringRef(Data, N)); } + + T make1(size_t N) { return make(TestData<CharType>::Data1, N); } + T make2(size_t N) { return make(TestData<CharType>::Data2, N); } +}; + +template <> +iterator_range<StringRef::const_iterator> +RadixTreeTypeTest<iterator_range<StringRef::const_iterator>>::make( + const char *Data, size_t N) { + return StringRef(Data).take_front(N); +} + +template <> +iterator_range<StringRef::const_reverse_iterator> +RadixTreeTypeTest<iterator_range<StringRef::const_reverse_iterator>>::make( + const char *Data, size_t N) { + return reverse(StringRef(Data).take_back(N)); +} + +template <> +ArrayRef<int> RadixTreeTypeTest<ArrayRef<int>>::make(const int *Data, + size_t N) { + return ArrayRef<int>(Data, Data + N); +} + +template <> +std::vector<int> RadixTreeTypeTest<std::vector<int>>::make(const int *Data, + size_t N) { + return std::vector<int>(Data, Data + N); +} + +template <> +std::list<int> RadixTreeTypeTest<std::list<int>>::make(const int *Data, + size_t N) { + return std::list<int>(Data, Data + N); +} + +class TypeNameGenerator { +public: + template <typename T> static std::string GetName(int) { + if (std::is_same_v<T, StringRef>) + return "StringRef"; + if (std::is_same_v<T, std::string>) + return "string"; + if (std::is_same_v<T, iterator_range<StringRef::const_iterator>>) + return "iterator_range"; + if (std::is_same_v<T, iterator_range<StringRef::const_reverse_iterator>>) + return "reverse_iterator_range"; + if (std::is_same_v<T, ArrayRef<int>>) + return "ArrayRef"; + if (std::is_same_v<T, std::vector<int>>) + return "vector"; + if (std::is_same_v<T, std::list<int>>) + return "list"; + return "Unknown"; + } +}; + +using TestTypes = + ::testing::Types<StringRef, std::string, + iterator_range<StringRef::const_iterator>, + iterator_range<StringRef::const_reverse_iterator>, + ArrayRef<int>, std::vector<int>, std::list<int>>; + +TYPED_TEST_SUITE(RadixTreeTypeTest, TestTypes, TypeNameGenerator); + +TYPED_TEST(RadixTreeTypeTest, Helpers) { + for (size_t i = 0; i < 9; ++i) { + auto R1 = this->make1(i); + auto R2 = this->make2(i); + EXPECT_EQ(llvm::range_size(R1), i); + EXPECT_EQ(llvm::range_size(R2), i); + auto [I1, I2] = llvm::mismatch(R1, R2); + // Exactly 2 first elements of Data1 and Data2 must match. + EXPECT_EQ(std::distance(R1.begin(), I1), std::min<int>(2, i)); + } +} + +TYPED_TEST(RadixTreeTypeTest, Empty) { + RadixTree<TypeParam, int> T; + EXPECT_TRUE(T.empty()); + EXPECT_EQ(T.size(), 0u); + + EXPECT_TRUE(T.find_prefixes(this->make1(0)).empty()); + EXPECT_TRUE(T.find_prefixes(this->make2(1)).empty()); + + EXPECT_EQ(T.countNodes(), 1u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertEmpty) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + auto [It, IsNew] = T.emplace(this->make1(0), 5); + EXPECT_TRUE(!T.empty()); + EXPECT_EQ(T.size(), 1u); + EXPECT_TRUE(IsNew); + const auto &[K, V] = *It; + EXPECT_TRUE(K.empty()); + EXPECT_EQ(5, V); + + EXPECT_THAT(T.find_prefixes(this->make1(0)), + ElementsAre(Pair(ElementsAre(), 5))); + + EXPECT_THAT(T.find_prefixes(this->make2(1)), + ElementsAre(Pair(ElementsAre(), 5))); + + EXPECT_THAT(T, ElementsAre(Pair(ElementsAre(), 5))); + + EXPECT_EQ(T.countNodes(), 1u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertEmptyTwice) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + T.emplace(this->make1(0), 5); + auto [It, IsNew] = T.emplace(this->make1(0), 6); + EXPECT_TRUE(!T.empty()); + EXPECT_EQ(T.size(), 1u); + EXPECT_TRUE(!IsNew); + const auto &[K, V] = *It; + EXPECT_TRUE(K.empty()); + EXPECT_EQ(5, V); + + EXPECT_THAT(T.find_prefixes(this->make1(0)), + ElementsAre(Pair(ElementsAre(), 5))); + + EXPECT_THAT(T.find_prefixes(this->make2(1)), + ElementsAre(Pair(ElementsAre(), 5))); + + EXPECT_THAT(T, ElementsAre(Pair(ElementsAre(), 5))); + + EXPECT_EQ(T.countNodes(), 1u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertOne) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + auto [It, IsNew] = T.emplace(this->make1(1), 4); + EXPECT_TRUE(!T.empty()); + EXPECT_EQ(T.size(), 1u); + EXPECT_TRUE(IsNew); + const auto &[K, V] = *It; + EXPECT_THAT(K, ElementsAreArray(this->make1(1))); + EXPECT_EQ(4, V); + + EXPECT_THAT(T, ElementsAre(Pair(ElementsAreArray(this->make1(1)), 4))); + + EXPECT_THAT(T.find_prefixes(this->make1(1)), + ElementsAre(Pair(ElementsAreArray(this->make1(1)), 4))); + + EXPECT_THAT(T.find_prefixes(this->make1(2)), + ElementsAre(Pair(ElementsAreArray(this->make1(1)), 4))); + + EXPECT_EQ(T.countNodes(), 2u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertOneTwice) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + T.emplace(this->make1(1), 4); + auto [It, IsNew] = T.emplace(this->make1(1), 4); + EXPECT_TRUE(!T.empty()); + EXPECT_EQ(T.size(), 1u); + EXPECT_TRUE(!IsNew); + + EXPECT_THAT(T, ElementsAre(Pair(ElementsAreArray(this->make1(1)), 4))); + EXPECT_EQ(T.countNodes(), 2u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertSuperStrings) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + + for (size_t Len = 0; Len < 7; Len += 2) { + auto [It, IsNew] = T.emplace(this->make1(Len), Len); + EXPECT_TRUE(IsNew); + } + + EXPECT_THAT(T, + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(0)), 0), + Pair(ElementsAreArray(this->make1(2)), 2), + Pair(ElementsAreArray(this->make1(4)), 4), + Pair(ElementsAreArray(this->make1(6)), 6))); + + EXPECT_THAT(T.find_prefixes(this->make1(0)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(0)), 0))); + + EXPECT_THAT(T.find_prefixes(this->make1(3)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(0)), 0), + Pair(ElementsAreArray(this->make1(2)), 2))); + + EXPECT_THAT(T.find_prefixes(this->make1(7)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(0)), 0), + Pair(ElementsAreArray(this->make1(2)), 2), + Pair(ElementsAreArray(this->make1(4)), 4), + Pair(ElementsAreArray(this->make1(6)), 6))); + + EXPECT_EQ(T.countNodes(), 4u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertSubStrings) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + + for (size_t Len = 0; Len < 7; Len += 2) { + auto [It, IsNew] = T.emplace(this->make1(7 - Len), 7 - Len); + EXPECT_TRUE(IsNew); + } + + EXPECT_THAT(T, + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(1)), 1), + Pair(ElementsAreArray(this->make1(3)), 3), + Pair(ElementsAreArray(this->make1(5)), 5), + Pair(ElementsAreArray(this->make1(7)), 7))); + + EXPECT_THAT(T.find_prefixes(this->make1(0)), UnorderedElementsAre()); + + EXPECT_THAT(T.find_prefixes(this->make1(3)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(1)), 1), + Pair(ElementsAreArray(this->make1(3)), 3))); + + EXPECT_THAT(T.find_prefixes(this->make1(6)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(1)), 1), + Pair(ElementsAreArray(this->make1(3)), 3), + Pair(ElementsAreArray(this->make1(5)), 5))); + + EXPECT_EQ(T.countNodes(), 5u); +} + +TYPED_TEST(RadixTreeTypeTest, InsertVShape) { + using TreeType = RadixTree<TypeParam, int>; + TreeType T; + + EXPECT_EQ(T.countNodes(), 1u); + T.emplace(this->make1(5), 15); + EXPECT_EQ(T.countNodes(), 2u); + T.emplace(this->make2(6), 26); + EXPECT_EQ(T.countNodes(), 4u); + T.emplace(this->make2(1), 21); + EXPECT_EQ(T.countNodes(), 5u); + + EXPECT_THAT(T, + UnorderedElementsAre(Pair(ElementsAreArray(this->make1(5)), 15), + Pair(ElementsAreArray(this->make2(6)), 26), + Pair(ElementsAreArray(this->make2(1)), 21))); + + EXPECT_THAT(T.find_prefixes(this->make1(7)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make2(1)), 21), + Pair(ElementsAreArray(this->make1(5)), 15))); + + EXPECT_THAT(T.find_prefixes(this->make2(7)), + UnorderedElementsAre(Pair(ElementsAreArray(this->make2(1)), 21), + Pair(ElementsAreArray(this->make2(6)), 26))); + + EXPECT_EQ(T.countNodes(), 5u); +} + +} // namespace diff --git a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt index 7b563d7..b06aa25 100644 --- a/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt +++ b/llvm/unittests/ExecutionEngine/Orc/CMakeLists.txt @@ -26,7 +26,6 @@ add_llvm_unittest(OrcJITTests IndirectionUtilsTest.cpp JITTargetMachineBuilderTest.cpp LazyCallThroughAndReexportsTest.cpp - LibraryResolverTest.cpp LookupAndRecordAddrsTest.cpp MachOPlatformTest.cpp MapperJITLinkMemoryManagerTest.cpp diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/A/A_linux.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/A/A_linux.yaml deleted file mode 100644 index afd1d9e..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/A/A_linux.yaml +++ /dev/null @@ -1,460 +0,0 @@ ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -ProgramHeaders: - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .rela.plt - Align: 0x1000 - Offset: 0x0 - - Type: PT_LOAD - Flags: [ PF_X, PF_R ] - FirstSec: .init - LastSec: .fini - VAddr: 0x1000 - Align: 0x1000 - Offset: 0x1000 - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .rodata - LastSec: .eh_frame - VAddr: 0x2000 - Align: 0x1000 - Offset: 0x2000 - - Type: PT_LOAD - Flags: [ PF_W, PF_R ] - FirstSec: .init_array - LastSec: .bss - VAddr: 0x3E10 - Align: 0x1000 - Offset: 0x2E10 - - Type: PT_DYNAMIC - Flags: [ PF_W, PF_R ] - FirstSec: .dynamic - LastSec: .dynamic - VAddr: 0x3E20 - Align: 0x8 - Offset: 0x2E20 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.build-id - LastSec: .note.gnu.build-id - VAddr: 0x2C8 - Align: 0x4 - Offset: 0x2C8 - - Type: PT_GNU_PROPERTY - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_GNU_EH_FRAME - Flags: [ PF_R ] - FirstSec: .eh_frame_hdr - LastSec: .eh_frame_hdr - VAddr: 0x2010 - Align: 0x4 - Offset: 0x2010 - - Type: PT_GNU_STACK - Flags: [ PF_W, PF_R ] - Align: 0x10 - Offset: 0x0 - - Type: PT_GNU_RELRO - Flags: [ PF_R ] - FirstSec: .init_array - LastSec: .got - VAddr: 0x3E10 - Offset: 0x2E10 -Sections: - - Name: .note.gnu.property - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2A8 - AddressAlign: 0x8 - Notes: - - Name: GNU - Desc: 020000C0040000000300000000000000 - Type: NT_GNU_PROPERTY_TYPE_0 - - Name: .note.gnu.build-id - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2C8 - AddressAlign: 0x4 - Notes: - - Name: GNU - Desc: 73604396C95840D5C380A0950F085A778F94EE7C - Type: NT_PRPSINFO - - Name: .gnu.hash - Type: SHT_GNU_HASH - Flags: [ SHF_ALLOC ] - Address: 0x2F0 - Link: .dynsym - AddressAlign: 0x8 - Header: - SymNdx: 0x6 - Shift2: 0x6 - BloomFilter: [ 0x400000080000 ] - HashBuckets: [ 0x0, 0x6 ] - HashValues: [ 0x7C9DCB93 ] - - Name: .dynsym - Type: SHT_DYNSYM - Flags: [ SHF_ALLOC ] - Address: 0x318 - Link: .dynstr - AddressAlign: 0x8 - - Name: .dynstr - Type: SHT_STRTAB - Flags: [ SHF_ALLOC ] - Address: 0x3C0 - AddressAlign: 0x1 - - Name: .gnu.version - Type: SHT_GNU_versym - Flags: [ SHF_ALLOC ] - Address: 0x436 - Link: .dynsym - AddressAlign: 0x2 - Entries: [ 0, 1, 2, 1, 1, 2, 1 ] - - Name: .gnu.version_r - Type: SHT_GNU_verneed - Flags: [ SHF_ALLOC ] - Address: 0x448 - Link: .dynstr - AddressAlign: 0x8 - Dependencies: - - Version: 1 - File: libc.so.6 - Entries: - - Name: GLIBC_2.2.5 - Hash: 157882997 - Flags: 0 - Other: 2 - - Name: .rela.dyn - Type: SHT_RELA - Flags: [ SHF_ALLOC ] - Address: 0x468 - Link: .dynsym - AddressAlign: 0x8 - Relocations: - - Offset: 0x3E10 - Type: R_X86_64_RELATIVE - Addend: 4368 - - Offset: 0x3E18 - Type: R_X86_64_RELATIVE - Addend: 4304 - - Offset: 0x4020 - Type: R_X86_64_RELATIVE - Addend: 16416 - - Offset: 0x3FE0 - Symbol: _ITM_deregisterTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FE8 - Symbol: __gmon_start__ - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF0 - Symbol: _ITM_registerTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF8 - Symbol: __cxa_finalize - Type: R_X86_64_GLOB_DAT - - Name: .rela.plt - Type: SHT_RELA - Flags: [ SHF_ALLOC, SHF_INFO_LINK ] - Address: 0x510 - Link: .dynsym - AddressAlign: 0x8 - Info: .got.plt - Relocations: - - Offset: 0x4018 - Symbol: puts - Type: R_X86_64_JUMP_SLOT - - Name: .init - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1000 - AddressAlign: 0x4 - Offset: 0x1000 - Content: F30F1EFA4883EC08488B05D92F00004885C07402FFD04883C408C3 - - Name: .plt - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1020 - AddressAlign: 0x10 - EntSize: 0x10 - Content: FF35E22F0000F2FF25E32F00000F1F00F30F1EFA6800000000F2E9E1FFFFFF90 - - Name: .plt.got - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1040 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25AD2F00000F1F440000 - - Name: .plt.sec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1050 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25BD2F00000F1F440000 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1060 - AddressAlign: 0x10 - Content: 488D3DC12F0000488D05BA2F00004839F87415488B05662F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D912F0000488D358A2F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05352F00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D4D2F000000752B5548833D122F0000004889E5740C488B3D2E2F0000E849FFFFFFE864FFFFFFC605252F0000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFFF30F1EFA554889E5488D05D80E00004889C7E820FFFFFF905DC3 - - Name: .fini - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1134 - AddressAlign: 0x4 - Content: F30F1EFA4883EC084883C408C3 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2000 - AddressAlign: 0x1 - Offset: 0x2000 - Content: 48656C6C6F2066726F6D204100 - - Name: .eh_frame_hdr - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2010 - AddressAlign: 0x4 - Content: 011B033B2C0000000400000010F0FFFF4800000030F0FFFF7000000040F0FFFF8800000009F1FFFFA0000000 - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2040 - AddressAlign: 0x8 - Content: 1400000000000000017A5200017810011B0C070890010000240000001C000000C0EFFFFF20000000000E10460E184A0F0B770880003F1A3A2A332422000000001400000044000000B8EFFFFF100000000000000000000000140000005C000000B0EFFFFF1000000000000000000000001C0000007400000061F0FFFF1A00000000450E108602430D06510C070800000000000000 - - Name: .init_array - Type: SHT_INIT_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E10 - AddressAlign: 0x8 - EntSize: 0x8 - Offset: 0x2E10 - Content: '1011000000000000' - - Name: .fini_array - Type: SHT_FINI_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E18 - AddressAlign: 0x8 - EntSize: 0x8 - Content: D010000000000000 - - Name: .dynamic - Type: SHT_DYNAMIC - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E20 - Link: .dynstr - AddressAlign: 0x8 - Entries: - - Tag: DT_NEEDED - Value: 0x5F - - Tag: DT_INIT - Value: 0x1000 - - Tag: DT_FINI - Value: 0x1134 - - Tag: DT_INIT_ARRAY - Value: 0x3E10 - - Tag: DT_INIT_ARRAYSZ - Value: 0x8 - - Tag: DT_FINI_ARRAY - Value: 0x3E18 - - Tag: DT_FINI_ARRAYSZ - Value: 0x8 - - Tag: DT_GNU_HASH - Value: 0x2F0 - - Tag: DT_STRTAB - Value: 0x3C0 - - Tag: DT_SYMTAB - Value: 0x318 - - Tag: DT_STRSZ - Value: 0x75 - - Tag: DT_SYMENT - Value: 0x18 - - Tag: DT_PLTGOT - Value: 0x4000 - - Tag: DT_PLTRELSZ - Value: 0x18 - - Tag: DT_PLTREL - Value: 0x7 - - Tag: DT_JMPREL - Value: 0x510 - - Tag: DT_RELA - Value: 0x468 - - Tag: DT_RELASZ - Value: 0xA8 - - Tag: DT_RELAENT - Value: 0x18 - - Tag: DT_VERNEED - Value: 0x448 - - Tag: DT_VERNEEDNUM - Value: 0x1 - - Tag: DT_VERSYM - Value: 0x436 - - Tag: DT_RELACOUNT - Value: 0x3 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3FE0 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '0000000000000000000000000000000000000000000000000000000000000000' - - Name: .got.plt - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4000 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '203E000000000000000000000000000000000000000000003010000000000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4020 - AddressAlign: 0x8 - Content: '2040000000000000' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4028 - AddressAlign: 0x1 - Size: 0x8 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x1 - EntSize: 0x1 - Content: 4743433A20285562756E74752031312E342E302D317562756E7475317E32322E30342E32292031312E342E3000 -Symbols: - - Name: crtstuff.c - Type: STT_FILE - Index: SHN_ABS - - Name: deregister_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1060 - - Name: register_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1090 - - Name: __do_global_dtors_aux - Type: STT_FUNC - Section: .text - Value: 0x10D0 - - Name: completed.0 - Type: STT_OBJECT - Section: .bss - Value: 0x4028 - Size: 0x1 - - Name: __do_global_dtors_aux_fini_array_entry - Type: STT_OBJECT - Section: .fini_array - Value: 0x3E18 - - Name: frame_dummy - Type: STT_FUNC - Section: .text - Value: 0x1110 - - Name: __frame_dummy_init_array_entry - Type: STT_OBJECT - Section: .init_array - Value: 0x3E10 - - Name: libA.c - Type: STT_FILE - Index: SHN_ABS - - Name: 'crtstuff.c (1)' - Type: STT_FILE - Index: SHN_ABS - - Name: __FRAME_END__ - Type: STT_OBJECT - Section: .eh_frame - Value: 0x20D0 - - Type: STT_FILE - Index: SHN_ABS - - Name: _fini - Type: STT_FUNC - Section: .fini - Value: 0x1134 - - Name: __dso_handle - Type: STT_OBJECT - Section: .data - Value: 0x4020 - - Name: _DYNAMIC - Type: STT_OBJECT - Section: .dynamic - Value: 0x3E20 - - Name: __GNU_EH_FRAME_HDR - Section: .eh_frame_hdr - Value: 0x2010 - - Name: __TMC_END__ - Type: STT_OBJECT - Section: .data - Value: 0x4028 - - Name: _GLOBAL_OFFSET_TABLE_ - Type: STT_OBJECT - Section: .got.plt - Value: 0x4000 - - Name: _init - Type: STT_FUNC - Section: .init - Value: 0x1000 - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: 'puts@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayA - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1119 - Size: 0x1A - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: '__cxa_finalize@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_WEAK -DynamicSymbols: - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: puts - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: __cxa_finalize - Type: STT_FUNC - Binding: STB_WEAK - - Name: sayA - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1119 - Size: 0x1A -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/A/A_macho.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/A/A_macho.yaml deleted file mode 100644 index 2e851a90..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/A/A_macho.yaml +++ /dev/null @@ -1,723 +0,0 @@ ---- !fat-mach-o -FatHeader: - magic: 0xCAFEBABE - nfat_arch: 3 -FatArchs: - - cputype: 0x1000007 - cpusubtype: 0x3 - offset: 0x1000 - size: 8376 - align: 12 - - cputype: 0x100000C - cpusubtype: 0x0 - offset: 0x4000 - size: 33376 - align: 14 - - cputype: 0x100000C - cpusubtype: 0x80000002 - offset: 0x10000 - size: 33376 - align: 14 -Slices: - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x1000007 - cpusubtype: 0x3 - filetype: 0x6 - ncmds: 14 - sizeofcmds: 960 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 4096 - fileoff: 0 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0xF80 - size: 20 - offset: 0xF80 - align: 4 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 554889E5488D3D0F000000B000E8020000005DC3 - - sectname: __stubs - segname: __TEXT - addr: 0xF94 - size: 6 - offset: 0xF94 - align: 1 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x6 - reserved3: 0x0 - content: FF2566000000 - - sectname: __cstring - segname: __TEXT - addr: 0xF9A - size: 14 - offset: 0xF9A - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D20410A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0xFA8 - size: 88 - offset: 0xFA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000800F00004000000040000000940F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000100000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 4096 - vmsize: 4096 - fileoff: 4096 - filesize: 4096 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x1000 - size: 8 - offset: 0x1000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 8192 - vmsize: 4096 - fileoff: 8192 - filesize: 184 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 8192 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 8288 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 8320 - nsyms: 2 - stroff: 8360 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 8352 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: ADFFA141-C3EE-37CD-B1E7-906D69F81BCB - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 8312 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 8320 - datasize: 0 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayA - Flags: 0x0 - Address: 0xF80 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 3968 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayA - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0xF80 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x10, 0x6, 0x0, - 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x0 - filetype: 0x6 - ncmds: 15 - sizeofcmds: 976 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F70 - size: 28 - offset: 0x3F70 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8C0035FD6 - - sectname: __stubs - segname: __TEXT - addr: 0x3F8C - size: 12 - offset: 0x3F8C - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0xC - reserved3: 0x0 - content: 100000B0100240F900021FD6 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 14 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D20410A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000703F000040000000400000008C3F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x4000 - size: 8 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 608 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 2 - stroff: 32936 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32928 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: C45227E0-C6C0-3137-969B-36AABF9D5487 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 32960 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayA - Flags: 0x0 - Address: 0x3F70 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16240 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayA - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0x3F70 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0x6, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x80000002 - filetype: 0x6 - ncmds: 15 - sizeofcmds: 976 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F68 - size: 32 - offset: 0x3F68 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 7F2303D5FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8FF0F5FD6 - - sectname: __auth_stubs - segname: __TEXT - addr: 0x3F88 - size: 16 - offset: 0x3F88 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x10 - reserved3: 0x0 - content: 110000B031020091300240F9110A1FD7 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 14 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D20410A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000683F00004000000040000000883F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __auth_got - segname: __DATA_CONST - addr: 0x4000 - size: 8 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: 00000000000001C0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 608 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 2 - stroff: 32936 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32928 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: C9DC00C2-E721-365C-9C2D-E9FDB7C838BB - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 32960 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayA - Flags: 0x0 - Address: 0x3F68 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16232 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayA - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0x3F68 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0xC, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/B/B_linux.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/B/B_linux.yaml deleted file mode 100644 index fe4393e..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/B/B_linux.yaml +++ /dev/null @@ -1,460 +0,0 @@ ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -ProgramHeaders: - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .rela.plt - Align: 0x1000 - Offset: 0x0 - - Type: PT_LOAD - Flags: [ PF_X, PF_R ] - FirstSec: .init - LastSec: .fini - VAddr: 0x1000 - Align: 0x1000 - Offset: 0x1000 - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .rodata - LastSec: .eh_frame - VAddr: 0x2000 - Align: 0x1000 - Offset: 0x2000 - - Type: PT_LOAD - Flags: [ PF_W, PF_R ] - FirstSec: .init_array - LastSec: .bss - VAddr: 0x3E10 - Align: 0x1000 - Offset: 0x2E10 - - Type: PT_DYNAMIC - Flags: [ PF_W, PF_R ] - FirstSec: .dynamic - LastSec: .dynamic - VAddr: 0x3E20 - Align: 0x8 - Offset: 0x2E20 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.build-id - LastSec: .note.gnu.build-id - VAddr: 0x2C8 - Align: 0x4 - Offset: 0x2C8 - - Type: PT_GNU_PROPERTY - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_GNU_EH_FRAME - Flags: [ PF_R ] - FirstSec: .eh_frame_hdr - LastSec: .eh_frame_hdr - VAddr: 0x2010 - Align: 0x4 - Offset: 0x2010 - - Type: PT_GNU_STACK - Flags: [ PF_W, PF_R ] - Align: 0x10 - Offset: 0x0 - - Type: PT_GNU_RELRO - Flags: [ PF_R ] - FirstSec: .init_array - LastSec: .got - VAddr: 0x3E10 - Offset: 0x2E10 -Sections: - - Name: .note.gnu.property - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2A8 - AddressAlign: 0x8 - Notes: - - Name: GNU - Desc: 020000C0040000000300000000000000 - Type: NT_GNU_PROPERTY_TYPE_0 - - Name: .note.gnu.build-id - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2C8 - AddressAlign: 0x4 - Notes: - - Name: GNU - Desc: 6337F7C1BF21A1DE17630C55602EB4CAC50435BB - Type: NT_PRPSINFO - - Name: .gnu.hash - Type: SHT_GNU_HASH - Flags: [ SHF_ALLOC ] - Address: 0x2F0 - Link: .dynsym - AddressAlign: 0x8 - Header: - SymNdx: 0x6 - Shift2: 0x6 - BloomFilter: [ 0x400000100000 ] - HashBuckets: [ 0x6, 0x0 ] - HashValues: [ 0x7C9DCB95 ] - - Name: .dynsym - Type: SHT_DYNSYM - Flags: [ SHF_ALLOC ] - Address: 0x318 - Link: .dynstr - AddressAlign: 0x8 - - Name: .dynstr - Type: SHT_STRTAB - Flags: [ SHF_ALLOC ] - Address: 0x3C0 - AddressAlign: 0x1 - - Name: .gnu.version - Type: SHT_GNU_versym - Flags: [ SHF_ALLOC ] - Address: 0x436 - Link: .dynsym - AddressAlign: 0x2 - Entries: [ 0, 1, 2, 1, 1, 2, 1 ] - - Name: .gnu.version_r - Type: SHT_GNU_verneed - Flags: [ SHF_ALLOC ] - Address: 0x448 - Link: .dynstr - AddressAlign: 0x8 - Dependencies: - - Version: 1 - File: libc.so.6 - Entries: - - Name: GLIBC_2.2.5 - Hash: 157882997 - Flags: 0 - Other: 2 - - Name: .rela.dyn - Type: SHT_RELA - Flags: [ SHF_ALLOC ] - Address: 0x468 - Link: .dynsym - AddressAlign: 0x8 - Relocations: - - Offset: 0x3E10 - Type: R_X86_64_RELATIVE - Addend: 4368 - - Offset: 0x3E18 - Type: R_X86_64_RELATIVE - Addend: 4304 - - Offset: 0x4020 - Type: R_X86_64_RELATIVE - Addend: 16416 - - Offset: 0x3FE0 - Symbol: _ITM_deregisterTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FE8 - Symbol: __gmon_start__ - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF0 - Symbol: _ITM_registerTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF8 - Symbol: __cxa_finalize - Type: R_X86_64_GLOB_DAT - - Name: .rela.plt - Type: SHT_RELA - Flags: [ SHF_ALLOC, SHF_INFO_LINK ] - Address: 0x510 - Link: .dynsym - AddressAlign: 0x8 - Info: .got.plt - Relocations: - - Offset: 0x4018 - Symbol: puts - Type: R_X86_64_JUMP_SLOT - - Name: .init - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1000 - AddressAlign: 0x4 - Offset: 0x1000 - Content: F30F1EFA4883EC08488B05D92F00004885C07402FFD04883C408C3 - - Name: .plt - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1020 - AddressAlign: 0x10 - EntSize: 0x10 - Content: FF35E22F0000F2FF25E32F00000F1F00F30F1EFA6800000000F2E9E1FFFFFF90 - - Name: .plt.got - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1040 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25AD2F00000F1F440000 - - Name: .plt.sec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1050 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25BD2F00000F1F440000 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1060 - AddressAlign: 0x10 - Content: 488D3DC12F0000488D05BA2F00004839F87415488B05662F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D912F0000488D358A2F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05352F00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D4D2F000000752B5548833D122F0000004889E5740C488B3D2E2F0000E849FFFFFFE864FFFFFFC605252F0000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFFF30F1EFA554889E5488D05D80E00004889C7E820FFFFFF905DC3 - - Name: .fini - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1134 - AddressAlign: 0x4 - Content: F30F1EFA4883EC084883C408C3 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2000 - AddressAlign: 0x1 - Offset: 0x2000 - Content: 48656C6C6F2066726F6D204200 - - Name: .eh_frame_hdr - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2010 - AddressAlign: 0x4 - Content: 011B033B2C0000000400000010F0FFFF4800000030F0FFFF7000000040F0FFFF8800000009F1FFFFA0000000 - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2040 - AddressAlign: 0x8 - Content: 1400000000000000017A5200017810011B0C070890010000240000001C000000C0EFFFFF20000000000E10460E184A0F0B770880003F1A3A2A332422000000001400000044000000B8EFFFFF100000000000000000000000140000005C000000B0EFFFFF1000000000000000000000001C0000007400000061F0FFFF1A00000000450E108602430D06510C070800000000000000 - - Name: .init_array - Type: SHT_INIT_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E10 - AddressAlign: 0x8 - EntSize: 0x8 - Offset: 0x2E10 - Content: '1011000000000000' - - Name: .fini_array - Type: SHT_FINI_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E18 - AddressAlign: 0x8 - EntSize: 0x8 - Content: D010000000000000 - - Name: .dynamic - Type: SHT_DYNAMIC - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E20 - Link: .dynstr - AddressAlign: 0x8 - Entries: - - Tag: DT_NEEDED - Value: 0x5F - - Tag: DT_INIT - Value: 0x1000 - - Tag: DT_FINI - Value: 0x1134 - - Tag: DT_INIT_ARRAY - Value: 0x3E10 - - Tag: DT_INIT_ARRAYSZ - Value: 0x8 - - Tag: DT_FINI_ARRAY - Value: 0x3E18 - - Tag: DT_FINI_ARRAYSZ - Value: 0x8 - - Tag: DT_GNU_HASH - Value: 0x2F0 - - Tag: DT_STRTAB - Value: 0x3C0 - - Tag: DT_SYMTAB - Value: 0x318 - - Tag: DT_STRSZ - Value: 0x75 - - Tag: DT_SYMENT - Value: 0x18 - - Tag: DT_PLTGOT - Value: 0x4000 - - Tag: DT_PLTRELSZ - Value: 0x18 - - Tag: DT_PLTREL - Value: 0x7 - - Tag: DT_JMPREL - Value: 0x510 - - Tag: DT_RELA - Value: 0x468 - - Tag: DT_RELASZ - Value: 0xA8 - - Tag: DT_RELAENT - Value: 0x18 - - Tag: DT_VERNEED - Value: 0x448 - - Tag: DT_VERNEEDNUM - Value: 0x1 - - Tag: DT_VERSYM - Value: 0x436 - - Tag: DT_RELACOUNT - Value: 0x3 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3FE0 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '0000000000000000000000000000000000000000000000000000000000000000' - - Name: .got.plt - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4000 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '203E000000000000000000000000000000000000000000003010000000000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4020 - AddressAlign: 0x8 - Content: '2040000000000000' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4028 - AddressAlign: 0x1 - Size: 0x8 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x1 - EntSize: 0x1 - Content: 4743433A20285562756E74752031312E342E302D317562756E7475317E32322E30342E32292031312E342E3000 -Symbols: - - Name: crtstuff.c - Type: STT_FILE - Index: SHN_ABS - - Name: deregister_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1060 - - Name: register_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1090 - - Name: __do_global_dtors_aux - Type: STT_FUNC - Section: .text - Value: 0x10D0 - - Name: completed.0 - Type: STT_OBJECT - Section: .bss - Value: 0x4028 - Size: 0x1 - - Name: __do_global_dtors_aux_fini_array_entry - Type: STT_OBJECT - Section: .fini_array - Value: 0x3E18 - - Name: frame_dummy - Type: STT_FUNC - Section: .text - Value: 0x1110 - - Name: __frame_dummy_init_array_entry - Type: STT_OBJECT - Section: .init_array - Value: 0x3E10 - - Name: libB.c - Type: STT_FILE - Index: SHN_ABS - - Name: 'crtstuff.c (1)' - Type: STT_FILE - Index: SHN_ABS - - Name: __FRAME_END__ - Type: STT_OBJECT - Section: .eh_frame - Value: 0x20D0 - - Type: STT_FILE - Index: SHN_ABS - - Name: _fini - Type: STT_FUNC - Section: .fini - Value: 0x1134 - - Name: __dso_handle - Type: STT_OBJECT - Section: .data - Value: 0x4020 - - Name: _DYNAMIC - Type: STT_OBJECT - Section: .dynamic - Value: 0x3E20 - - Name: __GNU_EH_FRAME_HDR - Section: .eh_frame_hdr - Value: 0x2010 - - Name: __TMC_END__ - Type: STT_OBJECT - Section: .data - Value: 0x4028 - - Name: _GLOBAL_OFFSET_TABLE_ - Type: STT_OBJECT - Section: .got.plt - Value: 0x4000 - - Name: _init - Type: STT_FUNC - Section: .init - Value: 0x1000 - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: 'puts@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: sayB - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1119 - Size: 0x1A - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: '__cxa_finalize@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_WEAK -DynamicSymbols: - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: puts - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: __cxa_finalize - Type: STT_FUNC - Binding: STB_WEAK - - Name: sayB - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1119 - Size: 0x1A -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/B/B_macho.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/B/B_macho.yaml deleted file mode 100644 index 3d57c4f..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/B/B_macho.yaml +++ /dev/null @@ -1,723 +0,0 @@ ---- !fat-mach-o -FatHeader: - magic: 0xCAFEBABE - nfat_arch: 3 -FatArchs: - - cputype: 0x1000007 - cpusubtype: 0x3 - offset: 0x1000 - size: 8376 - align: 12 - - cputype: 0x100000C - cpusubtype: 0x0 - offset: 0x4000 - size: 33376 - align: 14 - - cputype: 0x100000C - cpusubtype: 0x80000002 - offset: 0x10000 - size: 33376 - align: 14 -Slices: - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x1000007 - cpusubtype: 0x3 - filetype: 0x6 - ncmds: 14 - sizeofcmds: 960 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 4096 - fileoff: 0 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0xF80 - size: 20 - offset: 0xF80 - align: 4 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 554889E5488D3D0F000000B000E8020000005DC3 - - sectname: __stubs - segname: __TEXT - addr: 0xF94 - size: 6 - offset: 0xF94 - align: 1 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x6 - reserved3: 0x0 - content: FF2566000000 - - sectname: __cstring - segname: __TEXT - addr: 0xF9A - size: 14 - offset: 0xF9A - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D20420A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0xFA8 - size: 88 - offset: 0xFA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000800F00004000000040000000940F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000100000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 4096 - vmsize: 4096 - fileoff: 4096 - filesize: 4096 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x1000 - size: 8 - offset: 0x1000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 8192 - vmsize: 4096 - fileoff: 8192 - filesize: 184 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libB.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 8192 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 8288 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 8320 - nsyms: 2 - stroff: 8360 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 8352 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 88B60B3C-13D3-3D7E-AEED-5F3E991FDF08 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 8312 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 8320 - datasize: 0 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayB - Flags: 0x0 - Address: 0xF80 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 3968 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayB - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0xF80 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x10, 0x6, 0x0, - 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x0 - filetype: 0x6 - ncmds: 15 - sizeofcmds: 976 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F70 - size: 28 - offset: 0x3F70 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8C0035FD6 - - sectname: __stubs - segname: __TEXT - addr: 0x3F8C - size: 12 - offset: 0x3F8C - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0xC - reserved3: 0x0 - content: 100000B0100240F900021FD6 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 14 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D20420A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000703F000040000000400000008C3F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x4000 - size: 8 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 608 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libB.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 2 - stroff: 32936 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32928 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 90C3787A-22E1-35AE-9284-97A4842F88AF - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 32960 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayB - Flags: 0x0 - Address: 0x3F70 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16240 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayB - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0x3F70 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0x6, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x80000002 - filetype: 0x6 - ncmds: 15 - sizeofcmds: 976 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F68 - size: 32 - offset: 0x3F68 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 7F2303D5FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8FF0F5FD6 - - sectname: __auth_stubs - segname: __TEXT - addr: 0x3F88 - size: 16 - offset: 0x3F88 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x10 - reserved3: 0x0 - content: 110000B031020091300240F9110A1FD7 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 14 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D20420A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000683F00004000000040000000883F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __auth_got - segname: __DATA_CONST - addr: 0x4000 - size: 8 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: 00000000000001C0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 608 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libB.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 2 - stroff: 32936 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32928 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 76B41B3A-00EC-388B-A432-478A96772CC4 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 32960 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayB - Flags: 0x0 - Address: 0x3F68 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16232 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayB - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0x3F68 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0xC, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/C/C_linux.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/C/C_linux.yaml deleted file mode 100644 index 8b75b1e..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/C/C_linux.yaml +++ /dev/null @@ -1,461 +0,0 @@ ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -ProgramHeaders: - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .rela.plt - Align: 0x1000 - Offset: 0x0 - - Type: PT_LOAD - Flags: [ PF_X, PF_R ] - FirstSec: .init - LastSec: .fini - VAddr: 0x1000 - Align: 0x1000 - Offset: 0x1000 - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .eh_frame_hdr - LastSec: .eh_frame - VAddr: 0x2000 - Align: 0x1000 - Offset: 0x2000 - - Type: PT_LOAD - Flags: [ PF_W, PF_R ] - FirstSec: .init_array - LastSec: .bss - VAddr: 0x3E00 - Align: 0x1000 - Offset: 0x2E00 - - Type: PT_DYNAMIC - Flags: [ PF_W, PF_R ] - FirstSec: .dynamic - LastSec: .dynamic - VAddr: 0x3E10 - Align: 0x8 - Offset: 0x2E10 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.build-id - LastSec: .note.gnu.build-id - VAddr: 0x2C8 - Align: 0x4 - Offset: 0x2C8 - - Type: PT_GNU_PROPERTY - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_GNU_EH_FRAME - Flags: [ PF_R ] - FirstSec: .eh_frame_hdr - LastSec: .eh_frame_hdr - VAddr: 0x2000 - Align: 0x4 - Offset: 0x2000 - - Type: PT_GNU_STACK - Flags: [ PF_W, PF_R ] - Align: 0x10 - Offset: 0x0 - - Type: PT_GNU_RELRO - Flags: [ PF_R ] - FirstSec: .init_array - LastSec: .got - VAddr: 0x3E00 - Offset: 0x2E00 -Sections: - - Name: .note.gnu.property - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2A8 - AddressAlign: 0x8 - Notes: - - Name: GNU - Desc: 020000C0040000000300000000000000 - Type: NT_GNU_PROPERTY_TYPE_0 - - Name: .note.gnu.build-id - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2C8 - AddressAlign: 0x4 - Notes: - - Name: GNU - Desc: C5C3C9594A5D3556DC54D70850C6DBC316710857 - Type: NT_PRPSINFO - - Name: .gnu.hash - Type: SHT_GNU_HASH - Flags: [ SHF_ALLOC ] - Address: 0x2F0 - Link: .dynsym - AddressAlign: 0x8 - Header: - SymNdx: 0x9 - Shift2: 0x6 - BloomFilter: [ 0x400000200000 ] - HashBuckets: [ 0x0, 0x9 ] - HashValues: [ 0x7C9DCB95 ] - - Name: .dynsym - Type: SHT_DYNSYM - Flags: [ SHF_ALLOC ] - Address: 0x318 - Link: .dynstr - AddressAlign: 0x8 - - Name: .dynstr - Type: SHT_STRTAB - Flags: [ SHF_ALLOC ] - Address: 0x408 - AddressAlign: 0x1 - Content: "6C6962412E736F006C6962422E736F006C6962442E736F006C69625A2E736F00244F524947494E2F2E2E2F413A244F524947494E2F2E2E2F423A244F524947494E2F2E2E2F443A244F524947494E2F2E2E2F5A" - - Name: .rela.dyn - Type: SHT_RELA - Flags: [ SHF_ALLOC ] - Address: 0x4D0 - Link: .dynsym - AddressAlign: 0x8 - Relocations: - - Offset: 0x3E00 - Type: R_X86_64_RELATIVE - Addend: 4464 - - Offset: 0x3E08 - Type: R_X86_64_RELATIVE - Addend: 4400 - - Offset: 0x4038 - Type: R_X86_64_RELATIVE - Addend: 16440 - - Offset: 0x3FE0 - Symbol: __cxa_finalize - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FE8 - Symbol: _ITM_registerTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF0 - Symbol: _ITM_deregisterTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF8 - Symbol: __gmon_start__ - Type: R_X86_64_GLOB_DAT - - Name: .rela.plt - Type: SHT_RELA - Flags: [ SHF_ALLOC, SHF_INFO_LINK ] - Address: 0x578 - Link: .dynsym - AddressAlign: 0x8 - Info: .got.plt - Relocations: - - Offset: 0x4018 - Symbol: sayD - Type: R_X86_64_JUMP_SLOT - - Offset: 0x4020 - Symbol: sayA - Type: R_X86_64_JUMP_SLOT - - Offset: 0x4028 - Symbol: sayB - Type: R_X86_64_JUMP_SLOT - - Offset: 0x4030 - Symbol: sayZ - Type: R_X86_64_JUMP_SLOT - - Name: .init - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1000 - AddressAlign: 0x4 - Offset: 0x1000 - Content: F30F1EFA4883EC08488B05E92F00004885C07402FFD04883C408C3 - - Name: .plt - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1020 - AddressAlign: 0x10 - EntSize: 0x10 - Content: FF35E22F0000F2FF25E32F00000F1F00F30F1EFA6800000000F2E9E1FFFFFF90F30F1EFA6801000000F2E9D1FFFFFF90F30F1EFA6802000000F2E9C1FFFFFF90F30F1EFA6803000000F2E9B1FFFFFF90 - - Name: .plt.got - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1070 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25652F00000F1F440000 - - Name: .plt.sec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1080 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF258D2F00000F1F440000F30F1EFAF2FF25852F00000F1F440000F30F1EFAF2FF257D2F00000F1F440000F30F1EFAF2FF25752F00000F1F440000 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x10C0 - AddressAlign: 0x10 - Content: 488D3D792F0000488D05722F00004839F87415488B05162F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D492F0000488D35422F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05CD2E00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D052F000000752B5548833D9A2E0000004889E5740C488B3DE62E0000E819FFFFFFE864FFFFFFC605DD2E0000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFFF30F1EFA554889E5B800000000E805FFFFFFB800000000E80BFFFFFFB800000000E8E1FEFFFFB800000000E807FFFFFF905DC3 - - Name: .fini - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x11AC - AddressAlign: 0x4 - Content: F30F1EFA4883EC084883C408C3 - - Name: .eh_frame_hdr - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2000 - AddressAlign: 0x4 - Offset: 0x2000 - Content: 011B033B2C0000000400000020F0FFFF4800000070F0FFFF7000000080F0FFFF8800000079F1FFFFA0000000 - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2030 - AddressAlign: 0x8 - Content: 1400000000000000017A5200017810011B0C070890010000240000001C000000D0EFFFFF50000000000E10460E184A0F0B770880003F1A3A2A332422000000001400000044000000F8EFFFFF100000000000000000000000140000005C000000F0EFFFFF4000000000000000000000001C00000074000000D1F0FFFF3300000000450E108602430D066A0C070800000000000000 - - Name: .init_array - Type: SHT_INIT_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E00 - AddressAlign: 0x8 - EntSize: 0x8 - Offset: 0x2E00 - Content: '7011000000000000' - - Name: .fini_array - Type: SHT_FINI_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E08 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '3011000000000000' - - Name: .dynamic - Type: SHT_DYNAMIC - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E10 - Link: .dynstr - AddressAlign: 0x8 - Entries: - - Tag: DT_NEEDED - Value: 0x0 - - Tag: DT_NEEDED - Value: 0x8 - - Tag: DT_NEEDED - Value: 0x10 - - Tag: DT_NEEDED - Value: 0x18 - - Tag: DT_RUNPATH - Value: 0x20 - - Tag: DT_INIT - Value: 0x1000 - - Tag: DT_FINI - Value: 0x11AC - - Tag: DT_INIT_ARRAY - Value: 0x3E00 - - Tag: DT_INIT_ARRAYSZ - Value: 0x8 - - Tag: DT_FINI_ARRAY - Value: 0x3E08 - - Tag: DT_FINI_ARRAYSZ - Value: 0x8 - - Tag: DT_GNU_HASH - Value: 0x2F0 - - Tag: DT_STRTAB - Value: 0x408 - - Tag: DT_SYMTAB - Value: 0x318 - - Tag: DT_STRSZ - Value: 0xC2 - - Tag: DT_SYMENT - Value: 0x18 - - Tag: DT_PLTGOT - Value: 0x4000 - - Tag: DT_PLTRELSZ - Value: 0x60 - - Tag: DT_PLTREL - Value: 0x7 - - Tag: DT_JMPREL - Value: 0x578 - - Tag: DT_RELA - Value: 0x4D0 - - Tag: DT_RELASZ - Value: 0xA8 - - Tag: DT_RELAENT - Value: 0x18 - - Tag: DT_RELACOUNT - Value: 0x3 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3FE0 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '0000000000000000000000000000000000000000000000000000000000000000' - - Name: .got.plt - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4000 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '103E000000000000000000000000000000000000000000003010000000000000401000000000000050100000000000006010000000000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4038 - AddressAlign: 0x8 - Content: '3840000000000000' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4040 - AddressAlign: 0x1 - Size: 0x8 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x1 - EntSize: 0x1 - Content: 4743433A20285562756E74752031312E342E302D317562756E7475317E32322E30342E32292031312E342E3000 -Symbols: - - Name: crtstuff.c - Type: STT_FILE - Index: SHN_ABS - - Name: deregister_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x10C0 - - Name: register_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x10F0 - - Name: __do_global_dtors_aux - Type: STT_FUNC - Section: .text - Value: 0x1130 - - Name: completed.0 - Type: STT_OBJECT - Section: .bss - Value: 0x4040 - Size: 0x1 - - Name: __do_global_dtors_aux_fini_array_entry - Type: STT_OBJECT - Section: .fini_array - Value: 0x3E08 - - Name: frame_dummy - Type: STT_FUNC - Section: .text - Value: 0x1170 - - Name: __frame_dummy_init_array_entry - Type: STT_OBJECT - Section: .init_array - Value: 0x3E00 - - Name: libC.c - Type: STT_FILE - Index: SHN_ABS - - Name: 'crtstuff.c (1)' - Type: STT_FILE - Index: SHN_ABS - - Name: __FRAME_END__ - Type: STT_OBJECT - Section: .eh_frame - Value: 0x20C0 - - Type: STT_FILE - Index: SHN_ABS - - Name: _DYNAMIC - Type: STT_OBJECT - Section: .dynamic - Value: 0x3E10 - - Name: __TMC_END__ - Type: STT_OBJECT - Section: .data - Value: 0x4040 - - Name: __dso_handle - Type: STT_OBJECT - Section: .data - Value: 0x4038 - - Name: _init - Type: STT_FUNC - Section: .init - Value: 0x1000 - - Name: __GNU_EH_FRAME_HDR - Section: .eh_frame_hdr - Value: 0x2000 - - Name: _fini - Type: STT_FUNC - Section: .fini - Value: 0x11AC - - Name: _GLOBAL_OFFSET_TABLE_ - Type: STT_OBJECT - Section: .got.plt - Value: 0x4000 - - Name: sayD - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __cxa_finalize - Binding: STB_WEAK - - Name: sayC - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1179 - Size: 0x33 - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: sayA - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayB - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayZ - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK -DynamicSymbols: - - Name: sayD - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __cxa_finalize - Binding: STB_WEAK - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: sayA - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayB - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayZ - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: sayC - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1179 - Size: 0x33 -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/C/C_macho.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/C/C_macho.yaml deleted file mode 100644 index f6ad081..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/C/C_macho.yaml +++ /dev/null @@ -1,915 +0,0 @@ ---- !fat-mach-o -FatHeader: - magic: 0xCAFEBABE - nfat_arch: 3 -FatArchs: - - cputype: 0x1000007 - cpusubtype: 0x3 - offset: 0x1000 - size: 8488 - align: 12 - - cputype: 0x100000C - cpusubtype: 0x0 - offset: 0x4000 - size: 33488 - align: 14 - - cputype: 0x100000C - cpusubtype: 0x80000002 - offset: 0x10000 - size: 33488 - align: 14 -Slices: - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x1000007 - cpusubtype: 0x3 - filetype: 0x6 - ncmds: 22 - sizeofcmds: 1200 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 312 - segname: __TEXT - vmaddr: 0 - vmsize: 4096 - fileoff: 0 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 3 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0xF60 - size: 34 - offset: 0xF60 - align: 4 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 554889E5B000E817000000B000E816000000B000E815000000B000E8140000005DC3 - - sectname: __stubs - segname: __TEXT - addr: 0xF82 - size: 24 - offset: 0xF82 - align: 1 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x6 - reserved3: 0x0 - content: FF2578000000FF257A000000FF257C000000FF257E000000 - - sectname: __unwind_info - segname: __TEXT - addr: 0xF9C - size: 88 - offset: 0xF9C - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000600F00004000000040000000820F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000100000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 4096 - vmsize: 4096 - fileoff: 4096 - filesize: 4096 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x1000 - size: 32 - offset: 0x1000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x4 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000001080010000000000108002000000000010800300000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 8192 - vmsize: 4096 - fileoff: 8192 - filesize: 296 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libC.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 8192 - datasize: 120 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 8312 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 8344 - nsyms: 5 - stroff: 8456 - strsize: 32 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 4 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 8424 - nindirectsyms: 8 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 2A1F4EC3-CD6C-3293-9D2B-5D8E42FE51EF - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libB.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libD.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libZ.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../A' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../B' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../D' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../Z' - ZeroPadBytes: 3 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 8336 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 8344 - datasize: 0 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayC - Flags: 0x0 - Address: 0xF60 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 3936 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - - n_strx: 14 - n_type: 0x1 - n_sect: 0 - n_desc: 512 - n_value: 0 - - n_strx: 20 - n_type: 0x1 - n_sect: 0 - n_desc: 768 - n_value: 0 - - n_strx: 26 - n_type: 0x1 - n_sect: 0 - n_desc: 1024 - n_value: 0 - StringTable: - - ' ' - - _sayC - - _sayA - - _sayB - - _sayD - - _sayZ - IndirectSymbols: [ 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4 ] - FunctionStarts: [ 0xF60 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x58, 0x0, 0x0, 0x0, 0x4, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x10, 0x6, 0x0, - 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x2, 0xE, 0x0, 0x0, 0x3, 0x1A, 0x0, 0x0, - 0x4, 0x26, 0x0, 0x0, 0x0, 0x5F, 0x73, 0x61, 0x79, - 0x41, 0x0, 0x5F, 0x73, 0x61, 0x79, 0x42, 0x0, - 0x5F, 0x73, 0x61, 0x79, 0x44, 0x0, 0x5F, 0x73, - 0x61, 0x79, 0x5A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x0 - filetype: 0x6 - ncmds: 23 - sizeofcmds: 1216 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 312 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 3 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F58 - size: 32 - offset: 0x3F58 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: FD7BBFA9FD03009106000094080000940A0000940C000094FD7BC1A8C0035FD6 - - sectname: __stubs - segname: __TEXT - addr: 0x3F78 - size: 48 - offset: 0x3F78 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0xC - reserved3: 0x0 - content: 100000B0100240F900021FD6100000B0100640F900021FD6100000B0100A40F900021FD6100000B0100E40F900021FD6 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000583F00004000000040000000783F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x4000 - size: 32 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x4 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000001080010000000000108002000000000010800300000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 720 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libC.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 120 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32888 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32920 - nsyms: 5 - stroff: 33032 - strsize: 32 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 4 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 33000 - nindirectsyms: 8 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 6DE75070-D632-398D-8BB5-06C8C8B29147 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libB.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libD.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libZ.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../A' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../B' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../D' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../Z' - ZeroPadBytes: 3 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32912 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32920 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 33072 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayC - Flags: 0x0 - Address: 0x3F58 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16216 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - - n_strx: 14 - n_type: 0x1 - n_sect: 0 - n_desc: 512 - n_value: 0 - - n_strx: 20 - n_type: 0x1 - n_sect: 0 - n_desc: 768 - n_value: 0 - - n_strx: 26 - n_type: 0x1 - n_sect: 0 - n_desc: 1024 - n_value: 0 - StringTable: - - ' ' - - _sayC - - _sayA - - _sayB - - _sayD - - _sayZ - IndirectSymbols: [ 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4 ] - FunctionStarts: [ 0x3F58 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x58, 0x0, 0x0, 0x0, 0x4, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0x6, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x2, 0xE, 0x0, 0x0, 0x3, 0x1A, 0x0, 0x0, - 0x4, 0x26, 0x0, 0x0, 0x0, 0x5F, 0x73, 0x61, 0x79, - 0x41, 0x0, 0x5F, 0x73, 0x61, 0x79, 0x42, 0x0, - 0x5F, 0x73, 0x61, 0x79, 0x44, 0x0, 0x5F, 0x73, - 0x61, 0x79, 0x5A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x80000002 - filetype: 0x6 - ncmds: 23 - sizeofcmds: 1216 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 312 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 3 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F44 - size: 36 - offset: 0x3F44 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 7F2303D5FD7BBFA9FD03009106000094090000940C0000940F000094FD7BC1A8FF0F5FD6 - - sectname: __auth_stubs - segname: __TEXT - addr: 0x3F68 - size: 64 - offset: 0x3F68 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x10 - reserved3: 0x0 - content: 110000B031020091300240F9110A1FD7110000B031220091300240F9110A1FD7110000B031420091300240F9110A1FD7110000B031620091300240F9110A1FD7 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000443F00004000000040000000683F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __auth_got - segname: __DATA_CONST - addr: 0x4000 - size: 32 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x4 - reserved2: 0x0 - reserved3: 0x0 - content: 00000000000009C001000000000009C002000000000009C003000000000001C0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 720 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libC.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 120 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32888 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32920 - nsyms: 5 - stroff: 33032 - strsize: 32 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 4 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 33000 - nindirectsyms: 8 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: C1E8A3F5-14B1-3BF2-B737-18AB98364487 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libB.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libD.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libZ.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../A' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../B' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../D' - ZeroPadBytes: 3 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../Z' - ZeroPadBytes: 3 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32912 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32920 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 33072 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayC - Flags: 0x0 - Address: 0x3F44 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16196 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - - n_strx: 14 - n_type: 0x1 - n_sect: 0 - n_desc: 512 - n_value: 0 - - n_strx: 20 - n_type: 0x1 - n_sect: 0 - n_desc: 768 - n_value: 0 - - n_strx: 26 - n_type: 0x1 - n_sect: 0 - n_desc: 1024 - n_value: 0 - StringTable: - - ' ' - - _sayC - - _sayA - - _sayB - - _sayD - - _sayZ - IndirectSymbols: [ 0x1, 0x2, 0x3, 0x4, 0x1, 0x2, 0x3, 0x4 ] - FunctionStarts: [ 0x3F44 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x58, 0x0, 0x0, 0x0, 0x4, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0xC, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x2, 0xE, 0x0, 0x0, 0x3, 0x1A, 0x0, 0x0, - 0x4, 0x26, 0x0, 0x0, 0x0, 0x5F, 0x73, 0x61, 0x79, - 0x41, 0x0, 0x5F, 0x73, 0x61, 0x79, 0x42, 0x0, - 0x5F, 0x73, 0x61, 0x79, 0x44, 0x0, 0x5F, 0x73, - 0x61, 0x79, 0x5A, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0 ] -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/D/D_linux.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/D/D_linux.yaml deleted file mode 100644 index f4f2f36..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/D/D_linux.yaml +++ /dev/null @@ -1,479 +0,0 @@ ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -ProgramHeaders: - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .rela.plt - Align: 0x1000 - Offset: 0x0 - - Type: PT_LOAD - Flags: [ PF_X, PF_R ] - FirstSec: .init - LastSec: .fini - VAddr: 0x1000 - Align: 0x1000 - Offset: 0x1000 - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .rodata - LastSec: .eh_frame - VAddr: 0x2000 - Align: 0x1000 - Offset: 0x2000 - - Type: PT_LOAD - Flags: [ PF_W, PF_R ] - FirstSec: .init_array - LastSec: .bss - VAddr: 0x3DF0 - Align: 0x1000 - Offset: 0x2DF0 - - Type: PT_DYNAMIC - Flags: [ PF_W, PF_R ] - FirstSec: .dynamic - LastSec: .dynamic - VAddr: 0x3E00 - Align: 0x8 - Offset: 0x2E00 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.build-id - LastSec: .note.gnu.build-id - VAddr: 0x2C8 - Align: 0x4 - Offset: 0x2C8 - - Type: PT_GNU_PROPERTY - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_GNU_EH_FRAME - Flags: [ PF_R ] - FirstSec: .eh_frame_hdr - LastSec: .eh_frame_hdr - VAddr: 0x2010 - Align: 0x4 - Offset: 0x2010 - - Type: PT_GNU_STACK - Flags: [ PF_W, PF_R ] - Align: 0x10 - Offset: 0x0 - - Type: PT_GNU_RELRO - Flags: [ PF_R ] - FirstSec: .init_array - LastSec: .got - VAddr: 0x3DF0 - Offset: 0x2DF0 -Sections: - - Name: .note.gnu.property - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2A8 - AddressAlign: 0x8 - Notes: - - Name: GNU - Desc: 020000C0040000000300000000000000 - Type: NT_GNU_PROPERTY_TYPE_0 - - Name: .note.gnu.build-id - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2C8 - AddressAlign: 0x4 - Notes: - - Name: GNU - Desc: 6A0CC906C743C23E1400FDD239CF755466AB3E7B - Type: NT_PRPSINFO - - Name: .gnu.hash - Type: SHT_GNU_HASH - Flags: [ SHF_ALLOC ] - Address: 0x2F0 - Link: .dynsym - AddressAlign: 0x8 - Header: - SymNdx: 0x7 - Shift2: 0x6 - BloomFilter: [ 0x400000400000 ] - HashBuckets: [ 0x7, 0x0 ] - HashValues: [ 0x7C9DCB97 ] - - Name: .dynsym - Type: SHT_DYNSYM - Flags: [ SHF_ALLOC ] - Address: 0x318 - Link: .dynstr - AddressAlign: 0x8 - - Name: .dynstr - Type: SHT_STRTAB - Flags: [ SHF_ALLOC ] - Address: 0x3D8 - AddressAlign: 0x1 - Content: "6C6962412E736F006C6962632E736F2E3600244F524947494E2F2E2E2F4100" - - Name: .gnu.version - Type: SHT_GNU_versym - Flags: [ SHF_ALLOC ] - Address: 0x468 - Link: .dynsym - AddressAlign: 0x2 - Entries: [ 0, 1, 2, 1, 1, 1, 2, 1 ] - - Name: .gnu.version_r - Type: SHT_GNU_verneed - Flags: [ SHF_ALLOC ] - Address: 0x478 - Link: .dynstr - AddressAlign: 0x8 - Dependencies: - - Version: 1 - File: libc.so.6 - Entries: - - Name: GLIBC_2.2.5 - Hash: 157882997 - Flags: 0 - Other: 2 - - Name: .rela.dyn - Type: SHT_RELA - Flags: [ SHF_ALLOC ] - Address: 0x498 - Link: .dynsym - AddressAlign: 0x8 - Relocations: - - Offset: 0x3DF0 - Type: R_X86_64_RELATIVE - Addend: 4400 - - Offset: 0x3DF8 - Type: R_X86_64_RELATIVE - Addend: 4336 - - Offset: 0x4028 - Type: R_X86_64_RELATIVE - Addend: 16424 - - Offset: 0x3FE0 - Symbol: _ITM_deregisterTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FE8 - Symbol: __gmon_start__ - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF0 - Symbol: _ITM_registerTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF8 - Symbol: __cxa_finalize - Type: R_X86_64_GLOB_DAT - - Name: .rela.plt - Type: SHT_RELA - Flags: [ SHF_ALLOC, SHF_INFO_LINK ] - Address: 0x540 - Link: .dynsym - AddressAlign: 0x8 - Info: .got.plt - Relocations: - - Offset: 0x4018 - Symbol: puts - Type: R_X86_64_JUMP_SLOT - - Offset: 0x4020 - Symbol: sayA - Type: R_X86_64_JUMP_SLOT - - Name: .init - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1000 - AddressAlign: 0x4 - Offset: 0x1000 - Content: F30F1EFA4883EC08488B05D92F00004885C07402FFD04883C408C3 - - Name: .plt - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1020 - AddressAlign: 0x10 - EntSize: 0x10 - Content: FF35E22F0000F2FF25E32F00000F1F00F30F1EFA6800000000F2E9E1FFFFFF90F30F1EFA6801000000F2E9D1FFFFFF90 - - Name: .plt.got - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1050 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF259D2F00000F1F440000 - - Name: .plt.sec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1060 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25AD2F00000F1F440000F30F1EFAF2FF25A52F00000F1F440000 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1080 - AddressAlign: 0x10 - Content: 488D3DA92F0000488D05A22F00004839F87415488B05462F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D792F0000488D35722F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05152F00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D352F000000752B5548833DF22E0000004889E5740C488B3D162F0000E839FFFFFFE864FFFFFFC6050D2F0000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFFF30F1EFA554889E5B800000000E825FFFFFF905DC3F30F1EFA554889E5488D05A30E00004889C7E8FBFEFFFF905DC3 - - Name: .fini - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1168 - AddressAlign: 0x4 - Content: F30F1EFA4883EC084883C408C3 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2000 - AddressAlign: 0x1 - Offset: 0x2000 - Content: 48656C6C6F2066726F6D20442100 - - Name: .eh_frame_hdr - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2010 - AddressAlign: 0x4 - Content: 011B033B340000000500000010F0FFFF5000000040F0FFFF7800000050F0FFFF9000000029F1FFFFA80000003EF1FFFFC8000000 - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2048 - AddressAlign: 0x8 - Content: 1400000000000000017A5200017810011B0C070890010000240000001C000000B8EFFFFF30000000000E10460E184A0F0B770880003F1A3A2A332422000000001400000044000000C0EFFFFF100000000000000000000000140000005C000000B8EFFFFF2000000000000000000000001C0000007400000079F0FFFF1500000000450E108602430D064C0C07080000001C000000940000006EF0FFFF1A00000000450E108602430D06510C070800000000000000 - - Name: .init_array - Type: SHT_INIT_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3DF0 - AddressAlign: 0x8 - EntSize: 0x8 - Offset: 0x2DF0 - Content: '3011000000000000' - - Name: .fini_array - Type: SHT_FINI_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3DF8 - AddressAlign: 0x8 - EntSize: 0x8 - Content: F010000000000000 - - Name: .dynamic - Type: SHT_DYNAMIC - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E00 - Link: .dynstr - AddressAlign: 0x8 - Entries: - - Tag: DT_NEEDED - Value: 0x00 - - Tag: DT_NEEDED - Value: 0x08 - - Tag: DT_RUNPATH - Value: 0x12 - - Tag: DT_INIT - Value: 0x1000 - - Tag: DT_FINI - Value: 0x1168 - - Tag: DT_INIT_ARRAY - Value: 0x3DF0 - - Tag: DT_INIT_ARRAYSZ - Value: 0x8 - - Tag: DT_FINI_ARRAY - Value: 0x3DF8 - - Tag: DT_FINI_ARRAYSZ - Value: 0x8 - - Tag: DT_GNU_HASH - Value: 0x2F0 - - Tag: DT_STRTAB - Value: 0x3D8 - - Tag: DT_SYMTAB - Value: 0x318 - - Tag: DT_STRSZ - Value: 0x8F - - Tag: DT_SYMENT - Value: 0x18 - - Tag: DT_PLTGOT - Value: 0x4000 - - Tag: DT_PLTRELSZ - Value: 0x30 - - Tag: DT_PLTREL - Value: 0x7 - - Tag: DT_JMPREL - Value: 0x540 - - Tag: DT_RELA - Value: 0x498 - - Tag: DT_RELASZ - Value: 0xA8 - - Tag: DT_RELAENT - Value: 0x18 - - Tag: DT_VERNEED - Value: 0x478 - - Tag: DT_VERNEEDNUM - Value: 0x1 - - Tag: DT_VERSYM - Value: 0x468 - - Tag: DT_RELACOUNT - Value: 0x3 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3FE0 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '0000000000000000000000000000000000000000000000000000000000000000' - - Name: .got.plt - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4000 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '003E0000000000000000000000000000000000000000000030100000000000004010000000000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4028 - AddressAlign: 0x8 - Content: '2840000000000000' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4030 - AddressAlign: 0x1 - Size: 0x8 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x1 - EntSize: 0x1 - Content: 4743433A20285562756E74752031312E342E302D317562756E7475317E32322E30342E32292031312E342E3000 -Symbols: - - Name: crtstuff.c - Type: STT_FILE - Index: SHN_ABS - - Name: deregister_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1080 - - Name: register_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x10B0 - - Name: __do_global_dtors_aux - Type: STT_FUNC - Section: .text - Value: 0x10F0 - - Name: completed.0 - Type: STT_OBJECT - Section: .bss - Value: 0x4030 - Size: 0x1 - - Name: __do_global_dtors_aux_fini_array_entry - Type: STT_OBJECT - Section: .fini_array - Value: 0x3DF8 - - Name: frame_dummy - Type: STT_FUNC - Section: .text - Value: 0x1130 - - Name: __frame_dummy_init_array_entry - Type: STT_OBJECT - Section: .init_array - Value: 0x3DF0 - - Name: libD.c - Type: STT_FILE - Index: SHN_ABS - - Name: keepSayA - Type: STT_FUNC - Section: .text - Value: 0x1139 - Size: 0x15 - - Name: 'crtstuff.c (1)' - Type: STT_FILE - Index: SHN_ABS - - Name: __FRAME_END__ - Type: STT_OBJECT - Section: .eh_frame - Value: 0x20F8 - - Type: STT_FILE - Index: SHN_ABS - - Name: _fini - Type: STT_FUNC - Section: .fini - Value: 0x1168 - - Name: __dso_handle - Type: STT_OBJECT - Section: .data - Value: 0x4028 - - Name: _DYNAMIC - Type: STT_OBJECT - Section: .dynamic - Value: 0x3E00 - - Name: __GNU_EH_FRAME_HDR - Section: .eh_frame_hdr - Value: 0x2010 - - Name: __TMC_END__ - Type: STT_OBJECT - Section: .data - Value: 0x4030 - - Name: _GLOBAL_OFFSET_TABLE_ - Type: STT_OBJECT - Section: .got.plt - Value: 0x4000 - - Name: _init - Type: STT_FUNC - Section: .init - Value: 0x1000 - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: 'puts@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayA - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: sayD - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x114E - Size: 0x1A - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: '__cxa_finalize@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_WEAK -DynamicSymbols: - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: puts - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: sayA - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: __cxa_finalize - Type: STT_FUNC - Binding: STB_WEAK - - Name: sayD - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x114E - Size: 0x1A -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/D/D_macho.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/D/D_macho.yaml deleted file mode 100644 index 1f80c1d..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/D/D_macho.yaml +++ /dev/null @@ -1,801 +0,0 @@ ---- !fat-mach-o -FatHeader: - magic: 0xCAFEBABE - nfat_arch: 3 -FatArchs: - - cputype: 0x1000007 - cpusubtype: 0x3 - offset: 0x1000 - size: 8432 - align: 12 - - cputype: 0x100000C - cpusubtype: 0x0 - offset: 0x4000 - size: 33424 - align: 14 - - cputype: 0x100000C - cpusubtype: 0x80000002 - offset: 0x10000 - size: 33424 - align: 14 -Slices: - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x1000007 - cpusubtype: 0x3 - filetype: 0x6 - ncmds: 16 - sizeofcmds: 1040 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 4096 - fileoff: 0 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0xF60 - size: 36 - offset: 0xF60 - align: 4 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 554889E5B000E81F0000005DC30F1F00554889E5488D3D15000000B000E8020000005DC3 - - sectname: __stubs - segname: __TEXT - addr: 0xF84 - size: 12 - offset: 0xF84 - align: 1 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x6 - reserved3: 0x0 - content: FF2576000000FF2578000000 - - sectname: __cstring - segname: __TEXT - addr: 0xF90 - size: 15 - offset: 0xF90 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D2044210A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0xFA0 - size: 88 - offset: 0xFA0 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000600F00004000000040000000840F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000100000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 4096 - vmsize: 4096 - fileoff: 4096 - filesize: 4096 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x1000 - size: 16 - offset: 0x1000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x2 - reserved2: 0x0 - reserved3: 0x0 - content: '00000000000010800100000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 8192 - vmsize: 4096 - fileoff: 8192 - filesize: 240 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libD.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 8192 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 8288 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 8320 - nsyms: 4 - stroff: 8400 - strsize: 32 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 1 - iextdefsym: 1 - nextdefsym: 1 - iundefsym: 2 - nundefsym: 2 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 8384 - nindirectsyms: 4 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 8B5D4A65-6C4F-3D34-9294-26E03CFBD3AE - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../A' - ZeroPadBytes: 3 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 8312 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 8320 - datasize: 0 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayD - Flags: 0x0 - Address: 0xF70 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 22 - n_type: 0xE - n_sect: 1 - n_desc: 0 - n_value: 3936 - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 3952 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 512 - n_value: 0 - - n_strx: 16 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayD - - _printf - - _sayA - - _keepSayA - IndirectSymbols: [ 0x2, 0x3, 0x2, 0x3 ] - FunctionStarts: [ 0xF60, 0xF70 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x2, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x10, 0x6, 0x0, - 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x2, 0x0, - 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x5F, 0x73, 0x61, - 0x79, 0x41, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x0 - filetype: 0x6 - ncmds: 17 - sizeofcmds: 1056 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F50 - size: 48 - offset: 0x3F50 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: FD7BBFA9FD0300910D000094FD7BC1A8C0035FD6FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8C0035FD6 - - sectname: __stubs - segname: __TEXT - addr: 0x3F80 - size: 24 - offset: 0x3F80 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0xC - reserved3: 0x0 - content: 100000B0100240F900021FD6100000B0100640F900021FD6 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 15 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D2044210A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000503F00004000000040000000803F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x4000 - size: 16 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x2 - reserved2: 0x0 - reserved3: 0x0 - content: '00000000000010800100000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 656 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libD.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 4 - stroff: 32976 - strsize: 32 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 1 - iextdefsym: 1 - nextdefsym: 1 - iundefsym: 2 - nundefsym: 2 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32960 - nindirectsyms: 4 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 5898A6CE-0F78-3CA2-8F7D-B1AAAF26C49F - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../A' - ZeroPadBytes: 3 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 33008 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayD - Flags: 0x0 - Address: 0x3F64 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 22 - n_type: 0xE - n_sect: 1 - n_desc: 0 - n_value: 16208 - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16228 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 512 - n_value: 0 - - n_strx: 16 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayD - - _printf - - _sayA - - _keepSayA - IndirectSymbols: [ 0x2, 0x3, 0x2, 0x3 ] - FunctionStarts: [ 0x3F50, 0x3F64 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x2, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0x6, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x2, 0x0, - 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x5F, 0x73, 0x61, - 0x79, 0x41, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x80000002 - filetype: 0x6 - ncmds: 17 - sizeofcmds: 1056 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F40 - size: 56 - offset: 0x3F40 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 7F2303D5FD7BBFA9FD0300910F000094FD7BC1A8FF0F5FD67F2303D5FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8FF0F5FD6 - - sectname: __auth_stubs - segname: __TEXT - addr: 0x3F78 - size: 32 - offset: 0x3F78 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x10 - reserved3: 0x0 - content: 110000B031020091300240F9110A1FD7110000B031220091300240F9110A1FD7 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 15 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D2044210A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000403F00004000000040000000783F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __auth_got - segname: __DATA_CONST - addr: 0x4000 - size: 16 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x2 - reserved2: 0x0 - reserved3: 0x0 - content: 00000000000009C001000000000001C0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 656 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libD.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 4 - stroff: 32976 - strsize: 32 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 1 - iextdefsym: 1 - nextdefsym: 1 - iundefsym: 2 - nundefsym: 2 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32960 - nindirectsyms: 4 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 81A288C4-6F51-3913-9330-EDE155D1DD35 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 2 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libA.dylib' - ZeroPadBytes: 7 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_RPATH - cmdsize: 32 - path: 12 - Content: '@loader_path/../A' - ZeroPadBytes: 3 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 33008 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayD - Flags: 0x0 - Address: 0x3F58 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 22 - n_type: 0xE - n_sect: 1 - n_desc: 0 - n_value: 16192 - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16216 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 512 - n_value: 0 - - n_strx: 16 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayD - - _printf - - _sayA - - _keepSayA - IndirectSymbols: [ 0x2, 0x3, 0x2, 0x3 ] - FunctionStarts: [ 0x3F40, 0x3F58 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x2, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0xC, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x2, 0x0, - 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x5F, 0x73, 0x61, - 0x79, 0x41, 0x0, 0x0 ] -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/Z/Z_linux.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/Z/Z_linux.yaml deleted file mode 100644 index 5561f29..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/Z/Z_linux.yaml +++ /dev/null @@ -1,460 +0,0 @@ ---- !ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_DYN - Machine: EM_X86_64 -ProgramHeaders: - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .rela.plt - Align: 0x1000 - Offset: 0x0 - - Type: PT_LOAD - Flags: [ PF_X, PF_R ] - FirstSec: .init - LastSec: .fini - VAddr: 0x1000 - Align: 0x1000 - Offset: 0x1000 - - Type: PT_LOAD - Flags: [ PF_R ] - FirstSec: .rodata - LastSec: .eh_frame - VAddr: 0x2000 - Align: 0x1000 - Offset: 0x2000 - - Type: PT_LOAD - Flags: [ PF_W, PF_R ] - FirstSec: .init_array - LastSec: .bss - VAddr: 0x3E10 - Align: 0x1000 - Offset: 0x2E10 - - Type: PT_DYNAMIC - Flags: [ PF_W, PF_R ] - FirstSec: .dynamic - LastSec: .dynamic - VAddr: 0x3E20 - Align: 0x8 - Offset: 0x2E20 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_NOTE - Flags: [ PF_R ] - FirstSec: .note.gnu.build-id - LastSec: .note.gnu.build-id - VAddr: 0x2C8 - Align: 0x4 - Offset: 0x2C8 - - Type: PT_GNU_PROPERTY - Flags: [ PF_R ] - FirstSec: .note.gnu.property - LastSec: .note.gnu.property - VAddr: 0x2A8 - Align: 0x8 - Offset: 0x2A8 - - Type: PT_GNU_EH_FRAME - Flags: [ PF_R ] - FirstSec: .eh_frame_hdr - LastSec: .eh_frame_hdr - VAddr: 0x2010 - Align: 0x4 - Offset: 0x2010 - - Type: PT_GNU_STACK - Flags: [ PF_W, PF_R ] - Align: 0x10 - Offset: 0x0 - - Type: PT_GNU_RELRO - Flags: [ PF_R ] - FirstSec: .init_array - LastSec: .got - VAddr: 0x3E10 - Offset: 0x2E10 -Sections: - - Name: .note.gnu.property - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2A8 - AddressAlign: 0x8 - Notes: - - Name: GNU - Desc: 020000C0040000000300000000000000 - Type: NT_GNU_PROPERTY_TYPE_0 - - Name: .note.gnu.build-id - Type: SHT_NOTE - Flags: [ SHF_ALLOC ] - Address: 0x2C8 - AddressAlign: 0x4 - Notes: - - Name: GNU - Desc: 640A4A3AC0DF6BA3DAC3B51CCD727245117E0B30 - Type: NT_PRPSINFO - - Name: .gnu.hash - Type: SHT_GNU_HASH - Flags: [ SHF_ALLOC ] - Address: 0x2F0 - Link: .dynsym - AddressAlign: 0x8 - Header: - SymNdx: 0x6 - Shift2: 0x6 - BloomFilter: [ 0x500000000000 ] - HashBuckets: [ 0x6, 0x0 ] - HashValues: [ 0x7C9DCBAD ] - - Name: .dynsym - Type: SHT_DYNSYM - Flags: [ SHF_ALLOC ] - Address: 0x318 - Link: .dynstr - AddressAlign: 0x8 - - Name: .dynstr - Type: SHT_STRTAB - Flags: [ SHF_ALLOC ] - Address: 0x3C0 - AddressAlign: 0x1 - - Name: .gnu.version - Type: SHT_GNU_versym - Flags: [ SHF_ALLOC ] - Address: 0x436 - Link: .dynsym - AddressAlign: 0x2 - Entries: [ 0, 1, 2, 1, 1, 2, 1 ] - - Name: .gnu.version_r - Type: SHT_GNU_verneed - Flags: [ SHF_ALLOC ] - Address: 0x448 - Link: .dynstr - AddressAlign: 0x8 - Dependencies: - - Version: 1 - File: libc.so.6 - Entries: - - Name: GLIBC_2.2.5 - Hash: 157882997 - Flags: 0 - Other: 2 - - Name: .rela.dyn - Type: SHT_RELA - Flags: [ SHF_ALLOC ] - Address: 0x468 - Link: .dynsym - AddressAlign: 0x8 - Relocations: - - Offset: 0x3E10 - Type: R_X86_64_RELATIVE - Addend: 4368 - - Offset: 0x3E18 - Type: R_X86_64_RELATIVE - Addend: 4304 - - Offset: 0x4020 - Type: R_X86_64_RELATIVE - Addend: 16416 - - Offset: 0x3FE0 - Symbol: _ITM_deregisterTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FE8 - Symbol: __gmon_start__ - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF0 - Symbol: _ITM_registerTMCloneTable - Type: R_X86_64_GLOB_DAT - - Offset: 0x3FF8 - Symbol: __cxa_finalize - Type: R_X86_64_GLOB_DAT - - Name: .rela.plt - Type: SHT_RELA - Flags: [ SHF_ALLOC, SHF_INFO_LINK ] - Address: 0x510 - Link: .dynsym - AddressAlign: 0x8 - Info: .got.plt - Relocations: - - Offset: 0x4018 - Symbol: puts - Type: R_X86_64_JUMP_SLOT - - Name: .init - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1000 - AddressAlign: 0x4 - Offset: 0x1000 - Content: F30F1EFA4883EC08488B05D92F00004885C07402FFD04883C408C3 - - Name: .plt - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1020 - AddressAlign: 0x10 - EntSize: 0x10 - Content: FF35E22F0000F2FF25E32F00000F1F00F30F1EFA6800000000F2E9E1FFFFFF90 - - Name: .plt.got - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1040 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25AD2F00000F1F440000 - - Name: .plt.sec - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1050 - AddressAlign: 0x10 - EntSize: 0x10 - Content: F30F1EFAF2FF25BD2F00000F1F440000 - - Name: .text - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1060 - AddressAlign: 0x10 - Content: 488D3DC12F0000488D05BA2F00004839F87415488B05662F00004885C07409FFE00F1F8000000000C30F1F8000000000488D3D912F0000488D358A2F00004829FE4889F048C1EE3F48C1F8034801C648D1FE7414488B05352F00004885C07408FFE0660F1F440000C30F1F8000000000F30F1EFA803D4D2F000000752B5548833D122F0000004889E5740C488B3D2E2F0000E849FFFFFFE864FFFFFFC605252F0000015DC30F1F00C30F1F8000000000F30F1EFAE977FFFFFFF30F1EFA554889E5488D05D80E00004889C7E820FFFFFF905DC3 - - Name: .fini - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC, SHF_EXECINSTR ] - Address: 0x1134 - AddressAlign: 0x4 - Content: F30F1EFA4883EC084883C408C3 - - Name: .rodata - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2000 - AddressAlign: 0x1 - Offset: 0x2000 - Content: 48656C6C6F2066726F6D205A00 - - Name: .eh_frame_hdr - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2010 - AddressAlign: 0x4 - Content: 011B033B2C0000000400000010F0FFFF4800000030F0FFFF7000000040F0FFFF8800000009F1FFFFA0000000 - - Name: .eh_frame - Type: SHT_PROGBITS - Flags: [ SHF_ALLOC ] - Address: 0x2040 - AddressAlign: 0x8 - Content: 1400000000000000017A5200017810011B0C070890010000240000001C000000C0EFFFFF20000000000E10460E184A0F0B770880003F1A3A2A332422000000001400000044000000B8EFFFFF100000000000000000000000140000005C000000B0EFFFFF1000000000000000000000001C0000007400000061F0FFFF1A00000000450E108602430D06510C070800000000000000 - - Name: .init_array - Type: SHT_INIT_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E10 - AddressAlign: 0x8 - EntSize: 0x8 - Offset: 0x2E10 - Content: '1011000000000000' - - Name: .fini_array - Type: SHT_FINI_ARRAY - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E18 - AddressAlign: 0x8 - EntSize: 0x8 - Content: D010000000000000 - - Name: .dynamic - Type: SHT_DYNAMIC - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3E20 - Link: .dynstr - AddressAlign: 0x8 - Entries: - - Tag: DT_NEEDED - Value: 0x5F - - Tag: DT_INIT - Value: 0x1000 - - Tag: DT_FINI - Value: 0x1134 - - Tag: DT_INIT_ARRAY - Value: 0x3E10 - - Tag: DT_INIT_ARRAYSZ - Value: 0x8 - - Tag: DT_FINI_ARRAY - Value: 0x3E18 - - Tag: DT_FINI_ARRAYSZ - Value: 0x8 - - Tag: DT_GNU_HASH - Value: 0x2F0 - - Tag: DT_STRTAB - Value: 0x3C0 - - Tag: DT_SYMTAB - Value: 0x318 - - Tag: DT_STRSZ - Value: 0x75 - - Tag: DT_SYMENT - Value: 0x18 - - Tag: DT_PLTGOT - Value: 0x4000 - - Tag: DT_PLTRELSZ - Value: 0x18 - - Tag: DT_PLTREL - Value: 0x7 - - Tag: DT_JMPREL - Value: 0x510 - - Tag: DT_RELA - Value: 0x468 - - Tag: DT_RELASZ - Value: 0xA8 - - Tag: DT_RELAENT - Value: 0x18 - - Tag: DT_VERNEED - Value: 0x448 - - Tag: DT_VERNEEDNUM - Value: 0x1 - - Tag: DT_VERSYM - Value: 0x436 - - Tag: DT_RELACOUNT - Value: 0x3 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Tag: DT_NULL - Value: 0x0 - - Name: .got - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x3FE0 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '0000000000000000000000000000000000000000000000000000000000000000' - - Name: .got.plt - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4000 - AddressAlign: 0x8 - EntSize: 0x8 - Content: '203E000000000000000000000000000000000000000000003010000000000000' - - Name: .data - Type: SHT_PROGBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4020 - AddressAlign: 0x8 - Content: '2040000000000000' - - Name: .bss - Type: SHT_NOBITS - Flags: [ SHF_WRITE, SHF_ALLOC ] - Address: 0x4028 - AddressAlign: 0x1 - Size: 0x8 - - Name: .comment - Type: SHT_PROGBITS - Flags: [ SHF_MERGE, SHF_STRINGS ] - AddressAlign: 0x1 - EntSize: 0x1 - Content: 4743433A20285562756E74752031312E342E302D317562756E7475317E32322E30342E32292031312E342E3000 -Symbols: - - Name: crtstuff.c - Type: STT_FILE - Index: SHN_ABS - - Name: deregister_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1060 - - Name: register_tm_clones - Type: STT_FUNC - Section: .text - Value: 0x1090 - - Name: __do_global_dtors_aux - Type: STT_FUNC - Section: .text - Value: 0x10D0 - - Name: completed.0 - Type: STT_OBJECT - Section: .bss - Value: 0x4028 - Size: 0x1 - - Name: __do_global_dtors_aux_fini_array_entry - Type: STT_OBJECT - Section: .fini_array - Value: 0x3E18 - - Name: frame_dummy - Type: STT_FUNC - Section: .text - Value: 0x1110 - - Name: __frame_dummy_init_array_entry - Type: STT_OBJECT - Section: .init_array - Value: 0x3E10 - - Name: libZ.c - Type: STT_FILE - Index: SHN_ABS - - Name: 'crtstuff.c (1)' - Type: STT_FILE - Index: SHN_ABS - - Name: __FRAME_END__ - Type: STT_OBJECT - Section: .eh_frame - Value: 0x20D0 - - Type: STT_FILE - Index: SHN_ABS - - Name: _fini - Type: STT_FUNC - Section: .fini - Value: 0x1134 - - Name: __dso_handle - Type: STT_OBJECT - Section: .data - Value: 0x4020 - - Name: _DYNAMIC - Type: STT_OBJECT - Section: .dynamic - Value: 0x3E20 - - Name: __GNU_EH_FRAME_HDR - Section: .eh_frame_hdr - Value: 0x2010 - - Name: __TMC_END__ - Type: STT_OBJECT - Section: .data - Value: 0x4028 - - Name: _GLOBAL_OFFSET_TABLE_ - Type: STT_OBJECT - Section: .got.plt - Value: 0x4000 - - Name: _init - Type: STT_FUNC - Section: .init - Value: 0x1000 - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: 'puts@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: sayZ - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1119 - Size: 0x1A - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: '__cxa_finalize@GLIBC_2.2.5' - Type: STT_FUNC - Binding: STB_WEAK -DynamicSymbols: - - Name: _ITM_deregisterTMCloneTable - Binding: STB_WEAK - - Name: puts - Type: STT_FUNC - Binding: STB_GLOBAL - - Name: __gmon_start__ - Binding: STB_WEAK - - Name: _ITM_registerTMCloneTable - Binding: STB_WEAK - - Name: __cxa_finalize - Type: STT_FUNC - Binding: STB_WEAK - - Name: sayZ - Type: STT_FUNC - Section: .text - Binding: STB_GLOBAL - Value: 0x1119 - Size: 0x1A -... diff --git a/llvm/unittests/ExecutionEngine/Orc/Inputs/Z/Z_macho.yaml b/llvm/unittests/ExecutionEngine/Orc/Inputs/Z/Z_macho.yaml deleted file mode 100644 index c0c1826..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/Inputs/Z/Z_macho.yaml +++ /dev/null @@ -1,723 +0,0 @@ ---- !fat-mach-o -FatHeader: - magic: 0xCAFEBABE - nfat_arch: 3 -FatArchs: - - cputype: 0x1000007 - cpusubtype: 0x3 - offset: 0x1000 - size: 8376 - align: 12 - - cputype: 0x100000C - cpusubtype: 0x0 - offset: 0x4000 - size: 33376 - align: 14 - - cputype: 0x100000C - cpusubtype: 0x80000002 - offset: 0x10000 - size: 33376 - align: 14 -Slices: - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x1000007 - cpusubtype: 0x3 - filetype: 0x6 - ncmds: 14 - sizeofcmds: 960 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 4096 - fileoff: 0 - filesize: 4096 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0xF80 - size: 20 - offset: 0xF80 - align: 4 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 554889E5488D3D0F000000B000E8020000005DC3 - - sectname: __stubs - segname: __TEXT - addr: 0xF94 - size: 6 - offset: 0xF94 - align: 1 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x6 - reserved3: 0x0 - content: FF2566000000 - - sectname: __cstring - segname: __TEXT - addr: 0xF9A - size: 14 - offset: 0xF9A - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D205A0A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0xFA8 - size: 88 - offset: 0xFA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000800F00004000000040000000940F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000100000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 4096 - vmsize: 4096 - fileoff: 4096 - filesize: 4096 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x1000 - size: 8 - offset: 0x1000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 8192 - vmsize: 4096 - fileoff: 8192 - filesize: 184 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libZ.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 8192 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 8288 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 8320 - nsyms: 2 - stroff: 8360 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 8352 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 399E203C-FF9A-3B80-872C-85F3A759A78B - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 8312 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 8320 - datasize: 0 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayZ - Flags: 0x0 - Address: 0xF80 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 3968 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayZ - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0xF80 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x10, 0x6, 0x0, - 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x0 - filetype: 0x6 - ncmds: 15 - sizeofcmds: 976 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F70 - size: 28 - offset: 0x3F70 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8C0035FD6 - - sectname: __stubs - segname: __TEXT - addr: 0x3F8C - size: 12 - offset: 0x3F8C - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0xC - reserved3: 0x0 - content: 100000B0100240F900021FD6 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 14 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D205A0A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000703F000040000000400000008C3F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __got - segname: __DATA_CONST - addr: 0x4000 - size: 8 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: '0000000000000080' - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 608 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libZ.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 2 - stroff: 32936 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32928 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: 6E8E78AF-EDB2-3830-BE1E-013390302CC5 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 32960 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayZ - Flags: 0x0 - Address: 0x3F70 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16240 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayZ - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0x3F70 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0x6, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] - - !mach-o - FileHeader: - magic: 0xFEEDFACF - cputype: 0x100000C - cpusubtype: 0x80000002 - filetype: 0x6 - ncmds: 15 - sizeofcmds: 976 - flags: 0x100085 - reserved: 0x0 - LoadCommands: - - cmd: LC_SEGMENT_64 - cmdsize: 392 - segname: __TEXT - vmaddr: 0 - vmsize: 16384 - fileoff: 0 - filesize: 16384 - maxprot: 5 - initprot: 5 - nsects: 4 - flags: 0 - Sections: - - sectname: __text - segname: __TEXT - addr: 0x3F68 - size: 32 - offset: 0x3F68 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000400 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 7F2303D5FD7BBFA9FD0300910000009000603E9103000094FD7BC1A8FF0F5FD6 - - sectname: __auth_stubs - segname: __TEXT - addr: 0x3F88 - size: 16 - offset: 0x3F88 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x80000408 - reserved1: 0x0 - reserved2: 0x10 - reserved3: 0x0 - content: 110000B031020091300240F9110A1FD7 - - sectname: __cstring - segname: __TEXT - addr: 0x3F98 - size: 14 - offset: 0x3F98 - align: 0 - reloff: 0x0 - nreloc: 0 - flags: 0x2 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 48656C6C6F2066726F6D205A0A00 - - sectname: __unwind_info - segname: __TEXT - addr: 0x3FA8 - size: 88 - offset: 0x3FA8 - align: 2 - reloff: 0x0 - nreloc: 0 - flags: 0x0 - reserved1: 0x0 - reserved2: 0x0 - reserved3: 0x0 - content: 010000001C000000000000001C000000000000001C00000002000000683F00004000000040000000883F00000000000040000000000000000000000000000000030000000C00010010000100000000000000000400000000 - - cmd: LC_SEGMENT_64 - cmdsize: 152 - segname: __DATA_CONST - vmaddr: 16384 - vmsize: 16384 - fileoff: 16384 - filesize: 16384 - maxprot: 3 - initprot: 3 - nsects: 1 - flags: 16 - Sections: - - sectname: __auth_got - segname: __DATA_CONST - addr: 0x4000 - size: 8 - offset: 0x4000 - align: 3 - reloff: 0x0 - nreloc: 0 - flags: 0x6 - reserved1: 0x1 - reserved2: 0x0 - reserved3: 0x0 - content: 00000000000001C0 - - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT - vmaddr: 32768 - vmsize: 16384 - fileoff: 32768 - filesize: 608 - maxprot: 1 - initprot: 1 - nsects: 0 - flags: 0 - - cmd: LC_ID_DYLIB - cmdsize: 48 - dylib: - name: 24 - timestamp: 1 - current_version: 0 - compatibility_version: 0 - Content: '@rpath/libZ.dylib' - ZeroPadBytes: 7 - - cmd: LC_DYLD_CHAINED_FIXUPS - cmdsize: 16 - dataoff: 32768 - datasize: 96 - - cmd: LC_DYLD_EXPORTS_TRIE - cmdsize: 16 - dataoff: 32864 - datasize: 24 - - cmd: LC_SYMTAB - cmdsize: 24 - symoff: 32896 - nsyms: 2 - stroff: 32936 - strsize: 16 - - cmd: LC_DYSYMTAB - cmdsize: 80 - ilocalsym: 0 - nlocalsym: 0 - iextdefsym: 0 - nextdefsym: 1 - iundefsym: 1 - nundefsym: 1 - tocoff: 0 - ntoc: 0 - modtaboff: 0 - nmodtab: 0 - extrefsymoff: 0 - nextrefsyms: 0 - indirectsymoff: 32928 - nindirectsyms: 2 - extreloff: 0 - nextrel: 0 - locreloff: 0 - nlocrel: 0 - - cmd: LC_UUID - cmdsize: 24 - uuid: E74F368D-238F-31FA-BF40-FA2964FED986 - - cmd: LC_BUILD_VERSION - cmdsize: 32 - platform: 1 - minos: 983040 - sdk: 983552 - ntools: 1 - Tools: - - tool: 3 - version: 73074435 - - cmd: LC_SOURCE_VERSION - cmdsize: 16 - version: 0 - - cmd: LC_LOAD_DYLIB - cmdsize: 56 - dylib: - name: 24 - timestamp: 2 - current_version: 88539136 - compatibility_version: 65536 - Content: '/usr/lib/libSystem.B.dylib' - ZeroPadBytes: 6 - - cmd: LC_FUNCTION_STARTS - cmdsize: 16 - dataoff: 32888 - datasize: 8 - - cmd: LC_DATA_IN_CODE - cmdsize: 16 - dataoff: 32896 - datasize: 0 - - cmd: LC_CODE_SIGNATURE - cmdsize: 16 - dataoff: 32960 - datasize: 416 - LinkEditData: - ExportTrie: - TerminalSize: 0 - NodeOffset: 0 - Name: '' - Flags: 0x0 - Address: 0x0 - Other: 0x0 - ImportName: '' - Children: - - TerminalSize: 3 - NodeOffset: 13 - Name: _sayZ - Flags: 0x0 - Address: 0x3F68 - Other: 0x0 - ImportName: '' - NameList: - - n_strx: 2 - n_type: 0xF - n_sect: 1 - n_desc: 0 - n_value: 16232 - - n_strx: 8 - n_type: 0x1 - n_sect: 0 - n_desc: 256 - n_value: 0 - StringTable: - - ' ' - - _sayZ - - _printf - IndirectSymbols: [ 0x1, 0x1 ] - FunctionStarts: [ 0x3F68 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x48, - 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0x1, 0x0, - 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x18, 0x0, 0x0, 0x0, 0x0, 0x40, 0xC, 0x0, - 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x2, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5F, 0x70, 0x72, - 0x69, 0x6E, 0x74, 0x66, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0 ] -... diff --git a/llvm/unittests/ExecutionEngine/Orc/LibraryResolverTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LibraryResolverTest.cpp deleted file mode 100644 index f6990ee..0000000 --- a/llvm/unittests/ExecutionEngine/Orc/LibraryResolverTest.cpp +++ /dev/null @@ -1,896 +0,0 @@ -//===- LibraryResolverTest.cpp - Unit tests for LibraryResolver -===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryResolver.h" -#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h" -#include "llvm/ExecutionEngine/Orc/TargetProcess/LibraryScanner.h" -#include "llvm/ObjectYAML/MachOYAML.h" -#include "llvm/ObjectYAML/yaml2obj.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/YAMLParser.h" -#include "llvm/Support/YAMLTraits.h" -#include "llvm/Support/raw_ostream.h" - -#include "llvm/Testing/Support/SupportHelpers.h" - -#include "gtest/gtest.h" - -#include <algorithm> -#include <optional> -#include <string> -#include <vector> - -using namespace llvm; -using namespace llvm::orc; - -#if defined(__APPLE__) || defined(__linux__) -// TODO: Add COFF (Windows) support for these tests. -// this facility also works correctly on Windows (COFF), -// so we should eventually enable and run these tests for that platform as well. -namespace { - -#if defined(__APPLE__) -constexpr const char *ext = ".dylib"; -#elif defined(_WIN32) -constexpr const char *ext = ".dll"; -#else -constexpr const char *ext = ".so"; -#endif - -bool EnvReady = false; - -Triple getTargetTriple() { - auto JTMB = JITTargetMachineBuilder::detectHost(); - if (!JTMB) { - consumeError(JTMB.takeError()); - return Triple(); - } - return JTMB->getTargetTriple(); -} - -static bool CheckHostSupport() { - auto Triple = getTargetTriple(); - // TODO: Extend support to COFF (Windows) once test setup and YAML conversion - // are verified. - if (!Triple.isOSBinFormatMachO() && - !(Triple.isOSBinFormatELF() && Triple.getArch() == Triple::x86_64)) - return false; - - return true; -} - -std::string getYamlFilePlatformExt() { - auto Triple = getTargetTriple(); - if (Triple.isOSBinFormatMachO()) - return "_macho"; - else if (Triple.isOSBinFormatELF()) - return "_linux"; - - return ""; -} - -unsigned getYamlDocNum() { - // auto Triple = getTargetTriple(); - // if (Triple.isOSBinFormatELF()) - // return 1; - - return 1; -} - -class LibraryTestEnvironment : public ::testing::Environment { - std::vector<std::string> CreatedDylibsDir; - std::vector<std::string> CreatedDylibs; - SmallVector<char, 128> DirPath; - -public: - void SetUp() override { - if (!CheckHostSupport()) { - EnvReady = false; - return; - } - - StringRef ThisFile = __FILE__; - SmallVector<char, 128> InputDirPath(ThisFile.begin(), ThisFile.end()); - sys::path::remove_filename(InputDirPath); - sys::path::append(InputDirPath, "Inputs"); - if (!sys::fs::exists(InputDirPath)) - return; - - SmallString<128> UniqueDir; - sys::path::append(UniqueDir, InputDirPath); - std::error_code EC = sys::fs::createUniqueDirectory(UniqueDir, DirPath); - - if (EC) - return; - - // given yamlPath + DylibPath, validate + convert - auto processYamlToDylib = [&](const SmallVector<char, 128> &YamlPath, - const SmallVector<char, 128> &DylibPath, - unsigned DocNum) -> bool { - if (!sys::fs::exists(YamlPath)) { - errs() << "YAML file missing: " - << StringRef(YamlPath.data(), YamlPath.size()) << "\n"; - EnvReady = false; - return false; - } - - auto BufOrErr = MemoryBuffer::getFile(YamlPath); - if (!BufOrErr) { - errs() << "Failed to read " - << StringRef(YamlPath.data(), YamlPath.size()) << ": " - << BufOrErr.getError().message() << "\n"; - EnvReady = false; - return false; - } - - yaml::Input yin(BufOrErr->get()->getBuffer()); - std::error_code EC; - raw_fd_ostream outFile(StringRef(DylibPath.data(), DylibPath.size()), EC, - sys::fs::OF_None); - - if (EC) { - errs() << "Failed to open " - << StringRef(DylibPath.data(), DylibPath.size()) - << " for writing: " << EC.message() << "\n"; - EnvReady = false; - return false; - } - - if (!yaml::convertYAML( - yin, outFile, - [](const Twine &M) { - // Handle or ignore errors here - errs() << "Yaml Error :" << M << "\n"; - }, - DocNum)) { - errs() << "Failed to convert " - << StringRef(YamlPath.data(), YamlPath.size()) << " to " - << StringRef(DylibPath.data(), DylibPath.size()) << "\n"; - EnvReady = false; - return false; - } - - CreatedDylibsDir.push_back(std::string(sys::path::parent_path( - StringRef(DylibPath.data(), DylibPath.size())))); - CreatedDylibs.push_back(std::string(DylibPath.begin(), DylibPath.end())); - return true; - }; - - std::vector<const char *> LibDirs = {"Z", "A", "B", "C", "D"}; - - unsigned DocNum = getYamlDocNum(); - std::string YamlPltExt = getYamlFilePlatformExt(); - for (const auto &LibdirName : LibDirs) { - // YAML path - SmallVector<char, 128> YamlPath(InputDirPath.begin(), InputDirPath.end()); - SmallVector<char, 128> YamlFileName; - YamlFileName.append(LibdirName, LibdirName + strlen(LibdirName)); - YamlFileName.append(YamlPltExt.begin(), YamlPltExt.end()); - sys::path::append(YamlPath, LibdirName, YamlFileName); - sys::path::replace_extension(YamlPath, ".yaml"); - - // dylib path - SmallVector<char, 128> DylibPath(DirPath.begin(), DirPath.end()); - SmallVector<char, 128> DylibFileName; - StringRef prefix("lib"); - DylibFileName.append(prefix.begin(), prefix.end()); - DylibFileName.append(LibdirName, LibdirName + strlen(LibdirName)); - - sys::path::append(DylibPath, LibdirName); - if (!sys::fs::exists(DylibPath)) { - auto EC = sys::fs::create_directory(DylibPath); - if (EC) - return; - } - sys::path::append(DylibPath, DylibFileName); - sys::path::replace_extension(DylibPath, ext); - if (!processYamlToDylib(YamlPath, DylibPath, DocNum)) - return; - } - - EnvReady = true; - } - - void TearDown() override { sys::fs::remove_directories(DirPath); } - - std::string getBaseDir() const { - return std::string(DirPath.begin(), DirPath.end()); - } - - std::vector<std::string> getDylibPaths() const { return CreatedDylibs; } -}; - -static LibraryTestEnvironment *GlobalEnv = - static_cast<LibraryTestEnvironment *>( - ::testing::AddGlobalTestEnvironment(new LibraryTestEnvironment())); - -inline std::string libPath(const std::string &BaseDir, - const std::string &name) { -#if defined(__APPLE__) - return BaseDir + "/" + name + ".dylib"; -#elif defined(_WIN32) - return BaseDir + "/" + name + ".dll"; -#else - return BaseDir + "/" + name + ".so"; -#endif -} - -inline std::string withext(const std::string &lib) { - SmallString<128> P(lib); - sys::path::replace_extension(P, ext); - return P.str().str(); -} - -inline std::string platformSymbolName(const std::string &name) { -#if defined(__APPLE__) - return "_" + name; // macOS prepends underscore -#else - return name; -#endif -} - -struct TestLibrary { - std::string path; - std::vector<std::string> Syms; -}; - -class LibraryResolverIT : public ::testing::Test { -protected: - std::string BaseDir; - std::unordered_map<std::string, TestLibrary> libs; - - void addLib(const std::string &name) { - SmallString<512> path; - sys::fs::real_path(libPath(BaseDir, name + "/lib" + name), path); - if (path.empty()) - EnvReady = false; - libs[name] = {path.str().str(), {platformSymbolName("say" + name)}}; - } - - void SetUp() override { - if (!EnvReady) - GTEST_SKIP() << "Skipping test: environment setup failed."; - - ASSERT_NE(GlobalEnv, nullptr); - BaseDir = GlobalEnv->getBaseDir(); - for (const auto &P : GlobalEnv->getDylibPaths()) { - if (!sys::fs::exists(P)) - GTEST_SKIP(); - } - const std::vector<std::string> libNames = {"A", "B", "C", "D", "Z"}; - for (const auto &name : libNames) - addLib(name); - - if (!EnvReady) - GTEST_SKIP() << "Skipping test: environment setup failed."; - } - - const std::vector<std::string> &sym(const std::string &key) { - return libs[key].Syms; - } - const std::string &lib(const std::string &key) { return libs[key].path; } - const std::string libdir(const std::string &key) { - SmallString<512> P(libs[key].path); - sys::path::remove_filename(P); - return P.str().str(); - } - const std::string libname(const std::string &key) { - return sys::path::filename(libs[key].path).str(); - } -}; - -// Helper: allow either "sayA" or "_sayA" depending on how your SymbolEnumerator -// reports. -static bool matchesEitherUnderscore(const std::string &got, - const std::string &bare) { - return got == bare || got == ("_" + bare); -} - -// Helper: normalize path ending check (we only care that it resolved to the -// right dylib) -static bool endsWith(const std::string &s, const std::string &suffix) { - if (s.size() < suffix.size()) - return false; - return std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); -} - -// --- 1) SymbolEnumerator enumerates real exports from libC.dylib --- -TEST_F(LibraryResolverIT, EnumerateSymbolsFromARespectsDefaults) { - const std::string libC = lib("C"); - - SymbolEnumeratorOptions Opts = SymbolEnumeratorOptions::defaultOptions(); - - std::vector<std::string> seen; - auto onEach = [&](llvm::StringRef sym) -> EnumerateResult { - seen.emplace_back(sym.str()); - return EnumerateResult::Continue; - }; - - const bool ok = SymbolEnumerator::enumerateSymbols(libC, onEach, Opts); - ASSERT_TRUE(ok) << "enumerateSymbols failed on " << libC; - - // We expect to see sayA (export) and not an undefined reference to printf. - bool foundSayA = false; - for (const auto &s : seen) { - if (matchesEitherUnderscore(s, "sayA")) { - foundSayA = true; - break; - } - } - EXPECT_FALSE(foundSayA) << "Expected exported symbol sayA in libC"; -} - -TEST_F(LibraryResolverIT, EnumerateSymbols_ExportsOnly_DefaultFlags) { - const std::string libC = lib("C"); - SymbolEnumeratorOptions Opts = SymbolEnumeratorOptions::defaultOptions(); - - std::vector<std::string> seen; - auto onEach = [&](llvm::StringRef sym) -> EnumerateResult { - seen.emplace_back(sym.str()); - return EnumerateResult::Continue; - }; - - ASSERT_TRUE(SymbolEnumerator::enumerateSymbols(libC, onEach, Opts)); - - // sayC is exported, others are undefined → only sayC expected - EXPECT_TRUE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayC"); - })); - EXPECT_FALSE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayA"); - })); - EXPECT_FALSE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayB"); - })); - EXPECT_FALSE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayZ"); - })); -} - -TEST_F(LibraryResolverIT, EnumerateSymbols_IncludesUndefineds) { - const std::string libC = lib("C"); - - SymbolEnumeratorOptions Opts; - Opts.FilterFlags = - SymbolEnumeratorOptions::IgnoreWeak | - SymbolEnumeratorOptions::IgnoreIndirect; // no IgnoreUndefined - - std::vector<std::string> seen; - auto onEach = [&](llvm::StringRef sym) -> EnumerateResult { - seen.emplace_back(sym.str()); - return EnumerateResult::Continue; - }; - - ASSERT_TRUE(SymbolEnumerator::enumerateSymbols(libC, onEach, Opts)); - - // Now we should see both sayC (export) and the undefined refs sayA, sayB, - // sayZ - EXPECT_TRUE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayC"); - })); - EXPECT_TRUE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayA"); - })); - EXPECT_TRUE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayB"); - })); - EXPECT_TRUE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayZ"); - })); -} - -TEST_F(LibraryResolverIT, EnumerateSymbols_IndirectExportRespected) { - const std::string libD = lib("D"); - - SymbolEnumeratorOptions Opts; - Opts.FilterFlags = SymbolEnumeratorOptions::IgnoreWeak; // allow indirects - - std::vector<std::string> seen; - auto onEach = [&](llvm::StringRef sym) -> EnumerateResult { - seen.emplace_back(sym.str()); - return EnumerateResult::Continue; - }; - - ASSERT_TRUE(SymbolEnumerator::enumerateSymbols(libD, onEach, Opts)); - - // sayA is re-exported from A, so should appear unless IgnoreIndirect was set - EXPECT_TRUE(any_of(seen, [&](const std::string &s) { - return matchesEitherUnderscore(s, "sayA"); - })); -} - -// --- 2) Filters: if we remove IgnoreUndefined, we should also see undefineds -// like printf --- -TEST_F(LibraryResolverIT, EnumerateSymbolsIncludesUndefWhenNotIgnored) { - const std::string libA = lib("A"); - - SymbolEnumeratorOptions Opts = SymbolEnumeratorOptions::defaultOptions(); - // Start from defaults but allow undefined - Opts.FilterFlags &= ~SymbolEnumeratorOptions::IgnoreUndefined; - - bool SawPrintf = false; - auto onEach = [&](llvm::StringRef sym) -> EnumerateResult { - if (matchesEitherUnderscore(sym.str(), "printf") || - matchesEitherUnderscore(sym.str(), "puts")) - SawPrintf = true; - return EnumerateResult::Continue; - }; - - ASSERT_TRUE(SymbolEnumerator::enumerateSymbols(libA, onEach, Opts)); - EXPECT_TRUE(SawPrintf) - << "Expected to see undefined symbol printf when not filtered"; -} - -// --- 3) Full resolution via LibraryResolutionDriver/LibraryResolver --- -TEST_F(LibraryResolverIT, DriverResolvesSymbolsToCorrectLibraries) { - // Create the resolver from real base paths (our fixtures dir) - auto Stup = LibraryResolver::Setup::create({BaseDir}); - - // Full system behavior: no mocks - auto Driver = LibraryResolutionDriver::create(Stup); - ASSERT_NE(Driver, nullptr); - - // Tell the Driver about the scan path kinds (User/System) as your production - // code expects. - Driver->addScanPath(libdir("A"), PathType::User); - Driver->addScanPath(libdir("B"), PathType::User); - Driver->addScanPath(libdir("Z"), PathType::User); - - // Symbols to resolve (bare names; class handles underscore differences - // internally) - std::vector<std::string> Syms = {platformSymbolName("sayA"), - platformSymbolName("sayB"), - platformSymbolName("sayZ")}; - - bool CallbackRan = false; - Driver->resolveSymbols(Syms, [&](SymbolQuery &Q) { - CallbackRan = true; - - // sayA should resolve to A.dylib - { - auto lib = Q.getResolvedLib(platformSymbolName("sayA")); - ASSERT_TRUE(lib.has_value()) << "sayA should be resolved"; - EXPECT_TRUE(endsWith(lib->str(), libname("A"))) - << "sayA resolved to: " << lib->str(); - } - - // sayB should resolve to B.dylib - { - auto lib = Q.getResolvedLib(platformSymbolName("sayB")); - ASSERT_TRUE(lib.has_value()) << "sayB should be resolved"; - EXPECT_TRUE(endsWith(lib->str(), libname("B"))) - << "sayB resolved to: " << lib->str(); - } - - // sayZ should resolve to B.dylib - { - auto lib = Q.getResolvedLib(platformSymbolName("sayZ")); - ASSERT_TRUE(lib.has_value()) << "sayZ should be resolved"; - EXPECT_TRUE(endsWith(lib->str(), libname("Z"))) - << "sayZ resolved to: " << lib->str(); - } - - EXPECT_TRUE(Q.allResolved()); - }); - - EXPECT_TRUE(CallbackRan); -} - -// --- 4) Cross-library reference visibility (C references A) --- -TEST_F(LibraryResolverIT, EnumeratorSeesInterLibraryRelationship) { - const std::string libC = lib("C"); - - SymbolEnumeratorOptions OnlyUndef = SymbolEnumeratorOptions::defaultOptions(); - // Show only undefined (drop IgnoreUndefined) to see C's reference to sayA - OnlyUndef.FilterFlags &= ~SymbolEnumeratorOptions::IgnoreUndefined; - - bool SawSayAAsUndef = false; - auto onEach = [&](llvm::StringRef sym) -> EnumerateResult { - if (matchesEitherUnderscore(sym.str(), "sayA")) - SawSayAAsUndef = true; - return EnumerateResult::Continue; - }; - - ASSERT_TRUE(SymbolEnumerator::enumerateSymbols(libC, onEach, OnlyUndef)); - EXPECT_TRUE(SawSayAAsUndef) - << "libC should have an undefined reference to sayA (defined in libA)"; -} - -// // // --- 5) Optional: stress SymbolQuery with the real resolve flow -// // // And resolve libC dependency libA, libB, libZ --- -TEST_F(LibraryResolverIT, ResolveManySymbols) { - auto Stup = LibraryResolver::Setup::create({BaseDir}); - auto Driver = LibraryResolutionDriver::create(Stup); - ASSERT_NE(Driver, nullptr); - Driver->addScanPath(libdir("C"), PathType::User); - - // Many duplicates to provoke concurrent updates inside SymbolQuery - std::vector<std::string> Syms = { - platformSymbolName("sayA"), platformSymbolName("sayB"), - platformSymbolName("sayA"), platformSymbolName("sayB"), - platformSymbolName("sayZ"), platformSymbolName("sayZ"), - platformSymbolName("sayZ"), platformSymbolName("sayZ"), - platformSymbolName("sayA"), platformSymbolName("sayB"), - platformSymbolName("sayA"), platformSymbolName("sayB")}; - - bool CallbackRan = false; - Driver->resolveSymbols(Syms, [&](SymbolQuery &Q) { - CallbackRan = true; - EXPECT_TRUE(Q.isResolved(platformSymbolName("sayA"))); - EXPECT_TRUE(Q.isResolved(platformSymbolName("sayB"))); - EXPECT_TRUE(Q.isResolved(platformSymbolName("sayZ"))); - - auto A = Q.getResolvedLib(platformSymbolName("sayA")); - auto B = Q.getResolvedLib(platformSymbolName("sayB")); - auto Z = Q.getResolvedLib(platformSymbolName("sayZ")); - ASSERT_TRUE(A.has_value()); - ASSERT_TRUE(B.has_value()); - ASSERT_TRUE(Z.has_value()); - EXPECT_TRUE(endsWith(A->str(), libname("A"))); - EXPECT_TRUE(endsWith(B->str(), libname("B"))); - EXPECT_TRUE(endsWith(Z->str(), libname("Z"))); - EXPECT_TRUE(Q.allResolved()); - }); - - EXPECT_TRUE(CallbackRan); -} - -// // // --- 5) Optional: stress SymbolQuery with the real resolve flow -// // // And resolve libD dependency libA --- -TEST_F(LibraryResolverIT, ResolveManySymbols2) { - auto Stup = LibraryResolver::Setup::create({BaseDir}); - auto Driver = LibraryResolutionDriver::create(Stup); - ASSERT_NE(Driver, nullptr); - Driver->addScanPath(libdir("D"), PathType::User); - - // Many duplicates to provoke concurrent updates inside SymbolQuery - std::vector<std::string> Syms = { - platformSymbolName("sayA"), platformSymbolName("sayB"), - platformSymbolName("sayA"), platformSymbolName("sayB"), - platformSymbolName("sayZ"), platformSymbolName("sayZ"), - platformSymbolName("sayZ"), platformSymbolName("sayZ"), - platformSymbolName("sayD"), platformSymbolName("sayD"), - platformSymbolName("sayA"), platformSymbolName("sayB"), - platformSymbolName("sayA"), platformSymbolName("sayB")}; - - Driver->resolveSymbols(Syms, [&](SymbolQuery &Q) { - EXPECT_TRUE(Q.isResolved(platformSymbolName("sayA"))); - EXPECT_TRUE(Q.isResolved(platformSymbolName("sayD"))); - - auto A = Q.getResolvedLib(platformSymbolName("sayA")); - auto D = Q.getResolvedLib(platformSymbolName("sayD")); - ASSERT_TRUE(A.has_value()); - ASSERT_TRUE(D.has_value()); - EXPECT_TRUE(endsWith(A->str(), libname("A"))); - EXPECT_TRUE(endsWith(D->str(), libname("D"))); - EXPECT_FALSE(Q.allResolved()); - }); -} - -TEST_F(LibraryResolverIT, ScanSingleUserPath) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - LibraryScanHelper ScanH({}, LibPathCache, PResolver); - - ScanH.addBasePath(libdir("C"), PathType::User); - - std::error_code EC; - auto libCPathOpt = PResolver->resolve(lib("C"), EC); - - if (!libCPathOpt || EC) { - FAIL(); - } - - std::string libCPath = *libCPathOpt; - - LibraryManager LibMgr; - LibraryScanner Scanner(ScanH, LibMgr); - - Scanner.scanNext(PathType::User, 0); - - bool found = false; - LibMgr.forEachLibrary([&](const LibraryInfo &lib) { - if (lib.getFullPath() == libCPath) { - found = true; - } - return true; - }); - EXPECT_TRUE(found) << "Expected to find " << libCPath; -} - -TEST_F(LibraryResolverIT, ScanAndCheckDeps) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - LibraryScanHelper ScanH({}, LibPathCache, PResolver); - - ScanH.addBasePath(libdir("C"), PathType::User); - - LibraryManager LibMgr; - LibraryScanner Scanner(ScanH, LibMgr); - - Scanner.scanNext(PathType::User, 0); - - size_t count = 0; - LibMgr.forEachLibrary([&](const LibraryInfo &) { - count++; - return true; - }); - - EXPECT_GE(count, 3u) << "Should find at least libA in multiple paths"; -} - -TEST_F(LibraryResolverIT, ScanEmptyPath) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - LibraryScanHelper ScanH({}, LibPathCache, PResolver); - - ScanH.addBasePath("/tmp/empty", PathType::User); - - LibraryManager LibMgr; - LibraryScanner Scanner(ScanH, LibMgr); - - Scanner.scanNext(PathType::User, 0); - - size_t count = 0; - LibMgr.forEachLibrary([&](const LibraryInfo &) { - count++; - return true; - }); - EXPECT_EQ(count, 0u); -} - -TEST_F(LibraryResolverIT, PathResolverResolvesKnownPaths) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - std::error_code EC; - auto Missing = PResolver->resolve("temp/foo/bar", EC); - EXPECT_FALSE(Missing.has_value()) << "Unexpectedly resolved a bogus path"; - EXPECT_TRUE(EC) << "Expected error resolving path"; - - auto DirPath = PResolver->resolve(BaseDir, EC); - ASSERT_TRUE(DirPath.has_value()); - EXPECT_FALSE(EC) << "Expected no error resolving path"; - EXPECT_EQ(*DirPath, BaseDir); - - auto DylibPath = PResolver->resolve(lib("C"), EC); - ASSERT_TRUE(DylibPath.has_value()); - EXPECT_FALSE(EC) << "Expected no error resolving path"; - EXPECT_EQ(*DylibPath, lib("C")); -} - -TEST_F(LibraryResolverIT, PathResolverNormalizesDotAndDotDot) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - std::error_code EC; - - // e.g. BaseDir + "/./C/../C/C.dylib" → BaseDir + "/C.dylib" - std::string Messy = BaseDir + "/C/./../C/./libC" + ext; - auto Resolved = PResolver->resolve(Messy, EC); - ASSERT_TRUE(Resolved.has_value()); - EXPECT_FALSE(EC); - EXPECT_EQ(*Resolved, lib("C")) << "Expected realpath to collapse . and .."; -} - -#if !defined(_WIN32) -TEST_F(LibraryResolverIT, PathResolverFollowsSymlinks) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - std::error_code EC; - - // Create a symlink temp -> BaseDir (only if filesystem allows it) - std::string linkName = BaseDir + withext("/link_to_C"); - std::string target = lib("C"); - ::symlink(target.c_str(), linkName.c_str()); - - auto resolved = PResolver->resolve(linkName, EC); - ASSERT_TRUE(resolved.has_value()); - EXPECT_FALSE(EC); - EXPECT_EQ(*resolved, target); - - ::unlink(linkName.c_str()); // cleanup -} - -TEST_F(LibraryResolverIT, PathResolverCachesResults) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - SmallString<128> TmpDylib; - sys::fs::createUniqueFile(withext("A-copy"), TmpDylib); - sys::fs::copy_file(lib("A"), TmpDylib); - - std::error_code EC; - - // First resolve -> should populate LibPathCache - auto first = PResolver->resolve(TmpDylib, EC); - ASSERT_TRUE(first.has_value()); - - // Forcefully remove the file from disk - ::unlink(TmpDylib.c_str()); - - // Second resolve -> should still succeed from LibPathCache - auto second = PResolver->resolve(TmpDylib, EC); - EXPECT_TRUE(second.has_value()); - EXPECT_EQ(*second, *first); -} -#endif - -TEST_F(LibraryResolverIT, LoaderPathSubstitutionAndResolve) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - DylibSubstitutor substitutor; - substitutor.configure(libdir("C")); -#if defined(__APPLE__) - // Substitute @loader_path with BaseDir - std::string substituted = - substitutor.substitute(withext("@loader_path/libC")); -#elif defined(__linux__) - // Substitute $origin with BaseDir - std::string substituted = substitutor.substitute(withext("$ORIGIN/libC")); -#endif - ASSERT_FALSE(substituted.empty()); - EXPECT_EQ(substituted, lib("C")); - - // Now try resolving the substituted path - std::error_code EC; - auto resolved = PResolver->resolve(substituted, EC); - ASSERT_TRUE(resolved.has_value()) << "Expected to resolve substituted dylib"; - EXPECT_EQ(*resolved, lib("C")); - EXPECT_FALSE(EC) << "Expected no error resolving substituted dylib"; -} - -TEST_F(LibraryResolverIT, ResolveFromUsrOrSystemPaths) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - DylibPathValidator validator(*PResolver); - - std::vector<std::string> Paths = {"/foo/bar/", "temp/foo", libdir("C"), - libdir("A"), libdir("B"), libdir("Z")}; - - SmallVector<StringRef> P(Paths.begin(), Paths.end()); - - DylibResolver Resolver(validator); - Resolver.configure("", {{P, SearchPathType::UsrOrSys}}); - - // Check "C" - auto ValOptC = Resolver.resolve("libC", true); - EXPECT_TRUE(ValOptC.has_value()); - EXPECT_EQ(*ValOptC, lib("C")); - - auto ValOptCdylib = Resolver.resolve(withext("libC")); - EXPECT_TRUE(ValOptCdylib.has_value()); - EXPECT_EQ(*ValOptCdylib, lib("C")); - - // Check "A" - auto ValOptA = Resolver.resolve("libA", true); - EXPECT_TRUE(ValOptA.has_value()); - EXPECT_EQ(*ValOptA, lib("A")); - - auto ValOptAdylib = Resolver.resolve(withext("libA")); - EXPECT_TRUE(ValOptAdylib.has_value()); - EXPECT_EQ(*ValOptAdylib, lib("A")); - - // Check "B" - auto ValOptB = Resolver.resolve("libB", true); - EXPECT_TRUE(ValOptB.has_value()); - EXPECT_EQ(*ValOptB, lib("B")); - - auto ValOptBdylib = Resolver.resolve(withext("libB")); - EXPECT_TRUE(ValOptBdylib.has_value()); - EXPECT_EQ(*ValOptBdylib, lib("B")); - - // Check "Z" - auto ValOptZ = Resolver.resolve("libZ", true); - EXPECT_TRUE(ValOptZ.has_value()); - EXPECT_EQ(*ValOptZ, lib("Z")); - - auto ValOptZdylib = Resolver.resolve(withext("libZ")); - EXPECT_TRUE(ValOptZdylib.has_value()); - EXPECT_EQ(*ValOptZdylib, lib("Z")); -} - -#if defined(__APPLE__) -TEST_F(LibraryResolverIT, ResolveViaLoaderPathAndRPathSubstitution) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - DylibPathValidator validator(*PResolver); - - std::vector<std::string> Paths = {"@loader_path/../A", "@loader_path/../B", - "@loader_path/../D", "@loader_path/../Z"}; - - SmallVector<StringRef> P(Paths.begin(), Paths.end()); - - DylibResolver Resolver(validator); - - // Use only RPath config - Resolver.configure(lib("C"), {{P, SearchPathType::RPath}}); - - // --- Check A --- - auto ValOptA = Resolver.resolve("@rpath/libA", true); - EXPECT_TRUE(ValOptA.has_value()); - EXPECT_EQ(*ValOptA, lib("A")); - - auto ValOptAdylib = Resolver.resolve(withext("@rpath/libA")); - EXPECT_TRUE(ValOptAdylib.has_value()); - EXPECT_EQ(*ValOptAdylib, lib("A")); - - // --- Check B --- - auto ValOptB = Resolver.resolve("@rpath/libB", true); - EXPECT_TRUE(ValOptB.has_value()); - EXPECT_EQ(*ValOptB, lib("B")); - - auto ValOptBdylib = Resolver.resolve(withext("@rpath/libB")); - EXPECT_TRUE(ValOptBdylib.has_value()); - EXPECT_EQ(*ValOptBdylib, lib("B")); - - // --- Check Z --- - auto ValOptZ = Resolver.resolve("@rpath/libZ", true); - EXPECT_TRUE(ValOptZ.has_value()); - EXPECT_EQ(*ValOptZ, lib("Z")); - - auto ValOptZdylib = Resolver.resolve(withext("@rpath/libZ")); - EXPECT_TRUE(ValOptZdylib.has_value()); - EXPECT_EQ(*ValOptZdylib, lib("Z")); -} -#endif - -#if defined(__linux__) -TEST_F(LibraryResolverIT, ResolveViaOriginAndRPathSubstitution) { - auto LibPathCache = std::make_shared<LibraryPathCache>(); - auto PResolver = std::make_shared<PathResolver>(LibPathCache); - - DylibPathValidator validator(*PResolver); - - // On Linux, $ORIGIN works like @loader_path - std::vector<std::string> Paths = {"$ORIGIN/../A", "$ORIGIN/../B", - "$ORIGIN/../D", "$ORIGIN/../Z"}; - - SmallVector<StringRef> P(Paths.begin(), Paths.end()); - - DylibResolver Resolver(validator); - - // Use only RPath config - Resolver.configure(lib("C"), {{P, SearchPathType::RunPath}}); - - // --- Check A --- - auto ValOptA = Resolver.resolve("libA", true); - EXPECT_TRUE(ValOptA.has_value()); - EXPECT_EQ(*ValOptA, lib("A")); - - auto valOptASO = Resolver.resolve(withext("libA")); - EXPECT_TRUE(valOptASO.has_value()); - EXPECT_EQ(*valOptASO, lib("A")); - - // --- Check B --- - auto ValOptB = Resolver.resolve("libB", true); - EXPECT_TRUE(ValOptB.has_value()); - EXPECT_EQ(*ValOptB, lib("B")); - - auto valOptBSO = Resolver.resolve(withext("libB")); - EXPECT_TRUE(valOptBSO.has_value()); - EXPECT_EQ(*valOptBSO, lib("B")); - - // --- Check Z --- - auto ValOptZ = Resolver.resolve("libZ", true); - EXPECT_TRUE(ValOptZ.has_value()); - EXPECT_EQ(*ValOptZ, lib("Z")); - - auto valOptZSO = Resolver.resolve(withext("libZ")); - EXPECT_TRUE(valOptZSO.has_value()); - EXPECT_EQ(*valOptZSO, lib("Z")); -} -#endif -} // namespace -#endif // defined(__APPLE__) diff --git a/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.td b/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.td index d74abc2..37db096 100644 --- a/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.td +++ b/mlir/include/mlir/Dialect/AMDGPU/IR/AMDGPU.td @@ -923,10 +923,10 @@ def AMDGPU_MFMAOp : AMDGPU_Op<"mfma", [AllTypesMatch<["destC", "destD"]>, Pure]>, Arguments<(ins - I32Attr:$m, - I32Attr:$n, - I32Attr:$k, - I32Attr:$blocks, + ConfinedAttr<I32Attr, [IntIsOneOf<[4, 16, 32]>]>:$m, + ConfinedAttr<I32Attr, [IntIsOneOf<[4, 16, 32]>]>:$n, + ConfinedAttr<I32Attr, [IntIsOneOf<[1, 2, 4, 8, 16, 32, 64, 128]>]>:$k, + DefaultValuedAttr<ConfinedAttr<I32Attr, [IntIsOneOf<[1, 2, 4, 16]>]>, "1">:$blocks, MFMAInTypes:$sourceA, MFMAInTypes:$sourceB, MFMAOutTypes:$destC, @@ -969,14 +969,16 @@ def AMDGPU_MFMAOp : Example: ```mlir - %0 = amdgpu.mfma %matA * %matB + %matC - { abid = 1 : i32, cbsz = 1 : i32, - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32 } + %0 = amdgpu.mfma 16x16x16 %matA * %matB + %matC + : vector<4xf16>, vector<4xf16>, vector<4xf32> + + %1 = amdgpu.mfma 32x32x1 %matD * %matE + %matF + { abid = 1 : i32, cbsz = 1 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32> ``` }]; let assemblyFormat = [{ - $sourceA `*` $sourceB `+` $destC + custom<MNKDimensionList>($m, $n, $k) $sourceA `*` $sourceB `+` $destC attr-dict `blgp` `=` $blgp `:` type($sourceA) `,` type($sourceB) `,` type($destC) @@ -1109,9 +1111,9 @@ def AMDGPU_ScaledMFMAOp : AMDGPU_Op<"scaled_mfma", [AllTypesMatch<["destC", "destD"]>, Pure]>, Arguments<(ins - I32Attr:$m, - I32Attr:$n, - I32Attr:$k, + ConfinedAttr<I32Attr, [IntIsOneOf<[16, 32]>]>:$m, + ConfinedAttr<I32Attr, [IntIsOneOf<[16, 32]>]>:$n, + ConfinedAttr<I32Attr, [IntIsOneOf<[64, 128]>]>:$k, ScaledMFMAInTypes:$sourceA, ScaledMFMAInTypes:$sourceB, ScaledMFMAOutTypes:$destC, @@ -1124,8 +1126,8 @@ def AMDGPU_ScaledMFMAOp : let summary = "MLIR wrapper for CDNA scaled mfma instructions"; let description = [{ The `amdgpu.scaled_mfma` op is an MLIR wrapper around intrinsics - for various scaled versions of `mfma` instructions in the CDNA architecture, which perform - multiple outer products in order to allow fast matrix multiplication. + for various scaled versions of `mfma` instructions in the CDNA architecture, which + perform multiple outer products in order to allow fast matrix multiplication. The wrapper will select an appropriate `mfma` instruction, if one is available, based on the provided `m`, `k`, `n`, and `nBlks` attributes, along with the @@ -1140,15 +1142,23 @@ def AMDGPU_ScaledMFMAOp : This wrapper takes inspiration from `amdgpu.mfma`, but has some key differences: - `amdgpu.scaled_mfma` operates on fp4 (f4E2M1FN), fp6 (f6E2M3FN and f6E3M2FN) and - fp8 (f8E4M3FN and f8E5M2) types using either M=N=16, K=128 or M=N=32, K=64 as their tile - size. + fp8 (f8E4M3FN and f8E5M2) types using either M=N=16, K=128 or M=N=32, K=64 as + their tile size. - `amdgpu.scaled_mfma` does not support broadcasting. So, `cbsz`, `abid`, and `blgp` - are omitted from this wrapper. - - The `negateA`, `negateB`, and `negateC` flags in `amdgpu.mfma` are only supported for - double-precision operations on gfx94x and so are not included here. + are omitted from this wrapper. + - The `negateA`, `negateB`, and `negateC` flags in `amdgpu.mfma` are only supported + for double-precision operations on gfx94x and so are not included here. + + Example: + ```mlir + %0 = amdgpu.scaled_mfma 32x32x64 (%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2 + : vector<4xf8E8M0FNU>, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<16xf32> + ``` }]; let assemblyFormat = [{ - `(` $scalesA `[` $scalesIdxA `]` `*` $sourceA `)` `*` `(` $scalesB `[` $scalesIdxB `]` `*` $sourceB `)` `+` $destC + custom<MNKDimensionList>($m, $n, $k) ` ` + `(` $scalesA `[` $scalesIdxA `]` `*` $sourceA `)` `*` + `(` $scalesB `[` $scalesIdxB `]` `*` $sourceB `)` `+` $destC attr-dict `:` type($scalesA) `,` type($sourceA) `,` type($scalesB) `,` type($sourceB) `,` type($destC) }]; diff --git a/mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp b/mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp index 4c4965e..585b6da 100644 --- a/mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp +++ b/mlir/lib/Dialect/AMDGPU/IR/AMDGPUDialect.cpp @@ -422,11 +422,11 @@ LogicalResult MFMAOp::verify() { Type sourceElem = sourceType, destElem = destType; uint32_t sourceLen = 1, destLen = 1; - if (auto sourceVector = llvm::dyn_cast<VectorType>(sourceType)) { + if (auto sourceVector = dyn_cast<VectorType>(sourceType)) { sourceLen = sourceVector.getNumElements(); sourceElem = sourceVector.getElementType(); } - if (auto destVector = llvm::dyn_cast<VectorType>(destType)) { + if (auto destVector = dyn_cast<VectorType>(destType)) { destLen = destVector.getNumElements(); destElem = destVector.getElementType(); } @@ -451,7 +451,7 @@ LogicalResult MFMAOp::verify() { return emitOpError("expected both non-small-float source operand types " "to match exactly"); } - // Normalize the wider integer types the compiler expects to i8 + // Normalize the wider integer types the compiler expects to i8. if (sourceElem.isInteger(32)) { sourceLen *= 4; sourceElem = b.getI8Type(); diff --git a/mlir/test/Conversion/AMDGPUToROCDL/mfma-gfx950.mlir b/mlir/test/Conversion/AMDGPUToROCDL/mfma-gfx950.mlir index 39c31d5..c746d76 100644 --- a/mlir/test/Conversion/AMDGPUToROCDL/mfma-gfx950.mlir +++ b/mlir/test/Conversion/AMDGPUToROCDL/mfma-gfx950.mlir @@ -8,46 +8,46 @@ func.func @mfma_to_rocdl(%arg0 : vector<8xf16>, %arg1 : vector<16xf32>, // CHECK: %[[c0:.+]] = llvm.mlir.constant(0 : i32) : i32 // CHECK: rocdl.mfma.f32.32x32x16.f16{{.*}}: (vector<8xf16>, vector<8xf16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf16>, vector<8xf16>, vector<16xf32> + amdgpu.mfma 32x32x16 %arg0 * %arg0 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf16>, vector<8xf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.16x16x32.f16{{.*}}: (vector<8xf16>, vector<8xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf16>, vector<8xf16>, vector<4xf32> + amdgpu.mfma 16x16x32 %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf16>, vector<8xf16>, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x16.bf16{{.*}}: (vector<8xbf16>, vector<8xbf16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg3 * %arg3 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xbf16>, vector<8xbf16>, vector<16xf32> + amdgpu.mfma 32x32x16 %arg3 * %arg3 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xbf16>, vector<8xbf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.16x16x32.bf16{{.*}}: (vector<8xbf16>, vector<8xbf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg3 * %arg3 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xbf16>, vector<8xbf16>, vector<4xf32> + amdgpu.mfma 16x16x32 %arg3 * %arg3 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xbf16>, vector<8xbf16>, vector<4xf32> // CHECK: rocdl.mfma.i32.32x32x32.i8{{.*}}: (vector<4xi32>, vector<4xi32>, vector<16xi32>, i32, i32, i32) -> vector<16xi32> - amdgpu.mfma %arg4 * %arg4 + %arg5 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<16xi8>, vector<16xi8>, vector<16xi32> + amdgpu.mfma 32x32x32 %arg4 * %arg4 + %arg5 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<16xi8>, vector<16xi8>, vector<16xi32> // CHECK: rocdl.mfma.i32.16x16x64.i8{{.*}}: (vector<4xi32>, vector<4xi32>, vector<4xi32>, i32, i32, i32) -> vector<4xi32> - amdgpu.mfma %arg4 * %arg4 + %arg6 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<16xi8>, vector<16xi8>, vector<4xi32> + amdgpu.mfma 16x16x64 %arg4 * %arg4 + %arg6 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<16xi8>, vector<16xi8>, vector<4xi32> // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c0]], %[[c0]], %[[c0]], %[[c0]]{{.*}}: (vector<8xi32>, vector<8xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg7 * %arg7 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<32xf8E4M3FN>, vector<32xf8E4M3FN>, vector<16xf32> + amdgpu.mfma 32x32x64 %arg7 * %arg7 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf8E4M3FN>, vector<32xf8E4M3FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c0]], %[[c0]], %[[c0]], %[[c0]]{{.*}}: (vector<8xi32>, vector<8xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg7 * %arg7 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 128 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<32xf8E4M3FN>, vector<32xf8E4M3FN>, vector<4xf32> + amdgpu.mfma 16x16x128 %arg7 * %arg7 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf8E4M3FN>, vector<32xf8E4M3FN>, vector<4xf32> // CHECK: %[[c1:.+]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c1]], %[[c1]], %[[c0]], %[[c0]]{{.*}}: (vector<8xi32>, vector<8xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg8 * %arg8 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<32xf8E5M2>, vector<32xf8E5M2>, vector<16xf32> + amdgpu.mfma 32x32x64 %arg8 * %arg8 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf8E5M2>, vector<32xf8E5M2>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c1]], %[[c1]], %[[c0]], %[[c0]]{{.*}}: (vector<8xi32>, vector<8xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg8 * %arg8 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 128 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<32xf8E5M2>, vector<32xf8E5M2>, vector<4xf32> + amdgpu.mfma 16x16x128 %arg8 * %arg8 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf8E5M2>, vector<32xf8E5M2>, vector<4xf32> // CHECK: %[[c2:.+]] = llvm.mlir.constant(2 : i32) : i32 // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c2]], %[[c2]], %[[c0]], %[[c0]]{{.*}}: (vector<6xi32>, vector<6xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg9 * %arg9 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf6E2M3FN>, vector<16xf32> + amdgpu.mfma 32x32x64 %arg9 * %arg9 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf6E2M3FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c2]], %[[c2]], %[[c0]], %[[c0]]{{.*}}: (vector<6xi32>, vector<6xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 128 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf6E2M3FN>, vector<4xf32> + amdgpu.mfma 16x16x128 %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf6E2M3FN>, vector<4xf32> // CHECK: %[[c3:.+]] = llvm.mlir.constant(3 : i32) : i32 // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c3]], %[[c3]], %[[c0]], %[[c0]]{{.*}}: (vector<6xi32>, vector<6xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg10 * %arg10 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<32xf6E3M2FN>, vector<32xf6E3M2FN>, vector<16xf32> + amdgpu.mfma 32x32x64 %arg10 * %arg10 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf6E3M2FN>, vector<32xf6E3M2FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c3]], %[[c3]], %[[c0]], %[[c0]]{{.*}}: (vector<6xi32>, vector<6xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 128 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<32xf6E3M2FN>, vector<32xf6E3M2FN>, vector<4xf32> + amdgpu.mfma 16x16x128 %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf6E3M2FN>, vector<32xf6E3M2FN>, vector<4xf32> // CHECK-DAG: %[[c4:.+]] = llvm.mlir.constant(4 : i32) : i32 // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c4]], %[[c4]], %[[c0]], %[[c0]]{{.*}}: (vector<4xi32>, vector<4xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg11 * %arg11 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<32xf4E2M1FN>, vector<32xf4E2M1FN>, vector<16xf32> + amdgpu.mfma 32x32x64 %arg11 * %arg11 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf4E2M1FN>, vector<32xf4E2M1FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c4]], %[[c4]], %[[c0]], %[[c0]]{{.*}}: (vector<4xi32>, vector<4xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg11 * %arg11 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 128 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<32xf4E2M1FN>, vector<32xf4E2M1FN>, vector<4xf32> + amdgpu.mfma 16x16x128 %arg11 * %arg11 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf4E2M1FN>, vector<32xf4E2M1FN>, vector<4xf32> // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c2]], %[[c4]], %[[c0]], %[[c0]]{{.*}}: (vector<6xi32>, vector<4xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg9 * %arg11 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 64 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf4E2M1FN>, vector<16xf32> + amdgpu.mfma 32x32x64 %arg9 * %arg11 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf4E2M1FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c2]], %[[c4]], %[[c0]], %[[c0]]{{.*}}: (vector<6xi32>, vector<4xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg9 * %arg11 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 128 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf4E2M1FN>, vector<4xf32> + amdgpu.mfma 16x16x128 %arg9 * %arg11 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<32xf6E2M3FN>, vector<32xf4E2M1FN>, vector<4xf32> func.return } @@ -55,50 +55,50 @@ func.func @mfma_to_rocdl(%arg0 : vector<8xf16>, %arg1 : vector<16xf32>, // CHECK-LABEL: func @scaled_mfma_to_rocdl( // CHECK-SAME: %[[ARG0:.*]]: vector<16xf32>, %[[ARG1:.*]]: vector<4xf32>, %[[ARG2:.*]]: vector<32xf8E4M3FN>, %[[ARG3:.*]]: vector<32xf8E5M2>, %[[ARG4:.*]]: vector<32xf6E2M3FN>, %[[ARG5:.*]]: vector<32xf6E3M2FN>, %[[ARG6:.*]]: vector<32xf4E2M1FN>, %[[ARG7:.*]]: vector<4xf8E8M0FNU>, %[[ARG8:.*]]: f8E8M0FNU func.func @scaled_mfma_to_rocdl(%arg0 : vector<16xf32>, - %arg1 : vector<4xf32>, %arg2 : vector<32xf8E4M3FN>, - %arg3 : vector<32xf8E5M2>, %arg4 : vector<32xf6E2M3FN>, - %arg5 : vector<32xf6E3M2FN>, %arg6 : vector<32xf4E2M1FN>, - %arg7 : vector<4xf8E8M0FNU>, %arg8 : f8E8M0FNU) { - + %arg1 : vector<4xf32>, %arg2 : vector<32xf8E4M3FN>, + %arg3 : vector<32xf8E5M2>, %arg4 : vector<32xf6E2M3FN>, + %arg5 : vector<32xf6E3M2FN>, %arg6 : vector<32xf4E2M1FN>, + %arg7 : vector<4xf8E8M0FNU>, %arg8 : f8E8M0FNU) { + // CHECK: %[[c0:.+]] = llvm.mlir.constant(0 : i32) : i32 // CHECK: %[[c1:.+]] = llvm.mlir.constant(1 : i32) : i32 // CHECK: %[[b0:.+]] = llvm.bitcast {{.*}} : vector<4xi8> to i32 // CHECK: %[[z0:.+]] = llvm.zext {{.*}} : i8 to i32 // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<8xi32>, vector<8xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg2) * (%arg8[1] * %arg2) + %arg0 { k = 64 : i32, m = 32 : i32, n = 32 : i32 } : vector<4xf8E8M0FNU>, vector<32xf8E4M3FN>, f8E8M0FNU, vector<32xf8E4M3FN>, vector<16xf32> + amdgpu.scaled_mfma 32x32x64 (%arg7[0] * %arg2) * (%arg8[1] * %arg2) + %arg0 : vector<4xf8E8M0FNU>, vector<32xf8E4M3FN>, f8E8M0FNU, vector<32xf8E4M3FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<8xi32>, vector<8xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg2) * (%arg8[1] * %arg2) + %arg1 { k = 128 : i32, m = 16 : i32, n = 16 : i32 } : vector<4xf8E8M0FNU>, vector<32xf8E4M3FN>, f8E8M0FNU, vector<32xf8E4M3FN>, vector<4xf32> - + amdgpu.scaled_mfma 16x16x128 (%arg7[0] * %arg2) * (%arg8[1] * %arg2) + %arg1 : vector<4xf8E8M0FNU>, vector<32xf8E4M3FN>, f8E8M0FNU, vector<32xf8E4M3FN>, vector<4xf32> + // CHECK: llvm.bitcast - + // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<8xi32>, vector<8xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg3) * (%arg8[1] * %arg3) + %arg0 { k = 64 : i32, m = 32 : i32, n = 32 : i32 } : vector<4xf8E8M0FNU>, vector<32xf8E5M2>, f8E8M0FNU, vector<32xf8E5M2>, vector<16xf32> + amdgpu.scaled_mfma 32x32x64 (%arg7[0] * %arg3) * (%arg8[1] * %arg3) + %arg0 : vector<4xf8E8M0FNU>, vector<32xf8E5M2>, f8E8M0FNU, vector<32xf8E5M2>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<8xi32>, vector<8xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg3) * (%arg8[1] * %arg3) + %arg1 { k = 128 : i32, m = 16 : i32, n = 16 : i32 } : vector<4xf8E8M0FNU>, vector<32xf8E5M2>, f8E8M0FNU, vector<32xf8E5M2>, vector<4xf32> - + amdgpu.scaled_mfma 16x16x128 (%arg7[0] * %arg3) * (%arg8[1] * %arg3) + %arg1 : vector<4xf8E8M0FNU>, vector<32xf8E5M2>, f8E8M0FNU, vector<32xf8E5M2>, vector<4xf32> + // CHECK: llvm.bitcast - + // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<6xi32>, vector<6xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg4) * (%arg8[1] * %arg4) + %arg0 { k = 64 : i32, m = 32 : i32, n = 32 : i32 } : vector<4xf8E8M0FNU>, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<16xf32> + amdgpu.scaled_mfma 32x32x64 (%arg7[0] * %arg4) * (%arg8[1] * %arg4) + %arg0 : vector<4xf8E8M0FNU>, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<6xi32>, vector<6xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg4) * (%arg8[1] * %arg4) + %arg1 { k = 128 : i32, m = 16 : i32, n = 16 : i32 } : vector<4xf8E8M0FNU>, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<4xf32> - + amdgpu.scaled_mfma 16x16x128 (%arg7[0] * %arg4) * (%arg8[1] * %arg4) + %arg1 : vector<4xf8E8M0FNU>, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<4xf32> + // CHECK: llvm.bitcast // CHECK: llvm.mlir.constant(3 : i32) : i32 // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<6xi32>, vector<6xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg5) * (%arg8[1] * %arg5) + %arg0 { k = 64 : i32, m = 32 : i32, n = 32 : i32 } : vector<4xf8E8M0FNU>, vector<32xf6E3M2FN>, f8E8M0FNU, vector<32xf6E3M2FN>, vector<16xf32> + amdgpu.scaled_mfma 32x32x64 (%arg7[0] * %arg5) * (%arg8[1] * %arg5) + %arg0 : vector<4xf8E8M0FNU>, vector<32xf6E3M2FN>, f8E8M0FNU, vector<32xf6E3M2FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<6xi32>, vector<6xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg5) * (%arg8[1] * %arg5) + %arg1 { k = 128 : i32, m = 16 : i32, n = 16 : i32 } : vector<4xf8E8M0FNU>, vector<32xf6E3M2FN>, f8E8M0FNU, vector<32xf6E3M2FN>, vector<4xf32> - + amdgpu.scaled_mfma 16x16x128 (%arg7[0] * %arg5) * (%arg8[1] * %arg5) + %arg1 : vector<4xf8E8M0FNU>, vector<32xf6E3M2FN>, f8E8M0FNU, vector<32xf6E3M2FN>, vector<4xf32> + // CHECK: llvm.bitcast // CHECK: llvm.mlir.constant(4 : i32) : i32 - + // CHECK: rocdl.mfma.scale.f32.32x32x64.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<4xi32>, vector<4xi32>, vector<16xf32>, i32, i32, i32, i32, i32, i32) -> vector<16xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg6) * (%arg8[1] * %arg6) + %arg0 { k = 64 : i32, m = 32 : i32, n = 32 : i32 } : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, f8E8M0FNU, vector<32xf4E2M1FN>, vector<16xf32> + amdgpu.scaled_mfma 32x32x64 (%arg7[0] * %arg6) * (%arg8[1] * %arg6) + %arg0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, f8E8M0FNU, vector<32xf4E2M1FN>, vector<16xf32> // CHECK: rocdl.mfma.scale.f32.16x16x128.f8f6f4{{.*}}, %[[c0]], %[[b0]], %[[c1]], %[[z0]] : (vector<4xi32>, vector<4xi32>, vector<4xf32>, i32, i32, i32, i32, i32, i32) -> vector<4xf32> - amdgpu.scaled_mfma(%arg7[0] * %arg6) * (%arg8[1] * %arg6) + %arg1 { k = 128 : i32, m = 16 : i32, n = 16 : i32 } : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, f8E8M0FNU, vector<32xf4E2M1FN>, vector<4xf32> + amdgpu.scaled_mfma 16x16x128 (%arg7[0] * %arg6) * (%arg8[1] * %arg6) + %arg1 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, f8E8M0FNU, vector<32xf4E2M1FN>, vector<4xf32> func.return } diff --git a/mlir/test/Conversion/AMDGPUToROCDL/mfma.mlir b/mlir/test/Conversion/AMDGPUToROCDL/mfma.mlir index 52db142..e292d98 100644 --- a/mlir/test/Conversion/AMDGPUToROCDL/mfma.mlir +++ b/mlir/test/Conversion/AMDGPUToROCDL/mfma.mlir @@ -9,89 +9,89 @@ func.func @mfma_to_rocdl(%arg0 : f32, %arg1 : vector<32xf32>, %arg14 : vector<2xf32>, %arg15 : vector<8xf8E5M2FNUZ>, %arg16 : vector<8xf8E4M3FNUZ>) { // CHECK: rocdl.mfma.f32.32x32x1f32{{.*}}: (f32, f32, vector<32xf32>, i32, i32, i32) -> vector<32xf32> - amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 1 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : f32, f32, vector<32xf32> + amdgpu.mfma 32x32x1 %arg0 * %arg0 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, blocks = 2 : i32 } blgp = none : f32, f32, vector<32xf32> // CHECK: rocdl.mfma.f32.16x16x1f32{{.*}}: (f32, f32, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 1 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : f32, f32, vector<16xf32> + amdgpu.mfma 16x16x1 %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, blocks = 4 : i32 } blgp = none : f32, f32, vector<16xf32> // CHECK: rocdl.mfma.f32.4x4x1f32{{.*}}: (f32, f32, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg0 * %arg0 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 1 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : f32, f32, vector<4xf32> + amdgpu.mfma 4x4x1 %arg0 * %arg0 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, blocks = 16 : i32 } blgp = none : f32, f32, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x2f32{{.*}}: (f32, f32, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : f32, f32, vector<16xf32> + amdgpu.mfma 32x32x2 %arg0 * %arg0 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f32, f32, vector<16xf32> // CHECK: rocdl.mfma.f32.16x16x4f32{{.*}}: (f32, f32, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg0 * %arg0 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : f32, f32, vector<4xf32> + amdgpu.mfma 16x16x4 %arg0 * %arg0 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f32, f32, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x4f16{{.*}}: (vector<4xf16>, vector<4xf16>, vector<32xf32>, i32, i32, i32) -> vector<32xf32> - amdgpu.mfma %arg4 * %arg4 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<32xf32> + amdgpu.mfma 32x32x4 %arg4 * %arg4 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, blocks = 2 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<32xf32> // CHECK: rocdl.mfma.f32.16x16x4f16{{.*}}: (vector<4xf16>, vector<4xf16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg4 * %arg4 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<16xf32> + amdgpu.mfma 16x16x4 %arg4 * %arg4 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, blocks = 4 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.4x4x4f16{{.*}}: (vector<4xf16>, vector<4xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg4 * %arg4 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> + amdgpu.mfma 4x4x4 %arg4 * %arg4 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, blocks = 16 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x8f16{{.*}}: (vector<4xf16>, vector<4xf16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg4 * %arg4 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<16xf32> + amdgpu.mfma 32x32x8 %arg4 * %arg4 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.16x16x16f16{{.*}}: (vector<4xf16>, vector<4xf16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg4 * %arg4 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> + amdgpu.mfma 16x16x16 %arg4 * %arg4 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> // CHECK: %[[BITCAST_4xi8_i32:.+]] = llvm.bitcast {{.*}} : vector<4xi8> to i32 // CHECK: rocdl.mfma.i32.32x32x4i8 %[[BITCAST_4xi8_i32]], %[[BITCAST_4xi8_i32]], {{.*}}: (i32, i32, vector<32xi32>, i32, i32, i32) -> vector<32xi32> - amdgpu.mfma %arg5 * %arg5 + %arg6 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<32xi32> + amdgpu.mfma 32x32x4 %arg5 * %arg5 + %arg6 { abid = 0 : i32, cbsz = 0 : i32, blocks = 2 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<32xi32> // CHECK: rocdl.mfma.i32.16x16x4i8{{.*}}: (i32, i32, vector<16xi32>, i32, i32, i32) -> vector<16xi32> - amdgpu.mfma %arg5 * %arg5 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<16xi32> + amdgpu.mfma 16x16x4 %arg5 * %arg5 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, blocks = 4 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<16xi32> // CHECK: rocdl.mfma.i32.4x4x4i8{{.*}}: (i32, i32, vector<4xi32>, i32, i32, i32) -> vector<4xi32> - amdgpu.mfma %arg5 * %arg5 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<4xi32> + amdgpu.mfma 4x4x4 %arg5 * %arg5 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, blocks = 16 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<4xi32> // CHECK: rocdl.mfma.i32.32x32x8i8{{.*}}: (i32, i32, vector<16xi32>, i32, i32, i32) -> vector<16xi32> - amdgpu.mfma %arg5 * %arg5 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<16xi32> + amdgpu.mfma 32x32x8 %arg5 * %arg5 + %arg7 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<16xi32> // CHECK: rocdl.mfma.i32.16x16x16i8{{.*}}: (i32, i32, vector<4xi32>, i32, i32, i32) -> vector<4xi32> - amdgpu.mfma %arg5 * %arg5 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<4xi32> + amdgpu.mfma 16x16x16 %arg5 * %arg5 + %arg8 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xi8>, vector<4xi8>, vector<4xi32> // CHECK: %[[BITCAST_2xbf16_2xi16:.+]] = llvm.bitcast {{.*}} : vector<2xbf16> to vector<2xi16> // CHECK: rocdl.mfma.f32.32x32x2bf16 %[[BITCAST_2xbf16_2xi16]], %[[BITCAST_2xbf16_2xi16]], %{{.*}}: (vector<2xi16>, vector<2xi16>, vector<32xf32>, i32, i32, i32) -> vector<32xf32> - amdgpu.mfma %arg9 * %arg9 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<32xf32> + amdgpu.mfma 32x32x2 %arg9 * %arg9 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, blocks = 2 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<32xf32> // CHECK: rocdl.mfma.f32.16x16x2bf16{{.*}}: (vector<2xi16>, vector<2xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<16xf32> + amdgpu.mfma 16x16x2 %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, blocks = 4 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.4x4x2bf16{{.*}}: (vector<2xi16>, vector<2xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg9 * %arg9 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 2 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<4xf32> + amdgpu.mfma 4x4x2 %arg9 * %arg9 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, blocks = 16 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x4bf16{{.*}}: (vector<2xi16>, vector<2xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<16xf32> + amdgpu.mfma 32x32x4 %arg9 * %arg9 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.16x16x8bf16{{.*}}: (vector<2xi16>, vector<2xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg9 * %arg9 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<4xf32> + amdgpu.mfma 16x16x8 %arg9 * %arg9 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<2xbf16>, vector<2xbf16>, vector<4xf32> // CHECK: %[[BITCAST_4xbf16_4xi16:.+]] = llvm.bitcast {{.*}} : vector<4xbf16> to vector<4xi16> // CHECK: rocdl.mfma.f32.32x32x4bf16.1k %[[BITCAST_4xbf16_4xi16]], %[[BITCAST_4xbf16_4xi16]], {{.*}}: (vector<4xi16>, vector<4xi16>, vector<32xf32>, i32, i32, i32) -> vector<32xf32> - amdgpu.mfma %arg10 * %arg10 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<32xf32> + amdgpu.mfma 32x32x4 %arg10 * %arg10 + %arg1 { abid = 0 : i32, cbsz = 0 : i32, blocks = 2 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<32xf32> // CHECK: rocdl.mfma.f32.16x16x4bf16.1k{{.*}}: (vector<4xi16>, vector<4xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 4 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<16xf32> + amdgpu.mfma 16x16x4 %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, blocks = 4 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.4x4x4bf16.1k{{.*}}: (vector<4xi16>, vector<4xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg10 * %arg10 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 16 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<4xf32> + amdgpu.mfma 4x4x4 %arg10 * %arg10 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, blocks = 16 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x8bf16.1k{{.*}}: (vector<4xi16>, vector<4xi16>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<16xf32> + amdgpu.mfma 32x32x8 %arg10 * %arg10 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<16xf32> // CHECK: rocdl.mfma.f32.16x16x16bf16.1k{{.*}}: (vector<4xi16>, vector<4xi16>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg10 * %arg10 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<4xf32> + amdgpu.mfma 16x16x16 %arg10 * %arg10 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xbf16>, vector<4xbf16>, vector<4xf32> // CHECK: rocdl.mfma.f64.16x16x4f64{{.*}}: (f64, f64, vector<4xf64>, i32, i32, i32) -> vector<4xf64> - amdgpu.mfma %arg11 * %arg11 + %arg12 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : f64, f64, vector<4xf64> + amdgpu.mfma 16x16x4 %arg11 * %arg11 + %arg12 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f64, f64, vector<4xf64> // CHECK: rocdl.mfma.f64.4x4x4f64{{.*}}: (f64, f64, f64, i32, i32, i32) -> f64 - amdgpu.mfma %arg11 * %arg11 + %arg11 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 4 : i32, n = 4 : i32, blocks = 4 : i32 } blgp = none : f64, f64, f64 + amdgpu.mfma 4x4x4 %arg11 * %arg11 + %arg11 { abid = 0 : i32, cbsz = 0 : i32, blocks = 4 : i32 } blgp = none : f64, f64, f64 // CHECK: %[[BITCAST_8xi8_i64:.+]] = llvm.bitcast {{.*}} : vector<8xi8> to i64 // CHECK: rocdl.mfma.i32.16x16x32.i8 %[[BITCAST_8xi8_i64]], %[[BITCAST_8xi8_i64]], {{.*}}: (i64, i64, vector<4xi32>, i32, i32, i32) -> vector<4xi32> - amdgpu.mfma %arg13 * %arg13 + %arg8 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xi8>, vector<8xi8>, vector<4xi32> + amdgpu.mfma 16x16x32 %arg13 * %arg13 + %arg8 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xi8>, vector<8xi8>, vector<4xi32> // CHECK: rocdl.mfma.i32.32x32x16.i8{{.*}}: (i64, i64, vector<16xi32>, i32, i32, i32) -> vector<16xi32> - amdgpu.mfma %arg13 * %arg13 + %arg7 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xi8>, vector<8xi8>, vector<16xi32> + amdgpu.mfma 32x32x16 %arg13 * %arg13 + %arg7 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xi8>, vector<8xi8>, vector<16xi32> // CHECK: rocdl.mfma.f32.16x16x8.xf32{{.*}}: (vector<2xf32>, vector<2xf32>, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg14 * %arg14 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 8 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32, reducePrecision } blgp = none : vector<2xf32>, vector<2xf32>, vector<4xf32> + amdgpu.mfma 16x16x8 %arg14 * %arg14 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, reducePrecision } blgp = none : vector<2xf32>, vector<2xf32>, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x4.xf32{{.*}}: (vector<2xf32>, vector<2xf32>, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg14 * %arg14 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 4 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32, reducePrecision } blgp = none : vector<2xf32>, vector<2xf32>, vector<16xf32> + amdgpu.mfma 32x32x4 %arg14 * %arg14 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, reducePrecision } blgp = none : vector<2xf32>, vector<2xf32>, vector<16xf32> // CHECK: %[[BITCAST_8xi8_i64_1:.+]] = llvm.bitcast {{.*}} : vector<8xi8> to i64 // CHECK: rocdl.mfma.f32.16x16x32.bf8.bf8 %[[BITCAST_8xi8_i64_1]], %[[BITCAST_8xi8_i64_1]], {{.*}}: (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg15 * %arg15 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E5M2FNUZ>, vector<4xf32> + amdgpu.mfma 16x16x32 %arg15 * %arg15 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E5M2FNUZ>, vector<4xf32> // CHECK: %[[BITCAST_8xi8_i64_2:.+]] = llvm.bitcast {{.*}} : vector<8xi8> to i64 // CHECK: rocdl.mfma.f32.16x16x32.bf8.fp8 %[[BITCAST_8xi8_i64_1]], %[[BITCAST_8xi8_i64_2]], {{.*}}: (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg15 * %arg16 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E4M3FNUZ>, vector<4xf32> + amdgpu.mfma 16x16x32 %arg15 * %arg16 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E4M3FNUZ>, vector<4xf32> // CHECK: rocdl.mfma.f32.16x16x32.fp8.bf8{{.*}}: (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg16 * %arg15 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E5M2FNUZ>, vector<4xf32> + amdgpu.mfma 16x16x32 %arg16 * %arg15 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E5M2FNUZ>, vector<4xf32> // CHECK: rocdl.mfma.f32.16x16x32.fp8.fp8{{.*}}: (i64, i64, vector<4xf32>, i32, i32, i32) -> vector<4xf32> - amdgpu.mfma %arg16 * %arg16 + %arg3 { abid = 0 : i32, cbsz = 0 : i32, k = 32 : i32, m = 16 : i32, n = 16 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E4M3FNUZ>, vector<4xf32> + amdgpu.mfma 16x16x32 %arg16 * %arg16 + %arg3 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E4M3FNUZ>, vector<4xf32> // CHECK: rocdl.mfma.f32.32x32x16.bf8.bf8{{.*}}: (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg15 * %arg15 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E5M2FNUZ>, vector<16xf32> + amdgpu.mfma 32x32x16 %arg15 * %arg15 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E5M2FNUZ>, vector<16xf32> // CHECK: rocdl.mfma.f32.32x32x16.bf8.fp8{{.*}}: (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg15 * %arg16 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E4M3FNUZ>, vector<16xf32> + amdgpu.mfma 32x32x16 %arg15 * %arg16 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E5M2FNUZ>, vector<8xf8E4M3FNUZ>, vector<16xf32> // CHECK: rocdl.mfma.f32.32x32x16.fp8.bf8{{.*}}: (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg16 * %arg15 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E5M2FNUZ>, vector<16xf32> + amdgpu.mfma 32x32x16 %arg16 * %arg15 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E5M2FNUZ>, vector<16xf32> // CHECK: rocdl.mfma.f32.32x32x16.fp8.fp8{{.*}}: (i64, i64, vector<16xf32>, i32, i32, i32) -> vector<16xf32> - amdgpu.mfma %arg16 * %arg16 + %arg2 { abid = 0 : i32, cbsz = 0 : i32, k = 16 : i32, m = 32 : i32, n = 32 : i32, blocks = 1 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E4M3FNUZ>, vector<16xf32> + amdgpu.mfma 32x32x16 %arg16 * %arg16 + %arg2 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<8xf8E4M3FNUZ>, vector<8xf8E4M3FNUZ>, vector<16xf32> func.return } diff --git a/mlir/test/Dialect/AMDGPU/canonicalize.mlir b/mlir/test/Dialect/AMDGPU/canonicalize.mlir index 52d3275..fee0c00 100644 --- a/mlir/test/Dialect/AMDGPU/canonicalize.mlir +++ b/mlir/test/Dialect/AMDGPU/canonicalize.mlir @@ -165,10 +165,10 @@ func.func @fold_gather_to_lds_of_cast_dest(%global: memref<128x72xf32, 1>, %lds: // CHECK-LABEL: func @scaled_mfma // CHECK: %[[SCALE_1:.*]] = vector.extract_strided_slice %0 {offsets = [0], sizes = [4], strides = [1]} : vector<16xf8E8M0FNU> to vector<4xf8E8M0FNU> // CHECK: %[[SCALE_2:.*]] = vector.extract_strided_slice %2 {offsets = [4], sizes = [4], strides = [1]} : vector<16xf8E8M0FNU> to vector<4xf8E8M0FNU> -// CHECK: amdgpu.scaled_mfma(%[[SCALE_1]][3] * %{{.*}}) * (%[[SCALE_2]][2] * %{{.*}}) {{.*}} +// CHECK: amdgpu.scaled_mfma 16x16x128 (%[[SCALE_1]][3] * %{{.*}}) * (%[[SCALE_2]][2] * %{{.*}}) {{.*}} // CHECK: %[[SCALE_3:.*]] = vector.extract_strided_slice %5 {offsets = [8], sizes = [4], strides = [1]} : vector<16xf8E8M0FNU> to vector<4xf8E8M0FNU> // CHECK: %[[SCALE_4:.*]] = vector.extract_strided_slice %7 {offsets = [12], sizes = [4], strides = [1]} : vector<16xf8E8M0FNU> to vector<4xf8E8M0FNU> -// CHECK: amdgpu.scaled_mfma(%[[SCALE_3]][1] * %{{.*}}) * (%[[SCALE_4]][0] * %{{.*}}) {{.*}} +// CHECK: amdgpu.scaled_mfma 16x16x128 (%[[SCALE_3]][1] * %{{.*}}) * (%[[SCALE_4]][0] * %{{.*}}) {{.*}} func.func @scaled_mfma(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4E2M1FN>, %scalesA: vector<2x1x8x1xf8E8M0FNU>, %scalesB: vector<2x1x8x1xf8E8M0FNU>) -> (vector<4xf32>, vector<4xf32>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<4xf32> %cst_1 = arith.constant dense<5.877470e-39> : vector<4xf8E8M0FNU> @@ -176,12 +176,12 @@ func.func @scaled_mfma(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4E2M1FN>, %sc %sA = vector.insert %scaleA, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> %scaleB = vector.extract %scalesB[0, 0, 6, 0] : f8E8M0FNU from vector<2x1x8x1xf8E8M0FNU> %sB = vector.insert %scaleB, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> - %res_0 = amdgpu.scaled_mfma(%sA[0] * %opA) * (%sB[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + %res_0 = amdgpu.scaled_mfma 16x16x128 (%sA[0] * %opA) * (%sB[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> %scaleC = vector.extract %scalesA[1, 0, 1, 0] : f8E8M0FNU from vector<2x1x8x1xf8E8M0FNU> %sC = vector.insert %scaleC, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> %scaleD = vector.extract %scalesB[1, 0, 4, 0] : f8E8M0FNU from vector<2x1x8x1xf8E8M0FNU> %sD = vector.insert %scaleD, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> - %res_1 = amdgpu.scaled_mfma(%sC[0] * %opA) * (%sD[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + %res_1 = amdgpu.scaled_mfma 16x16x128 (%sC[0] * %opA) * (%sD[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> return %res_0, %res_1 : vector<4xf32>, vector<4xf32> } @@ -192,7 +192,7 @@ func.func @scaled_mfma(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4E2M1FN>, %sc // CHECK: vector.insert {{.*}} : f8E8M0FNU into vector<4xf8E8M0FNU> // CHECK: vector.extract {{.*}} : f8E8M0FNU from vector<2xf8E8M0FNU> // CHECK: vector.insert {{.*}} : f8E8M0FNU into vector<4xf8E8M0FNU> -// CHECK: amdgpu.scaled_mfma({{.*}}[0] * {{.*}}) * ({{.*}}[0] * {{.*}} +// CHECK: amdgpu.scaled_mfma 16x16x128 ({{.*}}[0] * {{.*}}) * ({{.*}}[0] * {{.*}} func.func @scaled_mfma_less_than_4(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4E2M1FN>, %scalesA: vector<2xf8E8M0FNU>, %scalesB: vector<2xf8E8M0FNU>) -> vector<4xf32> { %cst_0 = arith.constant dense<0.000000e+00> : vector<4xf32> %cst_1 = arith.constant dense<5.877470e-39> : vector<4xf8E8M0FNU> @@ -200,17 +200,17 @@ func.func @scaled_mfma_less_than_4(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4 %sA = vector.insert %scaleA, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> %scaleB = vector.extract %scalesB[1] : f8E8M0FNU from vector<2xf8E8M0FNU> %sB = vector.insert %scaleB, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> - %res_0 = amdgpu.scaled_mfma(%sA[0] * %opA) * (%sB[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + %res_0 = amdgpu.scaled_mfma 16x16x128 (%sA[0] * %opA) * (%sB[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> return %res_0 : vector<4xf32> } // ----- // CHECK-LABEL: func @scaled_mfma_ugly_shapes -// CHECK: amdgpu.scaled_mfma(%{{.*}}[0] * %{{.*}}) * (%{{.*}}[3] * %arg1) + %cst {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> -// CHECK: amdgpu.scaled_mfma(%{{.*}}[1] * %{{.*}}) * (%{{.*}}[3] * %arg1) + %cst {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> -// CHECK: amdgpu.scaled_mfma(%{{.*}}[2] * %{{.*}}) * (%{{.*}}[2] * %arg1) + %cst {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> -// CHECK: amdgpu.scaled_mfma(%{{.*}}[3] * %{{.*}}) * (%{{.*}}[1] * %arg1) + %cst {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> +// CHECK: amdgpu.scaled_mfma 16x16x128 (%{{.*}}[0] * %{{.*}}) * (%{{.*}}[3] * %arg1) + %cst : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> +// CHECK: amdgpu.scaled_mfma 16x16x128 (%{{.*}}[1] * %{{.*}}) * (%{{.*}}[3] * %arg1) + %cst : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> +// CHECK: amdgpu.scaled_mfma 16x16x128 (%{{.*}}[2] * %{{.*}}) * (%{{.*}}[2] * %arg1) + %cst : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> +// CHECK: amdgpu.scaled_mfma 16x16x128 (%{{.*}}[3] * %{{.*}}) * (%{{.*}}[1] * %arg1) + %cst : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> func.func @scaled_mfma_ugly_shapes(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4E2M1FN>, %scalesA: vector<5x5xf8E8M0FNU>, %scalesB: vector<7x23xf8E8M0FNU>) -> (vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32>) { %cst_0 = arith.constant dense<0.000000e+00> : vector<4xf32> %cst_1 = arith.constant dense<5.877470e-39> : vector<4xf8E8M0FNU> @@ -237,10 +237,10 @@ func.func @scaled_mfma_ugly_shapes(%opA: vector<32xf4E2M1FN>, %opB: vector<32xf4 %sB_6_21 = vector.insert %scaleB_6_21, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> %sB_6_20 = vector.insert %scaleB_6_20, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> %sB_6_19 = vector.insert %scaleB_6_19, %cst_1 [0] : f8E8M0FNU into vector<4xf8E8M0FNU> - - %res_4 = amdgpu.scaled_mfma(%sA_0_4[0] * %opA) * (%sB_6_22[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> - %res_5 = amdgpu.scaled_mfma(%sA_0_5[0] * %opA) * (%sB_6_21[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> - %res_6 = amdgpu.scaled_mfma(%sA_0_6[0] * %opA) * (%sB_6_20[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> - %res_7 = amdgpu.scaled_mfma(%sA_0_7[0] * %opA) * (%sB_6_19[0] * %opB) + %cst_0 {k = 128 : i32, m = 16 : i32, n = 16 : i32} : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + + %res_4 = amdgpu.scaled_mfma 16x16x128 (%sA_0_4[0] * %opA) * (%sB_6_22[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + %res_5 = amdgpu.scaled_mfma 16x16x128 (%sA_0_5[0] * %opA) * (%sB_6_21[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + %res_6 = amdgpu.scaled_mfma 16x16x128 (%sA_0_6[0] * %opA) * (%sB_6_20[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> + %res_7 = amdgpu.scaled_mfma 16x16x128 (%sA_0_7[0] * %opA) * (%sB_6_19[0] * %opB) + %cst_0 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf32> return %res_4, %res_5, %res_6, %res_7 : vector<4xf32>, vector<4xf32>, vector<4xf32>, vector<4xf32> } diff --git a/mlir/test/Dialect/AMDGPU/invalid.mlir b/mlir/test/Dialect/AMDGPU/invalid.mlir index 6a2518a..5784764 100644 --- a/mlir/test/Dialect/AMDGPU/invalid.mlir +++ b/mlir/test/Dialect/AMDGPU/invalid.mlir @@ -19,9 +19,7 @@ func.func @mixing_packed_stoch_round_types(%arg0: f32, %arg1: i32, %arg2: vector func.func @bad_source_types(%a: vector<2xf32>, %b: vector<4xf16>, %c: vector<32xf32>) -> vector<32xf32> { // expected-error@+1 {{'amdgpu.mfma' op expected both non-small-float source operand types to match exactly}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<2xf32>, vector<4xf16>, vector<32xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<2xf32>, vector<4xf16>, vector<32xf32> func.return %d : vector<32xf32> } @@ -30,9 +28,7 @@ func.func @bad_source_types(%a: vector<2xf32>, %b: vector<4xf16>, func.func @bad_source_types_f8(%a: vector<8xf8E5M2FNUZ>, %b: vector<8xi8>, %c: vector<32xf32>) -> vector<32xf32> { // expected-error@+1 {{'amdgpu.mfma' op expected both source operands to have small-float elements if one does}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<8xf8E5M2FNUZ>, vector<8xi8>, vector<32xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<8xf8E5M2FNUZ>, vector<8xi8>, vector<32xf32> func.return %d : vector<32xf32> } @@ -41,9 +37,7 @@ func.func @bad_source_types_f8(%a: vector<8xf8E5M2FNUZ>, %b: vector<8xi8>, func.func @bad_source_arguments(%a: vector<2xf32>, %b: vector<2xf32>, %c: vector<32xf32>) -> vector<32xf32> { // expected-error@+1 {{'amdgpu.mfma' op expected 1 source values for this operation but got 2}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<2xf32>, vector<2xf32>, vector<32xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<2xf32>, vector<2xf32>, vector<32xf32> func.return %d : vector<32xf32> } @@ -52,9 +46,7 @@ func.func @bad_source_arguments(%a: vector<2xf32>, %b: vector<2xf32>, func.func @bad_source_arguments_i8(%a: vector<8xi8>, %b: vector<8xi8>, %c: vector<4xi32>) -> vector<4xi32> { // expected-error@+1 {{'amdgpu.mfma' op expected 4 source values for this operation but got 8}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 4 : i32, blocks = 2 : i32, - abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<8xi8>, vector<8xi8>, vector<4xi32> + %d = amdgpu.mfma 32x32x4 %a * %b + %c { blocks = 2 : i32, abid = 0 : i32, cbsz = 0 : i32} blgp = none : vector<8xi8>, vector<8xi8>, vector<4xi32> func.return %d : vector<4xi32> } @@ -62,9 +54,7 @@ func.func @bad_source_arguments_i8(%a: vector<8xi8>, %b: vector<8xi8>, func.func @bad_dest_type(%a: f32, %b: f32, %c: vector<16xf32>) -> vector<16xf32> { // expected-error@+1 {{'amdgpu.mfma' op expected 32 result values for this operation but got 16}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 0 : i32, cbsz = 0 : i32} blgp = none : f32, f32, vector<16xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 0 : i32, cbsz = 0 : i32} blgp = none : f32, f32, vector<16xf32> return %d : vector<16xf32> } @@ -72,9 +62,7 @@ func.func @bad_dest_type(%a: f32, %b: f32, %c: vector<16xf32>) -> vector<16xf32> func.func @f64_permuting_b(%a: f64, %b: f64, %c: vector<4xf64>) -> vector<4xf64> { // expected-error@+1 {{'amdgpu.mfma' op double-precision ops do not support permuting lanes of B}} - %d = amdgpu.mfma %a * %b + %c { - m = 16 : i32, n = 16 : i32, k = 4 : i32, blocks = 1 : i32, - abid = 0 : i32, cbsz = 0 : i32} blgp = bcast_first_32 : f64, f64, vector<4xf64> + %d = amdgpu.mfma 16x16x4 %a * %b + %c { abid = 0 : i32, cbsz = 0 : i32} blgp = bcast_first_32 : f64, f64, vector<4xf64> return %d : vector<4xf64> } @@ -82,9 +70,7 @@ func.func @f64_permuting_b(%a: f64, %b: f64, %c: vector<4xf64>) -> vector<4xf64> func.func @f64_permuting_a(%a: f64, %b: f64, %c: vector<4xf64>) -> vector<4xf64> { // expected-error@+1 {{'amdgpu.mfma' op double-precision ops do not support permuting lanes of A}} - %d = amdgpu.mfma %a * %b + %c { - m = 16 : i32, n = 16 : i32, k = 4 : i32, blocks = 1 : i32, - abid = 0 : i32, cbsz = 1 : i32} blgp = none : f64, f64, vector<4xf64> + %d = amdgpu.mfma 16x16x4 %a * %b + %c { abid = 0 : i32, cbsz = 1 : i32} blgp = none : f64, f64, vector<4xf64> return %d : vector<4xf64> } @@ -92,9 +78,7 @@ func.func @f64_permuting_a(%a: f64, %b: f64, %c: vector<4xf64>) -> vector<4xf64> func.func @abid_without_bradcast(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { // expected-error@+1 {{'amdgpu.mfma' op block ID for permuting A (abid) must be below 2 ** cbsz}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 1 : i32, cbsz = 0 : i32} blgp = none : f32, f32, vector<32xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 1 : i32, cbsz = 0 : i32} blgp = none : f32, f32, vector<32xf32> func.return %d : vector<32xf32> } @@ -102,9 +86,7 @@ func.func @abid_without_bradcast(%a: f32, %b: f32, %c: vector<32xf32>) -> vector func.func @abid_too_large(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { // expected-error@+1 {{'amdgpu.mfma' op block ID for permuting A (abid) must be below 2 ** cbsz}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 2 : i32, cbsz = 1 : i32} blgp = none : f32, f32, vector<32xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 2 : i32, cbsz = 1 : i32} blgp = none : f32, f32, vector<32xf32> func.return %d : vector<32xf32> } @@ -112,9 +94,39 @@ func.func @abid_too_large(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32 func.func @no_negation(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { // expected-error@+1 {{'amdgpu.mfma' op negation flags only available for double-precision operations}} - %d = amdgpu.mfma %a * %b + %c { - m = 32 : i32, n = 32 : i32, k = 1 : i32, blocks = 2 : i32, - abid = 0 : i32, cbsz = 0 : i32, negateA} blgp = none : f32, f32, vector<32xf32> + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 2 : i32, abid = 0 : i32, cbsz = 0 : i32, negateA} blgp = none : f32, f32, vector<32xf32> + func.return %d : vector<32xf32> +} + +// ----- + +func.func @mfma_invalid_m(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { + // expected-error@+1 {{'amdgpu.mfma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32}}} + %d = amdgpu.mfma 7x32x1 %a * %b + %c { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f32, f32, vector<32xf32> + func.return %d : vector<32xf32> +} + +// ----- + +func.func @mfma_invalid_n(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { + // expected-error@+1 {{'amdgpu.mfma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {4, 16, 32}}} + %d = amdgpu.mfma 32x7x1 %a * %b + %c { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f32, f32, vector<32xf32> + func.return %d : vector<32xf32> +} + +// ----- + +func.func @mfma_invalid_k(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { + // expected-error@+1 {{'amdgpu.mfma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {1, 2, 4, 8, 16, 32, 64, 128}}} + %d = amdgpu.mfma 32x32x3 %a * %b + %c { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f32, f32, vector<32xf32> + func.return %d : vector<32xf32> +} + +// ----- + +func.func @mfma_invalid_blocks(%a: f32, %b: f32, %c: vector<32xf32>) -> vector<32xf32> { + // expected-error@+1 {{'amdgpu.mfma' op attribute 'blocks' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {1, 2, 4, 16}}} + %d = amdgpu.mfma 32x32x1 %a * %b + %c { blocks = 7 : i32, abid = 0 : i32, cbsz = 0 : i32 } blgp = none : f32, f32, vector<32xf32> func.return %d : vector<32xf32> } @@ -302,3 +314,27 @@ func.func @amdgpu.scaled_ext_packed816_invalid_input_output_sizes(%v: vector<8xf %ret0 = amdgpu.scaled_ext_packed816 %v scale(%scale) blockSize(16) firstScaleLane(0) firstScaleByte(0) : vector<8xf8E5M2>, vector<4xf8E8M0FNU> -> vector<16xf16> func.return } + +// ----- + +func.func @scaled_mfma_invalid_m(%arg0 : vector<4xf8E8M0FNU>, %arg1 : vector<32xf4E2M1FN>, %arg2 : vector<16xf32>) -> vector<16xf32> { + // expected-error@+1 {{'amdgpu.scaled_mfma' op attribute 'm' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}}} + %0 = amdgpu.scaled_mfma 8x32x64 (%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<16xf32> + func.return %0 : vector<16xf32> +} + +// ----- + +func.func @scaled_mfma_invalid_n(%arg0 : vector<4xf8E8M0FNU>, %arg1 : vector<32xf4E2M1FN>, %arg2 : vector<16xf32>) -> vector<16xf32> { + // expected-error@+1 {{'amdgpu.scaled_mfma' op attribute 'n' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {16, 32}}} + %0 = amdgpu.scaled_mfma 32x8x64 (%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<16xf32> + func.return %0 : vector<16xf32> +} + +// ----- + +func.func @scaled_mfma_invalid_k(%arg0 : vector<4xf8E8M0FNU>, %arg1 : vector<32xf4E2M1FN>, %arg2 : vector<16xf32>) -> vector<16xf32> { + // expected-error@+1 {{'amdgpu.scaled_mfma' op attribute 'k' failed to satisfy constraint: 32-bit signless integer attribute whose value is one of {64, 128}}} + %0 = amdgpu.scaled_mfma 32x32x32 (%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2 : vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<4xf8E8M0FNU>, vector<32xf4E2M1FN>, vector<16xf32> + func.return %0 : vector<16xf32> +} diff --git a/mlir/test/Dialect/AMDGPU/ops.mlir b/mlir/test/Dialect/AMDGPU/ops.mlir index a185eb6..a330967 100644 --- a/mlir/test/Dialect/AMDGPU/ops.mlir +++ b/mlir/test/Dialect/AMDGPU/ops.mlir @@ -559,9 +559,16 @@ func.func @sched_barrier() { } // CHECK-LABEL: func @mfma -func.func @mfma(%arg0 : f32, %arg1 : vector<32xf32>) -> vector<32xf32> { - // CHECK: amdgpu.mfma - %0 = amdgpu.mfma %arg0 * %arg0 + %arg1 { abid = 1 : i32, cbsz = 1 : i32, k = 1 : i32, m = 32 : i32, n = 32 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32> +func.func @mfma(%arg0 : vector<4xf16>, %arg1 : vector<4xf32>) -> vector<4xf32> { + // CHECK: amdgpu.mfma 16x16x16 + %0 = amdgpu.mfma 16x16x16 %arg0 * %arg0 + %arg1 { abid = 0 : i32, cbsz = 0 : i32 } blgp = none : vector<4xf16>, vector<4xf16>, vector<4xf32> + func.return %0 : vector<4xf32> +} + +// CHECK-LABEL: func @mfma_with_blocks +func.func @mfma_with_blocks(%arg0 : f32, %arg1 : vector<32xf32>) -> vector<32xf32> { + // CHECK: amdgpu.mfma 32x32x1 + %0 = amdgpu.mfma 32x32x1 %arg0 * %arg0 + %arg1 { abid = 1 : i32, cbsz = 1 : i32, blocks = 2 : i32 } blgp = bcast_second_32 : f32, f32, vector<32xf32> func.return %0 : vector<32xf32> } @@ -602,8 +609,8 @@ func.func @permlane32_swap(%arg0 : f32) -> f32 { // CHECK-LABEL: func @scaled_mfma func.func @scaled_mfma(%arg0 : f8E8M0FNU, %arg1 : vector<32xf6E2M3FN>, %arg2 : vector<16xf32>) -> vector<16xf32> { - // CHECK: amdgpu.scaled_mfma - %0 = amdgpu.scaled_mfma(%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2 { k = 64 : i32, m = 32 : i32, n = 32 : i32 } : f8E8M0FNU, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<16xf32> + // CHECK: amdgpu.scaled_mfma 32x32x64 + %0 = amdgpu.scaled_mfma 32x32x64 (%arg0[0] * %arg1) * (%arg0[1] * %arg1) + %arg2 : f8E8M0FNU, vector<32xf6E2M3FN>, f8E8M0FNU, vector<32xf6E2M3FN>, vector<16xf32> func.return %0 : vector<16xf32> } |
