diff options
Diffstat (limited to 'llvm/utils')
11 files changed, 108 insertions, 68 deletions
diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp index 3938d39..ed802e2 100644 --- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp +++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp @@ -15,6 +15,7 @@ #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/xxhash.h" +#include "llvm/TableGen/CodeGenHelpers.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/SetTheory.h" @@ -290,8 +291,9 @@ public: } // End anonymous namespace. void RuntimeLibcallEmitter::emitGetRuntimeLibcallEnum(raw_ostream &OS) const { - OS << "#ifdef GET_RUNTIME_LIBCALL_ENUM\n" - "namespace llvm {\n" + IfDefEmitter IfDef(OS, "GET_RUNTIME_LIBCALL_ENUM"); + + OS << "namespace llvm {\n" "namespace RTLIB {\n" "enum Libcall : unsigned short {\n"; @@ -315,8 +317,7 @@ void RuntimeLibcallEmitter::emitGetRuntimeLibcallEnum(raw_ostream &OS) const { << RuntimeLibcallImplDefList.size() + 1 << ";\n" "} // End namespace RTLIB\n" - "} // End namespace llvm\n" - "#endif\n\n"; + "} // End namespace llvm\n"; } // StringMap uses xxh3_64bits, truncated to uint32_t. @@ -432,14 +433,16 @@ void RuntimeLibcallEmitter::emitNameMatchHashTable( // // TODO: It may make more sense to split the search by string size more. There // are a few outliers, most call names are small. - OS << "#ifdef GET_LOOKUP_LIBCALL_IMPL_NAME_BODY\n" - " size_t Size = Name.size();\n" - " if (Size == 0 || Size > " - << MaxFuncNameSize - << ")\n" - " return enum_seq(RTLIB::Unsupported, RTLIB::Unsupported);\n" - " return lookupLibcallImplNameImpl(Name);\n" - "#endif\n"; + { + IfDefEmitter IfDef(OS, "GET_LOOKUP_LIBCALL_IMPL_NAME_BODY"); + + OS << " size_t Size = Name.size();\n" + " if (Size == 0 || Size > " + << MaxFuncNameSize + << ")\n" + " return enum_seq(RTLIB::Unsupported, RTLIB::Unsupported);\n" + " return lookupLibcallImplNameImpl(Name);\n"; + } auto [Size, Collisions] = computePerfectHashParameters(Hashes); std::vector<unsigned> Lookup = @@ -449,7 +452,7 @@ void RuntimeLibcallEmitter::emitNameMatchHashTable( LLVM_DEBUG(dbgs() << "Runtime libcall perfect hashing parameters: Size = " << Size << ", maximum collisions = " << Collisions << '\n'); - OS << "#ifdef DEFINE_GET_LOOKUP_LIBCALL_IMPL_NAME\n"; + IfDefEmitter IfDef(OS, "DEFINE_GET_LOOKUP_LIBCALL_IMPL_NAME"); emitHashFunction(OS); OS << "iota_range<RTLIB::LibcallImpl> RTLIB::RuntimeLibcallsInfo::" @@ -481,59 +484,57 @@ void RuntimeLibcallEmitter::emitNameMatchHashTable( return enum_seq(RTLIB::Unsupported, RTLIB::Unsupported); } )"; - - OS << "#endif\n\n"; } void RuntimeLibcallEmitter::emitGetInitRuntimeLibcallNames( raw_ostream &OS) const { - OS << "#ifdef GET_INIT_RUNTIME_LIBCALL_NAMES\n"; - // Emit the implementation names StringToOffsetTable Table(/*AppendZero=*/true, "RTLIB::RuntimeLibcallsInfo::"); - for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) - Table.GetOrAddStringOffset(LibCallImpl.getLibcallFuncName()); + { + IfDefEmitter IfDef(OS, "GET_INIT_RUNTIME_LIBCALL_NAMES"); + + for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) + Table.GetOrAddStringOffset(LibCallImpl.getLibcallFuncName()); - Table.EmitStringTableDef(OS, "RuntimeLibcallImplNameTable"); - OS << R"( + Table.EmitStringTableDef(OS, "RuntimeLibcallImplNameTable"); + OS << R"( const uint16_t RTLIB::RuntimeLibcallsInfo::RuntimeLibcallNameOffsetTable[] = { )"; - OS << formatv(" {}, // {}\n", Table.GetStringOffset(""), - ""); // Unsupported entry - for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) { - StringRef ImplName = LibCallImpl.getLibcallFuncName(); - OS << formatv(" {}, // {}\n", Table.GetStringOffset(ImplName), ImplName); - } - OS << "};\n"; + OS << formatv(" {}, // {}\n", Table.GetStringOffset(""), + ""); // Unsupported entry + for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) { + StringRef ImplName = LibCallImpl.getLibcallFuncName(); + OS << formatv(" {}, // {}\n", Table.GetStringOffset(ImplName), ImplName); + } + OS << "};\n"; - OS << R"( + OS << R"( const uint8_t RTLIB::RuntimeLibcallsInfo::RuntimeLibcallNameSizeTable[] = { )"; - OS << " 0,\n"; - for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) - OS << " " << LibCallImpl.getLibcallFuncName().size() << ",\n"; - OS << "};\n\n"; + OS << " 0,\n"; + for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) + OS << " " << LibCallImpl.getLibcallFuncName().size() << ",\n"; + OS << "};\n\n"; - // Emit the reverse mapping from implementation libraries to RTLIB::Libcall - OS << "const RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::" - "ImplToLibcall[RTLIB::NumLibcallImpls] = {\n" - " RTLIB::UNKNOWN_LIBCALL, // RTLIB::Unsupported\n"; + // Emit the reverse mapping from implementation libraries to RTLIB::Libcall + OS << "const RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::" + "ImplToLibcall[RTLIB::NumLibcallImpls] = {\n" + " RTLIB::UNKNOWN_LIBCALL, // RTLIB::Unsupported\n"; - for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) { - const RuntimeLibcall *Provides = LibCallImpl.getProvides(); - OS << " "; - Provides->emitEnumEntry(OS); - OS << ", // "; - LibCallImpl.emitEnumEntry(OS); - OS << '\n'; + for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) { + const RuntimeLibcall *Provides = LibCallImpl.getProvides(); + OS << " "; + Provides->emitEnumEntry(OS); + OS << ", // "; + LibCallImpl.emitEnumEntry(OS); + OS << '\n'; + } + OS << "};\n\n"; } - OS << "};\n\n"; - - OS << "#endif\n\n"; emitNameMatchHashTable(OS, Table); } @@ -757,9 +758,10 @@ void RuntimeLibcallEmitter::run(raw_ostream &OS) { emitGetInitRuntimeLibcallNames(OS); - OS << "#ifdef GET_SET_TARGET_RUNTIME_LIBCALL_SETS\n"; - emitSystemRuntimeLibrarySetCalls(OS); - OS << "#endif\n\n"; + { + IfDefEmitter IfDef(OS, "GET_SET_TARGET_RUNTIME_LIBCALL_SETS"); + emitSystemRuntimeLibrarySetCalls(OS); + } } void LibcallPredicateExpander::expand(SetTheory &ST, const Record *Def, diff --git a/llvm/utils/TableGen/InstrInfoEmitter.cpp b/llvm/utils/TableGen/InstrInfoEmitter.cpp index 176e4b2..0b90f91 100644 --- a/llvm/utils/TableGen/InstrInfoEmitter.cpp +++ b/llvm/utils/TableGen/InstrInfoEmitter.cpp @@ -29,6 +29,7 @@ #include "llvm/Support/Format.h" #include "llvm/Support/SourceMgr.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/TableGen/CodeGenHelpers.h" #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TGTimer.h" @@ -284,7 +285,7 @@ emitGetNamedOperandIdx(raw_ostream &OS, static void emitGetOperandIdxName(raw_ostream &OS, - MapVector<StringRef, unsigned> OperandNameToID, + const MapVector<StringRef, unsigned> &OperandNameToID, const MapVector<SmallVector<int>, unsigned> &OperandMap, unsigned MaxNumOperands, unsigned NumOperandNames) { OS << "LLVM_READONLY OpName getOperandIdxName(uint16_t Opcode, int16_t Idx) " @@ -1135,6 +1136,22 @@ void InstrInfoEmitter::run(raw_ostream &OS) { OS << "\n};\n} // end namespace llvm\n"; + { + NamespaceEmitter LlvmNS(OS, "llvm"); + NamespaceEmitter TargetNS(OS, Target.getInstNamespace()); + for (const Record *R : Records.getAllDerivedDefinitions("Operand")) { + if (R->isAnonymous()) + continue; + if (const DagInit *D = R->getValueAsDag("MIOperandInfo")) { + for (unsigned i = 0, e = D->getNumArgs(); i < e; ++i) { + if (const StringInit *Name = D->getArgName(i)) + OS << "constexpr unsigned SUBOP_" << R->getName() << "_" + << Name->getValue() << " = " << i << ";\n"; + } + } + } + } + OS << "#endif // GET_INSTRINFO_HEADER\n\n"; OS << "#ifdef GET_INSTRINFO_HELPER_DECLS\n"; diff --git a/llvm/utils/extract_symbols.py b/llvm/utils/extract_symbols.py index 3887234..0cbfd2e 100755 --- a/llvm/utils/extract_symbols.py +++ b/llvm/utils/extract_symbols.py @@ -105,6 +105,14 @@ def should_keep_microsoft_symbol(symbol, calling_convention_decoration): # Skip X86GenMnemonicTables functions, they are not exposed from llvm/include/. elif re.match(r"\?is[A-Z0-9]*@X86@llvm", symbol): return None + # Keep Registry<T>::Head and Registry<T>::Tail static members for plugin support. + # Pattern matches: ?Head@?$Registry@<template_args>@llvm@@ or ?Tail@?$Registry@... + elif ( + "?$Registry@" in symbol + and "@llvm@@" in symbol + and (symbol.startswith("?Head@") or symbol.startswith("?Tail@")) + ): + return symbol # Keep mangled llvm:: and clang:: function symbols. How we detect these is a # bit of a mess and imprecise, but that avoids having to completely demangle # the symbol name. The outermost namespace is at the end of the identifier diff --git a/llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/Models/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/Models/BUILD.gn index 3fd3aab..01a05bc 100644 --- a/llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/Models/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/lib/Analysis/FlowSensitive/Models/BUILD.gn @@ -11,5 +11,6 @@ static_library("Models") { sources = [ "ChromiumCheckModel.cpp", "UncheckedOptionalAccessModel.cpp", + "UncheckedStatusOrAccessModel.cpp", ] } diff --git a/llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn b/llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn index c9f3a074..c74a44c 100644 --- a/llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/unittests/Analysis/FlowSensitive/BUILD.gn @@ -44,6 +44,8 @@ unittest("ClangAnalysisFlowSensitiveTests") { "TransferTest.cpp", "TypeErasedDataflowAnalysisTest.cpp", "UncheckedOptionalAccessModelTest.cpp", + "UncheckedStatusOrAccessModelTest.cpp", + "UncheckedStatusOrAccessModelTestFixture.cpp", "ValueTest.cpp", "WatchedLiteralsSolverTest.cpp", ] diff --git a/llvm/utils/gn/secondary/lldb/source/Plugins/ExpressionParser/Clang/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Plugins/ExpressionParser/Clang/BUILD.gn index 5efc153..51911d7 100644 --- a/llvm/utils/gn/secondary/lldb/source/Plugins/ExpressionParser/Clang/BUILD.gn +++ b/llvm/utils/gn/secondary/lldb/source/Plugins/ExpressionParser/Clang/BUILD.gn @@ -47,7 +47,6 @@ static_library("Clang") { "ClangASTImporter.cpp", "ClangASTMetadata.cpp", "ClangASTSource.cpp", - "ClangDeclVendor.cpp", "ClangExpressionDeclMap.cpp", "ClangExpressionHelper.cpp", "ClangExpressionParser.cpp", diff --git a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn index 38ba466..df9ddf9 100644 --- a/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/Support/BUILD.gn @@ -45,6 +45,7 @@ static_library("Support") { "ARMAttributeParser.cpp", "ARMBuildAttributes.cpp", "ARMWinEH.cpp", + "AllocToken.cpp", "Allocator.cpp", "AutoConvert.cpp", "BalancedPartitioning.cpp", diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py index a7e2705..f883145 100644 --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -92,12 +92,12 @@ class ShellEnvironment(object): we maintain a dir stack for pushd/popd. """ - def __init__(self, cwd, env, umask=-1, ulimit={}): + def __init__(self, cwd, env, umask=-1, ulimit=None): self.cwd = cwd self.env = dict(env) self.umask = umask self.dirStack = [] - self.ulimit = ulimit + self.ulimit = ulimit if ulimit else {} def change_dir(self, newdir): if os.path.isabs(newdir): diff --git a/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt new file mode 100644 index 0000000..011d6db --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-ulimit/ulimit_reset.txt @@ -0,0 +1,3 @@ +# RUN: %{python} %S/print_limits.py +# Fail the test so that we can assert on the output. +# RUN: not echo return diff --git a/llvm/utils/lit/tests/shtest-ulimit.py b/llvm/utils/lit/tests/shtest-ulimit.py index e843277..9a8febd 100644 --- a/llvm/utils/lit/tests/shtest-ulimit.py +++ b/llvm/utils/lit/tests/shtest-ulimit.py @@ -5,9 +5,9 @@ # as well. # UNSUPPORTED: system-windows, system-solaris -# RUN: not %{lit} -a -v %{inputs}/shtest-ulimit | FileCheck %s +# RUN: not %{lit} -a -v %{inputs}/shtest-ulimit --order=lexical | FileCheck %s -# CHECK: -- Testing: 2 tests{{.*}} +# CHECK: -- Testing: 3 tests{{.*}} # CHECK-LABEL: FAIL: shtest-ulimit :: ulimit-bad-arg.txt ({{[^)]*}}) # CHECK: ulimit -n @@ -16,3 +16,6 @@ # CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_okay.txt ({{[^)]*}}) # CHECK: ulimit -n 50 # CHECK: RLIMIT_NOFILE=50 + +# CHECK-LABEL: FAIL: shtest-ulimit :: ulimit_reset.txt ({{[^)]*}}) +# CHECK-NOT: RLIMIT_NOFILE=50 diff --git a/llvm/utils/update_mc_test_checks.py b/llvm/utils/update_mc_test_checks.py index ab7fe19..67fff56 100755 --- a/llvm/utils/update_mc_test_checks.py +++ b/llvm/utils/update_mc_test_checks.py @@ -290,11 +290,9 @@ def update_test(ti: common.TestInfo): # prefix is selected and generated with most shared output lines # each run_id can only be used once - gen_prefix = "" used_runid = set() - # line number diff between generated prefix and testline - line_offset = 1 + selected_prefixes = set() for prefix, tup in p_dict_sorted.items(): o, run_ids = tup @@ -308,18 +306,24 @@ def update_test(ti: common.TestInfo): else: used_runid.add(i) if not skip: - used_prefixes.add(prefix) + selected_prefixes.add(prefix) - if hasErr(o): - newline = getErrCheckLine(prefix, o, mc_mode, line_offset) - else: - newline = getStdCheckLine(prefix, o, mc_mode) + # Generate check lines in alphabetical order. + check_lines = [] + for prefix in sorted(selected_prefixes): + o, run_ids = p_dict[prefix] + used_prefixes.add(prefix) + + if hasErr(o): + line_offset = len(check_lines) + 1 + check = getErrCheckLine(prefix, o, mc_mode, line_offset) + else: + check = getStdCheckLine(prefix, o, mc_mode) - if newline: - gen_prefix += newline - line_offset += 1 + if check: + check_lines.append(check.strip()) - generated_prefixes[input_line] = gen_prefix.rstrip("\n") + generated_prefixes[input_line] = "\n".join(check_lines) # write output for input_info in ti.iterlines(output_lines): |