[llvm-branch-commits] [llvm] CodeGen: Remove UsesMSVCFloatingPoint from MachineModuleInfo (PR #100368)

2024-07-24 Thread Saleem Abdulrasool via llvm-branch-commits

compnerd wrote:

`_fltused` is used to identify the need for supporting functions and is used 
during the linking process. Always emitting results in code size increases and 
overlinking, but catching the generated ones is definitely something that we 
should be doing.

https://github.com/llvm/llvm-project/pull/100368
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] CodeGen: Remove UsesMSVCFloatingPoint from MachineModuleInfo (PR #100368)

2024-07-24 Thread Saleem Abdulrasool via llvm-branch-commits

compnerd wrote:

Not entirely - `_fltused` indicates that any floating point operations are 
being used. The problem is that the kernel mode code does not permit floating 
point operations (though you can explicitly use `KeSaveFloatingPointState` and 
`KeRestoreFloatingPointState` to explicitly use floating point code in a 
region). The `_fltused` is a protection mechanism for that, with the user space 
C++ runtime ("ABI library" - a la libc++abi) support library (vcruntime) 
providing a default definition of the symbol. That way, if the user 
accidentally uses floating point code in the kernel, it is identified at link 
time and prevents the errant use. Doing this post legalization makes sense 
though.

https://github.com/llvm/llvm-project/pull/100368
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libunwind] release/19.x: [libunwind][AIX] Fix the wrong traceback from signal handler (#101069) (PR #101182)

2024-07-30 Thread Saleem Abdulrasool via llvm-branch-commits

https://github.com/compnerd approved this pull request.

This is good to include on the release branch, it should be safe and fixes the 
behavior on AIX.

https://github.com/llvm/llvm-project/pull/101182
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] release/19.x: [Support] Silence warnings when retrieving exported functions (#97905) (PR #101266)

2024-07-31 Thread Saleem Abdulrasool via llvm-branch-commits

https://github.com/compnerd approved this pull request.

This should be safe to backport. As long as it passes CI, this should not cause 
issues as it just uses a `void *` cast to strip the calling convention before 
re-applying it.

https://github.com/llvm/llvm-project/pull/101266
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-branch] r246135 - ReleaseNotes: fix minor spelling mistake

2015-09-09 Thread Saleem Abdulrasool via llvm-branch-commits
Author: compnerd
Date: Wed Aug 26 21:18:31 2015
New Revision: 246135

URL: http://llvm.org/viewvc/llvm-project?rev=246135&view=rev
Log:
ReleaseNotes: fix minor spelling mistake

Modified:
llvm/branches/release_37/docs/ReleaseNotes.rst

Modified: llvm/branches/release_37/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/docs/ReleaseNotes.rst?rev=246135&r1=246134&r2=246135&view=diff
==
--- llvm/branches/release_37/docs/ReleaseNotes.rst (original)
+++ llvm/branches/release_37/docs/ReleaseNotes.rst Wed Aug 26 21:18:31 2015
@@ -55,7 +55,7 @@ Non-comprehensive list of changes in thi
   The LLVM C API ``LLVMGetTargetMachineData`` is deprecated to reflect the fact
   that it won't be available anymore from ``TargetMachine`` in 3.8.
 
-* Comdats are now ortogonal to the linkage. LLVM will not create
+* Comdats are now orthogonal to the linkage. LLVM will not create
   comdats for weak linkage globals and the frontends are responsible
   for explicitly adding them.
 


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-branch] r246136 - ReleaseNotes: add a note about libunwind moving

2015-09-09 Thread Saleem Abdulrasool via llvm-branch-commits
Author: compnerd
Date: Wed Aug 26 21:20:03 2015
New Revision: 246136

URL: http://llvm.org/viewvc/llvm-project?rev=246136&view=rev
Log:
ReleaseNotes: add a note about libunwind moving

libunwind moved from libc++abi into a separate project.  This may catch users
off guard, so add a release note.

Thanks to Hans for the reminder!


Modified:
llvm/branches/release_37/docs/ReleaseNotes.rst

Modified: llvm/branches/release_37/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/docs/ReleaseNotes.rst?rev=246136&r1=246135&r2=246136&view=diff
==
--- llvm/branches/release_37/docs/ReleaseNotes.rst (original)
+++ llvm/branches/release_37/docs/ReleaseNotes.rst Wed Aug 26 21:20:03 2015
@@ -372,6 +372,17 @@ Changes since the last release:
 
 * Many bug fixes
 
+libunwind
+-
+
+The unwind implementation which use to reside in `libc++abi` has been moved 
into
+a separate repository.  This implementation can still be used for `libc++abi` 
by
+specifying `-DLIBCXXABI_USE_LLVM_UNWINDER=YES` and
+`-DLIBCXXABI_LIBUNWIND_PATH=` when configuring
+`libc++abi`, which defaults to `true` when building on ARM.
+
+The new repository can also be built standalone if just `libunwind` is desired.
+
 External Open Source Projects Using LLVM 3.7
 
 


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 16fdc5d - APINotes: annotate dump methods (NFC)

2021-01-08 Thread Saleem Abdulrasool via llvm-branch-commits

Author: Saleem Abdulrasool
Date: 2021-01-08T20:49:28Z
New Revision: 16fdc5da89068f646c153c6bd6c493b1d666bfbf

URL: 
https://github.com/llvm/llvm-project/commit/16fdc5da89068f646c153c6bd6c493b1d666bfbf
DIFF: 
https://github.com/llvm/llvm-project/commit/16fdc5da89068f646c153c6bd6c493b1d666bfbf.diff

LOG: APINotes: annotate dump methods (NFC)

This annotates the dump methods in APINotes to indicate that they are
unused as they are meant for debugging purposes.  This avoids an
unnecessary warning.

Added: 


Modified: 
clang/lib/APINotes/APINotesTypes.cpp

Removed: 




diff  --git a/clang/lib/APINotes/APINotesTypes.cpp 
b/clang/lib/APINotes/APINotesTypes.cpp
index 3d50ea96f144..c0bb726ea72b 100644
--- a/clang/lib/APINotes/APINotesTypes.cpp
+++ b/clang/lib/APINotes/APINotesTypes.cpp
@@ -11,7 +11,7 @@
 
 namespace clang {
 namespace api_notes {
-void CommonEntityInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void CommonEntityInfo::dump(llvm::raw_ostream &OS) const {
   if (Unavailable)
 OS << "[Unavailable] (" << UnavailableMsg << ")" << ' ';
   if (UnavailableInSwift)
@@ -23,7 +23,7 @@ void CommonEntityInfo::dump(llvm::raw_ostream &OS) const {
   OS << '\n';
 }
 
-void CommonTypeInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void CommonTypeInfo::dump(llvm::raw_ostream &OS) const {
   static_cast(*this).dump(OS);
   if (SwiftBridge)
 OS << "Swift Briged Type: " << *SwiftBridge << ' ';
@@ -32,7 +32,7 @@ void CommonTypeInfo::dump(llvm::raw_ostream &OS) const {
   OS << '\n';
 }
 
-void ObjCContextInfo::dump(llvm::raw_ostream &OS) {
+LLVM_DUMP_METHOD void ObjCContextInfo::dump(llvm::raw_ostream &OS) {
   static_cast(*this).dump(OS);
   if (HasDefaultNullability)
 OS << "DefaultNullability: " << DefaultNullability << ' ';
@@ -45,7 +45,7 @@ void ObjCContextInfo::dump(llvm::raw_ostream &OS) {
   OS << '\n';
 }
 
-void VariableInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void VariableInfo::dump(llvm::raw_ostream &OS) const {
   static_cast(*this).dump(OS);
   if (NullabilityAudited)
 OS << "Audited Nullability: " << Nullable << ' ';
@@ -54,14 +54,14 @@ void VariableInfo::dump(llvm::raw_ostream &OS) const {
   OS << '\n';
 }
 
-void ObjCPropertyInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void ObjCPropertyInfo::dump(llvm::raw_ostream &OS) const {
   static_cast(*this).dump(OS);
   if (SwiftImportAsAccessorsSpecified)
 OS << (SwiftImportAsAccessors ? "[SwiftImportAsAccessors] " : "");
   OS << '\n';
 }
 
-void ParamInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void ParamInfo::dump(llvm::raw_ostream &OS) const {
   static_cast(*this).dump(OS);
   if (NoEscapeSpecified)
 OS << (NoEscape ? "[NoEscape] " : "");
@@ -69,7 +69,7 @@ void ParamInfo::dump(llvm::raw_ostream &OS) const {
   OS << '\n';
 }
 
-void FunctionInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void FunctionInfo::dump(llvm::raw_ostream &OS) const {
   static_cast(*this).dump(OS);
   OS << (NullabilityAudited ? "[NullabilityAudited] " : "")
  << "RawRetainCountConvention: " << RawRetainCountConvention << ' ';
@@ -81,13 +81,13 @@ void FunctionInfo::dump(llvm::raw_ostream &OS) const {
 PI.dump(OS);
 }
 
-void ObjCMethodInfo::dump(llvm::raw_ostream &OS) {
+LLVM_DUMP_METHOD void ObjCMethodInfo::dump(llvm::raw_ostream &OS) {
   static_cast(*this).dump(OS);
   OS << (DesignatedInit ? "[DesignatedInit] " : "")
  << (RequiredInit ? "[RequiredInit] " : "") << '\n';
 }
 
-void TagInfo::dump(llvm::raw_ostream &OS) {
+LLVM_DUMP_METHOD void TagInfo::dump(llvm::raw_ostream &OS) {
   static_cast(*this).dump(OS);
   if (HasFlagEnum)
 OS << (IsFlagEnum ? "[FlagEnum] " : "");
@@ -97,7 +97,7 @@ void TagInfo::dump(llvm::raw_ostream &OS) {
   OS << '\n';
 }
 
-void TypedefInfo::dump(llvm::raw_ostream &OS) const {
+LLVM_DUMP_METHOD void TypedefInfo::dump(llvm::raw_ostream &OS) const {
   static_cast(*this).dump(OS);
   if (SwiftWrapper)
 OS << "Swift Type: " << static_cast(*SwiftWrapper) << ' ';



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] f6b02ec - APINotes: add property models for YAML attributes

2020-11-23 Thread Saleem Abdulrasool via llvm-branch-commits

Author: Saleem Abdulrasool
Date: 2020-11-23T21:29:17Z
New Revision: f6b02ecd027a825f1f4a1804c464f9f96d9372c9

URL: 
https://github.com/llvm/llvm-project/commit/f6b02ecd027a825f1f4a1804c464f9f96d9372c9
DIFF: 
https://github.com/llvm/llvm-project/commit/f6b02ecd027a825f1f4a1804c464f9f96d9372c9.diff

LOG: APINotes: add property models for YAML attributes

This adds internal representation of the attributes in a more usable
form.  This is meant to allow programmatic access to the attributes that
are specified in the YAML data.

This is based upon the work contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D91104
Reviewed By: Gabor Marton

Added: 
clang/lib/APINotes/APINotesTypes.cpp

Modified: 
clang/include/clang/APINotes/Types.h
clang/lib/APINotes/CMakeLists.txt

Removed: 




diff  --git a/clang/include/clang/APINotes/Types.h 
b/clang/include/clang/APINotes/Types.h
index be2a99ad6fd0..3095bfbf1718 100644
--- a/clang/include/clang/APINotes/Types.h
+++ b/clang/include/clang/APINotes/Types.h
@@ -9,6 +9,12 @@
 #ifndef LLVM_CLANG_APINOTES_TYPES_H
 #define LLVM_CLANG_APINOTES_TYPES_H
 
+#include "clang/Basic/Specifiers.h"
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/StringRef.h"
+#include 
+#include 
+
 namespace clang {
 namespace api_notes {
 enum class RetainCountConventionKind {
@@ -34,6 +40,694 @@ enum class SwiftNewTypeKind {
   Struct,
   Enum,
 };
+
+/// Describes API notes data for any entity.
+///
+/// This is used as the base of all API notes.
+class CommonEntityInfo {
+public:
+  /// Message to use when this entity is unavailable.
+  std::string UnavailableMsg;
+
+  /// Whether this entity is marked unavailable.
+  unsigned Unavailable : 1;
+
+  /// Whether this entity is marked unavailable in Swift.
+  unsigned UnavailableInSwift : 1;
+
+private:
+  /// Whether SwiftPrivate was specified.
+  unsigned SwiftPrivateSpecified : 1;
+
+  /// Whether this entity is considered "private" to a Swift overlay.
+  unsigned SwiftPrivate : 1;
+
+public:
+  /// Swift name of this entity.
+  std::string SwiftName;
+
+  CommonEntityInfo()
+  : Unavailable(0), UnavailableInSwift(0), SwiftPrivateSpecified(0),
+SwiftPrivate(0) {}
+
+  llvm::Optional isSwiftPrivate() const {
+return SwiftPrivateSpecified ? llvm::Optional(SwiftPrivate)
+ : llvm::None;
+  }
+
+  void setSwiftPrivate(llvm::Optional Private) {
+SwiftPrivateSpecified = Private.hasValue();
+SwiftPrivate = Private.hasValue() ? *Private : 0;
+  }
+
+  friend bool operator==(const CommonEntityInfo &, const CommonEntityInfo &);
+
+  CommonEntityInfo &operator|=(const CommonEntityInfo &RHS) {
+// Merge unavailability.
+if (RHS.Unavailable) {
+  Unavailable = true;
+  if (UnavailableMsg.empty())
+UnavailableMsg = RHS.UnavailableMsg;
+}
+
+if (RHS.UnavailableInSwift) {
+  UnavailableInSwift = true;
+  if (UnavailableMsg.empty())
+UnavailableMsg = RHS.UnavailableMsg;
+}
+
+if (!SwiftPrivateSpecified)
+  setSwiftPrivate(RHS.isSwiftPrivate());
+
+if (SwiftName.empty())
+  SwiftName = RHS.SwiftName;
+
+return *this;
+  }
+
+  LLVM_DUMP_METHOD void dump(llvm::raw_ostream &OS);
+};
+
+inline bool operator==(const CommonEntityInfo &LHS,
+   const CommonEntityInfo &RHS) {
+  return LHS.UnavailableMsg == RHS.UnavailableMsg &&
+ LHS.Unavailable == RHS.Unavailable &&
+ LHS.UnavailableInSwift == RHS.UnavailableInSwift &&
+ LHS.SwiftPrivateSpecified == RHS.SwiftPrivateSpecified &&
+ LHS.SwiftPrivate == RHS.SwiftPrivate && LHS.SwiftName == 
RHS.SwiftName;
+}
+
+inline bool operator!=(const CommonEntityInfo &LHS,
+   const CommonEntityInfo &RHS) {
+  return !(LHS == RHS);
+}
+
+/// Describes API notes for types.
+class CommonTypeInfo : public CommonEntityInfo {
+  /// The Swift type to which a given type is bridged.
+  ///
+  /// Reflects the swift_bridge attribute.
+  llvm::Optional SwiftBridge;
+
+  /// The NS error domain for this type.
+  llvm::Optional NSErrorDomain;
+
+public:
+  CommonTypeInfo() : CommonEntityInfo() {}
+
+  const llvm::Optional &getSwiftBridge() const {
+return SwiftBridge;
+  }
+
+  void setSwiftBridge(const llvm::Optional &SwiftType) {
+SwiftBridge = SwiftType;
+  }
+
+  void setSwiftBridge(const llvm::Optional &SwiftType) {
+SwiftBridge = SwiftType
+  ? llvm::Optional(std::string(*SwiftType))
+  : llvm::None;
+  }
+
+  const llvm::Optional &getNSErrorDomain() const {
+return NSErrorDomain;
+  }
+
+  void setNSErrorDomain(const llvm::Optional &Domain) {
+NSErrorDomain = Domain;
+  }
+
+  void setNSErrorDomain(const llvm::Optional &Domain) {
+NSErrorDomain =
+Domain ? llvm::Optional(std::string(

[llvm-branch-commits] [llvm] 939c8f6 - Bitcode: add some convenience helpers for streaming bitcode

2020-12-08 Thread Saleem Abdulrasool via llvm-branch-commits

Author: Saleem Abdulrasool
Date: 2020-12-08T21:15:41Z
New Revision: 939c8f676c871682dba8bab25ee4c0c08faf98e1

URL: 
https://github.com/llvm/llvm-project/commit/939c8f676c871682dba8bab25ee4c0c08faf98e1
DIFF: 
https://github.com/llvm/llvm-project/commit/939c8f676c871682dba8bab25ee4c0c08faf98e1.diff

LOG: Bitcode: add some convenience helpers for streaming bitcode

This adds a set of metaprogramming helpers to help define records and
serialize them out.  This is motivated by API Notes which use the
bitcode format to serialize out a binary representation of the data.
These helpers are generically useful though and could help simplify some
of the existing bitcode consumers as well.

This is extracted from the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D88582

Added: 
llvm/include/llvm/Bitcode/BitcodeConvenience.h

Modified: 


Removed: 




diff  --git a/llvm/include/llvm/Bitcode/BitcodeConvenience.h 
b/llvm/include/llvm/Bitcode/BitcodeConvenience.h
new file mode 100644
index ..0060d014ba82
--- /dev/null
+++ b/llvm/include/llvm/Bitcode/BitcodeConvenience.h
@@ -0,0 +1,486 @@
+//===- llvm/Bitcode/BitcodeConvenience.h - Convenience Wrappers -*- 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
+//
+//===--===//
+///
+/// \file Convenience wrappers for the LLVM bitcode format and bitstream APIs.
+///
+/// This allows you to use a sort of DSL to declare and use bitcode
+/// abbreviations and records. Example:
+///
+/// \code
+/// using Metadata = BCRecordLayout<
+///   METADATA_ID,  // ID
+///   BCFixed<16>,  // Module format major version
+///   BCFixed<16>,  // Module format minor version
+///   BCBlob// misc. version information
+/// >;
+/// Metadata metadata(Out);
+/// metadata.emit(ScratchRecord, VERSION_MAJOR, VERSION_MINOR, Data);
+/// \endcode
+///
+/// For details on the bitcode format, see
+///   http://llvm.org/docs/BitCodeFormat.html
+///
+//===--===//
+
+#ifndef LLVM_BITCODE_BITCODECONVENIENCE_H
+#define LLVM_BITCODE_BITCODECONVENIENCE_H
+
+#include "llvm/Bitstream/BitCodes.h"
+#include "llvm/Bitstream/BitstreamWriter.h"
+#include 
+
+namespace llvm {
+namespace detail {
+/// Convenience base for all kinds of bitcode abbreviation fields.
+///
+/// This just defines common properties queried by the metaprogramming.
+template  class BCField {
+public:
+  static const bool IsCompound = Compound;
+
+  /// Asserts that the given data is a valid value for this field.
+  template  static void assertValid(const T &data) {}
+
+  /// Converts a raw numeric representation of this value to its preferred
+  /// type.
+  template  static T convert(T rawValue) { return rawValue; }
+};
+} // namespace detail
+
+/// Represents a literal operand in a bitcode record.
+///
+/// The value of a literal operand is the same for all instances of the record,
+/// so it is only emitted in the abbreviation definition.
+///
+/// Note that because this uses a compile-time template, you cannot have a
+/// literal operand that is fixed at run-time without dropping down to the
+/// raw LLVM APIs.
+template  class BCLiteral : public detail::BCField<> {
+public:
+  static void emitOp(llvm::BitCodeAbbrev &abbrev) {
+abbrev.Add(llvm::BitCodeAbbrevOp(Value));
+  }
+
+  template  static void assertValid(const T &data) {
+assert(data == Value && "data value does not match declared literal 
value");
+  }
+};
+
+/// Represents a fixed-width value in a bitcode record.
+///
+/// Note that the LLVM bitcode format only supports unsigned values.
+template  class BCFixed : public detail::BCField<> {
+public:
+  static_assert(Width <= 64, "fixed-width field is too large");
+
+  static void emitOp(llvm::BitCodeAbbrev &abbrev) {
+abbrev.Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Fixed, Width));
+  }
+
+  static void assertValid(const bool &data) {
+assert(llvm::isUInt(data) &&
+   "data value does not fit in the given bit width");
+  }
+
+  template  static void assertValid(const T &data) {
+assert(data >= 0 && "cannot encode signed integers");
+assert(llvm::isUInt(data) &&
+   "data value does not fit in the given bit width");
+  }
+};
+
+/// Represents a variable-width value in a bitcode record.
+///
+/// The \p Width parameter should include the continuation bit.
+///
+/// Note that the LLVM bitcode format only supports unsigned values.
+template  class BCVBR : public detail::BCField<> {
+  static_assert(Width >= 2, "width does not have room for continu

[llvm-branch-commits] [clang] b13f741 - APINotes: add bitcode format schema definitions

2020-12-08 Thread Saleem Abdulrasool via llvm-branch-commits

Author: Saleem Abdulrasool
Date: 2020-12-08T21:15:41Z
New Revision: b13f74151137f33327e0549adc9778aebf98a299

URL: 
https://github.com/llvm/llvm-project/commit/b13f74151137f33327e0549adc9778aebf98a299
DIFF: 
https://github.com/llvm/llvm-project/commit/b13f74151137f33327e0549adc9778aebf98a299.diff

LOG: APINotes: add bitcode format schema definitions

This adds the bitcode format schema required for serialization of the
YAML data to a binary format.  APINotes are pre-compiled and re-used in
the binary format from the frontend.  These definitions provide the data
layout representation enabling writing (and eventually) reading of the
data in bitcode format.

This is extracted from the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D91997
Reviewed By: Gabor Marton

Added: 
clang/lib/APINotes/APINotesFormat.h

Modified: 


Removed: 




diff  --git a/clang/lib/APINotes/APINotesFormat.h 
b/clang/lib/APINotes/APINotesFormat.h
new file mode 100644
index ..6b76ecfc2567
--- /dev/null
+++ b/clang/lib/APINotes/APINotesFormat.h
@@ -0,0 +1,255 @@
+//===-- APINotesWriter.h - API Notes Writer -*- 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_CLANG_LIB_APINOTES_APINOTESFORMAT_H
+#define LLVM_CLANG_LIB_APINOTES_APINOTESFORMAT_H
+
+#include "llvm/ADT/PointerEmbeddedInt.h"
+#include "llvm/Bitcode/BitcodeConvenience.h"
+
+namespace clang {
+namespace api_notes {
+/// Magic number for API notes files.
+const unsigned char API_NOTES_SIGNATURE[] = {0xE2, 0x9C, 0xA8, 0x01};
+
+/// API notes file major version number.
+const uint16_t VERSION_MAJOR = 0;
+
+/// API notes file minor version number.
+///
+/// When the format changes IN ANY WAY, this number should be incremented.
+const uint16_t VERSION_MINOR = 24; // EnumExtensibility + FlagEnum
+
+using IdentifierID = llvm::PointerEmbeddedInt;
+using IdentifierIDField = llvm::BCVBR<16>;
+
+using SelectorID = llvm::PointerEmbeddedInt;
+using SelectorIDField = llvm::BCVBR<16>;
+
+/// The various types of blocks that can occur within a API notes file.
+///
+/// These IDs must \em not be renumbered or reordered without incrementing
+/// VERSION_MAJOR.
+enum BlockID {
+  /// The control block, which contains all of the information that needs to
+  /// be validated prior to committing to loading the API notes file.
+  ///
+  /// \sa control_block
+  CONTROL_BLOCK_ID = llvm::bitc::FIRST_APPLICATION_BLOCKID,
+
+  /// The identifier data block, which maps identifier strings to IDs.
+  IDENTIFIER_BLOCK_ID,
+
+  /// The Objective-C context data block, which contains information about
+  /// Objective-C classes and protocols.
+  OBJC_CONTEXT_BLOCK_ID,
+
+  /// The Objective-C property data block, which maps Objective-C
+  /// (class name, property name) pairs to information about the
+  /// property.
+  OBJC_PROPERTY_BLOCK_ID,
+
+  /// The Objective-C property data block, which maps Objective-C
+  /// (class name, selector, is_instance_method) tuples to information
+  /// about the method.
+  OBJC_METHOD_BLOCK_ID,
+
+  /// The Objective-C selector data block, which maps Objective-C
+  /// selector names (# of pieces, identifier IDs) to the selector ID
+  /// used in other tables.
+  OBJC_SELECTOR_BLOCK_ID,
+
+  /// The global variables data block, which maps global variable names to
+  /// information about the global variable.
+  GLOBAL_VARIABLE_BLOCK_ID,
+
+  /// The (global) functions data block, which maps global function names to
+  /// information about the global function.
+  GLOBAL_FUNCTION_BLOCK_ID,
+
+  /// The tag data block, which maps tag names to information about
+  /// the tags.
+  TAG_BLOCK_ID,
+
+  /// The typedef data block, which maps typedef names to information about
+  /// the typedefs.
+  TYPEDEF_BLOCK_ID,
+
+  /// The enum constant data block, which maps enumerator names to
+  /// information about the enumerators.
+  ENUM_CONSTANT_BLOCK_ID,
+};
+
+namespace control_block {
+// These IDs must \em not be renumbered or reordered without incrementing
+// VERSION_MAJOR.
+enum {
+  METADATA = 1,
+  MODULE_NAME = 2,
+  MODULE_OPTIONS = 3,
+  SOURCE_FILE = 4,
+};
+
+using MetadataLayout =
+llvm::BCRecordLayout, // Module format major version
+ llvm::BCFixed<16>  // Module format minor version
+ >;
+
+using ModuleNameLayout = llvm::BCRecordLayout;
+
+using ModuleOptionsLayout =
+llvm::BCRecordLayout // SwiftInferImportAsMember
+ >;
+
+using SourceFileLayout = llvm::BCRecordLayout, // file size
+   

[llvm-branch-commits] [llvm] ee74d1b - X86: use a data driven configuration of Windows x86 libcalls (NFC)

2020-12-09 Thread Saleem Abdulrasool via llvm-branch-commits

Author: Saleem Abdulrasool
Date: 2020-12-09T22:49:11Z
New Revision: ee74d1b420369d1dbe18be43d71d3392536ce228

URL: 
https://github.com/llvm/llvm-project/commit/ee74d1b420369d1dbe18be43d71d3392536ce228
DIFF: 
https://github.com/llvm/llvm-project/commit/ee74d1b420369d1dbe18be43d71d3392536ce228.diff

LOG: X86: use a data driven configuration of Windows x86 libcalls (NFC)

Rather than creating a series of associated calls and ensuring that
everything is lined up, use a table driven approach that ensures that
they two always stay in sync.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 53f30af8d38b..5a77cc1f17fc 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -135,19 +135,24 @@ X86TargetLowering::X86TargetLowering(const 
X86TargetMachine &TM,
   addBypassSlowDiv(64, 32);
   }
 
-  if (Subtarget.isTargetWindowsMSVC() ||
-  Subtarget.isTargetWindowsItanium()) {
-// Setup Windows compiler runtime calls.
-setLibcallName(RTLIB::SDIV_I64, "_alldiv");
-setLibcallName(RTLIB::UDIV_I64, "_aulldiv");
-setLibcallName(RTLIB::SREM_I64, "_allrem");
-setLibcallName(RTLIB::UREM_I64, "_aullrem");
-setLibcallName(RTLIB::MUL_I64, "_allmul");
-setLibcallCallingConv(RTLIB::SDIV_I64, CallingConv::X86_StdCall);
-setLibcallCallingConv(RTLIB::UDIV_I64, CallingConv::X86_StdCall);
-setLibcallCallingConv(RTLIB::SREM_I64, CallingConv::X86_StdCall);
-setLibcallCallingConv(RTLIB::UREM_I64, CallingConv::X86_StdCall);
-setLibcallCallingConv(RTLIB::MUL_I64, CallingConv::X86_StdCall);
+  // Setup Windows compiler runtime calls.
+  if (Subtarget.isTargetWindowsMSVC() || Subtarget.isTargetWindowsItanium()) {
+static const struct {
+  const RTLIB::Libcall Op;
+  const char * const Name;
+  const CallingConv::ID CC;
+} LibraryCalls[] = {
+  { RTLIB::SDIV_I64, "_alldiv", CallingConv::X86_StdCall },
+  { RTLIB::UDIV_I64, "_aulldiv", CallingConv::X86_StdCall },
+  { RTLIB::SREM_I64, "_allrem", CallingConv::X86_StdCall },
+  { RTLIB::UREM_I64, "_aullrem", CallingConv::X86_StdCall },
+  { RTLIB::MUL_I64, "_allmul", CallingConv::X86_StdCall },
+};
+
+for (const auto &LC : LibraryCalls) {
+  setLibcallName(LC.Op, LC.Name);
+  setLibcallCallingConv(LC.Op, LC.CC);
+}
   }
 
   if (Subtarget.getTargetTriple().isOSMSVCRT()) {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits