[llvm] [llvm] annotate interfaces in llvm/IR for DLL export (PR #141650)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 12:35:37 PDT 2025
https://github.com/andrurogerz updated https://github.com/llvm/llvm-project/pull/141650
>From 023d3c5d72bf695688cfbd80d252ad21b925178b Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Tue, 27 May 2025 09:49:17 -0700
Subject: [PATCH 1/3] [llvm] IDS auto codemod for IR library
---
llvm/include/llvm/IR/AbstractCallSite.h | 5 +-
llvm/include/llvm/IR/Analysis.h | 5 +-
llvm/include/llvm/IR/Argument.h | 85 ++--
.../llvm/IR/AssemblyAnnotationWriter.h | 2 +-
llvm/include/llvm/IR/Assumptions.h | 15 +-
llvm/include/llvm/IR/Attributes.h | 437 +++++++++---------
llvm/include/llvm/IR/AutoUpgrade.h | 37 +-
llvm/include/llvm/IR/BasicBlock.h | 133 +++---
llvm/include/llvm/IR/BuiltinGCs.h | 6 +-
llvm/include/llvm/IR/CmpPredicate.h | 11 +-
llvm/include/llvm/IR/Comdat.h | 9 +-
llvm/include/llvm/IR/Constant.h | 77 +--
llvm/include/llvm/IR/ConstantFPRange.h | 47 +-
llvm/include/llvm/IR/ConstantFold.h | 23 +-
llvm/include/llvm/IR/ConstantFolder.h | 3 +-
llvm/include/llvm/IR/ConstantRange.h | 194 ++++----
llvm/include/llvm/IR/ConstantRangeList.h | 15 +-
llvm/include/llvm/IR/Constants.h | 256 +++++-----
llvm/include/llvm/IR/DIBuilder.h | 177 +++----
llvm/include/llvm/IR/DataLayout.h | 62 +--
llvm/include/llvm/IR/DebugInfo.h | 71 +--
llvm/include/llvm/IR/DebugInfoMetadata.h | 261 +++++------
llvm/include/llvm/IR/DebugLoc.h | 33 +-
.../include/llvm/IR/DebugProgramInstruction.h | 171 +++----
llvm/include/llvm/IR/DerivedTypes.h | 92 ++--
llvm/include/llvm/IR/DiagnosticHandler.h | 3 +-
llvm/include/llvm/IR/DiagnosticInfo.h | 93 ++--
llvm/include/llvm/IR/DiagnosticPrinter.h | 3 +-
llvm/include/llvm/IR/Dominators.h | 41 +-
llvm/include/llvm/IR/DroppedVariableStats.h | 15 +-
llvm/include/llvm/IR/DroppedVariableStatsIR.h | 3 +-
llvm/include/llvm/IR/EHPersonalities.h | 11 +-
llvm/include/llvm/IR/FMF.h | 2 +-
llvm/include/llvm/IR/FPEnv.h | 11 +-
llvm/include/llvm/IR/Function.h | 5 +-
llvm/include/llvm/IR/GlobalAlias.h | 19 +-
llvm/include/llvm/IR/GlobalIFunc.h | 11 +-
llvm/include/llvm/IR/GlobalObject.h | 29 +-
llvm/include/llvm/IR/GlobalValue.h | 51 +-
llvm/include/llvm/IR/GlobalVariable.h | 25 +-
llvm/include/llvm/IR/IRBuilder.h | 167 +++----
llvm/include/llvm/IR/IRBuilderFolder.h | 3 +-
llvm/include/llvm/IR/IRPrintingPasses.h | 9 +-
llvm/include/llvm/IR/InlineAsm.h | 15 +-
llvm/include/llvm/IR/InstrTypes.h | 183 ++++----
llvm/include/llvm/IR/Instruction.h | 247 +++++-----
llvm/include/llvm/IR/Instructions.h | 365 +++++++--------
llvm/include/llvm/IR/IntrinsicInst.h | 131 +++---
llvm/include/llvm/IR/Intrinsics.h | 47 +-
llvm/include/llvm/IR/LLVMContext.h | 109 ++---
llvm/include/llvm/IR/LLVMRemarkStreamer.h | 13 +-
llvm/include/llvm/IR/LegacyPassManager.h | 9 +-
llvm/include/llvm/IR/LegacyPassManagers.h | 15 +-
llvm/include/llvm/IR/LegacyPassNameParser.h | 3 +-
llvm/include/llvm/IR/MDBuilder.h | 65 +--
llvm/include/llvm/IR/Mangler.h | 17 +-
.../IR/MemoryModelRelaxationAnnotations.h | 33 +-
llvm/include/llvm/IR/Metadata.h | 171 +++----
llvm/include/llvm/IR/Module.h | 9 +-
llvm/include/llvm/IR/ModuleSlotTracker.h | 5 +-
llvm/include/llvm/IR/ModuleSummaryIndex.h | 34 +-
llvm/include/llvm/IR/NoFolder.h | 3 +-
llvm/include/llvm/IR/Operator.h | 21 +-
llvm/include/llvm/IR/OptBisect.h | 5 +-
llvm/include/llvm/IR/PassInstrumentation.h | 6 +-
llvm/include/llvm/IR/PassManager.h | 11 +-
llvm/include/llvm/IR/PassManagerImpl.h | 3 +-
llvm/include/llvm/IR/PassTimingInfo.h | 15 +-
llvm/include/llvm/IR/ProfDataUtils.h | 39 +-
llvm/include/llvm/IR/ProfileSummary.h | 9 +-
llvm/include/llvm/IR/PseudoProbe.h | 5 +-
llvm/include/llvm/IR/ReplaceConstant.h | 2 +-
llvm/include/llvm/IR/RuntimeLibcalls.h | 3 +-
llvm/include/llvm/IR/StructuralHash.h | 9 +-
llvm/include/llvm/IR/Type.h | 112 ++---
llvm/include/llvm/IR/TypedPointerType.h | 5 +-
llvm/include/llvm/IR/Use.h | 12 +-
llvm/include/llvm/IR/User.h | 20 +-
llvm/include/llvm/IR/VFABIDemangler.h | 13 +-
llvm/include/llvm/IR/Value.h | 117 ++---
llvm/include/llvm/IR/ValueHandle.h | 13 +-
llvm/include/llvm/IR/ValueSymbolTable.h | 5 +-
llvm/include/llvm/IR/VectorBuilder.h | 11 +-
llvm/include/llvm/IR/VectorTypeUtils.h | 9 +-
llvm/include/llvm/IR/Verifier.h | 17 +-
.../include/llvm/IRPrinter/IRPrintingPasses.h | 13 +-
llvm/include/llvm/IRReader/IRReader.h | 9 +-
87 files changed, 2380 insertions(+), 2306 deletions(-)
diff --git a/llvm/include/llvm/IR/AbstractCallSite.h b/llvm/include/llvm/IR/AbstractCallSite.h
index 50afe016f0d63..9006b7356242b 100644
--- a/llvm/include/llvm/IR/AbstractCallSite.h
+++ b/llvm/include/llvm/IR/AbstractCallSite.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_ABSTRACTCALLSITE_H
#define LLVM_IR_ABSTRACTCALLSITE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
@@ -95,14 +96,14 @@ class AbstractCallSite {
/// If the use is not a callee use of a call or invoke instruction, the
/// callback metadata is used to determine the argument <-> parameter mapping
/// as well as the callee of the abstract call site.
- AbstractCallSite(const Use *U);
+ LLVM_ABI AbstractCallSite(const Use *U);
/// Add operand uses of \p CB that represent callback uses into
/// \p CallbackUses.
///
/// All uses added to \p CallbackUses can be used to create abstract call
/// sites for which AbstractCallSite::isCallbackCall() will return true.
- static void getCallbackUses(const CallBase &CB,
+ LLVM_ABI static void getCallbackUses(const CallBase &CB,
SmallVectorImpl<const Use *> &CallbackUses);
/// Conversion operator to conveniently check for a valid/initialized ACS.
diff --git a/llvm/include/llvm/IR/Analysis.h b/llvm/include/llvm/IR/Analysis.h
index dd43f5ee5f706..b67c6566c5051 100644
--- a/llvm/include/llvm/IR/Analysis.h
+++ b/llvm/include/llvm/IR/Analysis.h
@@ -12,6 +12,7 @@
#ifndef LLVM_IR_ANALYSIS_H
#define LLVM_IR_ANALYSIS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallPtrSet.h"
namespace llvm {
@@ -74,7 +75,7 @@ class CFGAnalyses {
static AnalysisSetKey *ID() { return &SetKey; }
private:
- static AnalysisSetKey SetKey;
+ LLVM_ABI static AnalysisSetKey SetKey;
};
/// A set of analyses that are preserved following a run of a transformation
@@ -310,7 +311,7 @@ class PreservedAnalyses {
private:
/// A special key used to indicate all analyses.
- static AnalysisSetKey AllAnalysesKey;
+ LLVM_ABI static AnalysisSetKey AllAnalysesKey;
/// The IDs of analyses and analysis sets that are preserved.
SmallPtrSet<void *, 2> PreservedIDs;
diff --git a/llvm/include/llvm/IR/Argument.h b/llvm/include/llvm/IR/Argument.h
index 5be58d7eca060..ba2dee67b7013 100644
--- a/llvm/include/llvm/IR/Argument.h
+++ b/llvm/include/llvm/IR/Argument.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_ARGUMENT_H
#define LLVM_IR_ARGUMENT_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Value.h"
@@ -37,7 +38,7 @@ class Argument final : public Value {
public:
/// Argument constructor.
- explicit Argument(Type *Ty, const Twine &Name = "", Function *F = nullptr,
+ LLVM_ABI explicit Argument(Type *Ty, const Twine &Name = "", Function *F = nullptr,
unsigned ArgNo = 0);
inline const Function *getParent() const { return Parent; }
@@ -56,133 +57,133 @@ class Argument final : public Value {
/// addrspace(0).
/// If AllowUndefOrPoison is true, respect the semantics of nonnull attribute
/// and return true even if the argument can be undef or poison.
- bool hasNonNullAttr(bool AllowUndefOrPoison = true) const;
+ LLVM_ABI bool hasNonNullAttr(bool AllowUndefOrPoison = true) const;
/// If this argument has the dereferenceable attribute, return the number of
/// bytes known to be dereferenceable. Otherwise, zero is returned.
- uint64_t getDereferenceableBytes() const;
+ LLVM_ABI uint64_t getDereferenceableBytes() const;
/// If this argument has the dereferenceable_or_null attribute, return the
/// number of bytes known to be dereferenceable. Otherwise, zero is returned.
- uint64_t getDereferenceableOrNullBytes() const;
+ LLVM_ABI uint64_t getDereferenceableOrNullBytes() const;
/// If this argument has nofpclass attribute, return the mask representing
/// disallowed floating-point values. Otherwise, fcNone is returned.
- FPClassTest getNoFPClass() const;
+ LLVM_ABI FPClassTest getNoFPClass() const;
/// If this argument has a range attribute, return the value range of the
/// argument. Otherwise, std::nullopt is returned.
- std::optional<ConstantRange> getRange() const;
+ LLVM_ABI std::optional<ConstantRange> getRange() const;
/// Return true if this argument has the byval attribute.
- bool hasByValAttr() const;
+ LLVM_ABI bool hasByValAttr() const;
/// Return true if this argument has the byref attribute.
- bool hasByRefAttr() const;
+ LLVM_ABI bool hasByRefAttr() const;
/// Return true if this argument has the swiftself attribute.
- bool hasSwiftSelfAttr() const;
+ LLVM_ABI bool hasSwiftSelfAttr() const;
/// Return true if this argument has the swifterror attribute.
- bool hasSwiftErrorAttr() const;
+ LLVM_ABI bool hasSwiftErrorAttr() const;
/// Return true if this argument has the byval, inalloca, or preallocated
/// attribute. These attributes represent arguments being passed by value,
/// with an associated copy between the caller and callee
- bool hasPassPointeeByValueCopyAttr() const;
+ LLVM_ABI bool hasPassPointeeByValueCopyAttr() const;
/// If this argument satisfies has hasPassPointeeByValueAttr, return the
/// in-memory ABI size copied to the stack for the call. Otherwise, return 0.
- uint64_t getPassPointeeByValueCopySize(const DataLayout &DL) const;
+ LLVM_ABI uint64_t getPassPointeeByValueCopySize(const DataLayout &DL) const;
/// Return true if this argument has the byval, sret, inalloca, preallocated,
/// or byref attribute. These attributes represent arguments being passed by
/// value (which may or may not involve a stack copy)
- bool hasPointeeInMemoryValueAttr() const;
+ LLVM_ABI bool hasPointeeInMemoryValueAttr() const;
/// If hasPointeeInMemoryValueAttr returns true, the in-memory ABI type is
/// returned. Otherwise, nullptr.
- Type *getPointeeInMemoryValueType() const;
+ LLVM_ABI Type *getPointeeInMemoryValueType() const;
/// If this is a byval or inalloca argument, return its alignment.
/// FIXME: Remove this function once transition to Align is over.
/// Use getParamAlign() instead.
- LLVM_DEPRECATED("Use getParamAlign() instead", "getParamAlign")
+ LLVM_ABI LLVM_DEPRECATED("Use getParamAlign() instead", "getParamAlign")
uint64_t getParamAlignment() const;
/// If this is a byval or inalloca argument, return its alignment.
- MaybeAlign getParamAlign() const;
+ LLVM_ABI MaybeAlign getParamAlign() const;
- MaybeAlign getParamStackAlign() const;
+ LLVM_ABI MaybeAlign getParamStackAlign() const;
/// If this is a byval argument, return its type.
- Type *getParamByValType() const;
+ LLVM_ABI Type *getParamByValType() const;
/// If this is an sret argument, return its type.
- Type *getParamStructRetType() const;
+ LLVM_ABI Type *getParamStructRetType() const;
/// If this is a byref argument, return its type.
- Type *getParamByRefType() const;
+ LLVM_ABI Type *getParamByRefType() const;
/// If this is an inalloca argument, return its type.
- Type *getParamInAllocaType() const;
+ LLVM_ABI Type *getParamInAllocaType() const;
/// Return true if this argument has the nest attribute.
- bool hasNestAttr() const;
+ LLVM_ABI bool hasNestAttr() const;
/// Return true if this argument has the noalias attribute.
- bool hasNoAliasAttr() const;
+ LLVM_ABI bool hasNoAliasAttr() const;
/// Return true if this argument has the nocapture attribute.
- bool hasNoCaptureAttr() const;
+ LLVM_ABI bool hasNoCaptureAttr() const;
/// Return true if this argument has the nofree attribute.
- bool hasNoFreeAttr() const;
+ LLVM_ABI bool hasNoFreeAttr() const;
/// Return true if this argument has the sret attribute.
- bool hasStructRetAttr() const;
+ LLVM_ABI bool hasStructRetAttr() const;
/// Return true if this argument has the inreg attribute.
- bool hasInRegAttr() const;
+ LLVM_ABI bool hasInRegAttr() const;
/// Return true if this argument has the returned attribute.
- bool hasReturnedAttr() const;
+ LLVM_ABI bool hasReturnedAttr() const;
/// Return true if this argument has the readonly or readnone attribute.
- bool onlyReadsMemory() const;
+ LLVM_ABI bool onlyReadsMemory() const;
/// Return true if this argument has the inalloca attribute.
- bool hasInAllocaAttr() const;
+ LLVM_ABI bool hasInAllocaAttr() const;
/// Return true if this argument has the preallocated attribute.
- bool hasPreallocatedAttr() const;
+ LLVM_ABI bool hasPreallocatedAttr() const;
/// Return true if this argument has the zext attribute.
- bool hasZExtAttr() const;
+ LLVM_ABI bool hasZExtAttr() const;
/// Return true if this argument has the sext attribute.
- bool hasSExtAttr() const;
+ LLVM_ABI bool hasSExtAttr() const;
/// Add attributes to an argument.
- void addAttrs(AttrBuilder &B);
+ LLVM_ABI void addAttrs(AttrBuilder &B);
- void addAttr(Attribute::AttrKind Kind);
+ LLVM_ABI void addAttr(Attribute::AttrKind Kind);
- void addAttr(Attribute Attr);
+ LLVM_ABI void addAttr(Attribute Attr);
/// Remove attributes from an argument.
- void removeAttr(Attribute::AttrKind Kind);
+ LLVM_ABI void removeAttr(Attribute::AttrKind Kind);
- void removeAttrs(const AttributeMask &AM);
+ LLVM_ABI void removeAttrs(const AttributeMask &AM);
/// Check if an argument has a given attribute.
- bool hasAttribute(Attribute::AttrKind Kind) const;
+ LLVM_ABI bool hasAttribute(Attribute::AttrKind Kind) const;
- bool hasAttribute(StringRef Kind) const;
+ LLVM_ABI bool hasAttribute(StringRef Kind) const;
- Attribute getAttribute(Attribute::AttrKind Kind) const;
+ LLVM_ABI Attribute getAttribute(Attribute::AttrKind Kind) const;
- AttributeSet getAttributes() const;
+ LLVM_ABI AttributeSet getAttributes() const;
/// Method for support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Value *V) {
diff --git a/llvm/include/llvm/IR/AssemblyAnnotationWriter.h b/llvm/include/llvm/IR/AssemblyAnnotationWriter.h
index 3fd3c57a67963..4c5812062d3f1 100644
--- a/llvm/include/llvm/IR/AssemblyAnnotationWriter.h
+++ b/llvm/include/llvm/IR/AssemblyAnnotationWriter.h
@@ -24,7 +24,7 @@ class Instruction;
class Value;
class formatted_raw_ostream;
-class AssemblyAnnotationWriter {
+class LLVM_ABI AssemblyAnnotationWriter {
public:
virtual ~AssemblyAnnotationWriter();
diff --git a/llvm/include/llvm/IR/Assumptions.h b/llvm/include/llvm/IR/Assumptions.h
index 2d2ecfbde6e6b..ca1bf67ca7377 100644
--- a/llvm/include/llvm/IR/Assumptions.h
+++ b/llvm/include/llvm/IR/Assumptions.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_ASSUMPTIONS_H
#define LLVM_IR_ASSUMPTIONS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
@@ -29,7 +30,7 @@ constexpr StringRef AssumptionAttrKey = "llvm.assume";
/// A set of known assumption strings that are accepted without warning and
/// which can be recommended as typo correction.
-extern StringSet<> KnownAssumptionStrings;
+LLVM_ABI extern StringSet<> KnownAssumptionStrings;
/// Helper that allows to insert a new assumption string in the known assumption
/// set by creating a (static) object.
@@ -49,25 +50,25 @@ struct KnownAssumptionString {
};
/// Return true if \p F has the assumption \p AssumptionStr attached.
-bool hasAssumption(const Function &F,
+LLVM_ABI bool hasAssumption(const Function &F,
const KnownAssumptionString &AssumptionStr);
/// Return true if \p CB or the callee has the assumption \p AssumptionStr
/// attached.
-bool hasAssumption(const CallBase &CB,
+LLVM_ABI bool hasAssumption(const CallBase &CB,
const KnownAssumptionString &AssumptionStr);
/// Return the set of all assumptions for the function \p F.
-DenseSet<StringRef> getAssumptions(const Function &F);
+LLVM_ABI DenseSet<StringRef> getAssumptions(const Function &F);
/// Return the set of all assumptions for the call \p CB.
-DenseSet<StringRef> getAssumptions(const CallBase &CB);
+LLVM_ABI DenseSet<StringRef> getAssumptions(const CallBase &CB);
/// Appends the set of assumptions \p Assumptions to \F.
-bool addAssumptions(Function &F, const DenseSet<StringRef> &Assumptions);
+LLVM_ABI bool addAssumptions(Function &F, const DenseSet<StringRef> &Assumptions);
/// Appends the set of assumptions \p Assumptions to \CB.
-bool addAssumptions(CallBase &CB, const DenseSet<StringRef> &Assumptions);
+LLVM_ABI bool addAssumptions(CallBase &CB, const DenseSet<StringRef> &Assumptions);
} // namespace llvm
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 0e8e31715acd7..0978408ca175c 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_ATTRIBUTES_H
#define LLVM_IR_ATTRIBUTES_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
@@ -114,14 +115,14 @@ class Attribute {
Kind <= LastConstantRangeListAttr;
}
- static bool canUseAsFnAttr(AttrKind Kind);
- static bool canUseAsParamAttr(AttrKind Kind);
- static bool canUseAsRetAttr(AttrKind Kind);
+ LLVM_ABI static bool canUseAsFnAttr(AttrKind Kind);
+ LLVM_ABI static bool canUseAsParamAttr(AttrKind Kind);
+ LLVM_ABI static bool canUseAsRetAttr(AttrKind Kind);
- static bool intersectMustPreserve(AttrKind Kind);
- static bool intersectWithAnd(AttrKind Kind);
- static bool intersectWithMin(AttrKind Kind);
- static bool intersectWithCustom(AttrKind Kind);
+ LLVM_ABI static bool intersectMustPreserve(AttrKind Kind);
+ LLVM_ABI static bool intersectWithAnd(AttrKind Kind);
+ LLVM_ABI static bool intersectWithMin(AttrKind Kind);
+ LLVM_ABI static bool intersectWithCustom(AttrKind Kind);
private:
AttributeImpl *pImpl = nullptr;
@@ -136,37 +137,37 @@ class Attribute {
//===--------------------------------------------------------------------===//
/// Return a uniquified Attribute object.
- static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
- static Attribute get(LLVMContext &Context, StringRef Kind,
+ LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
+ LLVM_ABI static Attribute get(LLVMContext &Context, StringRef Kind,
StringRef Val = StringRef());
- static Attribute get(LLVMContext &Context, AttrKind Kind, Type *Ty);
- static Attribute get(LLVMContext &Context, AttrKind Kind,
+ LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind, Type *Ty);
+ LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind,
const ConstantRange &CR);
- static Attribute get(LLVMContext &Context, AttrKind Kind,
+ LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind,
ArrayRef<ConstantRange> Val);
/// Return a uniquified Attribute object that has the specific
/// alignment set.
- static Attribute getWithAlignment(LLVMContext &Context, Align Alignment);
- static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment);
- static Attribute getWithDereferenceableBytes(LLVMContext &Context,
+ LLVM_ABI static Attribute getWithAlignment(LLVMContext &Context, Align Alignment);
+ LLVM_ABI static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment);
+ LLVM_ABI static Attribute getWithDereferenceableBytes(LLVMContext &Context,
uint64_t Bytes);
- static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context,
+ LLVM_ABI static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context,
uint64_t Bytes);
- static Attribute getWithAllocSizeArgs(
+ LLVM_ABI static Attribute getWithAllocSizeArgs(
LLVMContext &Context, unsigned ElemSizeArg,
const std::optional<unsigned> &NumElemsArg);
- static Attribute getWithVScaleRangeArgs(LLVMContext &Context,
+ LLVM_ABI static Attribute getWithVScaleRangeArgs(LLVMContext &Context,
unsigned MinValue, unsigned MaxValue);
- static Attribute getWithByValType(LLVMContext &Context, Type *Ty);
- static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty);
- static Attribute getWithByRefType(LLVMContext &Context, Type *Ty);
- static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty);
- static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty);
- static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind);
- static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME);
- static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask);
- static Attribute getWithCaptureInfo(LLVMContext &Context, CaptureInfo CI);
+ LLVM_ABI static Attribute getWithByValType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithByRefType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind);
+ LLVM_ABI static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME);
+ LLVM_ABI static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask);
+ LLVM_ABI static Attribute getWithCaptureInfo(LLVMContext &Context, CaptureInfo CI);
/// For a typed attribute, return the equivalent attribute with the type
/// changed to \p ReplacementTy.
@@ -175,45 +176,45 @@ class Attribute {
return get(Context, getKindAsEnum(), ReplacementTy);
}
- static Attribute::AttrKind getAttrKindFromName(StringRef AttrName);
+ LLVM_ABI static Attribute::AttrKind getAttrKindFromName(StringRef AttrName);
- static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind);
+ LLVM_ABI static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind);
/// Return true if the provided string matches the IR name of an attribute.
/// example: "noalias" return true but not "NoAlias"
- static bool isExistingAttribute(StringRef Name);
+ LLVM_ABI static bool isExistingAttribute(StringRef Name);
//===--------------------------------------------------------------------===//
// Attribute Accessors
//===--------------------------------------------------------------------===//
/// Return true if the attribute is an Attribute::AttrKind type.
- bool isEnumAttribute() const;
+ LLVM_ABI bool isEnumAttribute() const;
/// Return true if the attribute is an integer attribute.
- bool isIntAttribute() const;
+ LLVM_ABI bool isIntAttribute() const;
/// Return true if the attribute is a string (target-dependent)
/// attribute.
- bool isStringAttribute() const;
+ LLVM_ABI bool isStringAttribute() const;
/// Return true if the attribute is a type attribute.
- bool isTypeAttribute() const;
+ LLVM_ABI bool isTypeAttribute() const;
/// Return true if the attribute is a ConstantRange attribute.
- bool isConstantRangeAttribute() const;
+ LLVM_ABI bool isConstantRangeAttribute() const;
/// Return true if the attribute is a ConstantRangeList attribute.
- bool isConstantRangeListAttribute() const;
+ LLVM_ABI bool isConstantRangeListAttribute() const;
/// Return true if the attribute is any kind of attribute.
bool isValid() const { return pImpl; }
/// Return true if the attribute is present.
- bool hasAttribute(AttrKind Val) const;
+ LLVM_ABI bool hasAttribute(AttrKind Val) const;
/// Return true if the target-dependent attribute is present.
- bool hasAttribute(StringRef Val) const;
+ LLVM_ABI bool hasAttribute(StringRef Val) const;
/// Returns true if the attribute's kind can be represented as an enum (Enum,
/// Integer, Type, ConstantRange, or ConstantRangeList attribute).
@@ -221,101 +222,101 @@ class Attribute {
/// Return the attribute's kind as an enum (Attribute::AttrKind). This
/// requires the attribute be representable as an enum (see: `hasKindAsEnum`).
- Attribute::AttrKind getKindAsEnum() const;
+ LLVM_ABI Attribute::AttrKind getKindAsEnum() const;
/// Return the attribute's value as an integer. This requires that the
/// attribute be an integer attribute.
- uint64_t getValueAsInt() const;
+ LLVM_ABI uint64_t getValueAsInt() const;
/// Return the attribute's value as a boolean. This requires that the
/// attribute be a string attribute.
- bool getValueAsBool() const;
+ LLVM_ABI bool getValueAsBool() const;
/// Return the attribute's kind as a string. This requires the
/// attribute to be a string attribute.
- StringRef getKindAsString() const;
+ LLVM_ABI StringRef getKindAsString() const;
/// Return the attribute's value as a string. This requires the
/// attribute to be a string attribute.
- StringRef getValueAsString() const;
+ LLVM_ABI StringRef getValueAsString() const;
/// Return the attribute's value as a Type. This requires the attribute to be
/// a type attribute.
- Type *getValueAsType() const;
+ LLVM_ABI Type *getValueAsType() const;
/// Return the attribute's value as a ConstantRange. This requires the
/// attribute to be a ConstantRange attribute.
- const ConstantRange &getValueAsConstantRange() const;
+ LLVM_ABI const ConstantRange &getValueAsConstantRange() const;
/// Return the attribute's value as a ConstantRange array. This requires the
/// attribute to be a ConstantRangeList attribute.
- ArrayRef<ConstantRange> getValueAsConstantRangeList() const;
+ LLVM_ABI ArrayRef<ConstantRange> getValueAsConstantRangeList() const;
/// Returns the alignment field of an attribute as a byte alignment
/// value.
- MaybeAlign getAlignment() const;
+ LLVM_ABI MaybeAlign getAlignment() const;
/// Returns the stack alignment field of an attribute as a byte
/// alignment value.
- MaybeAlign getStackAlignment() const;
+ LLVM_ABI MaybeAlign getStackAlignment() const;
/// Returns the number of dereferenceable bytes from the
/// dereferenceable attribute.
- uint64_t getDereferenceableBytes() const;
+ LLVM_ABI uint64_t getDereferenceableBytes() const;
/// Returns the number of dereferenceable_or_null bytes from the
/// dereferenceable_or_null attribute.
- uint64_t getDereferenceableOrNullBytes() const;
+ LLVM_ABI uint64_t getDereferenceableOrNullBytes() const;
/// Returns the argument numbers for the allocsize attribute.
- std::pair<unsigned, std::optional<unsigned>> getAllocSizeArgs() const;
+ LLVM_ABI std::pair<unsigned, std::optional<unsigned>> getAllocSizeArgs() const;
/// Returns the minimum value for the vscale_range attribute.
- unsigned getVScaleRangeMin() const;
+ LLVM_ABI unsigned getVScaleRangeMin() const;
/// Returns the maximum value for the vscale_range attribute or std::nullopt
/// when unknown.
- std::optional<unsigned> getVScaleRangeMax() const;
+ LLVM_ABI std::optional<unsigned> getVScaleRangeMax() const;
// Returns the unwind table kind.
- UWTableKind getUWTableKind() const;
+ LLVM_ABI UWTableKind getUWTableKind() const;
// Returns the allocator function kind.
- AllocFnKind getAllocKind() const;
+ LLVM_ABI AllocFnKind getAllocKind() const;
/// Returns memory effects.
- MemoryEffects getMemoryEffects() const;
+ LLVM_ABI MemoryEffects getMemoryEffects() const;
/// Returns information from captures attribute.
- CaptureInfo getCaptureInfo() const;
+ LLVM_ABI CaptureInfo getCaptureInfo() const;
/// Return the FPClassTest for nofpclass
- FPClassTest getNoFPClass() const;
+ LLVM_ABI FPClassTest getNoFPClass() const;
/// Returns the value of the range attribute.
- const ConstantRange &getRange() const;
+ LLVM_ABI const ConstantRange &getRange() const;
/// Returns the value of the initializes attribute.
- ArrayRef<ConstantRange> getInitializes() const;
+ LLVM_ABI ArrayRef<ConstantRange> getInitializes() const;
/// The Attribute is converted to a string of equivalent mnemonic. This
/// is, presumably, for writing out the mnemonics for the assembly writer.
- std::string getAsString(bool InAttrGrp = false) const;
+ LLVM_ABI std::string getAsString(bool InAttrGrp = false) const;
/// Return true if this attribute belongs to the LLVMContext.
- bool hasParentContext(LLVMContext &C) const;
+ LLVM_ABI bool hasParentContext(LLVMContext &C) const;
/// Equality and non-equality operators.
bool operator==(Attribute A) const { return pImpl == A.pImpl; }
bool operator!=(Attribute A) const { return pImpl != A.pImpl; }
/// Used to sort attribute by kind.
- int cmpKind(Attribute A) const;
+ LLVM_ABI int cmpKind(Attribute A) const;
/// Less-than operator. Useful for sorting the attributes list.
- bool operator<(Attribute A) const;
+ LLVM_ABI bool operator<(Attribute A) const;
- void Profile(FoldingSetNodeID &ID) const;
+ LLVM_ABI void Profile(FoldingSetNodeID &ID) const;
/// Return a raw pointer that uniquely identifies this attribute.
void *getRawPointer() const {
@@ -364,94 +365,94 @@ class AttributeSet {
AttributeSet(const AttributeSet &) = default;
~AttributeSet() = default;
- static AttributeSet get(LLVMContext &C, const AttrBuilder &B);
- static AttributeSet get(LLVMContext &C, ArrayRef<Attribute> Attrs);
+ LLVM_ABI static AttributeSet get(LLVMContext &C, const AttrBuilder &B);
+ LLVM_ABI static AttributeSet get(LLVMContext &C, ArrayRef<Attribute> Attrs);
bool operator==(const AttributeSet &O) const { return SetNode == O.SetNode; }
bool operator!=(const AttributeSet &O) const { return !(*this == O); }
/// Add an argument attribute. Returns a new set because attribute sets are
/// immutable.
- [[nodiscard]] AttributeSet addAttribute(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeSet addAttribute(LLVMContext &C,
Attribute::AttrKind Kind) const;
/// Add a target-dependent attribute. Returns a new set because attribute sets
/// are immutable.
- [[nodiscard]] AttributeSet addAttribute(LLVMContext &C, StringRef Kind,
+ LLVM_ABI [[nodiscard]] AttributeSet addAttribute(LLVMContext &C, StringRef Kind,
StringRef Value = StringRef()) const;
/// Add attributes to the attribute set. Returns a new set because attribute
/// sets are immutable.
- [[nodiscard]] AttributeSet addAttributes(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeSet addAttributes(LLVMContext &C,
AttributeSet AS) const;
/// Remove the specified attribute from this set. Returns a new set because
/// attribute sets are immutable.
- [[nodiscard]] AttributeSet removeAttribute(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeSet removeAttribute(LLVMContext &C,
Attribute::AttrKind Kind) const;
/// Remove the specified attribute from this set. Returns a new set because
/// attribute sets are immutable.
- [[nodiscard]] AttributeSet removeAttribute(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeSet removeAttribute(LLVMContext &C,
StringRef Kind) const;
/// Remove the specified attributes from this set. Returns a new set because
/// attribute sets are immutable.
- [[nodiscard]] AttributeSet
+ LLVM_ABI [[nodiscard]] AttributeSet
removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const;
/// Try to intersect this AttributeSet with Other. Returns std::nullopt if
/// the two lists are inherently incompatible (imply different behavior, not
/// just analysis).
- [[nodiscard]] std::optional<AttributeSet>
+ LLVM_ABI [[nodiscard]] std::optional<AttributeSet>
intersectWith(LLVMContext &C, AttributeSet Other) const;
/// Return the number of attributes in this set.
- unsigned getNumAttributes() const;
+ LLVM_ABI unsigned getNumAttributes() const;
/// Return true if attributes exists in this set.
bool hasAttributes() const { return SetNode != nullptr; }
/// Return true if the attribute exists in this set.
- bool hasAttribute(Attribute::AttrKind Kind) const;
+ LLVM_ABI bool hasAttribute(Attribute::AttrKind Kind) const;
/// Return true if the attribute exists in this set.
- bool hasAttribute(StringRef Kind) const;
+ LLVM_ABI bool hasAttribute(StringRef Kind) const;
/// Return the attribute object.
- Attribute getAttribute(Attribute::AttrKind Kind) const;
+ LLVM_ABI Attribute getAttribute(Attribute::AttrKind Kind) const;
/// Return the target-dependent attribute object.
- Attribute getAttribute(StringRef Kind) const;
-
- MaybeAlign getAlignment() const;
- MaybeAlign getStackAlignment() const;
- uint64_t getDereferenceableBytes() const;
- uint64_t getDereferenceableOrNullBytes() const;
- Type *getByValType() const;
- Type *getStructRetType() const;
- Type *getByRefType() const;
- Type *getPreallocatedType() const;
- Type *getInAllocaType() const;
- Type *getElementType() const;
- std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
+ LLVM_ABI Attribute getAttribute(StringRef Kind) const;
+
+ LLVM_ABI MaybeAlign getAlignment() const;
+ LLVM_ABI MaybeAlign getStackAlignment() const;
+ LLVM_ABI uint64_t getDereferenceableBytes() const;
+ LLVM_ABI uint64_t getDereferenceableOrNullBytes() const;
+ LLVM_ABI Type *getByValType() const;
+ LLVM_ABI Type *getStructRetType() const;
+ LLVM_ABI Type *getByRefType() const;
+ LLVM_ABI Type *getPreallocatedType() const;
+ LLVM_ABI Type *getInAllocaType() const;
+ LLVM_ABI Type *getElementType() const;
+ LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
const;
- unsigned getVScaleRangeMin() const;
- std::optional<unsigned> getVScaleRangeMax() const;
- UWTableKind getUWTableKind() const;
- AllocFnKind getAllocKind() const;
- MemoryEffects getMemoryEffects() const;
- CaptureInfo getCaptureInfo() const;
- FPClassTest getNoFPClass() const;
- std::string getAsString(bool InAttrGrp = false) const;
+ LLVM_ABI unsigned getVScaleRangeMin() const;
+ LLVM_ABI std::optional<unsigned> getVScaleRangeMax() const;
+ LLVM_ABI UWTableKind getUWTableKind() const;
+ LLVM_ABI AllocFnKind getAllocKind() const;
+ LLVM_ABI MemoryEffects getMemoryEffects() const;
+ LLVM_ABI CaptureInfo getCaptureInfo() const;
+ LLVM_ABI FPClassTest getNoFPClass() const;
+ LLVM_ABI std::string getAsString(bool InAttrGrp = false) const;
/// Return true if this attribute set belongs to the LLVMContext.
- bool hasParentContext(LLVMContext &C) const;
+ LLVM_ABI bool hasParentContext(LLVMContext &C) const;
using iterator = const Attribute *;
- iterator begin() const;
- iterator end() const;
+ LLVM_ABI iterator begin() const;
+ LLVM_ABI iterator end() const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void dump() const;
#endif
@@ -510,14 +511,14 @@ class AttributeList {
public:
/// Create an AttributeList with the specified parameters in it.
- static AttributeList get(LLVMContext &C,
+ LLVM_ABI static AttributeList get(LLVMContext &C,
ArrayRef<std::pair<unsigned, Attribute>> Attrs);
- static AttributeList get(LLVMContext &C,
+ LLVM_ABI static AttributeList get(LLVMContext &C,
ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);
/// Create an AttributeList from attribute sets for a function, its
/// return value, and all of its arguments.
- static AttributeList get(LLVMContext &C, AttributeSet FnAttrs,
+ LLVM_ABI static AttributeList get(LLVMContext &C, AttributeSet FnAttrs,
AttributeSet RetAttrs,
ArrayRef<AttributeSet> ArgAttrs);
@@ -537,40 +538,40 @@ class AttributeList {
//===--------------------------------------------------------------------===//
/// Return an AttributeList with the specified parameters in it.
- static AttributeList get(LLVMContext &C, ArrayRef<AttributeList> Attrs);
- static AttributeList get(LLVMContext &C, unsigned Index,
+ LLVM_ABI static AttributeList get(LLVMContext &C, ArrayRef<AttributeList> Attrs);
+ LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
ArrayRef<Attribute::AttrKind> Kinds);
- static AttributeList get(LLVMContext &C, unsigned Index,
+ LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
ArrayRef<Attribute::AttrKind> Kinds,
ArrayRef<uint64_t> Values);
- static AttributeList get(LLVMContext &C, unsigned Index,
+ LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
ArrayRef<StringRef> Kind);
- static AttributeList get(LLVMContext &C, unsigned Index,
+ LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
AttributeSet Attrs);
- static AttributeList get(LLVMContext &C, unsigned Index,
+ LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
const AttrBuilder &B);
// TODO: remove non-AtIndex versions of these methods.
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
addAttributeAtIndex(LLVMContext &C, unsigned Index,
Attribute::AttrKind Kind) const;
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
addAttributeAtIndex(LLVMContext &C, unsigned Index, StringRef Kind,
StringRef Value = StringRef()) const;
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute A) const;
/// Add attributes to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList addAttributesAtIndex(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeList addAttributesAtIndex(LLVMContext &C,
unsigned Index,
const AttrBuilder &B) const;
@@ -642,7 +643,7 @@ class AttributeList {
/// Add an attribute to the attribute list at the given arg indices. Returns a
/// new list because attribute lists are immutable.
- [[nodiscard]] AttributeList addParamAttribute(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeList addParamAttribute(LLVMContext &C,
ArrayRef<unsigned> ArgNos,
Attribute A) const;
@@ -655,13 +656,13 @@ class AttributeList {
/// Remove the specified attribute at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
removeAttributeAtIndex(LLVMContext &C, unsigned Index,
Attribute::AttrKind Kind) const;
/// Remove the specified attribute at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
removeAttributeAtIndex(LLVMContext &C, unsigned Index, StringRef Kind) const;
[[nodiscard]] AttributeList removeAttribute(LLVMContext &C, unsigned Index,
StringRef Kind) const {
@@ -670,13 +671,13 @@ class AttributeList {
/// Remove the specified attributes at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
removeAttributesAtIndex(LLVMContext &C, unsigned Index,
const AttributeMask &AttrsToRemove) const;
/// Remove all attributes at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList removeAttributesAtIndex(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeList removeAttributesAtIndex(LLVMContext &C,
unsigned Index) const;
/// Remove the specified attribute at the function index from this
@@ -772,37 +773,37 @@ class AttributeList {
/// \brief Add the dereferenceable attribute to the attribute set at the given
/// index. Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList addDereferenceableRetAttr(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeList addDereferenceableRetAttr(LLVMContext &C,
uint64_t Bytes) const;
/// \brief Add the dereferenceable attribute to the attribute set at the given
/// arg index. Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList addDereferenceableParamAttr(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeList addDereferenceableParamAttr(LLVMContext &C,
unsigned ArgNo,
uint64_t Bytes) const;
/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given arg index. Returns a new list because attribute lists are
/// immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo,
uint64_t Bytes) const;
/// Add the range attribute to the attribute set at the return value index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList addRangeRetAttr(LLVMContext &C,
+ LLVM_ABI [[nodiscard]] AttributeList addRangeRetAttr(LLVMContext &C,
const ConstantRange &CR) const;
/// Add the allocsize attribute to the attribute set at the given arg index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] AttributeList
+ LLVM_ABI [[nodiscard]] AttributeList
addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
const std::optional<unsigned> &NumElemsArg) const;
/// Try to intersect this AttributeList with Other. Returns std::nullopt if
/// the two lists are inherently incompatible (imply different behavior, not
/// just analysis).
- [[nodiscard]] std::optional<AttributeList>
+ LLVM_ABI [[nodiscard]] std::optional<AttributeList>
intersectWith(LLVMContext &C, AttributeList Other) const;
//===--------------------------------------------------------------------===//
@@ -810,26 +811,26 @@ class AttributeList {
//===--------------------------------------------------------------------===//
/// The attributes for the specified index are returned.
- AttributeSet getAttributes(unsigned Index) const;
+ LLVM_ABI AttributeSet getAttributes(unsigned Index) const;
/// The attributes for the argument or parameter at the given index are
/// returned.
- AttributeSet getParamAttrs(unsigned ArgNo) const;
+ LLVM_ABI AttributeSet getParamAttrs(unsigned ArgNo) const;
/// The attributes for the ret value are returned.
- AttributeSet getRetAttrs() const;
+ LLVM_ABI AttributeSet getRetAttrs() const;
/// The function attributes are returned.
- AttributeSet getFnAttrs() const;
+ LLVM_ABI AttributeSet getFnAttrs() const;
/// Return true if the attribute exists at the given index.
- bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
+ LLVM_ABI bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
/// Return true if the attribute exists at the given index.
- bool hasAttributeAtIndex(unsigned Index, StringRef Kind) const;
+ LLVM_ABI bool hasAttributeAtIndex(unsigned Index, StringRef Kind) const;
/// Return true if attribute exists at the given index.
- bool hasAttributesAtIndex(unsigned Index) const;
+ LLVM_ABI bool hasAttributesAtIndex(unsigned Index) const;
/// Return true if the attribute exists for the given argument
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
@@ -860,10 +861,10 @@ class AttributeList {
bool hasRetAttrs() const { return hasAttributesAtIndex(ReturnIndex); }
/// Return true if the attribute exists for the function.
- bool hasFnAttr(Attribute::AttrKind Kind) const;
+ LLVM_ABI bool hasFnAttr(Attribute::AttrKind Kind) const;
/// Return true if the attribute exists for the function.
- bool hasFnAttr(StringRef Kind) const;
+ LLVM_ABI bool hasFnAttr(StringRef Kind) const;
/// Return true the attributes exist for the function.
bool hasFnAttrs() const { return hasAttributesAtIndex(FunctionIndex); }
@@ -871,14 +872,14 @@ class AttributeList {
/// Return true if the specified attribute is set for at least one
/// parameter or for the return value. If Index is not nullptr, the index
/// of a parameter with the specified attribute is provided.
- bool hasAttrSomewhere(Attribute::AttrKind Kind,
+ LLVM_ABI bool hasAttrSomewhere(Attribute::AttrKind Kind,
unsigned *Index = nullptr) const;
/// Return the attribute object that exists at the given index.
- Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
+ LLVM_ABI Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
/// Return the attribute object that exists at the given index.
- Attribute getAttributeAtIndex(unsigned Index, StringRef Kind) const;
+ LLVM_ABI Attribute getAttributeAtIndex(unsigned Index, StringRef Kind) const;
/// Return the attribute object that exists at the arg index.
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
@@ -906,75 +907,75 @@ class AttributeList {
}
/// Return the alignment of the return value.
- MaybeAlign getRetAlignment() const;
+ LLVM_ABI MaybeAlign getRetAlignment() const;
/// Return the alignment for the specified function parameter.
- MaybeAlign getParamAlignment(unsigned ArgNo) const;
+ LLVM_ABI MaybeAlign getParamAlignment(unsigned ArgNo) const;
/// Return the stack alignment for the specified function parameter.
- MaybeAlign getParamStackAlignment(unsigned ArgNo) const;
+ LLVM_ABI MaybeAlign getParamStackAlignment(unsigned ArgNo) const;
/// Return the byval type for the specified function parameter.
- Type *getParamByValType(unsigned ArgNo) const;
+ LLVM_ABI Type *getParamByValType(unsigned ArgNo) const;
/// Return the sret type for the specified function parameter.
- Type *getParamStructRetType(unsigned ArgNo) const;
+ LLVM_ABI Type *getParamStructRetType(unsigned ArgNo) const;
/// Return the byref type for the specified function parameter.
- Type *getParamByRefType(unsigned ArgNo) const;
+ LLVM_ABI Type *getParamByRefType(unsigned ArgNo) const;
/// Return the preallocated type for the specified function parameter.
- Type *getParamPreallocatedType(unsigned ArgNo) const;
+ LLVM_ABI Type *getParamPreallocatedType(unsigned ArgNo) const;
/// Return the inalloca type for the specified function parameter.
- Type *getParamInAllocaType(unsigned ArgNo) const;
+ LLVM_ABI Type *getParamInAllocaType(unsigned ArgNo) const;
/// Return the elementtype type for the specified function parameter.
- Type *getParamElementType(unsigned ArgNo) const;
+ LLVM_ABI Type *getParamElementType(unsigned ArgNo) const;
/// Get the stack alignment of the function.
- MaybeAlign getFnStackAlignment() const;
+ LLVM_ABI MaybeAlign getFnStackAlignment() const;
/// Get the stack alignment of the return value.
- MaybeAlign getRetStackAlignment() const;
+ LLVM_ABI MaybeAlign getRetStackAlignment() const;
/// Get the number of dereferenceable bytes (or zero if unknown) of the return
/// value.
- uint64_t getRetDereferenceableBytes() const;
+ LLVM_ABI uint64_t getRetDereferenceableBytes() const;
/// Get the number of dereferenceable bytes (or zero if unknown) of an arg.
- uint64_t getParamDereferenceableBytes(unsigned Index) const;
+ LLVM_ABI uint64_t getParamDereferenceableBytes(unsigned Index) const;
/// Get the number of dereferenceable_or_null bytes (or zero if unknown) of
/// the return value.
- uint64_t getRetDereferenceableOrNullBytes() const;
+ LLVM_ABI uint64_t getRetDereferenceableOrNullBytes() const;
/// Get the number of dereferenceable_or_null bytes (or zero if unknown) of an
/// arg.
- uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const;
+ LLVM_ABI uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const;
/// Get range (or std::nullopt if unknown) of an arg.
- std::optional<ConstantRange> getParamRange(unsigned ArgNo) const;
+ LLVM_ABI std::optional<ConstantRange> getParamRange(unsigned ArgNo) const;
/// Get the disallowed floating-point classes of the return value.
- FPClassTest getRetNoFPClass() const;
+ LLVM_ABI FPClassTest getRetNoFPClass() const;
/// Get the disallowed floating-point classes of the argument value.
- FPClassTest getParamNoFPClass(unsigned ArgNo) const;
+ LLVM_ABI FPClassTest getParamNoFPClass(unsigned ArgNo) const;
/// Get the unwind table kind requested for the function.
- UWTableKind getUWTableKind() const;
+ LLVM_ABI UWTableKind getUWTableKind() const;
- AllocFnKind getAllocKind() const;
+ LLVM_ABI AllocFnKind getAllocKind() const;
/// Returns memory effects of the function.
- MemoryEffects getMemoryEffects() const;
+ LLVM_ABI MemoryEffects getMemoryEffects() const;
/// Return the attributes at the index as a string.
- std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
+ LLVM_ABI std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
/// Return true if this attribute list belongs to the LLVMContext.
- bool hasParentContext(LLVMContext &C) const;
+ LLVM_ABI bool hasParentContext(LLVMContext &C) const;
//===--------------------------------------------------------------------===//
// AttributeList Introspection
@@ -982,10 +983,10 @@ class AttributeList {
using iterator = const AttributeSet *;
- iterator begin() const;
- iterator end() const;
+ LLVM_ABI iterator begin() const;
+ LLVM_ABI iterator end() const;
- unsigned getNumAttrSets() const;
+ LLVM_ABI unsigned getNumAttrSets() const;
// Implementation of indexes(). Produces iterators that wrap an index. Mostly
// to hide the awkwardness of unsigned wrapping when iterating over valid
@@ -1026,9 +1027,9 @@ class AttributeList {
/// Return true if there are no attributes.
bool isEmpty() const { return pImpl == nullptr; }
- void print(raw_ostream &O) const;
+ LLVM_ABI void print(raw_ostream &O) const;
- void dump() const;
+ LLVM_ABI void dump() const;
};
//===----------------------------------------------------------------------===//
@@ -1076,24 +1077,24 @@ class AttrBuilder {
addAttribute(A);
}
- AttrBuilder(LLVMContext &Ctx, AttributeSet AS);
+ LLVM_ABI AttrBuilder(LLVMContext &Ctx, AttributeSet AS);
- void clear();
+ LLVM_ABI void clear();
/// Add an attribute to the builder.
- AttrBuilder &addAttribute(Attribute::AttrKind Val);
+ LLVM_ABI AttrBuilder &addAttribute(Attribute::AttrKind Val);
/// Add the Attribute object to the builder.
- AttrBuilder &addAttribute(Attribute A);
+ LLVM_ABI AttrBuilder &addAttribute(Attribute A);
/// Add the target-dependent attribute to the builder.
- AttrBuilder &addAttribute(StringRef A, StringRef V = StringRef());
+ LLVM_ABI AttrBuilder &addAttribute(StringRef A, StringRef V = StringRef());
/// Remove an attribute from the builder.
- AttrBuilder &removeAttribute(Attribute::AttrKind Val);
+ LLVM_ABI AttrBuilder &removeAttribute(Attribute::AttrKind Val);
/// Remove the target-dependent attribute from the builder.
- AttrBuilder &removeAttribute(StringRef A);
+ LLVM_ABI AttrBuilder &removeAttribute(StringRef A);
/// Remove the target-dependent attribute from the builder.
AttrBuilder &removeAttribute(Attribute A) {
@@ -1105,40 +1106,40 @@ class AttrBuilder {
/// Add the attributes from the builder. Attributes in the passed builder
/// overwrite attributes in this builder if they have the same key.
- AttrBuilder &merge(const AttrBuilder &B);
+ LLVM_ABI AttrBuilder &merge(const AttrBuilder &B);
/// Remove the attributes from the builder.
- AttrBuilder &remove(const AttributeMask &AM);
+ LLVM_ABI AttrBuilder &remove(const AttributeMask &AM);
/// Return true if the builder has any attribute that's in the
/// specified builder.
- bool overlaps(const AttributeMask &AM) const;
+ LLVM_ABI bool overlaps(const AttributeMask &AM) const;
/// Return true if the builder has the specified attribute.
- bool contains(Attribute::AttrKind A) const;
+ LLVM_ABI bool contains(Attribute::AttrKind A) const;
/// Return true if the builder has the specified target-dependent
/// attribute.
- bool contains(StringRef A) const;
+ LLVM_ABI bool contains(StringRef A) const;
/// Return true if the builder has IR-level attributes.
bool hasAttributes() const { return !Attrs.empty(); }
/// Return Attribute with the given Kind. The returned attribute will be
/// invalid if the Kind is not present in the builder.
- Attribute getAttribute(Attribute::AttrKind Kind) const;
+ LLVM_ABI Attribute getAttribute(Attribute::AttrKind Kind) const;
/// Return Attribute with the given Kind. The returned attribute will be
/// invalid if the Kind is not present in the builder.
- Attribute getAttribute(StringRef Kind) const;
+ LLVM_ABI Attribute getAttribute(StringRef Kind) const;
/// Retrieve the range if the attribute exists (std::nullopt is returned
/// otherwise).
- std::optional<ConstantRange> getRange() const;
+ LLVM_ABI std::optional<ConstantRange> getRange() const;
/// Return raw (possibly packed/encoded) value of integer attribute or
/// std::nullopt if not set.
- std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
+ LLVM_ABI std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
/// Retrieve the alignment attribute, if it exists.
MaybeAlign getAlignment() const {
@@ -1170,7 +1171,7 @@ class AttrBuilder {
}
/// Retrieve type for the given type attribute.
- Type *getTypeAttr(Attribute::AttrKind Kind) const;
+ LLVM_ABI Type *getTypeAttr(Attribute::AttrKind Kind) const;
/// Retrieve the byval type.
Type *getByValType() const { return getTypeAttr(Attribute::ByVal); }
@@ -1191,15 +1192,15 @@ class AttrBuilder {
/// Retrieve the allocsize args, or std::nullopt if the attribute does not
/// exist.
- std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
+ LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
const;
/// Add integer attribute with raw value (packed/encoded if necessary).
- AttrBuilder &addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value);
+ LLVM_ABI AttrBuilder &addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value);
/// This turns an alignment into the form used internally in Attribute.
/// This call has no effect if Align is not set.
- AttrBuilder &addAlignmentAttr(MaybeAlign Align);
+ LLVM_ABI AttrBuilder &addAlignmentAttr(MaybeAlign Align);
/// This turns an int alignment (which must be a power of 2) into the
/// form used internally in Attribute.
@@ -1211,7 +1212,7 @@ class AttrBuilder {
/// This turns a stack alignment into the form used internally in Attribute.
/// This call has no effect if Align is not set.
- AttrBuilder &addStackAlignmentAttr(MaybeAlign Align);
+ LLVM_ABI AttrBuilder &addStackAlignmentAttr(MaybeAlign Align);
/// This turns an int stack alignment (which must be a power of 2) into
/// the form used internally in Attribute.
@@ -1223,84 +1224,84 @@ class AttrBuilder {
/// This turns the number of dereferenceable bytes into the form used
/// internally in Attribute.
- AttrBuilder &addDereferenceableAttr(uint64_t Bytes);
+ LLVM_ABI AttrBuilder &addDereferenceableAttr(uint64_t Bytes);
/// This turns the number of dereferenceable_or_null bytes into the
/// form used internally in Attribute.
- AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
+ LLVM_ABI AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
/// This turns one (or two) ints into the form used internally in Attribute.
- AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
+ LLVM_ABI AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
const std::optional<unsigned> &NumElemsArg);
/// This turns two ints into the form used internally in Attribute.
- AttrBuilder &addVScaleRangeAttr(unsigned MinValue,
+ LLVM_ABI AttrBuilder &addVScaleRangeAttr(unsigned MinValue,
std::optional<unsigned> MaxValue);
/// Add a type attribute with the given type.
- AttrBuilder &addTypeAttr(Attribute::AttrKind Kind, Type *Ty);
+ LLVM_ABI AttrBuilder &addTypeAttr(Attribute::AttrKind Kind, Type *Ty);
/// This turns a byval type into the form used internally in Attribute.
- AttrBuilder &addByValAttr(Type *Ty);
+ LLVM_ABI AttrBuilder &addByValAttr(Type *Ty);
/// This turns a sret type into the form used internally in Attribute.
- AttrBuilder &addStructRetAttr(Type *Ty);
+ LLVM_ABI AttrBuilder &addStructRetAttr(Type *Ty);
/// This turns a byref type into the form used internally in Attribute.
- AttrBuilder &addByRefAttr(Type *Ty);
+ LLVM_ABI AttrBuilder &addByRefAttr(Type *Ty);
/// This turns a preallocated type into the form used internally in Attribute.
- AttrBuilder &addPreallocatedAttr(Type *Ty);
+ LLVM_ABI AttrBuilder &addPreallocatedAttr(Type *Ty);
/// This turns an inalloca type into the form used internally in Attribute.
- AttrBuilder &addInAllocaAttr(Type *Ty);
+ LLVM_ABI AttrBuilder &addInAllocaAttr(Type *Ty);
/// Add an allocsize attribute, using the representation returned by
/// Attribute.getIntValue().
- AttrBuilder &addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr);
+ LLVM_ABI AttrBuilder &addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr);
/// Add a vscale_range attribute, using the representation returned by
/// Attribute.getIntValue().
- AttrBuilder &addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr);
+ LLVM_ABI AttrBuilder &addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr);
/// This turns the unwind table kind into the form used internally in
/// Attribute.
- AttrBuilder &addUWTableAttr(UWTableKind Kind);
+ LLVM_ABI AttrBuilder &addUWTableAttr(UWTableKind Kind);
// This turns the allocator kind into the form used internally in Attribute.
- AttrBuilder &addAllocKindAttr(AllocFnKind Kind);
+ LLVM_ABI AttrBuilder &addAllocKindAttr(AllocFnKind Kind);
/// Add memory effect attribute.
- AttrBuilder &addMemoryAttr(MemoryEffects ME);
+ LLVM_ABI AttrBuilder &addMemoryAttr(MemoryEffects ME);
/// Add captures attribute.
- AttrBuilder &addCapturesAttr(CaptureInfo CI);
+ LLVM_ABI AttrBuilder &addCapturesAttr(CaptureInfo CI);
// Add nofpclass attribute
- AttrBuilder &addNoFPClassAttr(FPClassTest NoFPClassMask);
+ LLVM_ABI AttrBuilder &addNoFPClassAttr(FPClassTest NoFPClassMask);
/// Add a ConstantRange attribute with the given range.
- AttrBuilder &addConstantRangeAttr(Attribute::AttrKind Kind,
+ LLVM_ABI AttrBuilder &addConstantRangeAttr(Attribute::AttrKind Kind,
const ConstantRange &CR);
/// Add range attribute.
- AttrBuilder &addRangeAttr(const ConstantRange &CR);
+ LLVM_ABI AttrBuilder &addRangeAttr(const ConstantRange &CR);
/// Add a ConstantRangeList attribute with the given ranges.
- AttrBuilder &addConstantRangeListAttr(Attribute::AttrKind Kind,
+ LLVM_ABI AttrBuilder &addConstantRangeListAttr(Attribute::AttrKind Kind,
ArrayRef<ConstantRange> Val);
/// Add initializes attribute.
- AttrBuilder &addInitializesAttr(const ConstantRangeList &CRL);
+ LLVM_ABI AttrBuilder &addInitializesAttr(const ConstantRangeList &CRL);
/// Add 0 or more parameter attributes which are equivalent to metadata
/// attached to \p I. e.g. !align -> align. This assumes the argument type is
/// the same as the original instruction and the attribute is compatible.
- AttrBuilder &addFromEquivalentMetadata(const Instruction &I);
+ LLVM_ABI AttrBuilder &addFromEquivalentMetadata(const Instruction &I);
ArrayRef<Attribute> attrs() const { return Attrs; }
- bool operator==(const AttrBuilder &B) const;
+ LLVM_ABI bool operator==(const AttrBuilder &B) const;
bool operator!=(const AttrBuilder &B) const { return !(*this == B); }
};
@@ -1314,7 +1315,7 @@ enum AttributeSafetyKind : uint8_t {
/// Returns true if this is a type legal for the 'nofpclass' attribute. This
/// follows the same type rules as FPMathOperator.
-bool isNoFPClassCompatibleType(Type *Ty);
+LLVM_ABI bool isNoFPClassCompatibleType(Type *Ty);
/// Which attributes cannot be applied to a type. The argument \p AS
/// is used as a hint for the attributes whose compatibility is being
@@ -1325,7 +1326,7 @@ bool isNoFPClassCompatibleType(Type *Ty);
/// attributes that are known to be safely droppable are contained in
/// the mask; only attributes that might be unsafe to drop (e.g.,
/// ABI-related attributes) are in the mask; or both.
-AttributeMask typeIncompatible(Type *Ty, AttributeSet AS,
+LLVM_ABI AttributeMask typeIncompatible(Type *Ty, AttributeSet AS,
AttributeSafetyKind ASK = ASK_ALL);
/// Get param/return attributes which imply immediate undefined behavior if an
@@ -1333,11 +1334,11 @@ AttributeMask typeIncompatible(Type *Ty, AttributeSet AS,
/// implies UB), but not nonnull (where null implies poison). It also does not
/// include attributes like nocapture, which constrain the function
/// implementation rather than the passed value.
-AttributeMask getUBImplyingAttributes();
+LLVM_ABI AttributeMask getUBImplyingAttributes();
/// \returns Return true if the two functions have compatible target-independent
/// attributes for inlining purposes.
-bool areInlineCompatible(const Function &Caller, const Function &Callee);
+LLVM_ABI bool areInlineCompatible(const Function &Caller, const Function &Callee);
/// Checks if there are any incompatible function attributes between
@@ -1346,19 +1347,19 @@ bool areInlineCompatible(const Function &Caller, const Function &Callee);
/// \param [in] A - The first function to be compared with.
/// \param [in] B - The second function to be compared with.
/// \returns true if the functions have compatible attributes.
-bool areOutlineCompatible(const Function &A, const Function &B);
+LLVM_ABI bool areOutlineCompatible(const Function &A, const Function &B);
/// Merge caller's and callee's attributes.
-void mergeAttributesForInlining(Function &Caller, const Function &Callee);
+LLVM_ABI void mergeAttributesForInlining(Function &Caller, const Function &Callee);
/// Merges the functions attributes from \p ToMerge into function \p Base.
///
/// \param [in,out] Base - The function being merged into.
/// \param [in] ToMerge - The function to merge attributes from.
-void mergeAttributesForOutlining(Function &Base, const Function &ToMerge);
+LLVM_ABI void mergeAttributesForOutlining(Function &Base, const Function &ToMerge);
/// Update min-legal-vector-width if it is in Attribute and less than Width.
-void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width);
+LLVM_ABI void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width);
} // end namespace AttributeFuncs
diff --git a/llvm/include/llvm/IR/AutoUpgrade.h b/llvm/include/llvm/IR/AutoUpgrade.h
index 8c093568a1e03..23384e746fdf2 100644
--- a/llvm/include/llvm/IR/AutoUpgrade.h
+++ b/llvm/include/llvm/IR/AutoUpgrade.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_AUTOUPGRADE_H
#define LLVM_IR_AUTOUPGRADE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include <vector>
@@ -36,62 +37,62 @@ namespace llvm {
/// for upgrading, and returns true if it requires upgrading. It may return
/// null in NewFn if the all calls to the original intrinsic function
/// should be transformed to non-function-call instructions.
- bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn,
+ LLVM_ABI bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn,
bool CanUpgradeDebugIntrinsicsToRecords = true);
/// This is the complement to the above, replacing a specific call to an
/// intrinsic function with a call to the specified new function.
- void UpgradeIntrinsicCall(CallBase *CB, Function *NewFn);
+ LLVM_ABI void UpgradeIntrinsicCall(CallBase *CB, Function *NewFn);
// This upgrades the comment for objc retain release markers in inline asm
// calls
- void UpgradeInlineAsmString(std::string *AsmStr);
+ LLVM_ABI void UpgradeInlineAsmString(std::string *AsmStr);
/// This is an auto-upgrade hook for any old intrinsic function syntaxes
/// which need to have both the function updated as well as all calls updated
/// to the new function. This should only be run in a post-processing fashion
/// so that it can update all calls to the old function.
- void UpgradeCallsToIntrinsic(Function* F);
+ LLVM_ABI void UpgradeCallsToIntrinsic(Function* F);
/// This checks for global variables which should be upgraded. If it requires
/// upgrading, returns a pointer to the upgraded variable.
- GlobalVariable *UpgradeGlobalVariable(GlobalVariable *GV);
+ LLVM_ABI GlobalVariable *UpgradeGlobalVariable(GlobalVariable *GV);
/// This checks for module flags which should be upgraded. It returns true if
/// module is modified.
- bool UpgradeModuleFlags(Module &M);
+ LLVM_ABI bool UpgradeModuleFlags(Module &M);
/// Convert legacy nvvm.annotations metadata to appropriate function
/// attributes.
- void UpgradeNVVMAnnotations(Module &M);
+ LLVM_ABI void UpgradeNVVMAnnotations(Module &M);
/// Convert calls to ARC runtime functions to intrinsic calls and upgrade the
/// old retain release marker to new module flag format.
- void UpgradeARCRuntime(Module &M);
+ LLVM_ABI void UpgradeARCRuntime(Module &M);
- void UpgradeSectionAttributes(Module &M);
+ LLVM_ABI void UpgradeSectionAttributes(Module &M);
/// Correct any IR that is relying on old function attribute behavior.
- void UpgradeFunctionAttributes(Function &F);
+ LLVM_ABI void UpgradeFunctionAttributes(Function &F);
/// If the given TBAA tag uses the scalar TBAA format, create a new node
/// corresponding to the upgrade to the struct-path aware TBAA format.
/// Otherwise return the \p TBAANode itself.
- MDNode *UpgradeTBAANode(MDNode &TBAANode);
+ LLVM_ABI MDNode *UpgradeTBAANode(MDNode &TBAANode);
/// This is an auto-upgrade for bitcast between pointers with different
/// address spaces: the instruction is replaced by a pair ptrtoint+inttoptr.
- Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
+ LLVM_ABI Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
Instruction *&Temp);
/// This is an auto-upgrade for bitcast constant expression between pointers
/// with different address spaces: the instruction is replaced by a pair
/// ptrtoint+inttoptr.
- Constant *UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy);
+ LLVM_ABI Constant *UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy);
/// Check the debug info version number, if it is out-dated, drop the debug
/// info. Return true if module is modified.
- bool UpgradeDebugInfo(Module &M);
+ LLVM_ABI bool UpgradeDebugInfo(Module &M);
/// Check whether a string looks like an old loop attachment tag.
inline bool mayBeOldLoopAttachmentTag(StringRef Name) {
@@ -99,17 +100,17 @@ namespace llvm {
}
/// Upgrade the loop attachment metadata node.
- MDNode *upgradeInstructionLoopAttachment(MDNode &N);
+ LLVM_ABI MDNode *upgradeInstructionLoopAttachment(MDNode &N);
/// Upgrade the datalayout string by adding a section for address space
/// pointers.
- std::string UpgradeDataLayoutString(StringRef DL, StringRef Triple);
+ LLVM_ABI std::string UpgradeDataLayoutString(StringRef DL, StringRef Triple);
/// Upgrade attributes that changed format or kind.
- void UpgradeAttributes(AttrBuilder &B);
+ LLVM_ABI void UpgradeAttributes(AttrBuilder &B);
/// Upgrade operand bundles (without knowing about their user instruction).
- void UpgradeOperandBundles(std::vector<OperandBundleDef> &OperandBundles);
+ LLVM_ABI void UpgradeOperandBundles(std::vector<OperandBundleDef> &OperandBundles);
} // End llvm namespace
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 9ee0bacb5c258..64622f45baf8e 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_BASICBLOCK_H
#define LLVM_IR_BASICBLOCK_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Twine.h"
@@ -81,25 +82,25 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
public:
/// Attach a DbgMarker to the given instruction. Enables the storage of any
/// debug-info at this position in the program.
- DbgMarker *createMarker(Instruction *I);
- DbgMarker *createMarker(InstListType::iterator It);
+ LLVM_ABI DbgMarker *createMarker(Instruction *I);
+ LLVM_ABI DbgMarker *createMarker(InstListType::iterator It);
/// Convert variable location debugging information stored in dbg.value
/// intrinsics into DbgMarkers / DbgRecords. Deletes all dbg.values in
/// the process and sets IsNewDbgInfoFormat = true. Only takes effect if
/// the UseNewDbgInfoFormat LLVM command line option is given.
- void convertToNewDbgValues();
+ LLVM_ABI void convertToNewDbgValues();
/// Convert variable location debugging information stored in DbgMarkers and
/// DbgRecords into the dbg.value intrinsic representation. Sets
/// IsNewDbgInfoFormat = false.
- void convertFromNewDbgValues();
+ LLVM_ABI void convertFromNewDbgValues();
/// Ensure the block is in "old" dbg.value format (\p NewFlag == false) or
/// in the new format (\p NewFlag == true), converting to the desired format
/// if necessary.
- void setIsNewDbgInfoFormat(bool NewFlag);
- void setNewDbgInfoFormatFlag(bool NewFlag);
+ LLVM_ABI void setIsNewDbgInfoFormat(bool NewFlag);
+ LLVM_ABI void setNewDbgInfoFormatFlag(bool NewFlag);
unsigned getNumber() const {
assert(getParent() && "only basic blocks in functions have valid numbers");
@@ -110,47 +111,47 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// instruction of this block. These are equivalent to dbg.value intrinsics
/// that exist at the end of a basic block with no terminator (a transient
/// state that occurs regularly).
- void setTrailingDbgRecords(DbgMarker *M);
+ LLVM_ABI void setTrailingDbgRecords(DbgMarker *M);
/// Fetch the collection of DbgRecords that "trail" after the last instruction
/// of this block, see \ref setTrailingDbgRecords. If there are none, returns
/// nullptr.
- DbgMarker *getTrailingDbgRecords();
+ LLVM_ABI DbgMarker *getTrailingDbgRecords();
/// Delete any trailing DbgRecords at the end of this block, see
/// \ref setTrailingDbgRecords.
- void deleteTrailingDbgRecords();
+ LLVM_ABI void deleteTrailingDbgRecords();
- void dumpDbgValues() const;
+ LLVM_ABI void dumpDbgValues() const;
/// Return the DbgMarker for the position given by \p It, so that DbgRecords
/// can be inserted there. This will either be nullptr if not present, a
/// DbgMarker, or TrailingDbgRecords if It is end().
- DbgMarker *getMarker(InstListType::iterator It);
+ LLVM_ABI DbgMarker *getMarker(InstListType::iterator It);
/// Return the DbgMarker for the position that comes after \p I. \see
/// BasicBlock::getMarker, this can be nullptr, a DbgMarker, or
/// TrailingDbgRecords if there is no next instruction.
- DbgMarker *getNextMarker(Instruction *I);
+ LLVM_ABI DbgMarker *getNextMarker(Instruction *I);
/// Insert a DbgRecord into a block at the position given by \p I.
- void insertDbgRecordAfter(DbgRecord *DR, Instruction *I);
+ LLVM_ABI void insertDbgRecordAfter(DbgRecord *DR, Instruction *I);
/// Insert a DbgRecord into a block at the position given by \p Here.
- void insertDbgRecordBefore(DbgRecord *DR, InstListType::iterator Here);
+ LLVM_ABI void insertDbgRecordBefore(DbgRecord *DR, InstListType::iterator Here);
/// Eject any debug-info trailing at the end of a block. DbgRecords can
/// transiently be located "off the end" of a block if the blocks terminator
/// is temporarily removed. Once a terminator is re-inserted this method will
/// move such DbgRecords back to the right place (ahead of the terminator).
- void flushTerminatorDbgRecords();
+ LLVM_ABI void flushTerminatorDbgRecords();
/// In rare circumstances instructions can be speculatively removed from
/// blocks, and then be re-inserted back into that position later. When this
/// happens in RemoveDIs debug-info mode, some special patching-up needs to
/// occur: inserting into the middle of a sequence of dbg.value intrinsics
/// does not have an equivalent with DbgRecords.
- void reinsertInstInDbgRecords(Instruction *I,
+ LLVM_ABI void reinsertInstInDbgRecords(Instruction *I,
std::optional<DbgRecord::self_iterator> Pos);
private:
@@ -161,17 +162,17 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// If the function parameter is specified, the basic block is automatically
/// inserted at either the end of the function (if InsertBefore is null), or
/// before the specified basic block.
- explicit BasicBlock(LLVMContext &C, const Twine &Name = "",
+ LLVM_ABI explicit BasicBlock(LLVMContext &C, const Twine &Name = "",
Function *Parent = nullptr,
BasicBlock *InsertBefore = nullptr);
public:
BasicBlock(const BasicBlock &) = delete;
BasicBlock &operator=(const BasicBlock &) = delete;
- ~BasicBlock();
+ LLVM_ABI ~BasicBlock();
/// Get the context in which this basic block lives.
- LLVMContext &getContext() const;
+ LLVM_ABI LLVMContext &getContext() const;
/// Instruction iterators...
using iterator = InstListType::iterator;
@@ -224,7 +225,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// nullptr if the function does not have a module.
///
/// Note: this is undefined behavior if the block does not have a parent.
- const Module *getModule() const;
+ LLVM_ABI const Module *getModule() const;
Module *getModule() {
return const_cast<Module *>(
static_cast<const BasicBlock *>(this)->getModule());
@@ -233,7 +234,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Get the data layout of the module this basic block belongs to.
///
/// Requires the basic block to have a parent module.
- const DataLayout &getDataLayout() const;
+ LLVM_ABI const DataLayout &getDataLayout() const;
/// Returns the terminator instruction if the block is well formed or null
/// if the block is not well formed.
@@ -250,7 +251,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns the call instruction calling \@llvm.experimental.deoptimize
/// prior to the terminating return instruction of this basic block, if such
/// a call is present. Otherwise, returns null.
- const CallInst *getTerminatingDeoptimizeCall() const;
+ LLVM_ABI const CallInst *getTerminatingDeoptimizeCall() const;
CallInst *getTerminatingDeoptimizeCall() {
return const_cast<CallInst *>(
static_cast<const BasicBlock *>(this)->getTerminatingDeoptimizeCall());
@@ -259,7 +260,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns the call instruction calling \@llvm.experimental.deoptimize
/// that is present either in current basic block or in block that is a unique
/// successor to current block, if such call is present. Otherwise, returns null.
- const CallInst *getPostdominatingDeoptimizeCall() const;
+ LLVM_ABI const CallInst *getPostdominatingDeoptimizeCall() const;
CallInst *getPostdominatingDeoptimizeCall() {
return const_cast<CallInst *>(
static_cast<const BasicBlock *>(this)->getPostdominatingDeoptimizeCall());
@@ -268,7 +269,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns the call instruction marked 'musttail' prior to the terminating
/// return instruction of this basic block, if such a call is present.
/// Otherwise, returns null.
- const CallInst *getTerminatingMustTailCall() const;
+ LLVM_ABI const CallInst *getTerminatingMustTailCall() const;
CallInst *getTerminatingMustTailCall() {
return const_cast<CallInst *>(
static_cast<const BasicBlock *>(this)->getTerminatingMustTailCall());
@@ -283,9 +284,9 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
///
/// Deprecated in favour of getFirstNonPHIIt, which returns an iterator that
/// preserves some debugging information.
- LLVM_DEPRECATED("Use iterators as instruction positions", "getFirstNonPHIIt")
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "getFirstNonPHIIt")
const Instruction *getFirstNonPHI() const;
- LLVM_DEPRECATED("Use iterators as instruction positions instead",
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions instead",
"getFirstNonPHIIt")
Instruction *getFirstNonPHI();
@@ -298,7 +299,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
///
/// Avoid unwrapping the iterator to an Instruction* before inserting here,
/// as important debug-info is preserved in the iterator.
- InstListType::const_iterator getFirstNonPHIIt() const;
+ LLVM_ABI InstListType::const_iterator getFirstNonPHIIt() const;
InstListType::iterator getFirstNonPHIIt() {
BasicBlock::iterator It =
static_cast<const BasicBlock *>(this)->getFirstNonPHIIt().getNonConst();
@@ -309,7 +310,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns a pointer to the first instruction in this block that is not a
/// PHINode or a debug intrinsic, or any pseudo operation if \c SkipPseudoOp
/// is true.
- InstListType::const_iterator
+ LLVM_ABI InstListType::const_iterator
getFirstNonPHIOrDbg(bool SkipPseudoOp = true) const;
InstListType::iterator getFirstNonPHIOrDbg(bool SkipPseudoOp = true) {
return static_cast<const BasicBlock *>(this)
@@ -320,7 +321,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns a pointer to the first instruction in this block that is not a
/// PHINode, a debug intrinsic, or a lifetime intrinsic, or any pseudo
/// operation if \c SkipPseudoOp is true.
- InstListType::const_iterator
+ LLVM_ABI InstListType::const_iterator
getFirstNonPHIOrDbgOrLifetime(bool SkipPseudoOp = true) const;
InstListType::iterator
getFirstNonPHIOrDbgOrLifetime(bool SkipPseudoOp = true) {
@@ -333,7 +334,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// suitable for inserting a non-PHI instruction.
///
/// In particular, it skips all PHIs and LandingPad instructions.
- const_iterator getFirstInsertionPt() const;
+ LLVM_ABI const_iterator getFirstInsertionPt() const;
iterator getFirstInsertionPt() {
return static_cast<const BasicBlock *>(this)
->getFirstInsertionPt().getNonConst();
@@ -341,7 +342,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns an iterator to the first instruction in this block that is
/// not a PHINode, a debug intrinsic, a static alloca or any pseudo operation.
- const_iterator getFirstNonPHIOrDbgOrAlloca() const;
+ LLVM_ABI const_iterator getFirstNonPHIOrDbgOrAlloca() const;
iterator getFirstNonPHIOrDbgOrAlloca() {
return static_cast<const BasicBlock *>(this)
->getFirstNonPHIOrDbgOrAlloca()
@@ -351,7 +352,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns the first potential AsynchEH faulty instruction
/// currently it checks for loads/stores (which may dereference a null
/// pointer) and calls/invokes (which may propagate exceptions)
- const Instruction* getFirstMayFaultInst() const;
+ LLVM_ABI const Instruction* getFirstMayFaultInst() const;
Instruction* getFirstMayFaultInst() {
return const_cast<Instruction*>(
static_cast<const BasicBlock*>(this)->getFirstMayFaultInst());
@@ -360,40 +361,40 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Return a const iterator range over the instructions in the block, skipping
/// any debug instructions. Skip any pseudo operations as well if \c
/// SkipPseudoOp is true.
- iterator_range<filter_iterator<BasicBlock::const_iterator,
+ LLVM_ABI iterator_range<filter_iterator<BasicBlock::const_iterator,
std::function<bool(const Instruction &)>>>
instructionsWithoutDebug(bool SkipPseudoOp = true) const;
/// Return an iterator range over the instructions in the block, skipping any
/// debug instructions. Skip and any pseudo operations as well if \c
/// SkipPseudoOp is true.
- iterator_range<
+ LLVM_ABI iterator_range<
filter_iterator<BasicBlock::iterator, std::function<bool(Instruction &)>>>
instructionsWithoutDebug(bool SkipPseudoOp = true);
/// Return the size of the basic block ignoring debug instructions
- filter_iterator<BasicBlock::const_iterator,
+ LLVM_ABI filter_iterator<BasicBlock::const_iterator,
std::function<bool(const Instruction &)>>::difference_type
sizeWithoutDebug() const;
/// Unlink 'this' from the containing function, but do not delete it.
- void removeFromParent();
+ LLVM_ABI void removeFromParent();
/// Unlink 'this' from the containing function and delete it.
///
// \returns an iterator pointing to the element after the erased one.
- SymbolTableList<BasicBlock>::iterator eraseFromParent();
+ LLVM_ABI SymbolTableList<BasicBlock>::iterator eraseFromParent();
/// Unlink this basic block from its current function and insert it into
/// the function that \p MovePos lives in, right before \p MovePos.
inline void moveBefore(BasicBlock *MovePos) {
moveBefore(MovePos->getIterator());
}
- void moveBefore(SymbolTableList<BasicBlock>::iterator MovePos);
+ LLVM_ABI void moveBefore(SymbolTableList<BasicBlock>::iterator MovePos);
/// Unlink this basic block from its current function and insert it
/// right after \p MovePos in the function \p MovePos lives in.
- void moveAfter(BasicBlock *MovePos);
+ LLVM_ABI void moveAfter(BasicBlock *MovePos);
/// Insert unlinked basic block into a function.
///
@@ -401,11 +402,11 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// provided, inserts before that basic block, otherwise inserts at the end.
///
/// \pre \a getParent() is \c nullptr.
- void insertInto(Function *Parent, BasicBlock *InsertBefore = nullptr);
+ LLVM_ABI void insertInto(Function *Parent, BasicBlock *InsertBefore = nullptr);
/// Return the predecessor of this block if it has a single predecessor
/// block. Otherwise return a null pointer.
- const BasicBlock *getSinglePredecessor() const;
+ LLVM_ABI const BasicBlock *getSinglePredecessor() const;
BasicBlock *getSinglePredecessor() {
return const_cast<BasicBlock *>(
static_cast<const BasicBlock *>(this)->getSinglePredecessor());
@@ -417,23 +418,23 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Note that unique predecessor doesn't mean single edge, there can be
/// multiple edges from the unique predecessor to this block (for example a
/// switch statement with multiple cases having the same destination).
- const BasicBlock *getUniquePredecessor() const;
+ LLVM_ABI const BasicBlock *getUniquePredecessor() const;
BasicBlock *getUniquePredecessor() {
return const_cast<BasicBlock *>(
static_cast<const BasicBlock *>(this)->getUniquePredecessor());
}
/// Return true if this block has exactly N predecessors.
- bool hasNPredecessors(unsigned N) const;
+ LLVM_ABI bool hasNPredecessors(unsigned N) const;
/// Return true if this block has N predecessors or more.
- bool hasNPredecessorsOrMore(unsigned N) const;
+ LLVM_ABI bool hasNPredecessorsOrMore(unsigned N) const;
/// Return the successor of this block if it has a single successor.
/// Otherwise return a null pointer.
///
/// This method is analogous to getSinglePredecessor above.
- const BasicBlock *getSingleSuccessor() const;
+ LLVM_ABI const BasicBlock *getSingleSuccessor() const;
BasicBlock *getSingleSuccessor() {
return const_cast<BasicBlock *>(
static_cast<const BasicBlock *>(this)->getSingleSuccessor());
@@ -443,7 +444,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Otherwise return a null pointer.
///
/// This method is analogous to getUniquePredecessor above.
- const BasicBlock *getUniqueSuccessor() const;
+ LLVM_ABI const BasicBlock *getUniqueSuccessor() const;
BasicBlock *getUniqueSuccessor() {
return const_cast<BasicBlock *>(
static_cast<const BasicBlock *>(this)->getUniqueSuccessor());
@@ -451,7 +452,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Print the basic block to an output stream with an optional
/// AssemblyAnnotationWriter.
- void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr,
+ LLVM_ABI void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr,
bool ShouldPreserveUseListOrder = false,
bool IsForDebug = false) const;
@@ -530,7 +531,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
iterator_range<const_phi_iterator> phis() const {
return const_cast<BasicBlock *>(this)->phis();
}
- iterator_range<phi_iterator> phis();
+ LLVM_ABI iterator_range<phi_iterator> phis();
private:
/// Return the underlying instruction list container.
@@ -584,7 +585,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
public:
/// Returns a pointer to the symbol table if one exists.
- ValueSymbolTable *getValueSymbolTable();
+ LLVM_ABI ValueSymbolTable *getValueSymbolTable();
/// Methods for support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Value *V) {
@@ -599,7 +600,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// counts go to zero. Then everything is delete'd for real. Note that no
/// operations are valid on an object that has "dropped all references",
/// except operator delete.
- void dropAllReferences();
+ LLVM_ABI void dropAllReferences();
/// Update PHI nodes in this BasicBlock before removal of predecessor \p Pred.
/// Note that this function does not actually remove the predecessor.
@@ -607,9 +608,9 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// If \p KeepOneInputPHIs is true then don't remove PHIs that are left with
/// zero or one incoming values, and don't simplify PHIs with all incoming
/// values the same.
- void removePredecessor(BasicBlock *Pred, bool KeepOneInputPHIs = false);
+ LLVM_ABI void removePredecessor(BasicBlock *Pred, bool KeepOneInputPHIs = false);
- bool canSplitPredecessors() const;
+ LLVM_ABI bool canSplitPredecessors() const;
/// Split the basic block into two basic blocks at the specified instruction.
///
@@ -629,7 +630,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
///
/// Also note that this doesn't preserve any passes. To split blocks while
/// keeping loop information consistent, use the SplitBlock utility function.
- BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "",
+ LLVM_ABI BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "",
bool Before = false);
BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "",
bool Before = false) {
@@ -653,7 +654,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Also note that this doesn't preserve any passes. To split blocks while
/// keeping loop information consistent, use the SplitBlockBefore utility
/// function.
- BasicBlock *splitBasicBlockBefore(iterator I, const Twine &BBName = "");
+ LLVM_ABI BasicBlock *splitBasicBlockBefore(iterator I, const Twine &BBName = "");
BasicBlock *splitBasicBlockBefore(Instruction *I, const Twine &BBName = "") {
return splitBasicBlockBefore(I->getIterator(), BBName);
}
@@ -676,13 +677,13 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Transfer a range of instructions that belong to \p FromBB from \p
/// FromBeginIt to \p FromEndIt, to this basic block at \p ToIt.
- void splice(BasicBlock::iterator ToIt, BasicBlock *FromBB,
+ LLVM_ABI void splice(BasicBlock::iterator ToIt, BasicBlock *FromBB,
BasicBlock::iterator FromBeginIt,
BasicBlock::iterator FromEndIt);
/// Erases a range of instructions from \p FromIt to (not including) \p ToIt.
/// \Returns \p ToIt.
- BasicBlock::iterator erase(BasicBlock::iterator FromIt, BasicBlock::iterator ToIt);
+ LLVM_ABI BasicBlock::iterator erase(BasicBlock::iterator FromIt, BasicBlock::iterator ToIt);
/// Returns true if there are any uses of this basic block other than
/// direct branches, switches, etc. to it.
@@ -692,15 +693,15 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Update all phi nodes in this basic block to refer to basic block \p New
/// instead of basic block \p Old.
- void replacePhiUsesWith(BasicBlock *Old, BasicBlock *New);
+ LLVM_ABI void replacePhiUsesWith(BasicBlock *Old, BasicBlock *New);
/// Update all phi nodes in this basic block's successors to refer to basic
/// block \p New instead of basic block \p Old.
- void replaceSuccessorsPhiUsesWith(BasicBlock *Old, BasicBlock *New);
+ LLVM_ABI void replaceSuccessorsPhiUsesWith(BasicBlock *Old, BasicBlock *New);
/// Update all phi nodes in this basic block's successors to refer to basic
/// block \p New instead of to it.
- void replaceSuccessorsPhiUsesWith(BasicBlock *New);
+ LLVM_ABI void replaceSuccessorsPhiUsesWith(BasicBlock *New);
/// Return true if this basic block is an exception handling block.
bool isEHPad() const { return getFirstNonPHIIt()->isEHPad(); }
@@ -709,23 +710,23 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
///
/// Being a ``landing pad'' means that the basic block is the destination of
/// the 'unwind' edge of an invoke instruction.
- bool isLandingPad() const;
+ LLVM_ABI bool isLandingPad() const;
/// Return the landingpad instruction associated with the landing pad.
- const LandingPadInst *getLandingPadInst() const;
+ LLVM_ABI const LandingPadInst *getLandingPadInst() const;
LandingPadInst *getLandingPadInst() {
return const_cast<LandingPadInst *>(
static_cast<const BasicBlock *>(this)->getLandingPadInst());
}
/// Return true if it is legal to hoist instructions into this block.
- bool isLegalToHoistInto() const;
+ LLVM_ABI bool isLegalToHoistInto() const;
/// Return true if this is the entry block of the containing function.
/// This method can only be used on blocks that have a parent function.
- bool isEntryBlock() const;
+ LLVM_ABI bool isEntryBlock() const;
- std::optional<uint64_t> getIrrLoopHeaderWeight() const;
+ LLVM_ABI std::optional<uint64_t> getIrrLoopHeaderWeight() const;
/// Returns true if the Order field of child Instructions is valid.
bool isInstrOrderValid() const {
@@ -739,7 +740,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
}
/// Renumber instructions and mark the ordering as valid.
- void renumberInstructions();
+ LLVM_ABI void renumberInstructions();
/// Asserts that instruction order numbers are marked invalid, or that they
/// are in ascending order. This is constant time if the ordering is invalid,
@@ -757,7 +758,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef)
/// Advance \p It while it points to a debug instruction and return the result.
/// This assumes that \p It is not at the end of a block.
-BasicBlock::iterator skipDebugIntrinsics(BasicBlock::iterator It);
+LLVM_ABI BasicBlock::iterator skipDebugIntrinsics(BasicBlock::iterator It);
#ifdef NDEBUG
/// In release builds, this is a no-op. For !NDEBUG builds, the checks are
diff --git a/llvm/include/llvm/IR/BuiltinGCs.h b/llvm/include/llvm/IR/BuiltinGCs.h
index 16aff01dbcf3d..18930fa28da5a 100644
--- a/llvm/include/llvm/IR/BuiltinGCs.h
+++ b/llvm/include/llvm/IR/BuiltinGCs.h
@@ -20,13 +20,13 @@ namespace llvm {
/// serve any purpose except to link in the plugins.
/// Ensure the definition of the builtin GCs gets linked in
-void linkAllBuiltinGCs();
+LLVM_ABI void linkAllBuiltinGCs();
/// Creates an ocaml-compatible metadata printer.
-void linkOcamlGCPrinter();
+LLVM_ABI void linkOcamlGCPrinter();
/// Creates an erlang-compatible metadata printer.
-void linkErlangGCPrinter();
+LLVM_ABI void linkErlangGCPrinter();
} // namespace llvm
diff --git a/llvm/include/llvm/IR/CmpPredicate.h b/llvm/include/llvm/IR/CmpPredicate.h
index fca27a76e2eb7..893dd12636ede 100644
--- a/llvm/include/llvm/IR/CmpPredicate.h
+++ b/llvm/include/llvm/IR/CmpPredicate.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_CMPPREDICATE_H
#define LLVM_IR_CMPPREDICATE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/InstrTypes.h"
namespace llvm {
@@ -54,14 +55,14 @@ class CmpPredicate {
/// samesign ult + slt -> slt
/// ult + ult -> ult
/// ult + slt -> std::nullopt
- static std::optional<CmpPredicate> getMatching(CmpPredicate A,
+ LLVM_ABI static std::optional<CmpPredicate> getMatching(CmpPredicate A,
CmpPredicate B);
/// Attempts to return a signed CmpInst::Predicate from the CmpPredicate. If
/// the CmpPredicate has samesign, return ICmpInst::getSignedPredicate,
/// dropping samesign information. Otherwise, return the predicate, dropping
/// samesign information.
- CmpInst::Predicate getPreferredSignedPredicate() const;
+ LLVM_ABI CmpInst::Predicate getPreferredSignedPredicate() const;
/// An operator== on the underlying Predicate.
bool operator==(CmpInst::Predicate P) const { return Pred == P; }
@@ -74,13 +75,13 @@ class CmpPredicate {
/// Do a ICmpInst::getCmpPredicate() or CmpInst::getPredicate(), as
/// appropriate.
- static CmpPredicate get(const CmpInst *Cmp);
+ LLVM_ABI static CmpPredicate get(const CmpInst *Cmp);
/// Get the swapped predicate of a CmpPredicate.
- static CmpPredicate getSwapped(CmpPredicate P);
+ LLVM_ABI static CmpPredicate getSwapped(CmpPredicate P);
/// Get the swapped predicate of a CmpInst.
- static CmpPredicate getSwapped(const CmpInst *Cmp);
+ LLVM_ABI static CmpPredicate getSwapped(const CmpInst *Cmp);
};
} // namespace llvm
diff --git a/llvm/include/llvm/IR/Comdat.h b/llvm/include/llvm/IR/Comdat.h
index 1701802e69772..1fc2356c0cbde 100644
--- a/llvm/include/llvm/IR/Comdat.h
+++ b/llvm/include/llvm/IR/Comdat.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_COMDAT_H
#define LLVM_IR_COMDAT_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/CBindingWrapping.h"
@@ -41,13 +42,13 @@ class Comdat {
};
Comdat(const Comdat &) = delete;
- Comdat(Comdat &&C);
+ LLVM_ABI Comdat(Comdat &&C);
SelectionKind getSelectionKind() const { return SK; }
void setSelectionKind(SelectionKind Val) { SK = Val; }
- StringRef getName() const;
- void print(raw_ostream &OS, bool IsForDebug = false) const;
- void dump() const;
+ LLVM_ABI StringRef getName() const;
+ LLVM_ABI void print(raw_ostream &OS, bool IsForDebug = false) const;
+ LLVM_ABI void dump() const;
const SmallPtrSetImpl<GlobalObject *> &getUsers() const { return Users; }
private:
diff --git a/llvm/include/llvm/IR/Constant.h b/llvm/include/llvm/IR/Constant.h
index 0aefb5ecf6b7f..04384b250dc10 100644
--- a/llvm/include/llvm/IR/Constant.h
+++ b/llvm/include/llvm/IR/Constant.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_CONSTANT_H
#define LLVM_IR_CONSTANT_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
@@ -51,84 +52,84 @@ class Constant : public User {
Constant(const Constant &) = delete;
/// Return true if this is the value that would be returned by getNullValue.
- bool isNullValue() const;
+ LLVM_ABI bool isNullValue() const;
/// Returns true if the value is one.
- bool isOneValue() const;
+ LLVM_ABI bool isOneValue() const;
/// Return true if the value is not the one value, or,
/// for vectors, does not contain one value elements.
- bool isNotOneValue() const;
+ LLVM_ABI bool isNotOneValue() const;
/// Return true if this is the value that would be returned by
/// getAllOnesValue.
- bool isAllOnesValue() const;
+ LLVM_ABI bool isAllOnesValue() const;
/// Return true if the value is what would be returned by
/// getZeroValueForNegation.
- bool isNegativeZeroValue() const;
+ LLVM_ABI bool isNegativeZeroValue() const;
/// Return true if the value is negative zero or null value.
- bool isZeroValue() const;
+ LLVM_ABI bool isZeroValue() const;
/// Return true if the value is not the smallest signed value, or,
/// for vectors, does not contain smallest signed value elements.
- bool isNotMinSignedValue() const;
+ LLVM_ABI bool isNotMinSignedValue() const;
/// Return true if the value is the smallest signed value.
- bool isMinSignedValue() const;
+ LLVM_ABI bool isMinSignedValue() const;
/// Return true if this is a finite and non-zero floating-point scalar
/// constant or a fixed width vector constant with all finite and non-zero
/// elements.
- bool isFiniteNonZeroFP() const;
+ LLVM_ABI bool isFiniteNonZeroFP() const;
/// Return true if this is a normal (as opposed to denormal, infinity, nan,
/// or zero) floating-point scalar constant or a vector constant with all
/// normal elements. See APFloat::isNormal.
- bool isNormalFP() const;
+ LLVM_ABI bool isNormalFP() const;
/// Return true if this scalar has an exact multiplicative inverse or this
/// vector has an exact multiplicative inverse for each element in the vector.
- bool hasExactInverseFP() const;
+ LLVM_ABI bool hasExactInverseFP() const;
/// Return true if this is a floating-point NaN constant or a vector
/// floating-point constant with all NaN elements.
- bool isNaN() const;
+ LLVM_ABI bool isNaN() const;
/// Return true if this constant and a constant 'Y' are element-wise equal.
/// This is identical to just comparing the pointers, with the exception that
/// for vectors, if only one of the constants has an `undef` element in some
/// lane, the constants still match.
- bool isElementWiseEqual(Value *Y) const;
+ LLVM_ABI bool isElementWiseEqual(Value *Y) const;
/// Return true if this is a vector constant that includes any undef or
/// poison elements. Since it is impossible to inspect a scalable vector
/// element- wise at compile time, this function returns true only if the
/// entire vector is undef or poison.
- bool containsUndefOrPoisonElement() const;
+ LLVM_ABI bool containsUndefOrPoisonElement() const;
/// Return true if this is a vector constant that includes any poison
/// elements.
- bool containsPoisonElement() const;
+ LLVM_ABI bool containsPoisonElement() const;
/// Return true if this is a vector constant that includes any strictly undef
/// (not poison) elements.
- bool containsUndefElement() const;
+ LLVM_ABI bool containsUndefElement() const;
/// Return true if this is a fixed width vector constant that includes
/// any constant expressions.
- bool containsConstantExpression() const;
+ LLVM_ABI bool containsConstantExpression() const;
/// Return true if the value can vary between threads.
- bool isThreadDependent() const;
+ LLVM_ABI bool isThreadDependent() const;
/// Return true if the value is dependent on a dllimport variable.
- bool isDLLImportDependent() const;
+ LLVM_ABI bool isDLLImportDependent() const;
/// Return true if the constant has users other than constant expressions and
/// other dangling things.
- bool isConstantUsed() const;
+ LLVM_ABI bool isConstantUsed() const;
/// This method classifies the entry according to whether or not it may
/// generate a relocation entry (either static or dynamic). This must be
@@ -136,28 +137,28 @@ class Constant : public User {
/// so.
///
/// FIXME: This really should not be in IR.
- bool needsRelocation() const;
- bool needsDynamicRelocation() const;
+ LLVM_ABI bool needsRelocation() const;
+ LLVM_ABI bool needsDynamicRelocation() const;
/// For aggregates (struct/array/vector) return the constant that corresponds
/// to the specified element if possible, or null if not. This can return null
/// if the element index is a ConstantExpr, if 'this' is a constant expr or
/// if the constant does not fit into an uint64_t.
- Constant *getAggregateElement(unsigned Elt) const;
- Constant *getAggregateElement(Constant *Elt) const;
+ LLVM_ABI Constant *getAggregateElement(unsigned Elt) const;
+ LLVM_ABI Constant *getAggregateElement(Constant *Elt) const;
/// If all elements of the vector constant have the same value, return that
/// value. Otherwise, return nullptr. Ignore poison elements by setting
/// AllowPoison to true.
- Constant *getSplatValue(bool AllowPoison = false) const;
+ LLVM_ABI Constant *getSplatValue(bool AllowPoison = false) const;
/// If C is a constant integer then return its value, otherwise C must be a
/// vector of constant integers, all equal, and the common value is returned.
- const APInt &getUniqueInteger() const;
+ LLVM_ABI const APInt &getUniqueInteger() const;
/// Convert constant to an approximate constant range. For vectors, the
/// range is the union over the element ranges. Poison elements are ignored.
- ConstantRange toConstantRange() const;
+ LLVM_ABI ConstantRange toConstantRange() const;
/// Called if some element of this constant is no longer valid.
/// At this point only other constants may be on the use_list for this
@@ -166,7 +167,7 @@ class Constant : public User {
/// available cached constants. Implementations should implement
/// destroyConstantImpl to remove constants from any pools/maps they are
/// contained it.
- void destroyConstant();
+ LLVM_ABI void destroyConstant();
//// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -184,36 +185,36 @@ class Constant : public User {
/// use Value::replaceAllUsesWith, which automatically dispatches to this
/// method as needed.
///
- void handleOperandChange(Value *, Value *);
+ LLVM_ABI void handleOperandChange(Value *, Value *);
- static Constant *getNullValue(Type* Ty);
+ LLVM_ABI static Constant *getNullValue(Type* Ty);
/// @returns the value for an integer or vector of integer constant of the
/// given type that has all its bits set to true.
/// Get the all ones value
- static Constant *getAllOnesValue(Type* Ty);
+ LLVM_ABI static Constant *getAllOnesValue(Type* Ty);
/// Return the value for an integer or pointer constant, or a vector thereof,
/// with the given scalar value.
- static Constant *getIntegerValue(Type *Ty, const APInt &V);
+ LLVM_ABI static Constant *getIntegerValue(Type *Ty, const APInt &V);
/// If there are any dead constant users dangling off of this constant, remove
/// them. This method is useful for clients that want to check to see if a
/// global is unused, but don't want to deal with potentially dead constants
/// hanging off of the globals.
- void removeDeadConstantUsers() const;
+ LLVM_ABI void removeDeadConstantUsers() const;
/// Return true if the constant has exactly one live use.
///
/// This returns the same result as calling Value::hasOneUse after
/// Constant::removeDeadConstantUsers, but doesn't remove dead constants.
- bool hasOneLiveUse() const;
+ LLVM_ABI bool hasOneLiveUse() const;
/// Return true if the constant has no live uses.
///
/// This returns the same result as calling Value::use_empty after
/// Constant::removeDeadConstantUsers, but doesn't remove dead constants.
- bool hasZeroLiveUses() const;
+ LLVM_ABI bool hasZeroLiveUses() const;
const Constant *stripPointerCasts() const {
return cast<Constant>(Value::stripPointerCasts());
@@ -226,17 +227,17 @@ class Constant : public User {
/// Try to replace undefined constant C or undefined elements in C with
/// Replacement. If no changes are made, the constant C is returned.
- static Constant *replaceUndefsWith(Constant *C, Constant *Replacement);
+ LLVM_ABI static Constant *replaceUndefsWith(Constant *C, Constant *Replacement);
/// Merges undefs of a Constant with another Constant, along with the
/// undefs already present. Other doesn't have to be the same type as C, but
/// both must either be scalars or vectors with the same element count. If no
/// changes are made, the constant C is returned.
- static Constant *mergeUndefsWith(Constant *C, Constant *Other);
+ LLVM_ABI static Constant *mergeUndefsWith(Constant *C, Constant *Other);
/// Return true if a constant is ConstantData or a ConstantAggregate or
/// ConstantExpr that contain only ConstantData.
- bool isManifestConstant() const;
+ LLVM_ABI bool isManifestConstant() const;
private:
enum PossibleRelocationsTy {
diff --git a/llvm/include/llvm/IR/ConstantFPRange.h b/llvm/include/llvm/IR/ConstantFPRange.h
index e240671296479..ef4de41a3025d 100644
--- a/llvm/include/llvm/IR/ConstantFPRange.h
+++ b/llvm/include/llvm/IR/ConstantFPRange.h
@@ -23,6 +23,7 @@
#ifndef LLVM_IR_CONSTANTFPRANGE_H
#define LLVM_IR_CONSTANTFPRANGE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/IR/Instructions.h"
#include <optional>
@@ -52,16 +53,16 @@ class [[nodiscard]] ConstantFPRange {
void makeFull();
/// Initialize a full or empty set for the specified semantics.
- explicit ConstantFPRange(const fltSemantics &Sem, bool IsFullSet);
+ LLVM_ABI explicit ConstantFPRange(const fltSemantics &Sem, bool IsFullSet);
public:
/// Initialize a range to hold the single specified value.
- explicit ConstantFPRange(const APFloat &Value);
+ LLVM_ABI explicit ConstantFPRange(const APFloat &Value);
/// Initialize a range of values explicitly.
/// Note: If \p LowerVal is greater than \p UpperVal, please use the canonical
/// form [Inf, -Inf].
- ConstantFPRange(APFloat LowerVal, APFloat UpperVal, bool MayBeQNaN,
+ LLVM_ABI ConstantFPRange(APFloat LowerVal, APFloat UpperVal, bool MayBeQNaN,
bool MayBeSNaN);
/// Create empty constant range with the given semantics.
@@ -75,10 +76,10 @@ class [[nodiscard]] ConstantFPRange {
}
/// Helper for (-inf, inf) to represent all finite values.
- static ConstantFPRange getFinite(const fltSemantics &Sem);
+ LLVM_ABI static ConstantFPRange getFinite(const fltSemantics &Sem);
/// Helper for [-inf, inf] to represent all non-NaN values.
- static ConstantFPRange getNonNaN(const fltSemantics &Sem);
+ LLVM_ABI static ConstantFPRange getNonNaN(const fltSemantics &Sem);
/// Create a range which doesn't contain NaNs.
static ConstantFPRange getNonNaN(APFloat LowerVal, APFloat UpperVal) {
@@ -93,7 +94,7 @@ class [[nodiscard]] ConstantFPRange {
}
/// Create a range which only contains NaNs.
- static ConstantFPRange getNaNOnly(const fltSemantics &Sem, bool MayBeQNaN,
+ LLVM_ABI static ConstantFPRange getNaNOnly(const fltSemantics &Sem, bool MayBeQNaN,
bool MayBeSNaN);
/// Produce the smallest range such that all values that may satisfy the given
@@ -104,7 +105,7 @@ class [[nodiscard]] ConstantFPRange {
/// a proper superset of the above.
///
/// Example: Pred = ole and Other = float [2, 5] returns Result = [-inf, 5]
- static ConstantFPRange makeAllowedFCmpRegion(FCmpInst::Predicate Pred,
+ LLVM_ABI static ConstantFPRange makeAllowedFCmpRegion(FCmpInst::Predicate Pred,
const ConstantFPRange &Other);
/// Produce the largest range such that all values in the returned range
@@ -115,7 +116,7 @@ class [[nodiscard]] ConstantFPRange {
/// will be a proper subset of the above.
///
/// Example: Pred = ole and Other = float [2, 5] returns [-inf, 2]
- static ConstantFPRange makeSatisfyingFCmpRegion(FCmpInst::Predicate Pred,
+ LLVM_ABI static ConstantFPRange makeSatisfyingFCmpRegion(FCmpInst::Predicate Pred,
const ConstantFPRange &Other);
/// Produce the exact range such that all values in the returned range satisfy
@@ -125,12 +126,12 @@ class [[nodiscard]] ConstantFPRange {
/// Example: Pred = olt and Other = float 3 returns [-inf, 3)
/// If the exact answer is not representable as a ConstantFPRange, returns
/// std::nullopt.
- static std::optional<ConstantFPRange>
+ LLVM_ABI static std::optional<ConstantFPRange>
makeExactFCmpRegion(FCmpInst::Predicate Pred, const APFloat &Other);
/// Does the predicate \p Pred hold between ranges this and \p Other?
/// NOTE: false does not mean that inverse predicate holds!
- bool fcmp(FCmpInst::Predicate Pred, const ConstantFPRange &Other) const;
+ LLVM_ABI bool fcmp(FCmpInst::Predicate Pred, const ConstantFPRange &Other) const;
/// Return the lower value for this range.
const APFloat &getLower() const { return Lower; }
@@ -141,27 +142,27 @@ class [[nodiscard]] ConstantFPRange {
bool containsNaN() const { return MayBeQNaN || MayBeSNaN; }
bool containsQNaN() const { return MayBeQNaN; }
bool containsSNaN() const { return MayBeSNaN; }
- bool isNaNOnly() const;
+ LLVM_ABI bool isNaNOnly() const;
/// Get the semantics of this ConstantFPRange.
const fltSemantics &getSemantics() const { return Lower.getSemantics(); }
/// Return true if this set contains all of the elements possible
/// for this data-type.
- bool isFullSet() const;
+ LLVM_ABI bool isFullSet() const;
/// Return true if this set contains no members.
- bool isEmptySet() const;
+ LLVM_ABI bool isEmptySet() const;
/// Return true if the specified value is in the set.
- bool contains(const APFloat &Val) const;
+ LLVM_ABI bool contains(const APFloat &Val) const;
/// Return true if the other range is a subset of this one.
- bool contains(const ConstantFPRange &CR) const;
+ LLVM_ABI bool contains(const ConstantFPRange &CR) const;
/// If this set contains a single element, return it, otherwise return null.
/// If \p ExcludesNaN is true, return the non-NaN single element.
- const APFloat *getSingleElement(bool ExcludesNaN = false) const;
+ LLVM_ABI const APFloat *getSingleElement(bool ExcludesNaN = false) const;
/// Return true if this set contains exactly one member.
/// If \p ExcludesNaN is true, return true if this set contains exactly one
@@ -173,30 +174,30 @@ class [[nodiscard]] ConstantFPRange {
/// Return true if the sign bit of all values in this range is 1.
/// Return false if the sign bit of all values in this range is 0.
/// Otherwise, return std::nullopt.
- std::optional<bool> getSignBit() const;
+ LLVM_ABI std::optional<bool> getSignBit() const;
/// Return true if this range is equal to another range.
- bool operator==(const ConstantFPRange &CR) const;
+ LLVM_ABI bool operator==(const ConstantFPRange &CR) const;
/// Return true if this range is not equal to another range.
bool operator!=(const ConstantFPRange &CR) const { return !operator==(CR); }
/// Return the FPClassTest which will return true for the value.
- FPClassTest classify() const;
+ LLVM_ABI FPClassTest classify() const;
/// Print out the bounds to a stream.
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
/// Allow printing from a debugger easily.
- void dump() const;
+ LLVM_ABI void dump() const;
/// Return the range that results from the intersection of this range with
/// another range.
- ConstantFPRange intersectWith(const ConstantFPRange &CR) const;
+ LLVM_ABI ConstantFPRange intersectWith(const ConstantFPRange &CR) const;
/// Return the smallest range that results from the union of this range
/// with another range. The resultant range is guaranteed to include the
/// elements of both sets, but may contain more.
- ConstantFPRange unionWith(const ConstantFPRange &CR) const;
+ LLVM_ABI ConstantFPRange unionWith(const ConstantFPRange &CR) const;
};
inline raw_ostream &operator<<(raw_ostream &OS, const ConstantFPRange &CR) {
diff --git a/llvm/include/llvm/IR/ConstantFold.h b/llvm/include/llvm/IR/ConstantFold.h
index 42043d365b2d3..8e29744981474 100644
--- a/llvm/include/llvm/IR/ConstantFold.h
+++ b/llvm/include/llvm/IR/ConstantFold.h
@@ -21,6 +21,7 @@
#ifndef LLVM_IR_CONSTANTFOLD_H
#define LLVM_IR_CONSTANTFOLD_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/InstrTypes.h"
#include <optional>
@@ -31,28 +32,28 @@ namespace llvm {
class Type;
// Constant fold various types of instruction...
- Constant *ConstantFoldCastInstruction(
+ LLVM_ABI Constant *ConstantFoldCastInstruction(
unsigned opcode, ///< The opcode of the cast
Constant *V, ///< The source constant
Type *DestTy ///< The destination type
);
- Constant *ConstantFoldSelectInstruction(Constant *Cond,
+ LLVM_ABI Constant *ConstantFoldSelectInstruction(Constant *Cond,
Constant *V1, Constant *V2);
- Constant *ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx);
- Constant *ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt,
+ LLVM_ABI Constant *ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx);
+ LLVM_ABI Constant *ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt,
Constant *Idx);
- Constant *ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
+ LLVM_ABI Constant *ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
ArrayRef<int> Mask);
- Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
+ LLVM_ABI Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
ArrayRef<unsigned> Idxs);
- Constant *ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val,
+ LLVM_ABI Constant *ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val,
ArrayRef<unsigned> Idxs);
- Constant *ConstantFoldUnaryInstruction(unsigned Opcode, Constant *V);
- Constant *ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1,
+ LLVM_ABI Constant *ConstantFoldUnaryInstruction(unsigned Opcode, Constant *V);
+ LLVM_ABI Constant *ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1,
Constant *V2);
- Constant *ConstantFoldCompareInstruction(CmpInst::Predicate Predicate,
+ LLVM_ABI Constant *ConstantFoldCompareInstruction(CmpInst::Predicate Predicate,
Constant *C1, Constant *C2);
- Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C,
+ LLVM_ABI Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C,
std::optional<ConstantRange> InRange,
ArrayRef<Value *> Idxs);
} // End llvm namespace
diff --git a/llvm/include/llvm/IR/ConstantFolder.h b/llvm/include/llvm/IR/ConstantFolder.h
index a1d9a8faf69e1..51108c07b5c48 100644
--- a/llvm/include/llvm/IR/ConstantFolder.h
+++ b/llvm/include/llvm/IR/ConstantFolder.h
@@ -16,6 +16,7 @@
#ifndef LLVM_IR_CONSTANTFOLDER_H
#define LLVM_IR_CONSTANTFOLDER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/ConstantFold.h"
@@ -27,7 +28,7 @@
namespace llvm {
/// ConstantFolder - Create constants with minimum, target independent, folding.
-class ConstantFolder final : public IRBuilderFolder {
+class LLVM_ABI ConstantFolder final : public IRBuilderFolder {
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
public:
diff --git a/llvm/include/llvm/IR/ConstantRange.h b/llvm/include/llvm/IR/ConstantRange.h
index 3561513212ce2..f46cf2cdfea3e 100644
--- a/llvm/include/llvm/IR/ConstantRange.h
+++ b/llvm/include/llvm/IR/ConstantRange.h
@@ -59,15 +59,15 @@ class [[nodiscard]] ConstantRange {
public:
/// Initialize a full or empty set for the specified bit width.
- explicit ConstantRange(uint32_t BitWidth, bool isFullSet);
+ LLVM_ABI explicit ConstantRange(uint32_t BitWidth, bool isFullSet);
/// Initialize a range to hold the single specified value.
- ConstantRange(APInt Value);
+ LLVM_ABI ConstantRange(APInt Value);
/// Initialize a range of values explicitly. This will assert out if
/// Lower==Upper and Lower != Min or Max value for its type. It will also
/// assert out if the two APInt's are not the same bit width.
- ConstantRange(APInt Lower, APInt Upper);
+ LLVM_ABI ConstantRange(APInt Lower, APInt Upper);
/// Create empty constant range with the given bit width.
static ConstantRange getEmpty(uint32_t BitWidth) {
@@ -90,11 +90,11 @@ class [[nodiscard]] ConstantRange {
/// Initialize a range based on a known bits constraint. The IsSigned flag
/// indicates whether the constant range should not wrap in the signed or
/// unsigned domain.
- static ConstantRange fromKnownBits(const KnownBits &Known, bool IsSigned);
+ LLVM_ABI static ConstantRange fromKnownBits(const KnownBits &Known, bool IsSigned);
/// Split the ConstantRange into positive and negative components, ignoring
/// zero values.
- std::pair<ConstantRange, ConstantRange> splitPosNeg() const;
+ LLVM_ABI std::pair<ConstantRange, ConstantRange> splitPosNeg() const;
/// Produce the smallest range such that all values that may satisfy the given
/// predicate with any value contained within Other is contained in the
@@ -104,7 +104,7 @@ class [[nodiscard]] ConstantRange {
/// proper superset of the above.
///
/// Example: Pred = ult and Other = i8 [2, 5) returns Result = [0, 4)
- static ConstantRange makeAllowedICmpRegion(CmpInst::Predicate Pred,
+ LLVM_ABI static ConstantRange makeAllowedICmpRegion(CmpInst::Predicate Pred,
const ConstantRange &Other);
/// Produce the largest range such that all values in the returned range
@@ -115,7 +115,7 @@ class [[nodiscard]] ConstantRange {
/// will be a proper subset of the above.
///
/// Example: Pred = ult and Other = i8 [2, 5) returns [0, 2)
- static ConstantRange makeSatisfyingICmpRegion(CmpInst::Predicate Pred,
+ LLVM_ABI static ConstantRange makeSatisfyingICmpRegion(CmpInst::Predicate Pred,
const ConstantRange &Other);
/// Produce the exact range such that all values in the returned range satisfy
@@ -125,22 +125,22 @@ class [[nodiscard]] ConstantRange {
/// { x : icmp op x y is true}'.
///
/// Example: Pred = ult and Other = i8 3 returns [0, 3)
- static ConstantRange makeExactICmpRegion(CmpInst::Predicate Pred,
+ LLVM_ABI static ConstantRange makeExactICmpRegion(CmpInst::Predicate Pred,
const APInt &Other);
/// Does the predicate \p Pred hold between ranges this and \p Other?
/// NOTE: false does not mean that inverse predicate holds!
- bool icmp(CmpInst::Predicate Pred, const ConstantRange &Other) const;
+ LLVM_ABI bool icmp(CmpInst::Predicate Pred, const ConstantRange &Other) const;
/// Return true iff CR1 ult CR2 is equivalent to CR1 slt CR2.
/// Does not depend on strictness/direction of the predicate.
- static bool
+ LLVM_ABI static bool
areInsensitiveToSignednessOfICmpPredicate(const ConstantRange &CR1,
const ConstantRange &CR2);
/// Return true iff CR1 ult CR2 is equivalent to CR1 sge CR2.
/// Does not depend on strictness/direction of the predicate.
- static bool
+ LLVM_ABI static bool
areInsensitiveToSignednessOfInvertedICmpPredicate(const ConstantRange &CR1,
const ConstantRange &CR2);
@@ -149,7 +149,7 @@ class [[nodiscard]] ConstantRange {
/// return a predicate equivalent to \p Pred, with flipped signedness
/// (i.e. unsigned instead of signed or vice versa), and maybe inverted,
/// otherwise returns CmpInst::Predicate::BAD_ICMP_PREDICATE.
- static CmpInst::Predicate
+ LLVM_ABI static CmpInst::Predicate
getEquivalentPredWithFlippedSignedness(CmpInst::Predicate Pred,
const ConstantRange &CR1,
const ConstantRange &CR2);
@@ -170,37 +170,37 @@ class [[nodiscard]] ConstantRange {
/// MGNR(Add, [i8 -1, 6), OBO::NoSignedWrap) == [INT_MIN+1, INT_MAX-4)
/// MGNR(Sub, [i8 1, 2), OBO::NoSignedWrap) == [-127, 128)
/// MGNR(Sub, [i8 1, 2), OBO::NoUnsignedWrap) == [1, 0)
- static ConstantRange makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
+ LLVM_ABI static ConstantRange makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
const ConstantRange &Other,
unsigned NoWrapKind);
/// Produce the range that contains X if and only if "X BinOp Other" does
/// not wrap.
- static ConstantRange makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
+ LLVM_ABI static ConstantRange makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
const APInt &Other,
unsigned NoWrapKind);
/// Initialize a range containing all values X that satisfy `(X & Mask)
/// != C`. Note that the range returned may contain values where `(X & Mask)
/// == C` holds, making it less precise, but still conservative.
- static ConstantRange makeMaskNotEqualRange(const APInt &Mask, const APInt &C);
+ LLVM_ABI static ConstantRange makeMaskNotEqualRange(const APInt &Mask, const APInt &C);
/// Returns true if ConstantRange calculations are supported for intrinsic
/// with \p IntrinsicID.
- static bool isIntrinsicSupported(Intrinsic::ID IntrinsicID);
+ LLVM_ABI static bool isIntrinsicSupported(Intrinsic::ID IntrinsicID);
/// Compute range of intrinsic result for the given operand ranges.
- static ConstantRange intrinsic(Intrinsic::ID IntrinsicID,
+ LLVM_ABI static ConstantRange intrinsic(Intrinsic::ID IntrinsicID,
ArrayRef<ConstantRange> Ops);
/// Set up \p Pred and \p RHS such that
/// ConstantRange::makeExactICmpRegion(Pred, RHS) == *this. Return true if
/// successful.
- bool getEquivalentICmp(CmpInst::Predicate &Pred, APInt &RHS) const;
+ LLVM_ABI bool getEquivalentICmp(CmpInst::Predicate &Pred, APInt &RHS) const;
/// Set up \p Pred, \p RHS and \p Offset such that (V + Offset) Pred RHS
/// is true iff V is in the range. Prefers using Offset == 0 if possible.
- void
+ LLVM_ABI void
getEquivalentICmp(CmpInst::Predicate &Pred, APInt &RHS, APInt &Offset) const;
/// Return the lower value for this range.
@@ -214,42 +214,42 @@ class [[nodiscard]] ConstantRange {
/// Return true if this set contains all of the elements possible
/// for this data-type.
- bool isFullSet() const;
+ LLVM_ABI bool isFullSet() const;
/// Return true if this set contains no members.
- bool isEmptySet() const;
+ LLVM_ABI bool isEmptySet() const;
/// Return true if this set wraps around the unsigned domain. Special cases:
/// * Empty set: Not wrapped.
/// * Full set: Not wrapped.
/// * [X, 0) == [X, Max]: Not wrapped.
- bool isWrappedSet() const;
+ LLVM_ABI bool isWrappedSet() const;
/// Return true if the exclusive upper bound wraps around the unsigned
/// domain. Special cases:
/// * Empty set: Not wrapped.
/// * Full set: Not wrapped.
/// * [X, 0): Wrapped.
- bool isUpperWrapped() const;
+ LLVM_ABI bool isUpperWrapped() const;
/// Return true if this set wraps around the signed domain. Special cases:
/// * Empty set: Not wrapped.
/// * Full set: Not wrapped.
/// * [X, SignedMin) == [X, SignedMax]: Not wrapped.
- bool isSignWrappedSet() const;
+ LLVM_ABI bool isSignWrappedSet() const;
/// Return true if the (exclusive) upper bound wraps around the signed
/// domain. Special cases:
/// * Empty set: Not wrapped.
/// * Full set: Not wrapped.
/// * [X, SignedMin): Wrapped.
- bool isUpperSignWrapped() const;
+ LLVM_ABI bool isUpperSignWrapped() const;
/// Return true if the specified value is in the set.
- bool contains(const APInt &Val) const;
+ LLVM_ABI bool contains(const APInt &Val) const;
/// Return true if the other range is a subset of this one.
- bool contains(const ConstantRange &CR) const;
+ LLVM_ABI bool contains(const ConstantRange &CR) const;
/// If this set contains a single element, return it, otherwise return null.
const APInt *getSingleElement() const {
@@ -270,31 +270,31 @@ class [[nodiscard]] ConstantRange {
bool isSingleElement() const { return getSingleElement() != nullptr; }
/// Compare set size of this range with the range CR.
- bool isSizeStrictlySmallerThan(const ConstantRange &CR) const;
+ LLVM_ABI bool isSizeStrictlySmallerThan(const ConstantRange &CR) const;
/// Compare set size of this range with Value.
- bool isSizeLargerThan(uint64_t MaxSize) const;
+ LLVM_ABI bool isSizeLargerThan(uint64_t MaxSize) const;
/// Return true if all values in this range are negative.
- bool isAllNegative() const;
+ LLVM_ABI bool isAllNegative() const;
/// Return true if all values in this range are non-negative.
- bool isAllNonNegative() const;
+ LLVM_ABI bool isAllNonNegative() const;
/// Return true if all values in this range are positive.
- bool isAllPositive() const;
+ LLVM_ABI bool isAllPositive() const;
/// Return the largest unsigned value contained in the ConstantRange.
- APInt getUnsignedMax() const;
+ LLVM_ABI APInt getUnsignedMax() const;
/// Return the smallest unsigned value contained in the ConstantRange.
- APInt getUnsignedMin() const;
+ LLVM_ABI APInt getUnsignedMin() const;
/// Return the largest signed value contained in the ConstantRange.
- APInt getSignedMax() const;
+ LLVM_ABI APInt getSignedMax() const;
/// Return the smallest signed value contained in the ConstantRange.
- APInt getSignedMin() const;
+ LLVM_ABI APInt getSignedMin() const;
/// Return true if this range is equal to another range.
bool operator==(const ConstantRange &CR) const {
@@ -306,18 +306,18 @@ class [[nodiscard]] ConstantRange {
/// Compute the maximal number of active bits needed to represent every value
/// in this range.
- unsigned getActiveBits() const;
+ LLVM_ABI unsigned getActiveBits() const;
/// Compute the maximal number of bits needed to represent every value
/// in this signed range.
- unsigned getMinSignedBits() const;
+ LLVM_ABI unsigned getMinSignedBits() const;
/// Subtract the specified constant from the endpoints of this constant range.
- ConstantRange subtract(const APInt &CI) const;
+ LLVM_ABI ConstantRange subtract(const APInt &CI) const;
/// Subtract the specified range from this range (aka relative complement of
/// the sets).
- ConstantRange difference(const ConstantRange &CR) const;
+ LLVM_ABI ConstantRange difference(const ConstantRange &CR) const;
/// If represented precisely, the result of some range operations may consist
/// of multiple disjoint ranges. As only a single range may be returned, any
@@ -333,7 +333,7 @@ class [[nodiscard]] ConstantRange {
/// Return the range that results from the intersection of this range with
/// another range. If the intersection is disjoint, such that two results
/// are possible, the preferred range is determined by the PreferredRangeType.
- ConstantRange intersectWith(const ConstantRange &CR,
+ LLVM_ABI ConstantRange intersectWith(const ConstantRange &CR,
PreferredRangeType Type = Smallest) const;
/// Return the range that results from the union of this range
@@ -341,17 +341,17 @@ class [[nodiscard]] ConstantRange {
/// elements of both sets, but may contain more. For example, [3, 9) union
/// [12,15) is [3, 15), which includes 9, 10, and 11, which were not included
/// in either set before.
- ConstantRange unionWith(const ConstantRange &CR,
+ LLVM_ABI ConstantRange unionWith(const ConstantRange &CR,
PreferredRangeType Type = Smallest) const;
/// Intersect the two ranges and return the result if it can be represented
/// exactly, otherwise return std::nullopt.
- std::optional<ConstantRange>
+ LLVM_ABI std::optional<ConstantRange>
exactIntersectWith(const ConstantRange &CR) const;
/// Union the two ranges and return the result if it can be represented
/// exactly, otherwise return std::nullopt.
- std::optional<ConstantRange> exactUnionWith(const ConstantRange &CR) const;
+ LLVM_ABI std::optional<ConstantRange> exactUnionWith(const ConstantRange &CR) const;
/// Return a new range representing the possible values resulting
/// from an application of the specified cast operator to this range. \p
@@ -359,212 +359,212 @@ class [[nodiscard]] ConstantRange {
/// change bitwidth, it must be the same as the source bitwidth. For casts
/// which do change bitwidth, the bitwidth must be consistent with the
/// requested cast and source bitwidth.
- ConstantRange castOp(Instruction::CastOps CastOp,
+ LLVM_ABI ConstantRange castOp(Instruction::CastOps CastOp,
uint32_t BitWidth) const;
/// Return a new range in the specified integer type, which must
/// be strictly larger than the current type. The returned range will
/// correspond to the possible range of values if the source range had been
/// zero extended to BitWidth.
- ConstantRange zeroExtend(uint32_t BitWidth) const;
+ LLVM_ABI ConstantRange zeroExtend(uint32_t BitWidth) const;
/// Return a new range in the specified integer type, which must
/// be strictly larger than the current type. The returned range will
/// correspond to the possible range of values if the source range had been
/// sign extended to BitWidth.
- ConstantRange signExtend(uint32_t BitWidth) const;
+ LLVM_ABI ConstantRange signExtend(uint32_t BitWidth) const;
/// Return a new range in the specified integer type, which must be
/// strictly smaller than the current type. The returned range will
/// correspond to the possible range of values if the source range had been
/// truncated to the specified type.
- ConstantRange truncate(uint32_t BitWidth) const;
+ LLVM_ABI ConstantRange truncate(uint32_t BitWidth) const;
/// Make this range have the bit width given by \p BitWidth. The
/// value is zero extended, truncated, or left alone to make it that width.
- ConstantRange zextOrTrunc(uint32_t BitWidth) const;
+ LLVM_ABI ConstantRange zextOrTrunc(uint32_t BitWidth) const;
/// Make this range have the bit width given by \p BitWidth. The
/// value is sign extended, truncated, or left alone to make it that width.
- ConstantRange sextOrTrunc(uint32_t BitWidth) const;
+ LLVM_ABI ConstantRange sextOrTrunc(uint32_t BitWidth) const;
/// Return a new range representing the possible values resulting
/// from an application of the specified binary operator to an left hand side
/// of this range and a right hand side of \p Other.
- ConstantRange binaryOp(Instruction::BinaryOps BinOp,
+ LLVM_ABI ConstantRange binaryOp(Instruction::BinaryOps BinOp,
const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an application of the specified overflowing binary operator to a
/// left hand side of this range and a right hand side of \p Other given
/// the provided knowledge about lack of wrapping \p NoWrapKind.
- ConstantRange overflowingBinaryOp(Instruction::BinaryOps BinOp,
+ LLVM_ABI ConstantRange overflowingBinaryOp(Instruction::BinaryOps BinOp,
const ConstantRange &Other,
unsigned NoWrapKind) const;
/// Return a new range representing the possible values resulting
/// from an addition of a value in this range and a value in \p Other.
- ConstantRange add(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange add(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an addition with wrap type \p NoWrapKind of a value in this
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- ConstantRange addWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
+ LLVM_ABI ConstantRange addWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
PreferredRangeType RangeType = Smallest) const;
/// Return a new range representing the possible values resulting
/// from a subtraction of a value in this range and a value in \p Other.
- ConstantRange sub(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange sub(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an subtraction with wrap type \p NoWrapKind of a value in this
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- ConstantRange subWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
+ LLVM_ABI ConstantRange subWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
PreferredRangeType RangeType = Smallest) const;
/// Return a new range representing the possible values resulting
/// from a multiplication of a value in this range and a value in \p Other,
/// treating both this and \p Other as unsigned ranges.
- ConstantRange multiply(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange multiply(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a multiplication with wrap type \p NoWrapKind of a value in this
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- ConstantRange
+ LLVM_ABI ConstantRange
multiplyWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
PreferredRangeType RangeType = Smallest) const;
/// Return range of possible values for a signed multiplication of this and
/// \p Other. However, if overflow is possible always return a full range
/// rather than trying to determine a more precise result.
- ConstantRange smul_fast(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange smul_fast(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a signed maximum of a value in this range and a value in \p Other.
- ConstantRange smax(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange smax(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an unsigned maximum of a value in this range and a value in \p Other.
- ConstantRange umax(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange umax(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a signed minimum of a value in this range and a value in \p Other.
- ConstantRange smin(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange smin(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an unsigned minimum of a value in this range and a value in \p Other.
- ConstantRange umin(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange umin(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an unsigned division of a value in this range and a value in
/// \p Other.
- ConstantRange udiv(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange udiv(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a signed division of a value in this range and a value in
/// \p Other. Division by zero and division of SignedMin by -1 are considered
/// undefined behavior, in line with IR, and do not contribute towards the
/// result.
- ConstantRange sdiv(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange sdiv(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an unsigned remainder operation of a value in this range and a
/// value in \p Other.
- ConstantRange urem(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange urem(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a signed remainder operation of a value in this range and a
/// value in \p Other.
- ConstantRange srem(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange srem(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting from
/// a binary-xor of a value in this range by an all-one value,
/// aka bitwise complement operation.
- ConstantRange binaryNot() const;
+ LLVM_ABI ConstantRange binaryNot() const;
/// Return a new range representing the possible values resulting
/// from a binary-and of a value in this range by a value in \p Other.
- ConstantRange binaryAnd(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange binaryAnd(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a binary-or of a value in this range by a value in \p Other.
- ConstantRange binaryOr(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange binaryOr(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a binary-xor of a value in this range by a value in \p Other.
- ConstantRange binaryXor(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange binaryXor(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a left shift of a value in this range by a value in \p Other.
/// TODO: This isn't fully implemented yet.
- ConstantRange shl(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange shl(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from a left shift with wrap type \p NoWrapKind of a value in this
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- ConstantRange shlWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
+ LLVM_ABI ConstantRange shlWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
PreferredRangeType RangeType = Smallest) const;
/// Return a new range representing the possible values resulting from a
/// logical right shift of a value in this range and a value in \p Other.
- ConstantRange lshr(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange lshr(const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting from a
/// arithmetic right shift of a value in this range and a value in \p Other.
- ConstantRange ashr(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange ashr(const ConstantRange &Other) const;
/// Perform an unsigned saturating addition of two constant ranges.
- ConstantRange uadd_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange uadd_sat(const ConstantRange &Other) const;
/// Perform a signed saturating addition of two constant ranges.
- ConstantRange sadd_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange sadd_sat(const ConstantRange &Other) const;
/// Perform an unsigned saturating subtraction of two constant ranges.
- ConstantRange usub_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange usub_sat(const ConstantRange &Other) const;
/// Perform a signed saturating subtraction of two constant ranges.
- ConstantRange ssub_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange ssub_sat(const ConstantRange &Other) const;
/// Perform an unsigned saturating multiplication of two constant ranges.
- ConstantRange umul_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange umul_sat(const ConstantRange &Other) const;
/// Perform a signed saturating multiplication of two constant ranges.
- ConstantRange smul_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange smul_sat(const ConstantRange &Other) const;
/// Perform an unsigned saturating left shift of this constant range by a
/// value in \p Other.
- ConstantRange ushl_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange ushl_sat(const ConstantRange &Other) const;
/// Perform a signed saturating left shift of this constant range by a
/// value in \p Other.
- ConstantRange sshl_sat(const ConstantRange &Other) const;
+ LLVM_ABI ConstantRange sshl_sat(const ConstantRange &Other) const;
/// Return a new range that is the logical not of the current set.
- ConstantRange inverse() const;
+ LLVM_ABI ConstantRange inverse() const;
/// Calculate absolute value range. If the original range contains signed
/// min, then the resulting range will contain signed min if and only if
/// \p IntMinIsPoison is false.
- ConstantRange abs(bool IntMinIsPoison = false) const;
+ LLVM_ABI ConstantRange abs(bool IntMinIsPoison = false) const;
/// Calculate ctlz range. If \p ZeroIsPoison is set, the range is computed
/// ignoring a possible zero value contained in the input range.
- ConstantRange ctlz(bool ZeroIsPoison = false) const;
+ LLVM_ABI ConstantRange ctlz(bool ZeroIsPoison = false) const;
/// Calculate cttz range. If \p ZeroIsPoison is set, the range is computed
/// ignoring a possible zero value contained in the input range.
- ConstantRange cttz(bool ZeroIsPoison = false) const;
+ LLVM_ABI ConstantRange cttz(bool ZeroIsPoison = false) const;
/// Calculate ctpop range.
- ConstantRange ctpop() const;
+ LLVM_ABI ConstantRange ctpop() const;
/// Represents whether an operation on the given constant range is known to
/// always or never overflow.
@@ -580,28 +580,28 @@ class [[nodiscard]] ConstantRange {
};
/// Return whether unsigned add of the two ranges always/never overflows.
- OverflowResult unsignedAddMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult unsignedAddMayOverflow(const ConstantRange &Other) const;
/// Return whether signed add of the two ranges always/never overflows.
- OverflowResult signedAddMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult signedAddMayOverflow(const ConstantRange &Other) const;
/// Return whether unsigned sub of the two ranges always/never overflows.
- OverflowResult unsignedSubMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult unsignedSubMayOverflow(const ConstantRange &Other) const;
/// Return whether signed sub of the two ranges always/never overflows.
- OverflowResult signedSubMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult signedSubMayOverflow(const ConstantRange &Other) const;
/// Return whether unsigned mul of the two ranges always/never overflows.
- OverflowResult unsignedMulMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult unsignedMulMayOverflow(const ConstantRange &Other) const;
/// Return known bits for values in this range.
- KnownBits toKnownBits() const;
+ LLVM_ABI KnownBits toKnownBits() const;
/// Print out the bounds to a stream.
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
/// Allow printing from a debugger easily.
- void dump() const;
+ LLVM_ABI void dump() const;
};
inline raw_ostream &operator<<(raw_ostream &OS, const ConstantRange &CR) {
@@ -612,7 +612,7 @@ inline raw_ostream &operator<<(raw_ostream &OS, const ConstantRange &CR) {
/// Parse out a conservative ConstantRange from !range metadata.
///
/// E.g. if RangeMD is !{i32 0, i32 10, i32 15, i32 20} then return [0, 20).
-ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD);
+LLVM_ABI ConstantRange getConstantRangeFromMetadata(const MDNode &RangeMD);
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/ConstantRangeList.h b/llvm/include/llvm/IR/ConstantRangeList.h
index b12c913103df5..2a02c19077b94 100644
--- a/llvm/include/llvm/IR/ConstantRangeList.h
+++ b/llvm/include/llvm/IR/ConstantRangeList.h
@@ -16,6 +16,7 @@
#ifndef LLVM_IR_CONSTANTRANGELIST_H
#define LLVM_IR_CONSTANTRANGELIST_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APInt.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/Support/Debug.h"
@@ -41,8 +42,8 @@ class [[nodiscard]] ConstantRangeList {
}
// Return true if the ranges are non-overlapping and increasing.
- static bool isOrderedRanges(ArrayRef<ConstantRange> RangesRef);
- static std::optional<ConstantRangeList>
+ LLVM_ABI static bool isOrderedRanges(ArrayRef<ConstantRange> RangesRef);
+ LLVM_ABI static std::optional<ConstantRangeList>
getConstantRangeList(ArrayRef<ConstantRange> RangesRef);
ArrayRef<ConstantRange> rangesRef() const { return Ranges; }
@@ -67,21 +68,21 @@ class [[nodiscard]] ConstantRangeList {
size_t size() const { return Ranges.size(); }
/// Insert a new range to Ranges and keep the list ordered.
- void insert(const ConstantRange &NewRange);
+ LLVM_ABI void insert(const ConstantRange &NewRange);
void insert(int64_t Lower, int64_t Upper) {
insert(ConstantRange(APInt(64, Lower, /*isSigned=*/true),
APInt(64, Upper, /*isSigned=*/true)));
}
- void subtract(const ConstantRange &SubRange);
+ LLVM_ABI void subtract(const ConstantRange &SubRange);
/// Return the range list that results from the union of this
/// ConstantRangeList with another ConstantRangeList, "CRL".
- ConstantRangeList unionWith(const ConstantRangeList &CRL) const;
+ LLVM_ABI ConstantRangeList unionWith(const ConstantRangeList &CRL) const;
/// Return the range list that results from the intersection of this
/// ConstantRangeList with another ConstantRangeList, "CRL".
- ConstantRangeList intersectWith(const ConstantRangeList &CRL) const;
+ LLVM_ABI ConstantRangeList intersectWith(const ConstantRangeList &CRL) const;
/// Return true if this range list is equal to another range list.
bool operator==(const ConstantRangeList &CRL) const {
@@ -92,7 +93,7 @@ class [[nodiscard]] ConstantRangeList {
}
/// Print out the ranges to a stream.
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void dump() const;
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index 6a01e8209071d..642469047c41d 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -103,16 +103,16 @@ class ConstantInt final : public ConstantData {
public:
ConstantInt(const ConstantInt &) = delete;
- static ConstantInt *getTrue(LLVMContext &Context);
- static ConstantInt *getFalse(LLVMContext &Context);
- static ConstantInt *getBool(LLVMContext &Context, bool V);
- static Constant *getTrue(Type *Ty);
- static Constant *getFalse(Type *Ty);
- static Constant *getBool(Type *Ty, bool V);
+ LLVM_ABI static ConstantInt *getTrue(LLVMContext &Context);
+ LLVM_ABI static ConstantInt *getFalse(LLVMContext &Context);
+ LLVM_ABI static ConstantInt *getBool(LLVMContext &Context, bool V);
+ LLVM_ABI static Constant *getTrue(Type *Ty);
+ LLVM_ABI static Constant *getFalse(Type *Ty);
+ LLVM_ABI static Constant *getBool(Type *Ty, bool V);
/// If Ty is a vector type, return a Constant with a splat of the given
/// value. Otherwise return a ConstantInt for the given value.
- static Constant *get(Type *Ty, uint64_t V, bool IsSigned = false);
+ LLVM_ABI static Constant *get(Type *Ty, uint64_t V, bool IsSigned = false);
/// Return a ConstantInt with the specified integer value for the specified
/// type. If the type is wider than 64 bits, the value will be zero-extended
@@ -120,7 +120,7 @@ class ConstantInt final : public ConstantData {
/// be interpreted as a 64-bit signed integer and sign-extended to fit
/// the type.
/// Get a ConstantInt for a specific value.
- static ConstantInt *get(IntegerType *Ty, uint64_t V, bool IsSigned = false);
+ LLVM_ABI static ConstantInt *get(IntegerType *Ty, uint64_t V, bool IsSigned = false);
/// Return a ConstantInt with the specified value for the specified type. The
/// value V will be canonicalized to a an unsigned APInt. Accessing it with
@@ -136,15 +136,15 @@ class ConstantInt final : public ConstantData {
/// Return a ConstantInt with the specified value and an implied Type. The
/// type is the integer type that corresponds to the bit width of the value.
- static ConstantInt *get(LLVMContext &Context, const APInt &V);
+ LLVM_ABI static ConstantInt *get(LLVMContext &Context, const APInt &V);
/// Return a ConstantInt constructed from the string strStart with the given
/// radix.
- static ConstantInt *get(IntegerType *Ty, StringRef Str, uint8_t Radix);
+ LLVM_ABI static ConstantInt *get(IntegerType *Ty, StringRef Str, uint8_t Radix);
/// If Ty is a vector type, return a Constant with a splat of the given
/// value. Otherwise return a ConstantInt for the given value.
- static Constant *get(Type *Ty, const APInt &V);
+ LLVM_ABI static Constant *get(Type *Ty, const APInt &V);
/// Return the constant as an APInt value reference. This allows clients to
/// obtain a full-precision copy of the value.
@@ -201,8 +201,8 @@ class ConstantInt final : public ConstantData {
/// to the appropriate unsigned type before calling the method.
/// @returns true if V is a valid value for type Ty
/// Determine if the value is in range for the given type.
- static bool isValueValidForType(Type *Ty, uint64_t V);
- static bool isValueValidForType(Type *Ty, int64_t V);
+ LLVM_ABI static bool isValueValidForType(Type *Ty, uint64_t V);
+ LLVM_ABI static bool isValueValidForType(Type *Ty, int64_t V);
bool isNegative() const { return Val.isNegative(); }
@@ -295,26 +295,26 @@ class ConstantFP final : public ConstantData {
/// for the specified value in the specified type. This should only be used
/// for simple constant values like 2.0/1.0 etc, that are known-valid both as
/// host double and as the target format.
- static Constant *get(Type *Ty, double V);
+ LLVM_ABI static Constant *get(Type *Ty, double V);
/// If Ty is a vector type, return a Constant with a splat of the given
/// value. Otherwise return a ConstantFP for the given value.
- static Constant *get(Type *Ty, const APFloat &V);
+ LLVM_ABI static Constant *get(Type *Ty, const APFloat &V);
- static Constant *get(Type *Ty, StringRef Str);
- static ConstantFP *get(LLVMContext &Context, const APFloat &V);
- static Constant *getNaN(Type *Ty, bool Negative = false,
+ LLVM_ABI static Constant *get(Type *Ty, StringRef Str);
+ LLVM_ABI static ConstantFP *get(LLVMContext &Context, const APFloat &V);
+ LLVM_ABI static Constant *getNaN(Type *Ty, bool Negative = false,
uint64_t Payload = 0);
- static Constant *getQNaN(Type *Ty, bool Negative = false,
+ LLVM_ABI static Constant *getQNaN(Type *Ty, bool Negative = false,
APInt *Payload = nullptr);
- static Constant *getSNaN(Type *Ty, bool Negative = false,
+ LLVM_ABI static Constant *getSNaN(Type *Ty, bool Negative = false,
APInt *Payload = nullptr);
- static Constant *getZero(Type *Ty, bool Negative = false);
+ LLVM_ABI static Constant *getZero(Type *Ty, bool Negative = false);
static Constant *getNegativeZero(Type *Ty) { return getZero(Ty, true); }
- static Constant *getInfinity(Type *Ty, bool Negative = false);
+ LLVM_ABI static Constant *getInfinity(Type *Ty, bool Negative = false);
/// Return true if Ty is big enough to represent V.
- static bool isValueValidForType(Type *Ty, const APFloat &V);
+ LLVM_ABI static bool isValueValidForType(Type *Ty, const APFloat &V);
inline const APFloat &getValueAPF() const { return Val; }
inline const APFloat &getValue() const { return Val; }
@@ -336,7 +336,7 @@ class ConstantFP final : public ConstantData {
/// two floating point values. The version with a double operand is retained
/// because it's so convenient to write isExactlyValue(2.0), but please use
/// it only for simple constants.
- bool isExactlyValue(const APFloat &V) const;
+ LLVM_ABI bool isExactlyValue(const APFloat &V) const;
bool isExactlyValue(double V) const {
bool ignored;
@@ -365,25 +365,25 @@ class ConstantAggregateZero final : public ConstantData {
public:
ConstantAggregateZero(const ConstantAggregateZero &) = delete;
- static ConstantAggregateZero *get(Type *Ty);
+ LLVM_ABI static ConstantAggregateZero *get(Type *Ty);
/// If this CAZ has array or vector type, return a zero with the right element
/// type.
- Constant *getSequentialElement() const;
+ LLVM_ABI Constant *getSequentialElement() const;
/// If this CAZ has struct type, return a zero with the right element type for
/// the specified element.
- Constant *getStructElement(unsigned Elt) const;
+ LLVM_ABI Constant *getStructElement(unsigned Elt) const;
/// Return a zero of the right value for the specified GEP index if we can,
/// otherwise return null (e.g. if C is a ConstantExpr).
- Constant *getElementValue(Constant *C) const;
+ LLVM_ABI Constant *getElementValue(Constant *C) const;
/// Return a zero of the right value for the specified GEP index.
- Constant *getElementValue(unsigned Idx) const;
+ LLVM_ABI Constant *getElementValue(unsigned Idx) const;
/// Return the number of elements in the array, vector, or struct.
- ElementCount getElementCount() const;
+ LLVM_ABI ElementCount getElementCount() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
///
@@ -405,7 +405,7 @@ class ConstantAggregateZero final : public ConstantData {
/// use operands.
class ConstantAggregate : public Constant {
protected:
- ConstantAggregate(Type *T, ValueTy VT, ArrayRef<Constant *> V,
+ LLVM_ABI ConstantAggregate(Type *T, ValueTy VT, ArrayRef<Constant *> V,
AllocInfo AllocInfo);
public:
@@ -439,7 +439,7 @@ class ConstantArray final : public ConstantAggregate {
public:
// ConstantArray accessors
- static Constant *get(ArrayType *T, ArrayRef<Constant *> V);
+ LLVM_ABI static Constant *get(ArrayType *T, ArrayRef<Constant *> V);
private:
static Constant *getImpl(ArrayType *T, ArrayRef<Constant *> V);
@@ -471,7 +471,7 @@ class ConstantStruct final : public ConstantAggregate {
public:
// ConstantStruct accessors
- static Constant *get(StructType *T, ArrayRef<Constant *> V);
+ LLVM_ABI static Constant *get(StructType *T, ArrayRef<Constant *> V);
template <typename... Csts>
static std::enable_if_t<are_base_of<Constant, Csts...>::value, Constant *>
@@ -491,10 +491,10 @@ class ConstantStruct final : public ConstantAggregate {
/// Return an anonymous struct type to use for a constant with the specified
/// set of elements. The list must not be empty.
- static StructType *getTypeForElements(ArrayRef<Constant *> V,
+ LLVM_ABI static StructType *getTypeForElements(ArrayRef<Constant *> V,
bool Packed = false);
/// This version of the method allows an empty list.
- static StructType *getTypeForElements(LLVMContext &Ctx,
+ LLVM_ABI static StructType *getTypeForElements(LLVMContext &Ctx,
ArrayRef<Constant *> V,
bool Packed = false);
@@ -523,7 +523,7 @@ class ConstantVector final : public ConstantAggregate {
public:
// ConstantVector accessors
- static Constant *get(ArrayRef<Constant *> V);
+ LLVM_ABI static Constant *get(ArrayRef<Constant *> V);
private:
static Constant *getImpl(ArrayRef<Constant *> V);
@@ -531,7 +531,7 @@ class ConstantVector final : public ConstantAggregate {
public:
/// Return a ConstantVector with the specified constant in each element.
/// Note that this might not return an instance of ConstantVector
- static Constant *getSplat(ElementCount EC, Constant *Elt);
+ LLVM_ABI static Constant *getSplat(ElementCount EC, Constant *Elt);
/// Specialize the getType() method to always return a FixedVectorType,
/// which reduces the amount of casting needed in parts of the compiler.
@@ -542,7 +542,7 @@ class ConstantVector final : public ConstantAggregate {
/// If all elements of the vector constant have the same value, return that
/// value. Otherwise, return nullptr. Ignore poison elements by setting
/// AllowPoison to true.
- Constant *getSplatValue(bool AllowPoison = false) const;
+ LLVM_ABI Constant *getSplatValue(bool AllowPoison = false) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -565,7 +565,7 @@ class ConstantPointerNull final : public ConstantData {
ConstantPointerNull(const ConstantPointerNull &) = delete;
/// Static factory methods - Return objects of the specified value
- static ConstantPointerNull *get(PointerType *T);
+ LLVM_ABI static ConstantPointerNull *get(PointerType *T);
/// Specialize the getType() method to always return an PointerType,
/// which reduces the amount of casting needed in parts of the compiler.
@@ -608,7 +608,7 @@ class ConstantDataSequential : public ConstantData {
explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
: ConstantData(ty, VT), DataElements(Data) {}
- static Constant *getImpl(StringRef Bytes, Type *Ty);
+ LLVM_ABI static Constant *getImpl(StringRef Bytes, Type *Ty);
public:
ConstantDataSequential(const ConstantDataSequential &) = delete;
@@ -617,49 +617,49 @@ class ConstantDataSequential : public ConstantData {
/// array of the specified element type.
/// ConstantDataArray only works with normal float and int types that are
/// stored densely in memory, not with things like i42 or x86_f80.
- static bool isElementTypeCompatible(Type *Ty);
+ LLVM_ABI static bool isElementTypeCompatible(Type *Ty);
/// If this is a sequential container of integers (of any size), return the
/// specified element in the low bits of a uint64_t.
- uint64_t getElementAsInteger(uint64_t i) const;
+ LLVM_ABI uint64_t getElementAsInteger(uint64_t i) const;
/// If this is a sequential container of integers (of any size), return the
/// specified element as an APInt.
- APInt getElementAsAPInt(uint64_t i) const;
+ LLVM_ABI APInt getElementAsAPInt(uint64_t i) const;
/// If this is a sequential container of floating point type, return the
/// specified element as an APFloat.
- APFloat getElementAsAPFloat(uint64_t i) const;
+ LLVM_ABI APFloat getElementAsAPFloat(uint64_t i) const;
/// If this is an sequential container of floats, return the specified element
/// as a float.
- float getElementAsFloat(uint64_t i) const;
+ LLVM_ABI float getElementAsFloat(uint64_t i) const;
/// If this is an sequential container of doubles, return the specified
/// element as a double.
- double getElementAsDouble(uint64_t i) const;
+ LLVM_ABI double getElementAsDouble(uint64_t i) const;
/// Return a Constant for a specified index's element.
/// Note that this has to compute a new constant to return, so it isn't as
/// efficient as getElementAsInteger/Float/Double.
- Constant *getElementAsConstant(uint64_t i) const;
+ LLVM_ABI Constant *getElementAsConstant(uint64_t i) const;
/// Return the element type of the array/vector.
- Type *getElementType() const;
+ LLVM_ABI Type *getElementType() const;
/// Return the number of elements in the array or vector.
- uint64_t getNumElements() const;
+ LLVM_ABI uint64_t getNumElements() const;
/// Return the size (in bytes) of each element in the array/vector.
/// The size of the elements is known to be a multiple of one byte.
- uint64_t getElementByteSize() const;
+ LLVM_ABI uint64_t getElementByteSize() const;
/// This method returns true if this is an array of \p CharSize integers.
- bool isString(unsigned CharSize = 8) const;
+ LLVM_ABI bool isString(unsigned CharSize = 8) const;
/// This method returns true if the array "isString", ends with a null byte,
/// and does not contains any other null bytes.
- bool isCString() const;
+ LLVM_ABI bool isCString() const;
/// If this array is isString(), then this method returns the array as a
/// StringRef. Otherwise, it asserts out.
@@ -679,7 +679,7 @@ class ConstantDataSequential : public ConstantData {
/// Return the raw, underlying, bytes of this data. Note that this is an
/// extremely tricky thing to work with, as it exposes the host endianness of
/// the data elements.
- StringRef getRawDataValues() const;
+ LLVM_ABI StringRef getRawDataValues() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -741,16 +741,16 @@ class ConstantDataArray final : public ConstantDataSequential {
/// number of bits of the type contained in the passed in ArrayRef.
/// (i.e. half or bfloat for 16bits, float for 32bits, double for 64bits) Note
/// that this can return a ConstantAggregateZero object.
- static Constant *getFP(Type *ElementType, ArrayRef<uint16_t> Elts);
- static Constant *getFP(Type *ElementType, ArrayRef<uint32_t> Elts);
- static Constant *getFP(Type *ElementType, ArrayRef<uint64_t> Elts);
+ LLVM_ABI static Constant *getFP(Type *ElementType, ArrayRef<uint16_t> Elts);
+ LLVM_ABI static Constant *getFP(Type *ElementType, ArrayRef<uint32_t> Elts);
+ LLVM_ABI static Constant *getFP(Type *ElementType, ArrayRef<uint64_t> Elts);
/// This method constructs a CDS and initializes it with a text string.
/// The default behavior (AddNull==true) causes a null terminator to
/// be placed at the end of the array (increasing the length of the string by
/// one more than the StringRef would normally indicate. Pass AddNull=false
/// to disable this behavior.
- static Constant *getString(LLVMContext &Context, StringRef Initializer,
+ LLVM_ABI static Constant *getString(LLVMContext &Context, StringRef Initializer,
bool AddNull = true);
/// Specialize the getType() method to always return an ArrayType,
@@ -788,12 +788,12 @@ class ConstantDataVector final : public ConstantDataSequential {
/// get() constructors - Return a constant with vector type with an element
/// count and element type matching the ArrayRef passed in. Note that this
/// can return a ConstantAggregateZero object.
- static Constant *get(LLVMContext &Context, ArrayRef<uint8_t> Elts);
- static Constant *get(LLVMContext &Context, ArrayRef<uint16_t> Elts);
- static Constant *get(LLVMContext &Context, ArrayRef<uint32_t> Elts);
- static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts);
- static Constant *get(LLVMContext &Context, ArrayRef<float> Elts);
- static Constant *get(LLVMContext &Context, ArrayRef<double> Elts);
+ LLVM_ABI static Constant *get(LLVMContext &Context, ArrayRef<uint8_t> Elts);
+ LLVM_ABI static Constant *get(LLVMContext &Context, ArrayRef<uint16_t> Elts);
+ LLVM_ABI static Constant *get(LLVMContext &Context, ArrayRef<uint32_t> Elts);
+ LLVM_ABI static Constant *get(LLVMContext &Context, ArrayRef<uint64_t> Elts);
+ LLVM_ABI static Constant *get(LLVMContext &Context, ArrayRef<float> Elts);
+ LLVM_ABI static Constant *get(LLVMContext &Context, ArrayRef<double> Elts);
/// getRaw() constructor - Return a constant with vector type with an element
/// count and element type matching the NumElements and ElementTy parameters
@@ -813,22 +813,22 @@ class ConstantDataVector final : public ConstantDataSequential {
/// number of bits of the type contained in the passed in ArrayRef.
/// (i.e. half or bfloat for 16bits, float for 32bits, double for 64bits) Note
/// that this can return a ConstantAggregateZero object.
- static Constant *getFP(Type *ElementType, ArrayRef<uint16_t> Elts);
- static Constant *getFP(Type *ElementType, ArrayRef<uint32_t> Elts);
- static Constant *getFP(Type *ElementType, ArrayRef<uint64_t> Elts);
+ LLVM_ABI static Constant *getFP(Type *ElementType, ArrayRef<uint16_t> Elts);
+ LLVM_ABI static Constant *getFP(Type *ElementType, ArrayRef<uint32_t> Elts);
+ LLVM_ABI static Constant *getFP(Type *ElementType, ArrayRef<uint64_t> Elts);
/// Return a ConstantVector with the specified constant in each element.
/// The specified constant has to be a of a compatible type (i8/i16/
/// i32/i64/half/bfloat/float/double) and must be a ConstantFP or ConstantInt.
- static Constant *getSplat(unsigned NumElts, Constant *Elt);
+ LLVM_ABI static Constant *getSplat(unsigned NumElts, Constant *Elt);
/// Returns true if this is a splat constant, meaning that all elements have
/// the same value.
- bool isSplat() const;
+ LLVM_ABI bool isSplat() const;
/// If this is a splat constant, meaning that all of the elements have the
/// same value, return that value. Otherwise return NULL.
- Constant *getSplatValue() const;
+ LLVM_ABI Constant *getSplatValue() const;
/// Specialize the getType() method to always return a FixedVectorType,
/// which reduces the amount of casting needed in parts of the compiler.
@@ -857,7 +857,7 @@ class ConstantTokenNone final : public ConstantData {
ConstantTokenNone(const ConstantTokenNone &) = delete;
/// Return the ConstantTokenNone.
- static ConstantTokenNone *get(LLVMContext &Context);
+ LLVM_ABI static ConstantTokenNone *get(LLVMContext &Context);
/// Methods to support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Value *V) {
@@ -878,7 +878,7 @@ class ConstantTargetNone final : public ConstantData {
ConstantTargetNone(const ConstantTargetNone &) = delete;
/// Static factory methods - Return objects of the specified value.
- static ConstantTargetNone *get(TargetExtType *T);
+ LLVM_ABI static ConstantTargetNone *get(TargetExtType *T);
/// Specialize the getType() method to always return an TargetExtType,
/// which reduces the amount of casting needed in parts of the compiler.
@@ -910,21 +910,21 @@ class BlockAddress final : public Constant {
void operator delete(void *Ptr) { User::operator delete(Ptr); }
/// Return a BlockAddress for the specified function and basic block.
- static BlockAddress *get(Function *F, BasicBlock *BB);
+ LLVM_ABI static BlockAddress *get(Function *F, BasicBlock *BB);
/// Return a BlockAddress for the specified basic block. The basic
/// block must be embedded into a function.
- static BlockAddress *get(BasicBlock *BB);
+ LLVM_ABI static BlockAddress *get(BasicBlock *BB);
/// Return a BlockAddress for the specified basic block, which may not be
/// part of a function. The specified type must match the type of the function
/// the block will be inserted into.
- static BlockAddress *get(Type *Ty, BasicBlock *BB);
+ LLVM_ABI static BlockAddress *get(Type *Ty, BasicBlock *BB);
/// Lookup an existing \c BlockAddress constant for the given BasicBlock.
///
/// \returns 0 if \c !BB->hasAddressTaken(), otherwise the \c BlockAddress.
- static BlockAddress *lookup(const BasicBlock *BB);
+ LLVM_ABI static BlockAddress *lookup(const BasicBlock *BB);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -963,7 +963,7 @@ class DSOLocalEquivalent final : public Constant {
void operator delete(void *Ptr) { User::operator delete(Ptr); }
/// Return a DSOLocalEquivalent for the specified global value.
- static DSOLocalEquivalent *get(GlobalValue *GV);
+ LLVM_ABI static DSOLocalEquivalent *get(GlobalValue *GV);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1000,7 +1000,7 @@ class NoCFIValue final : public Constant {
public:
/// Return a NoCFIValue for the specified function.
- static NoCFIValue *get(GlobalValue *GV);
+ LLVM_ABI static NoCFIValue *get(GlobalValue *GV);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1043,12 +1043,12 @@ class ConstantPtrAuth final : public Constant {
public:
/// Return a pointer signed with the specified parameters.
- static ConstantPtrAuth *get(Constant *Ptr, ConstantInt *Key,
+ LLVM_ABI static ConstantPtrAuth *get(Constant *Ptr, ConstantInt *Key,
ConstantInt *Disc, Constant *AddrDisc);
/// Produce a new ptrauth expression signing the given value using
/// the same schema as is stored in one.
- ConstantPtrAuth *getWithSameSchema(Constant *Pointer) const;
+ LLVM_ABI ConstantPtrAuth *getWithSameSchema(Constant *Pointer) const;
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@@ -1087,12 +1087,12 @@ class ConstantPtrAuth final : public Constant {
/// These discriminators can't be used in real pointer-auth values; they
/// can only be used in "prototype" values that indicate how some real
/// schema is supposed to be produced.
- bool hasSpecialAddressDiscriminator(uint64_t Value) const;
+ LLVM_ABI bool hasSpecialAddressDiscriminator(uint64_t Value) const;
/// Check whether an authentication operation with key \p Key and (possibly
/// blended) discriminator \p Discriminator is known to be compatible with
/// this ptrauth signed pointer.
- bool isKnownCompatibleWith(const Value *Key, const Value *Discriminator,
+ LLVM_ABI bool isKnownCompatibleWith(const Value *Key, const Value *Discriminator,
const DataLayout &DL) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1138,29 +1138,29 @@ class ConstantExpr : public Constant {
/// getAlignOf constant expr - computes the alignment of a type in a target
/// independent way (Note: the return type is an i64).
- static Constant *getAlignOf(Type *Ty);
+ LLVM_ABI static Constant *getAlignOf(Type *Ty);
/// getSizeOf constant expr - computes the (alloc) size of a type (in
/// address-units, not bits) in a target independent way (Note: the return
/// type is an i64).
///
- static Constant *getSizeOf(Type *Ty);
+ LLVM_ABI static Constant *getSizeOf(Type *Ty);
- static Constant *getNeg(Constant *C, bool HasNSW = false);
- static Constant *getNot(Constant *C);
- static Constant *getAdd(Constant *C1, Constant *C2, bool HasNUW = false,
+ LLVM_ABI static Constant *getNeg(Constant *C, bool HasNSW = false);
+ LLVM_ABI static Constant *getNot(Constant *C);
+ LLVM_ABI static Constant *getAdd(Constant *C1, Constant *C2, bool HasNUW = false,
bool HasNSW = false);
- static Constant *getSub(Constant *C1, Constant *C2, bool HasNUW = false,
+ LLVM_ABI static Constant *getSub(Constant *C1, Constant *C2, bool HasNUW = false,
bool HasNSW = false);
- static Constant *getXor(Constant *C1, Constant *C2);
- static Constant *getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced = false);
- static Constant *getPtrToInt(Constant *C, Type *Ty,
+ LLVM_ABI static Constant *getXor(Constant *C1, Constant *C2);
+ LLVM_ABI static Constant *getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced = false);
+ LLVM_ABI static Constant *getPtrToInt(Constant *C, Type *Ty,
bool OnlyIfReduced = false);
- static Constant *getIntToPtr(Constant *C, Type *Ty,
+ LLVM_ABI static Constant *getIntToPtr(Constant *C, Type *Ty,
bool OnlyIfReduced = false);
- static Constant *getBitCast(Constant *C, Type *Ty,
+ LLVM_ABI static Constant *getBitCast(Constant *C, Type *Ty,
bool OnlyIfReduced = false);
- static Constant *getAddrSpaceCast(Constant *C, Type *Ty,
+ LLVM_ABI static Constant *getAddrSpaceCast(Constant *C, Type *Ty,
bool OnlyIfReduced = false);
static Constant *getNSWNeg(Constant *C) { return getNeg(C, /*HasNSW=*/true); }
@@ -1185,7 +1185,7 @@ class ConstantExpr : public Constant {
/// function returns a new scalar/fixed width vector obtained from logBase2
/// of C. Undef vector elements are set to zero.
/// Return a null pointer otherwise.
- static Constant *getExactLogBase2(Constant *C);
+ LLVM_ABI static Constant *getExactLogBase2(Constant *C);
/// Return the identity constant for a binary opcode.
/// If the binop is not commutative, callers can acquire the operand 1
@@ -1194,16 +1194,16 @@ class ConstantExpr : public Constant {
/// is a fadd/fsub operation and we don't care about signed zeros, then
/// setting NSZ to true returns the identity +0.0 instead of -0.0. Return
/// nullptr if the operator does not have an identity constant.
- static Constant *getBinOpIdentity(unsigned Opcode, Type *Ty,
+ LLVM_ABI static Constant *getBinOpIdentity(unsigned Opcode, Type *Ty,
bool AllowRHSConstant = false,
bool NSZ = false);
- static Constant *getIntrinsicIdentity(Intrinsic::ID, Type *Ty);
+ LLVM_ABI static Constant *getIntrinsicIdentity(Intrinsic::ID, Type *Ty);
/// Return the identity constant for a binary or intrinsic Instruction.
/// The identity constant C is defined as X op C = X and C op X = X where C
/// and X are the first two operands, and the operation is commutative.
- static Constant *getIdentity(Instruction *I, Type *Ty,
+ LLVM_ABI static Constant *getIdentity(Instruction *I, Type *Ty,
bool AllowRHSConstant = false, bool NSZ = false);
/// Return the absorbing element for the given binary
@@ -1212,7 +1212,7 @@ class ConstantExpr : public Constant {
/// If AllowLHSConstant is true, the LHS operand is a constant C that must be
/// defined as C op X = C. It returns null if the operator doesn't have
/// an absorbing element.
- static Constant *getBinOpAbsorber(unsigned Opcode, Type *Ty,
+ LLVM_ABI static Constant *getBinOpAbsorber(unsigned Opcode, Type *Ty,
bool AllowLHSConstant = false);
/// Transparently provide more efficient getOperand methods.
@@ -1224,37 +1224,37 @@ class ConstantExpr : public Constant {
/// \param C The constant to be converted
/// \param Ty The type to which the constant is converted
/// \param OnlyIfReduced see \a getWithOperands() docs.
- static Constant *getCast(unsigned ops, Constant *C, Type *Ty,
+ LLVM_ABI static Constant *getCast(unsigned ops, Constant *C, Type *Ty,
bool OnlyIfReduced = false);
// Create a Trunc or BitCast cast constant expression
- static Constant *
+ LLVM_ABI static Constant *
getTruncOrBitCast(Constant *C, ///< The constant to trunc or bitcast
Type *Ty ///< The type to trunc or bitcast C to
);
/// Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant
/// expression.
- static Constant *
+ LLVM_ABI static Constant *
getPointerCast(Constant *C, ///< The pointer value to be casted (operand 0)
Type *Ty ///< The type to which cast should be made
);
/// Create a BitCast or AddrSpaceCast for a pointer type depending on
/// the address space.
- static Constant *getPointerBitCastOrAddrSpaceCast(
+ LLVM_ABI static Constant *getPointerBitCastOrAddrSpaceCast(
Constant *C, ///< The constant to addrspacecast or bitcast
Type *Ty ///< The type to bitcast or addrspacecast C to
);
/// Return true if this is a convert constant expression
- bool isCast() const;
+ LLVM_ABI bool isCast() const;
/// get - Return a binary or shift operator constant expression,
/// folding if possible.
///
/// \param OnlyIfReducedTy see \a getWithOperands() docs.
- static Constant *get(unsigned Opcode, Constant *C1, Constant *C2,
+ LLVM_ABI static Constant *get(unsigned Opcode, Constant *C1, Constant *C2,
unsigned Flags = 0, Type *OnlyIfReducedTy = nullptr);
/// Getelementptr form. Value* is only accepted for convenience;
@@ -1282,7 +1282,7 @@ class ConstantExpr : public Constant {
return getGetElementPtr(Ty, C, cast<Value>(Idx), NW, InRange,
OnlyIfReducedTy);
}
- static Constant *
+ LLVM_ABI static Constant *
getGetElementPtr(Type *Ty, Constant *C, ArrayRef<Value *> IdxList,
GEPNoWrapFlags NW = GEPNoWrapFlags::none(),
std::optional<ConstantRange> InRange = std::nullopt,
@@ -1306,11 +1306,11 @@ class ConstantExpr : public Constant {
return getGetElementPtr(Ty, C, IdxList, GEPNoWrapFlags::inBounds());
}
- static Constant *getExtractElement(Constant *Vec, Constant *Idx,
+ LLVM_ABI static Constant *getExtractElement(Constant *Vec, Constant *Idx,
Type *OnlyIfReducedTy = nullptr);
- static Constant *getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx,
+ LLVM_ABI static Constant *getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx,
Type *OnlyIfReducedTy = nullptr);
- static Constant *getShuffleVector(Constant *V1, Constant *V2,
+ LLVM_ABI static Constant *getShuffleVector(Constant *V1, Constant *V2,
ArrayRef<int> Mask,
Type *OnlyIfReducedTy = nullptr);
@@ -1319,16 +1319,16 @@ class ConstantExpr : public Constant {
/// Assert that this is a shufflevector and return the mask. See class
/// ShuffleVectorInst for a description of the mask representation.
- ArrayRef<int> getShuffleMask() const;
+ LLVM_ABI ArrayRef<int> getShuffleMask() const;
/// Assert that this is a shufflevector and return the mask.
///
/// TODO: This is a temporary hack until we update the bitcode format for
/// shufflevector.
- Constant *getShuffleMaskForBitcode() const;
+ LLVM_ABI Constant *getShuffleMaskForBitcode() const;
/// Return a string representation for an opcode.
- const char *getOpcodeName() const;
+ LLVM_ABI const char *getOpcodeName() const;
/// This returns the current constant expression with the operands replaced
/// with the specified values. The specified array must have the same number
@@ -1346,7 +1346,7 @@ class ConstantExpr : public Constant {
/// If \c OnlyIfReduced is \c true, nullptr will be returned unless something
/// gets constant-folded, the type changes, or the expression is otherwise
/// canonicalized. This parameter should almost always be \c false.
- Constant *getWithOperands(ArrayRef<Constant *> Ops, Type *Ty,
+ LLVM_ABI Constant *getWithOperands(ArrayRef<Constant *> Ops, Type *Ty,
bool OnlyIfReduced = false,
Type *SrcTy = nullptr) const;
@@ -1357,21 +1357,21 @@ class ConstantExpr : public Constant {
/// which would take a ConstantExpr parameter, but that would have spread
/// implementation details of ConstantExpr outside of Constants.cpp, which
/// would make it harder to remove ConstantExprs altogether.
- Instruction *getAsInstruction() const;
+ LLVM_ABI Instruction *getAsInstruction() const;
/// Whether creating a constant expression for this binary operator is
/// desirable.
- static bool isDesirableBinOp(unsigned Opcode);
+ LLVM_ABI static bool isDesirableBinOp(unsigned Opcode);
/// Whether creating a constant expression for this binary operator is
/// supported.
- static bool isSupportedBinOp(unsigned Opcode);
+ LLVM_ABI static bool isSupportedBinOp(unsigned Opcode);
/// Whether creating a constant expression for this cast is desirable.
- static bool isDesirableCastOp(unsigned Opcode);
+ LLVM_ABI static bool isDesirableCastOp(unsigned Opcode);
/// Whether creating a constant expression for this cast is supported.
- static bool isSupportedCastOp(unsigned Opcode);
+ LLVM_ABI static bool isSupportedCastOp(unsigned Opcode);
/// Whether creating a constant expression for this getelementptr type is
/// supported.
@@ -1422,25 +1422,25 @@ class UndefValue : public ConstantData {
UndefValue(const UndefValue &) = delete;
/// Static factory methods - Return an 'undef' object of the specified type.
- static UndefValue *get(Type *T);
+ LLVM_ABI static UndefValue *get(Type *T);
/// If this Undef has array or vector type, return a undef with the right
/// element type.
- UndefValue *getSequentialElement() const;
+ LLVM_ABI UndefValue *getSequentialElement() const;
/// If this undef has struct type, return a undef with the right element type
/// for the specified element.
- UndefValue *getStructElement(unsigned Elt) const;
+ LLVM_ABI UndefValue *getStructElement(unsigned Elt) const;
/// Return an undef of the right value for the specified GEP index if we can,
/// otherwise return null (e.g. if C is a ConstantExpr).
- UndefValue *getElementValue(Constant *C) const;
+ LLVM_ABI UndefValue *getElementValue(Constant *C) const;
/// Return an undef of the right value for the specified GEP index.
- UndefValue *getElementValue(unsigned Idx) const;
+ LLVM_ABI UndefValue *getElementValue(unsigned Idx) const;
/// Return the number of elements in the array, vector, or struct.
- unsigned getNumElements() const;
+ LLVM_ABI unsigned getNumElements() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -1467,22 +1467,22 @@ class PoisonValue final : public UndefValue {
PoisonValue(const PoisonValue &) = delete;
/// Static factory methods - Return an 'poison' object of the specified type.
- static PoisonValue *get(Type *T);
+ LLVM_ABI static PoisonValue *get(Type *T);
/// If this poison has array or vector type, return a poison with the right
/// element type.
- PoisonValue *getSequentialElement() const;
+ LLVM_ABI PoisonValue *getSequentialElement() const;
/// If this poison has struct type, return a poison with the right element
/// type for the specified element.
- PoisonValue *getStructElement(unsigned Elt) const;
+ LLVM_ABI PoisonValue *getStructElement(unsigned Elt) const;
/// Return an poison of the right value for the specified GEP index if we can,
/// otherwise return null (e.g. if C is a ConstantExpr).
- PoisonValue *getElementValue(Constant *C) const;
+ LLVM_ABI PoisonValue *getElementValue(Constant *C) const;
/// Return an poison of the right value for the specified GEP index.
- PoisonValue *getElementValue(unsigned Idx) const;
+ LLVM_ABI PoisonValue *getElementValue(unsigned Idx) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 4ce71bd3dad58..e7aab7732bbd5 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_DIBUILDER_H
#define LLVM_IR_DIBUILDER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
@@ -109,17 +110,17 @@ namespace llvm {
/// in order to resolve cycles during \a finalize().
///
/// If \p CU is given a value other than nullptr, then set \p CUNode to CU.
- explicit DIBuilder(Module &M, bool AllowUnresolved = true,
+ LLVM_ABI explicit DIBuilder(Module &M, bool AllowUnresolved = true,
DICompileUnit *CU = nullptr);
DIBuilder(const DIBuilder &) = delete;
DIBuilder &operator=(const DIBuilder &) = delete;
/// Construct any deferred debug info descriptors.
- void finalize();
+ LLVM_ABI void finalize();
/// Finalize a specific subprogram - no new variables may be added to this
/// subprogram afterwards.
- void finalizeSubprogram(DISubprogram *SP);
+ LLVM_ABI void finalizeSubprogram(DISubprogram *SP);
/// A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation.
@@ -148,7 +149,7 @@ namespace llvm {
/// \param SysRoot The clang system root (value of -isysroot).
/// \param SDK The SDK name. On Darwin, this is the last component
/// of the sysroot.
- DICompileUnit *
+ LLVM_ABI DICompileUnit *
createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer,
bool isOptimized, StringRef Flags, unsigned RV,
StringRef SplitName = StringRef(),
@@ -167,7 +168,7 @@ namespace llvm {
/// \param Checksum Optional checksum kind (e.g. CSK_MD5, CSK_SHA1, etc.)
/// and value.
/// \param Source Optional source text.
- DIFile *createFile(
+ LLVM_ABI DIFile *createFile(
StringRef Filename, StringRef Directory,
std::optional<DIFile::ChecksumInfo<StringRef>> Checksum = std::nullopt,
std::optional<StringRef> Source = std::nullopt);
@@ -178,7 +179,7 @@ namespace llvm {
/// \param MacroType DW_MACINFO_define or DW_MACINFO_undef.
/// \param Name Macro name.
/// \param Value Macro value.
- DIMacro *createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType,
+ LLVM_ABI DIMacro *createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType,
StringRef Name, StringRef Value = StringRef());
/// Create debugging information temporary entry for a macro file.
@@ -187,19 +188,19 @@ namespace llvm {
/// \param Parent Macro file parent (could be nullptr).
/// \param Line Source line number where the macro file is included.
/// \param File File descriptor containing the name of the macro file.
- DIMacroFile *createTempMacroFile(DIMacroFile *Parent, unsigned Line,
+ LLVM_ABI DIMacroFile *createTempMacroFile(DIMacroFile *Parent, unsigned Line,
DIFile *File);
/// Create a single enumerator value.
- DIEnumerator *createEnumerator(StringRef Name, const APSInt &Value);
- DIEnumerator *createEnumerator(StringRef Name, uint64_t Val,
+ LLVM_ABI DIEnumerator *createEnumerator(StringRef Name, const APSInt &Value);
+ LLVM_ABI DIEnumerator *createEnumerator(StringRef Name, uint64_t Val,
bool IsUnsigned = false);
/// Create a DWARF unspecified type.
- DIBasicType *createUnspecifiedType(StringRef Name);
+ LLVM_ABI DIBasicType *createUnspecifiedType(StringRef Name);
/// Create C++11 nullptr type.
- DIBasicType *createNullPtrType();
+ LLVM_ABI DIBasicType *createNullPtrType();
/// Create debugging information entry for a basic
/// type.
@@ -210,7 +211,7 @@ namespace llvm {
/// \param NumExtraInhabitants The number of extra inhabitants of the type.
/// An extra inhabitant is a bit pattern that does not represent a valid
/// value for instances of a given type. This is used by the Swift language.
- DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
+ LLVM_ABI DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
unsigned Encoding,
DINode::DIFlags Flags = DINode::FlagZero,
uint32_t NumExtraInhabitants = 0);
@@ -221,7 +222,7 @@ namespace llvm {
/// dwarf::DW_ATE_signed_fixed or DW_ATE_unsigned_fixed.
/// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
/// \param Factor Binary scale factor.
- DIFixedPointType *
+ LLVM_ABI DIFixedPointType *
createBinaryFixedPointType(StringRef Name, uint64_t SizeInBits,
uint32_t AlignInBits, unsigned Encoding,
DINode::DIFlags Flags, int Factor);
@@ -232,7 +233,7 @@ namespace llvm {
/// dwarf::DW_ATE_signed_fixed or DW_ATE_unsigned_fixed.
/// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
/// \param Factor Decimal scale factor.
- DIFixedPointType *
+ LLVM_ABI DIFixedPointType *
createDecimalFixedPointType(StringRef Name, uint64_t SizeInBits,
uint32_t AlignInBits, unsigned Encoding,
DINode::DIFlags Flags, int Factor);
@@ -245,7 +246,7 @@ namespace llvm {
/// \param Flags Optional DWARF attributes, e.g., DW_AT_endianity.
/// \param Numerator Numerator of scale factor.
/// \param Denominator Denominator of scale factor.
- DIFixedPointType *
+ LLVM_ABI DIFixedPointType *
createRationalFixedPointType(StringRef Name, uint64_t SizeInBits,
uint32_t AlignInBits, unsigned Encoding,
DINode::DIFlags Flags, APInt Numerator,
@@ -255,14 +256,14 @@ namespace llvm {
/// type.
/// \param Name Type name.
/// \param SizeInBits Size of the type.
- DIStringType *createStringType(StringRef Name, uint64_t SizeInBits);
+ LLVM_ABI DIStringType *createStringType(StringRef Name, uint64_t SizeInBits);
/// Create debugging information entry for Fortran
/// assumed length string type.
/// \param Name Type name.
/// \param StringLength String length expressed as DIVariable *.
/// \param StrLocationExp Optional memory location of the string.
- DIStringType *createStringType(StringRef Name, DIVariable *StringLength,
+ LLVM_ABI DIStringType *createStringType(StringRef Name, DIVariable *StringLength,
DIExpression *StrLocationExp = nullptr);
/// Create debugging information entry for Fortran
@@ -270,7 +271,7 @@ namespace llvm {
/// \param Name Type name.
/// \param StringLengthExp String length expressed in DIExpression form.
/// \param StrLocationExp Optional memory location of the string.
- DIStringType *createStringType(StringRef Name,
+ LLVM_ABI DIStringType *createStringType(StringRef Name,
DIExpression *StringLengthExp,
DIExpression *StrLocationExp = nullptr);
@@ -278,7 +279,7 @@ namespace llvm {
/// type, e.g. 'const int'.
/// \param Tag Tag identifing type, e.g. dwarf::TAG_volatile_type
/// \param FromTy Base Type.
- DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
+ LLVM_ABI DIDerivedType *createQualifiedType(unsigned Tag, DIType *FromTy);
/// Create debugging information entry for a pointer.
/// \param PointeeTy Type pointed by this pointer.
@@ -287,14 +288,14 @@ namespace llvm {
/// \param DWARFAddressSpace DWARF address space. (optional)
/// \param Name Pointer type name. (optional)
/// \param Annotations Member annotations.
- DIDerivedType *
+ LLVM_ABI DIDerivedType *
createPointerType(DIType *PointeeTy, uint64_t SizeInBits,
uint32_t AlignInBits = 0,
std::optional<unsigned> DWARFAddressSpace = std::nullopt,
StringRef Name = "", DINodeArray Annotations = nullptr);
/// Create a __ptrauth qualifier.
- DIDerivedType *createPtrAuthQualifiedType(DIType *FromTy, unsigned Key,
+ LLVM_ABI DIDerivedType *createPtrAuthQualifiedType(DIType *FromTy, unsigned Key,
bool IsAddressDiscriminated,
unsigned ExtraDiscriminator,
bool IsaPointer,
@@ -305,14 +306,14 @@ namespace llvm {
/// \param SizeInBits Size.
/// \param AlignInBits Alignment. (optional)
/// \param Class Type for which this pointer points to members of.
- DIDerivedType *
+ LLVM_ABI DIDerivedType *
createMemberPointerType(DIType *PointeeTy, DIType *Class,
uint64_t SizeInBits, uint32_t AlignInBits = 0,
DINode::DIFlags Flags = DINode::FlagZero);
/// Create debugging information entry for a c++
/// style reference or rvalue reference type.
- DIDerivedType *createReferenceType(
+ LLVM_ABI DIDerivedType *createReferenceType(
unsigned Tag, DIType *RTy, uint64_t SizeInBits = 0,
uint32_t AlignInBits = 0,
std::optional<unsigned> DWARFAddressSpace = std::nullopt);
@@ -326,7 +327,7 @@ namespace llvm {
/// \param AlignInBits Alignment. (optional)
/// \param Flags Flags to describe inheritance attribute, e.g. private
/// \param Annotations Annotations. (optional)
- DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
+ LLVM_ABI DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
unsigned LineNo, DIScope *Context,
uint32_t AlignInBits = 0,
DINode::DIFlags Flags = DINode::FlagZero,
@@ -343,7 +344,7 @@ namespace llvm {
/// \param Flags Flags to describe inheritance attribute (optional),
/// e.g. private.
/// \param Annotations Annotations. (optional)
- DIDerivedType *createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File,
+ LLVM_ABI DIDerivedType *createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File,
unsigned LineNo, DIScope *Context,
DINodeArray TParams,
uint32_t AlignInBits = 0,
@@ -351,7 +352,7 @@ namespace llvm {
DINodeArray Annotations = nullptr);
/// Create debugging information entry for a 'friend'.
- DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
+ LLVM_ABI DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
/// Create debugging information entry to establish
/// inheritance relationship between two types.
@@ -361,7 +362,7 @@ namespace llvm {
/// \param VBPtrOffset Virtual base pointer offset.
/// \param Flags Flags to describe inheritance attribute,
/// e.g. private
- DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
+ LLVM_ABI DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
uint64_t BaseOffset, uint32_t VBPtrOffset,
DINode::DIFlags Flags);
@@ -376,7 +377,7 @@ namespace llvm {
/// \param Flags Flags to encode member attribute, e.g. private
/// \param Ty Parent type.
/// \param Annotations Member annotations.
- DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
+ LLVM_ABI DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNo,
uint64_t SizeInBits, uint32_t AlignInBits,
uint64_t OffsetInBits,
@@ -398,7 +399,7 @@ namespace llvm {
/// ConstantDataArray if the variant applies
/// for multiple discriminants.
/// \param Ty Parent type.
- DIDerivedType *createVariantMemberType(DIScope *Scope, StringRef Name,
+ LLVM_ABI DIDerivedType *createVariantMemberType(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNo,
uint64_t SizeInBits,
uint32_t AlignInBits,
@@ -416,7 +417,7 @@ namespace llvm {
/// ConstantDataArray if the variant applies
/// for multiple discriminants.
/// \param Ty Parent type.
- DIDerivedType *createVariantMemberType(DIScope *Scope, DINodeArray Elements,
+ LLVM_ABI DIDerivedType *createVariantMemberType(DIScope *Scope, DINodeArray Elements,
Constant *Discriminant, DIType *Ty);
/// Create debugging information entry for a bit field member.
@@ -430,7 +431,7 @@ namespace llvm {
/// \param Flags Flags to encode member attribute.
/// \param Ty Parent type.
/// \param Annotations Member annotations.
- DIDerivedType *createBitFieldMemberType(DIScope *Scope, StringRef Name,
+ LLVM_ABI DIDerivedType *createBitFieldMemberType(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNo,
uint64_t SizeInBits,
uint64_t OffsetInBits,
@@ -449,7 +450,7 @@ namespace llvm {
/// \param Val Const initializer of the member.
/// \param Tag DWARF tag of the static member.
/// \param AlignInBits Member alignment.
- DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
+ LLVM_ABI DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNo,
DIType *Ty, DINode::DIFlags Flags,
Constant *Val, unsigned Tag,
@@ -466,7 +467,7 @@ namespace llvm {
/// \param Flags Flags to encode member attribute, e.g. private
/// \param Ty Parent type.
/// \param PropertyNode Property associated with this ivar.
- DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
+ LLVM_ABI DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
uint64_t SizeInBits, uint32_t AlignInBits,
uint64_t OffsetInBits, DINode::DIFlags Flags,
DIType *Ty, MDNode *PropertyNode);
@@ -480,7 +481,7 @@ namespace llvm {
/// \param SetterName Name of the Objective C property setter selector.
/// \param PropertyAttributes Objective C property attributes.
/// \param Ty Type.
- DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
+ LLVM_ABI DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
unsigned LineNumber,
StringRef GetterName,
StringRef SetterName,
@@ -503,7 +504,7 @@ namespace llvm {
/// for more info.
/// \param TemplateParms Template type parameters.
/// \param UniqueIdentifier A unique identifier for the class.
- DICompositeType *createClassType(
+ LLVM_ABI DICompositeType *createClassType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements,
@@ -526,7 +527,7 @@ namespace llvm {
/// \param NumExtraInhabitants The number of extra inhabitants of the type.
/// An extra inhabitant is a bit pattern that does not represent a valid
/// value for instances of a given type. This is used by the Swift language.
- DICompositeType *createStructType(
+ LLVM_ABI DICompositeType *createStructType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags,
DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang = 0,
@@ -544,7 +545,7 @@ namespace llvm {
/// \param Elements Union elements.
/// \param RunTimeLang Optional parameter, Objective-C runtime version.
/// \param UniqueIdentifier A unique identifier for the union.
- DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
+ LLVM_ABI DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint32_t AlignInBits,
DINode::DIFlags Flags,
@@ -565,7 +566,7 @@ namespace llvm {
/// \param Discriminator Discriminant member
/// \param Elements Variant elements.
/// \param UniqueIdentifier A unique identifier for the union.
- DICompositeType *createVariantPart(DIScope *Scope, StringRef Name,
+ LLVM_ABI DICompositeType *createVariantPart(DIScope *Scope, StringRef Name,
DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint32_t AlignInBits,
DINode::DIFlags Flags,
@@ -579,7 +580,7 @@ namespace llvm {
/// \param Name Type parameter name.
/// \param Ty Parameter type.
/// \param IsDefault Parameter is default or not
- DITemplateTypeParameter *createTemplateTypeParameter(DIScope *Scope,
+ LLVM_ABI DITemplateTypeParameter *createTemplateTypeParameter(DIScope *Scope,
StringRef Name,
DIType *Ty,
bool IsDefault);
@@ -591,7 +592,7 @@ namespace llvm {
/// \param Ty Parameter type.
/// \param IsDefault Parameter is default or not
/// \param Val Constant parameter value.
- DITemplateValueParameter *
+ LLVM_ABI DITemplateValueParameter *
createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty,
bool IsDefault, Constant *Val);
@@ -601,7 +602,7 @@ namespace llvm {
/// \param Ty Parameter type.
/// \param Val The fully qualified name of the template.
/// \param IsDefault Parameter is default or not.
- DITemplateValueParameter *
+ LLVM_ABI DITemplateValueParameter *
createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty,
StringRef Val, bool IsDefault = false);
@@ -610,7 +611,7 @@ namespace llvm {
/// \param Name Value parameter name.
/// \param Ty Parameter type.
/// \param Val An array of types in the pack.
- DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
+ LLVM_ABI DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
StringRef Name,
DIType *Ty,
DINodeArray Val);
@@ -632,7 +633,7 @@ namespace llvm {
/// \param Rank The rank attribute of a descriptor-based
/// Fortran array, either a DIExpression* or
/// a DIVariable*.
- DICompositeType *createArrayType(
+ LLVM_ABI DICompositeType *createArrayType(
uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
PointerUnion<DIExpression *, DIVariable *> Associated = nullptr,
@@ -661,7 +662,7 @@ namespace llvm {
/// Fortran array, either a DIExpression* or
/// a DIVariable*.
/// \param BitStride The bit size of an element of the array.
- DICompositeType *createArrayType(
+ LLVM_ABI DICompositeType *createArrayType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts,
PointerUnion<DIExpression *, DIVariable *> DataLocation = nullptr,
@@ -675,7 +676,7 @@ namespace llvm {
/// \param AlignInBits Alignment.
/// \param Ty Element type.
/// \param Subscripts Subscripts.
- DICompositeType *createVectorType(uint64_t Size, uint32_t AlignInBits,
+ LLVM_ABI DICompositeType *createVectorType(uint64_t Size, uint32_t AlignInBits,
DIType *Ty, DINodeArray Subscripts);
/// Create debugging information entry for an
@@ -692,7 +693,7 @@ namespace llvm {
/// \param UniqueIdentifier A unique identifier for the enum.
/// \param IsScoped Boolean flag indicate if this is C++11/ObjC 'enum
/// class'.
- DICompositeType *createEnumerationType(
+ LLVM_ABI DICompositeType *createEnumerationType(
DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber,
uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements,
DIType *UnderlyingType, unsigned RunTimeLang = 0,
@@ -706,7 +707,7 @@ namespace llvm {
/// \param SizeInBits Set size.
/// \param AlignInBits Set alignment.
/// \param Ty Base type of the set.
- DIDerivedType *createSetType(DIScope *Scope, StringRef Name, DIFile *File,
+ LLVM_ABI DIDerivedType *createSetType(DIScope *Scope, StringRef Name, DIFile *File,
unsigned LineNo, uint64_t SizeInBits,
uint32_t AlignInBits, DIType *Ty);
@@ -716,20 +717,20 @@ namespace llvm {
/// \param Flags E.g.: LValueReference.
/// These flags are used to emit dwarf attributes.
/// \param CC Calling convention, e.g. dwarf::DW_CC_normal
- DISubroutineType *
+ LLVM_ABI DISubroutineType *
createSubroutineType(DITypeRefArray ParameterTypes,
DINode::DIFlags Flags = DINode::FlagZero,
unsigned CC = 0);
/// Create a distinct clone of \p SP with FlagArtificial set.
- static DISubprogram *createArtificialSubprogram(DISubprogram *SP);
+ LLVM_ABI static DISubprogram *createArtificialSubprogram(DISubprogram *SP);
/// Create a uniqued clone of \p Ty with FlagArtificial set.
- static DIType *createArtificialType(DIType *Ty);
+ LLVM_ABI static DIType *createArtificialType(DIType *Ty);
/// Create a uniqued clone of \p Ty with FlagObjectPointer set.
/// If \p Implicit is true, also set FlagArtificial.
- static DIType *createObjectPointerType(DIType *Ty, bool Implicit);
+ LLVM_ABI static DIType *createObjectPointerType(DIType *Ty, bool Implicit);
/// Create a type describing a subrange of another type.
/// \param Scope Scope in which this set is defined.
@@ -744,7 +745,7 @@ namespace llvm {
/// \param UpperBound Upper bound.
/// \param Stride Stride, if any.
/// \param Bias Bias, if any.
- DISubrangeType *
+ LLVM_ABI DISubrangeType *
createSubrangeType(StringRef Name, DIFile *File, unsigned LineNo,
DIScope *Scope, uint64_t SizeInBits,
uint32_t AlignInBits, DINode::DIFlags Flags, DIType *Ty,
@@ -752,7 +753,7 @@ namespace llvm {
Metadata *Stride, Metadata *Bias);
/// Create a permanent forward-declared type.
- DICompositeType *
+ LLVM_ABI DICompositeType *
createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F,
unsigned Line, unsigned RuntimeLang = 0,
uint64_t SizeInBits = 0, uint32_t AlignInBits = 0,
@@ -760,7 +761,7 @@ namespace llvm {
std::optional<uint32_t> EnumKind = std::nullopt);
/// Create a temporary forward-declared type.
- DICompositeType *createReplaceableCompositeType(
+ LLVM_ABI DICompositeType *createReplaceableCompositeType(
unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line,
unsigned RuntimeLang = 0, uint64_t SizeInBits = 0,
uint32_t AlignInBits = 0, DINode::DIFlags Flags = DINode::FlagFwdDecl,
@@ -769,29 +770,29 @@ namespace llvm {
/// Retain DIScope* in a module even if it is not referenced
/// through debug info anchors.
- void retainType(DIScope *T);
+ LLVM_ABI void retainType(DIScope *T);
/// Create unspecified parameter type
/// for a subroutine type.
- DIBasicType *createUnspecifiedParameter();
+ LLVM_ABI DIBasicType *createUnspecifiedParameter();
/// Get a DINodeArray, create one if required.
- DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
+ LLVM_ABI DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
/// Get a DIMacroNodeArray, create one if required.
- DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
+ LLVM_ABI DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
/// Get a DITypeRefArray, create one if required.
- DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
+ LLVM_ABI DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
/// Create a descriptor for a value range. This
/// implicitly uniques the values returned.
- DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
- DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
- DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
+ LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
+ LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
+ LLVM_ABI DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
Metadata *UpperBound, Metadata *Stride);
- DIGenericSubrange *
+ LLVM_ABI DIGenericSubrange *
getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count,
DIGenericSubrange::BoundType LowerBound,
DIGenericSubrange::BoundType UpperBound,
@@ -811,7 +812,7 @@ namespace llvm {
/// \param Decl Reference to the corresponding declaration.
/// \param AlignInBits Variable alignment(or 0 if no alignment attr was
/// specified)
- DIGlobalVariableExpression *createGlobalVariableExpression(
+ LLVM_ABI DIGlobalVariableExpression *createGlobalVariableExpression(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined = true,
DIExpression *Expr = nullptr, MDNode *Decl = nullptr,
@@ -820,7 +821,7 @@ namespace llvm {
/// Identical to createGlobalVariable
/// except that the resulting DbgNode is temporary and meant to be RAUWed.
- DIGlobalVariable *createTempGlobalVariableFwdDecl(
+ LLVM_ABI DIGlobalVariable *createTempGlobalVariableFwdDecl(
DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File,
unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl = nullptr,
MDTuple *TemplateParams = nullptr, uint32_t AlignInBits = 0);
@@ -833,7 +834,7 @@ namespace llvm {
///
/// If \c AlwaysPreserve, this variable will be referenced from its
/// containing subprogram, and will survive some optimizations.
- DILocalVariable *
+ LLVM_ABI DILocalVariable *
createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File,
unsigned LineNo, DIType *Ty, bool AlwaysPreserve = false,
DINode::DIFlags Flags = DINode::FlagZero,
@@ -843,7 +844,7 @@ namespace llvm {
///
/// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
/// leads to a \a DISubprogram.
- DILabel *
+ LLVM_ABI DILabel *
createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
bool AlwaysPreserve = false);
@@ -858,7 +859,7 @@ namespace llvm {
///
/// If \c AlwaysPreserve, this variable will be referenced from its
/// containing subprogram, and will survive some optimizations.
- DILocalVariable *
+ LLVM_ABI DILocalVariable *
createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo,
DIFile *File, unsigned LineNo, DIType *Ty,
bool AlwaysPreserve = false,
@@ -868,7 +869,7 @@ namespace llvm {
/// Create a new descriptor for the specified
/// variable which has a complex address expression for its address.
/// \param Addr An array of complex address operations.
- DIExpression *createExpression(ArrayRef<uint64_t> Addr = {});
+ LLVM_ABI DIExpression *createExpression(ArrayRef<uint64_t> Addr = {});
/// Create an expression for a variable that does not have an address, but
/// does have a constant value.
@@ -894,7 +895,7 @@ namespace llvm {
/// \param Annotations Attribute Annotations.
/// \param TargetFuncName The name of the target function if this is
/// a trampoline.
- DISubprogram *
+ LLVM_ABI DISubprogram *
createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName,
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
unsigned ScopeLine, DINode::DIFlags Flags = DINode::FlagZero,
@@ -907,7 +908,7 @@ namespace llvm {
/// Identical to createFunction,
/// except that the resulting DbgNode is meant to be RAUWed.
- DISubprogram *createTempFunctionFwdDecl(
+ LLVM_ABI DISubprogram *createTempFunctionFwdDecl(
DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
DINode::DIFlags Flags = DINode::FlagZero,
@@ -934,7 +935,7 @@ namespace llvm {
/// \param SPFlags Additional flags specific to subprograms.
/// \param TParams Function template parameters.
/// \param ThrownTypes Exception types this function may throw.
- DISubprogram *
+ LLVM_ABI DISubprogram *
createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName,
DIFile *File, unsigned LineNo, DISubroutineType *Ty,
unsigned VTableIndex = 0, int ThisAdjustment = 0,
@@ -950,7 +951,7 @@ namespace llvm {
/// \param Name The name of this common block.
/// \param File The file this common block is defined.
/// \param LineNo Line number.
- DICommonBlock *createCommonBlock(DIScope *Scope, DIGlobalVariable *decl,
+ LLVM_ABI DICommonBlock *createCommonBlock(DIScope *Scope, DIGlobalVariable *decl,
StringRef Name, DIFile *File,
unsigned LineNo);
@@ -959,7 +960,7 @@ namespace llvm {
/// \param Scope Namespace scope
/// \param Name Name of this namespace
/// \param ExportSymbols True for C++ inline namespaces.
- DINamespace *createNameSpace(DIScope *Scope, StringRef Name,
+ LLVM_ABI DINamespace *createNameSpace(DIScope *Scope, StringRef Name,
bool ExportSymbols);
/// This creates new descriptor for a module with the specified
@@ -979,7 +980,7 @@ namespace llvm {
/// when set to true, only Scope and Name are required
/// as this entry is just a hint for the debugger to find
/// the corresponding definition in the global scope.
- DIModule *createModule(DIScope *Scope, StringRef Name,
+ LLVM_ABI DIModule *createModule(DIScope *Scope, StringRef Name,
StringRef ConfigurationMacros, StringRef IncludePath,
StringRef APINotesFile = {}, DIFile *File = nullptr,
unsigned LineNo = 0, bool IsDecl = false);
@@ -990,7 +991,7 @@ namespace llvm {
/// \param Scope Lexical block.
/// \param File Source file.
/// \param Discriminator DWARF path discriminator value.
- DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
+ LLVM_ABI DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
unsigned Discriminator = 0);
/// This creates a descriptor for a lexical block with the
@@ -999,7 +1000,7 @@ namespace llvm {
/// \param File Source file.
/// \param Line Line number.
/// \param Col Column number.
- DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
+ LLVM_ABI DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
unsigned Line, unsigned Col);
/// Create a descriptor for an imported module.
@@ -1008,7 +1009,7 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
+ LLVM_ABI DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
DIFile *File, unsigned Line,
DINodeArray Elements = nullptr);
@@ -1018,7 +1019,7 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- DIImportedEntity *createImportedModule(DIScope *Context,
+ LLVM_ABI DIImportedEntity *createImportedModule(DIScope *Context,
DIImportedEntity *NS, DIFile *File,
unsigned Line,
DINodeArray Elements = nullptr);
@@ -1029,7 +1030,7 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
+ LLVM_ABI DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
DIFile *File, unsigned Line,
DINodeArray Elements = nullptr);
@@ -1040,7 +1041,7 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
+ LLVM_ABI DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
DIFile *File, unsigned Line,
StringRef Name = "",
DINodeArray Elements = nullptr);
@@ -1051,7 +1052,7 @@ namespace llvm {
/// \param Expr A complex location expression.
/// \param DL Debug info location.
/// \param InsertAtEnd Location for the new intrinsic.
- DbgInstPtr insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
+ LLVM_ABI DbgInstPtr insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
DIExpression *Expr, const DILocation *DL,
BasicBlock *InsertAtEnd);
@@ -1069,7 +1070,7 @@ namespace llvm {
/// \param DL Debug info location, usually: (line: 0,
/// column: 0, scope: var-decl-scope). See
/// getDebugValueLoc.
- DbgInstPtr insertDbgAssign(Instruction *LinkedInstr, Value *Val,
+ LLVM_ABI DbgInstPtr insertDbgAssign(Instruction *LinkedInstr, Value *Val,
DILocalVariable *SrcVar, DIExpression *ValExpr,
Value *Addr, DIExpression *AddrExpr,
const DILocation *DL);
@@ -1080,7 +1081,7 @@ namespace llvm {
/// \param Expr A complex location expression.
/// \param DL Debug info location.
/// \param InsertPt Location for the new intrinsic.
- DbgInstPtr insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
+ LLVM_ABI DbgInstPtr insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
DIExpression *Expr, const DILocation *DL,
InsertPosition InsertPt);
@@ -1088,7 +1089,7 @@ namespace llvm {
/// \param LabelInfo Label's debug info descriptor.
/// \param DL Debug info location.
/// \param InsertBefore Location for the new intrinsic.
- DbgInstPtr insertLabel(DILabel *LabelInfo, const DILocation *DL,
+ LLVM_ABI DbgInstPtr insertLabel(DILabel *LabelInfo, const DILocation *DL,
InsertPosition InsertPt);
/// Insert a new llvm.dbg.value intrinsic call.
@@ -1097,7 +1098,7 @@ namespace llvm {
/// \param Expr A complex location expression.
/// \param DL Debug info location.
/// \param InsertPt Location for the new intrinsic.
- DbgInstPtr insertDbgValueIntrinsic(llvm::Value *Val,
+ LLVM_ABI DbgInstPtr insertDbgValueIntrinsic(llvm::Value *Val,
DILocalVariable *VarInfo,
DIExpression *Expr, const DILocation *DL,
InsertPosition InsertPt);
@@ -1106,7 +1107,7 @@ namespace llvm {
///
/// If this creates a self reference, it may orphan some unresolved cycles
/// in the operands of \c T, so \a DIBuilder needs to track that.
- void replaceVTableHolder(DICompositeType *&T,
+ LLVM_ABI void replaceVTableHolder(DICompositeType *&T,
DIType *VTableHolder);
/// Replace arrays on a composite type.
@@ -1114,7 +1115,7 @@ namespace llvm {
/// If \c T is resolved, but the arrays aren't -- which can happen if \c T
/// has a self-reference -- \a DIBuilder needs to track the array to
/// resolve cycles.
- void replaceArrays(DICompositeType *&T, DINodeArray Elements,
+ LLVM_ABI void replaceArrays(DICompositeType *&T, DINodeArray Elements,
DINodeArray TParams = DINodeArray());
/// Replace a temporary node.
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index e399a2f29e545..c086caef1ad8b 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -68,7 +68,7 @@ class DataLayout {
Align ABIAlign;
Align PrefAlign;
- bool operator==(const PrimitiveSpec &Other) const;
+ LLVM_ABI bool operator==(const PrimitiveSpec &Other) const;
};
/// Pointer type specification.
@@ -83,7 +83,7 @@ class DataLayout {
/// Additionally, they may also be non-integral (i.e. containing additional
/// metadata such as bounds information/permissions).
bool IsNonIntegral;
- bool operator==(const PointerSpec &Other) const;
+ LLVM_ABI bool operator==(const PointerSpec &Other) const;
};
enum class FunctionPtrAlignType {
@@ -144,7 +144,7 @@ class DataLayout {
/// Searches for a pointer specification that matches the given address space.
/// Returns the default address space specification if not found.
- const PointerSpec &getPointerSpec(uint32_t AddrSpace) const;
+ LLVM_ABI const PointerSpec &getPointerSpec(uint32_t AddrSpace) const;
/// Sets or updates the specification for pointer in the given address space.
void setPointerSpec(uint32_t AddrSpace, uint32_t BitWidth, Align ABIAlign,
@@ -152,7 +152,7 @@ class DataLayout {
bool IsNonIntegral);
/// Internal helper to get alignment for integer of given bitwidth.
- Align getIntegerAlignment(uint32_t BitWidth, bool abi_or_pref) const;
+ LLVM_ABI Align getIntegerAlignment(uint32_t BitWidth, bool abi_or_pref) const;
/// Internal helper method that returns requested alignment for type.
Align getAlignment(Type *Ty, bool abi_or_pref) const;
@@ -175,24 +175,24 @@ class DataLayout {
public:
/// Constructs a DataLayout with default values.
- DataLayout();
+ LLVM_ABI DataLayout();
/// Constructs a DataLayout from a specification string.
/// WARNING: Aborts execution if the string is malformed. Use parse() instead.
- explicit DataLayout(StringRef LayoutString);
+ LLVM_ABI explicit DataLayout(StringRef LayoutString);
DataLayout(const DataLayout &DL) { *this = DL; }
- ~DataLayout(); // Not virtual, do not subclass this class
+ LLVM_ABI ~DataLayout(); // Not virtual, do not subclass this class
- DataLayout &operator=(const DataLayout &Other);
+ LLVM_ABI DataLayout &operator=(const DataLayout &Other);
- bool operator==(const DataLayout &Other) const;
+ LLVM_ABI bool operator==(const DataLayout &Other) const;
bool operator!=(const DataLayout &Other) const { return !(*this == Other); }
/// Parse a data layout string and return the layout. Return an error
/// description on failure.
- static Expected<DataLayout> parse(StringRef LayoutString);
+ LLVM_ABI static Expected<DataLayout> parse(StringRef LayoutString);
/// Layout endianness...
bool isLittleEndian() const { return !BigEndian; }
@@ -303,7 +303,7 @@ class DataLayout {
llvm_unreachable("invalid mangling mode");
}
- static const char *getManglingComponent(const Triple &T);
+ LLVM_ABI static const char *getManglingComponent(const Triple &T);
/// Returns true if the specified type fits in a native integer type
/// supported by the CPU.
@@ -318,12 +318,12 @@ class DataLayout {
}
/// Layout pointer alignment
- Align getPointerABIAlignment(unsigned AS) const;
+ LLVM_ABI Align getPointerABIAlignment(unsigned AS) const;
/// Return target's alignment for stack-based pointers
/// FIXME: The defaults need to be removed once all of
/// the backends/clients are updated.
- Align getPointerPrefAlignment(unsigned AS = 0) const;
+ LLVM_ABI Align getPointerPrefAlignment(unsigned AS = 0) const;
/// The pointer representation size in bytes, rounded up to a whole number of
/// bytes. The difference between this function and getAddressSize() is that
@@ -333,7 +333,7 @@ class DataLayout {
/// \sa DataLayout::getAddressSizeInBits
/// FIXME: The defaults need to be removed once all of
/// the backends/clients are updated.
- unsigned getPointerSize(unsigned AS = 0) const;
+ LLVM_ABI unsigned getPointerSize(unsigned AS = 0) const;
/// The index size in bytes used for address calculation, rounded up to a
/// whole number of bytes. This not only defines the size used in
@@ -344,7 +344,7 @@ class DataLayout {
/// getPointerSize() returns 16, but getIndexSize() returns 8.
/// To help with code understanding, the alias getAddressSize() can be used
/// instead of getIndexSize() to clarify that an address width is needed.
- unsigned getIndexSize(unsigned AS) const;
+ LLVM_ABI unsigned getIndexSize(unsigned AS) const;
/// The integral size of a pointer in a given address space in bytes, which
/// is defined to be the same as getIndexSize(). This exists as a separate
@@ -413,13 +413,13 @@ class DataLayout {
/// If this function is called with a vector of pointers, then the type size
/// of the pointer is returned. This should only be called with a pointer or
/// vector of pointers.
- unsigned getPointerTypeSizeInBits(Type *) const;
+ LLVM_ABI unsigned getPointerTypeSizeInBits(Type *) const;
/// The size in bits of the index used in GEP calculation for this type.
/// The function should be called with pointer or vector of pointers type.
/// This is defined to return the same value as getAddressSizeInBits(),
/// but separate functions exist for code clarity.
- unsigned getIndexTypeSizeInBits(Type *Ty) const;
+ LLVM_ABI unsigned getIndexTypeSizeInBits(Type *Ty) const;
/// The size in bits of an address for this type.
/// This is defined to return the same value as getIndexTypeSizeInBits(),
@@ -519,7 +519,7 @@ class DataLayout {
}
/// Returns the minimum ABI-required alignment for the specified type.
- Align getABITypeAlign(Type *Ty) const;
+ LLVM_ABI Align getABITypeAlign(Type *Ty) const;
/// Helper function to return `Alignment` if it's set or the result of
/// `getABITypeAlign(Ty)`, in any case the result is a valid alignment.
@@ -538,19 +538,19 @@ class DataLayout {
/// type.
///
/// This is always at least as good as the ABI alignment.
- Align getPrefTypeAlign(Type *Ty) const;
+ LLVM_ABI Align getPrefTypeAlign(Type *Ty) const;
/// Returns an integer type with size at least as big as that of a
/// pointer in the given address space.
- IntegerType *getIntPtrType(LLVMContext &C, unsigned AddressSpace = 0) const;
+ LLVM_ABI IntegerType *getIntPtrType(LLVMContext &C, unsigned AddressSpace = 0) const;
/// Returns an integer (vector of integer) type with size at least as
/// big as that of a pointer of the given pointer (vector of pointer) type.
- Type *getIntPtrType(Type *) const;
+ LLVM_ABI Type *getIntPtrType(Type *) const;
/// Returns the smallest integer type with size at least as big as
/// Width bits.
- Type *getSmallestLegalIntType(LLVMContext &C, unsigned Width = 0) const;
+ LLVM_ABI Type *getSmallestLegalIntType(LLVMContext &C, unsigned Width = 0) const;
/// Returns the largest legal integer type, or null if none are set.
Type *getLargestLegalIntType(LLVMContext &C) const {
@@ -560,12 +560,12 @@ class DataLayout {
/// Returns the size of largest legal integer type size, or 0 if none
/// are set.
- unsigned getLargestLegalIntTypeSizeInBits() const;
+ LLVM_ABI unsigned getLargestLegalIntTypeSizeInBits() const;
/// Returns the type of a GEP index in \p AddressSpace.
/// If it was not specified explicitly, it will be the integer type of the
/// pointer width - IntPtrType.
- IntegerType *getIndexType(LLVMContext &C, unsigned AddressSpace) const;
+ LLVM_ABI IntegerType *getIndexType(LLVMContext &C, unsigned AddressSpace) const;
/// Returns the type of an address in \p AddressSpace
IntegerType *getAddressType(LLVMContext &C, unsigned AddressSpace) const {
return getIndexType(C, AddressSpace);
@@ -574,7 +574,7 @@ class DataLayout {
/// Returns the type of a GEP index.
/// If it was not specified explicitly, it will be the integer type of the
/// pointer width - IntPtrType.
- Type *getIndexType(Type *PtrTy) const;
+ LLVM_ABI Type *getIndexType(Type *PtrTy) const;
/// Returns the type of an address in \p AddressSpace
Type *getAddressType(Type *PtrTy) const { return getIndexType(PtrTy); }
@@ -583,28 +583,28 @@ class DataLayout {
///
/// Note that this takes the element type, not the pointer type.
/// This is used to implement getelementptr.
- int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef<Value *> Indices) const;
+ LLVM_ABI int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef<Value *> Indices) const;
/// Get GEP indices to access Offset inside ElemTy. ElemTy is updated to be
/// the result element type and Offset to be the residual offset.
- SmallVector<APInt> getGEPIndicesForOffset(Type *&ElemTy, APInt &Offset) const;
+ LLVM_ABI SmallVector<APInt> getGEPIndicesForOffset(Type *&ElemTy, APInt &Offset) const;
/// Get single GEP index to access Offset inside ElemTy. Returns std::nullopt
/// if index cannot be computed, e.g. because the type is not an aggregate.
/// ElemTy is updated to be the result element type and Offset to be the
/// residual offset.
- std::optional<APInt> getGEPIndexForOffset(Type *&ElemTy, APInt &Offset) const;
+ LLVM_ABI std::optional<APInt> getGEPIndexForOffset(Type *&ElemTy, APInt &Offset) const;
/// Returns a StructLayout object, indicating the alignment of the
/// struct, its size, and the offsets of its fields.
///
/// Note that this information is lazily cached.
- const StructLayout *getStructLayout(StructType *Ty) const;
+ LLVM_ABI const StructLayout *getStructLayout(StructType *Ty) const;
/// Returns the preferred alignment of the specified global.
///
/// This includes an explicitly requested alignment (if the global has one).
- Align getPreferredAlign(const GlobalVariable *GV) const;
+ LLVM_ABI Align getPreferredAlign(const GlobalVariable *GV) const;
};
inline DataLayout *unwrap(LLVMTargetDataRef P) {
@@ -638,7 +638,7 @@ class StructLayout final : private TrailingObjects<StructLayout, TypeSize> {
/// Given a valid byte offset into the structure, returns the structure
/// index that contains it.
- unsigned getElementContainingOffset(uint64_t FixedOffset) const;
+ LLVM_ABI unsigned getElementContainingOffset(uint64_t FixedOffset) const;
MutableArrayRef<TypeSize> getMemberOffsets() {
return getTrailingObjects(NumElements);
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index c47738a6442e6..8e4ea005a1116 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -16,6 +16,7 @@
#ifndef LLVM_IR_DEBUGINFO_H
#define LLVM_IR_DEBUGINFO_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
@@ -40,37 +41,37 @@ class Module;
/// Finds dbg.declare intrinsics declaring local variables as living in the
/// memory that 'V' points to.
-TinyPtrVector<DbgDeclareInst *> findDbgDeclares(Value *V);
+LLVM_ABI TinyPtrVector<DbgDeclareInst *> findDbgDeclares(Value *V);
/// As above, for DVRDeclares.
-TinyPtrVector<DbgVariableRecord *> findDVRDeclares(Value *V);
+LLVM_ABI TinyPtrVector<DbgVariableRecord *> findDVRDeclares(Value *V);
/// As above, for DVRValues.
-TinyPtrVector<DbgVariableRecord *> findDVRValues(Value *V);
+LLVM_ABI TinyPtrVector<DbgVariableRecord *> findDVRValues(Value *V);
/// Finds the llvm.dbg.value intrinsics describing a value.
-void findDbgValues(
+LLVM_ABI void findDbgValues(
SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V,
SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords = nullptr);
/// Finds the debug info intrinsics describing a value.
-void findDbgUsers(
+LLVM_ABI void findDbgUsers(
SmallVectorImpl<DbgVariableIntrinsic *> &DbgInsts, Value *V,
SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords = nullptr);
/// Find subprogram that is enclosing this scope.
-DISubprogram *getDISubprogram(const MDNode *Scope);
+LLVM_ABI DISubprogram *getDISubprogram(const MDNode *Scope);
/// Produce a DebugLoc to use for each dbg.declare that is promoted to a
/// dbg.value.
-DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII);
-DebugLoc getDebugValueLoc(DbgVariableRecord *DVR);
+LLVM_ABI DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII);
+LLVM_ABI DebugLoc getDebugValueLoc(DbgVariableRecord *DVR);
/// Strip debug info in the module if it exists.
///
/// To do this, we remove all calls to the debugger intrinsics and any named
/// metadata for debugging. We also remove debug locations for instructions.
/// Return true if module is modified.
-bool StripDebugInfo(Module &M);
-bool stripDebugInfo(Function &F);
+LLVM_ABI bool StripDebugInfo(Module &M);
+LLVM_ABI bool stripDebugInfo(Function &F);
/// Downgrade the debug info in a module to contain only line table information.
///
@@ -82,17 +83,17 @@ bool stripDebugInfo(Function &F);
/// 4) Create a new CU debug info, and similarly for every metadata node
/// that's reachable from the CU debug info.
/// All debug type metadata nodes are unreachable and garbage collected.
-bool stripNonLineTableDebugInfo(Module &M);
+LLVM_ABI bool stripNonLineTableDebugInfo(Module &M);
/// Update the debug locations contained within the MD_loop metadata attached
/// to the instruction \p I, if one exists. \p Updater is applied to Metadata
/// operand in the MD_loop metadata: the returned value is included in the
/// updated loop metadata node if it is non-null.
-void updateLoopMetadataDebugLocations(
+LLVM_ABI void updateLoopMetadataDebugLocations(
Instruction &I, function_ref<Metadata *(Metadata *)> Updater);
/// Return Debug Info Metadata Version by checking module flags.
-unsigned getDebugMetadataVersionFromModule(const Module &M);
+LLVM_ABI unsigned getDebugMetadataVersionFromModule(const Module &M);
/// Utility to find all debug info in a module.
///
@@ -105,23 +106,23 @@ unsigned getDebugMetadataVersionFromModule(const Module &M);
class DebugInfoFinder {
public:
/// Process entire module and collect debug info anchors.
- void processModule(const Module &M);
+ LLVM_ABI void processModule(const Module &M);
/// Process a single instruction and collect debug info anchors.
- void processInstruction(const Module &M, const Instruction &I);
+ LLVM_ABI void processInstruction(const Module &M, const Instruction &I);
/// Process a DILocalVariable.
- void processVariable(DILocalVariable *DVI);
+ LLVM_ABI void processVariable(DILocalVariable *DVI);
/// Process debug info location.
- void processLocation(const Module &M, const DILocation *Loc);
+ LLVM_ABI void processLocation(const Module &M, const DILocation *Loc);
/// Process a DbgRecord (e.g, treat a DbgVariableRecord like a
/// DbgVariableIntrinsic).
- void processDbgRecord(const Module &M, const DbgRecord &DR);
+ LLVM_ABI void processDbgRecord(const Module &M, const DbgRecord &DR);
/// Process subprogram.
- void processSubprogram(DISubprogram *SP);
+ LLVM_ABI void processSubprogram(DISubprogram *SP);
/// Clear all lists.
- void reset();
+ LLVM_ABI void reset();
private:
void processCompileUnit(DICompileUnit *CU);
@@ -190,7 +191,7 @@ using AssignmentInstRange =
/// as an attachment.
/// Iterators invalidated by adding or removing DIAssignID metadata to/from any
/// instruction (including by deleting or cloning instructions).
-AssignmentInstRange getAssignmentInsts(DIAssignID *ID);
+LLVM_ABI AssignmentInstRange getAssignmentInsts(DIAssignID *ID);
/// Return a range of instructions (typically just one) that perform the
/// assignment that \p DAI encodes.
/// Iterators invalidated by adding or removing DIAssignID metadata to/from any
@@ -226,7 +227,7 @@ class DbgAssignIt
using AssignmentMarkerRange = iterator_range<DbgAssignIt>;
/// Return a range of dbg.assign intrinsics which use \ID as an operand.
/// Iterators invalidated by deleting an intrinsic contained in this range.
-AssignmentMarkerRange getAssignmentMarkers(DIAssignID *ID);
+LLVM_ABI AssignmentMarkerRange getAssignmentMarkers(DIAssignID *ID);
/// Return a range of dbg.assign intrinsics for which \p Inst performs the
/// assignment they encode.
/// Iterators invalidated by deleting an intrinsic contained in this range.
@@ -245,13 +246,13 @@ getDVRAssignmentMarkers(const Instruction *Inst) {
}
/// Delete the llvm.dbg.assign intrinsics linked to \p Inst.
-void deleteAssignmentMarkers(const Instruction *Inst);
+LLVM_ABI void deleteAssignmentMarkers(const Instruction *Inst);
/// Replace all uses (and attachments) of \p Old with \p New.
-void RAUW(DIAssignID *Old, DIAssignID *New);
+LLVM_ABI void RAUW(DIAssignID *Old, DIAssignID *New);
/// Remove all Assignment Tracking related intrinsics and metadata from \p F.
-void deleteAll(Function *F);
+LLVM_ABI void deleteAll(Function *F);
/// Calculate the fragment of the variable in \p DAI covered
/// from (Dest + SliceOffsetInBits) to
@@ -262,18 +263,18 @@ void deleteAll(Function *F);
/// variable size) in DAI.
///
/// Result contains a zero-sized fragment if there's no intersect.
-bool calculateFragmentIntersect(
+LLVM_ABI bool calculateFragmentIntersect(
const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
uint64_t SliceSizeInBits, const DbgAssignIntrinsic *DbgAssign,
std::optional<DIExpression::FragmentInfo> &Result);
-bool calculateFragmentIntersect(
+LLVM_ABI bool calculateFragmentIntersect(
const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign,
std::optional<DIExpression::FragmentInfo> &Result);
/// Replace DIAssignID uses and attachments with IDs from \p Map.
/// If an ID is unmapped a new ID is generated and added to \p Map.
-void remapAssignID(DenseMap<DIAssignID *, DIAssignID *> &Map, Instruction &I);
+LLVM_ABI void remapAssignID(DenseMap<DIAssignID *, DIAssignID *> &Map, Instruction &I);
/// Helper struct for trackAssignments, below. We don't use the similar
/// DebugVariable class because trackAssignments doesn't (yet?) understand
@@ -330,7 +331,7 @@ using StorageToVarsMap =
/// Track assignments to \p Vars between \p Start and \p End.
-void trackAssignments(Function::iterator Start, Function::iterator End,
+LLVM_ABI void trackAssignments(Function::iterator Start, Function::iterator End,
const StorageToVarsMap &Vars, const DataLayout &DL,
bool DebugPrints = false);
@@ -350,11 +351,11 @@ struct AssignmentInfo {
SizeInBits == DL.getTypeSizeInBits(Base->getAllocatedType())) {}
};
-std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
+LLVM_ABI std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
const MemIntrinsic *I);
-std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
+LLVM_ABI std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
const StoreInst *SI);
-std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
+LLVM_ABI std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
const AllocaInst *AI);
} // end namespace at
@@ -371,12 +372,12 @@ class AssignmentTrackingPass : public PassInfoMixin<AssignmentTrackingPass> {
bool runOnFunction(Function &F);
public:
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
/// Return true if assignment tracking is enabled for module \p M.
-bool isAssignmentTrackingEnabled(const Module &M);
+LLVM_ABI bool isAssignmentTrackingEnabled(const Module &M);
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index d82c69aebb026..f92fa77167e38 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_DEBUGINFOMETADATA_H
#define LLVM_IR_DEBUGINFOMETADATA_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/PointerUnion.h"
@@ -68,7 +69,7 @@ enum Tag : uint16_t;
class DbgVariableIntrinsic;
class DbgVariableRecord;
-extern cl::opt<bool> EnableFSDiscriminator;
+LLVM_ABI extern cl::opt<bool> EnableFSDiscriminator;
class DITypeRefArray {
const MDTuple *N = nullptr;
@@ -165,7 +166,7 @@ class DINode : public MDNode {
void setTag(unsigned Tag) { SubclassData16 = Tag; }
public:
- dwarf::Tag getTag() const;
+ LLVM_ABI dwarf::Tag getTag() const;
/// Debug info flags.
///
@@ -181,14 +182,14 @@ class DINode : public MDNode {
LLVM_MARK_AS_BITMASK_ENUM(FlagLargest)
};
- static DIFlags getFlag(StringRef Flag);
- static StringRef getFlagString(DIFlags Flag);
+ LLVM_ABI static DIFlags getFlag(StringRef Flag);
+ LLVM_ABI static StringRef getFlagString(DIFlags Flag);
/// Split up a flags bitfield.
///
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
/// any remaining (unrecognized) bits.
- static DIFlags splitFlags(DIFlags Flags,
+ LLVM_ABI static DIFlags splitFlags(DIFlags Flags,
SmallVectorImpl<DIFlags> &SplitFlags);
static bool classof(const Metadata *MD) {
@@ -257,7 +258,7 @@ class GenericDINode : public DINode {
DwarfOps, Storage, ShouldCreate);
}
- static GenericDINode *getImpl(LLVMContext &Context, unsigned Tag,
+ LLVM_ABI static GenericDINode *getImpl(LLVMContext &Context, unsigned Tag,
MDString *Header, ArrayRef<Metadata *> DwarfOps,
StorageType Storage, bool ShouldCreate = true);
@@ -281,7 +282,7 @@ class GenericDINode : public DINode {
/// Return a (temporary) clone of this.
TempGenericDINode clone() const { return cloneImpl(); }
- dwarf::Tag getTag() const;
+ LLVM_ABI dwarf::Tag getTag() const;
StringRef getHeader() const { return getStringOperand(0); }
MDString *getRawHeader() const { return getOperandAs<MDString>(0); }
@@ -317,7 +318,7 @@ class DIAssignID : public MDNode {
~DIAssignID() { dropAllReferences(); }
- static DIAssignID *getImpl(LLVMContext &Context, StorageType Storage,
+ LLVM_ABI static DIAssignID *getImpl(LLVMContext &Context, StorageType Storage,
bool ShouldCreate = true);
TempDIAssignID cloneImpl() const { return getTemporary(getContext()); }
@@ -352,15 +353,15 @@ class DISubrange : public DINode {
~DISubrange() = default;
- static DISubrange *getImpl(LLVMContext &Context, int64_t Count,
+ LLVM_ABI static DISubrange *getImpl(LLVMContext &Context, int64_t Count,
int64_t LowerBound, StorageType Storage,
bool ShouldCreate = true);
- static DISubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
+ LLVM_ABI static DISubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
int64_t LowerBound, StorageType Storage,
bool ShouldCreate = true);
- static DISubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
+ LLVM_ABI static DISubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
Metadata *LowerBound, Metadata *UpperBound,
Metadata *Stride, StorageType Storage,
bool ShouldCreate = true);
@@ -394,13 +395,13 @@ class DISubrange : public DINode {
typedef PointerUnion<ConstantInt *, DIVariable *, DIExpression *> BoundType;
- BoundType getCount() const;
+ LLVM_ABI BoundType getCount() const;
- BoundType getLowerBound() const;
+ LLVM_ABI BoundType getLowerBound() const;
- BoundType getUpperBound() const;
+ LLVM_ABI BoundType getUpperBound() const;
- BoundType getStride() const;
+ LLVM_ABI BoundType getStride() const;
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DISubrangeKind;
@@ -416,7 +417,7 @@ class DIGenericSubrange : public DINode {
~DIGenericSubrange() = default;
- static DIGenericSubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
+ LLVM_ABI static DIGenericSubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
Metadata *LowerBound, Metadata *UpperBound,
Metadata *Stride, StorageType Storage,
bool ShouldCreate = true);
@@ -441,10 +442,10 @@ class DIGenericSubrange : public DINode {
using BoundType = PointerUnion<DIVariable *, DIExpression *>;
- BoundType getCount() const;
- BoundType getLowerBound() const;
- BoundType getUpperBound() const;
- BoundType getStride() const;
+ LLVM_ABI BoundType getCount() const;
+ LLVM_ABI BoundType getLowerBound() const;
+ LLVM_ABI BoundType getUpperBound() const;
+ LLVM_ABI BoundType getStride() const;
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DIGenericSubrangeKind;
@@ -460,7 +461,7 @@ class DIEnumerator : public DINode {
friend class MDNode;
APInt Value;
- DIEnumerator(LLVMContext &C, StorageType Storage, const APInt &Value,
+ LLVM_ABI DIEnumerator(LLVMContext &C, StorageType Storage, const APInt &Value,
bool IsUnsigned, ArrayRef<Metadata *> Ops);
DIEnumerator(LLVMContext &C, StorageType Storage, int64_t Value,
bool IsUnsigned, ArrayRef<Metadata *> Ops)
@@ -474,7 +475,7 @@ class DIEnumerator : public DINode {
return getImpl(Context, Value, IsUnsigned,
getCanonicalMDString(Context, Name), Storage, ShouldCreate);
}
- static DIEnumerator *getImpl(LLVMContext &Context, const APInt &Value,
+ LLVM_ABI static DIEnumerator *getImpl(LLVMContext &Context, const APInt &Value,
bool IsUnsigned, MDString *Name,
StorageType Storage, bool ShouldCreate = true);
@@ -529,8 +530,8 @@ class DIScope : public DINode {
inline StringRef getDirectory() const;
inline std::optional<StringRef> getSource() const;
- StringRef getName() const;
- DIScope *getScope() const;
+ LLVM_ABI StringRef getName() const;
+ LLVM_ABI DIScope *getScope() const;
/// Return the raw underlying file.
///
@@ -630,7 +631,7 @@ class DIFile : public DIScope {
Source ? MDString::get(Context, *Source) : nullptr, Storage,
ShouldCreate);
}
- static DIFile *getImpl(LLVMContext &Context, MDString *Filename,
+ LLVM_ABI static DIFile *getImpl(LLVMContext &Context, MDString *Filename,
MDString *Directory,
std::optional<ChecksumInfo<MDString *>> CS,
MDString *Source, StorageType Storage,
@@ -675,8 +676,8 @@ class DIFile : public DIScope {
}
MDString *getRawSource() const { return Source; }
- static StringRef getChecksumKindAsString(ChecksumKind CSKind);
- static std::optional<ChecksumKind> getChecksumKind(StringRef CSKindStr);
+ LLVM_ABI static StringRef getChecksumKindAsString(ChecksumKind CSKind);
+ LLVM_ABI static std::optional<ChecksumKind> getChecksumKind(StringRef CSKindStr);
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DIFileKind;
@@ -754,7 +755,7 @@ class DIType : public DIScope {
unsigned getLine() const { return Line; }
uint64_t getSizeInBits() const { return SizeInBits; }
- uint32_t getAlignInBits() const;
+ LLVM_ABI uint32_t getAlignInBits() const;
uint32_t getAlignInBytes() const { return getAlignInBits() / CHAR_BIT; }
uint64_t getOffsetInBits() const { return OffsetInBits; }
uint32_t getNumExtraInhabitants() const { return NumExtraInhabitants; }
@@ -855,7 +856,7 @@ class DIBasicType : public DIType {
SizeInBits, AlignInBits, Encoding, NumExtraInhabitants,
Flags, Storage, ShouldCreate);
}
- static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag,
+ LLVM_ABI static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag,
MDString *Name, uint64_t SizeInBits,
uint32_t AlignInBits, unsigned Encoding,
uint32_t NumExtraInhabitants, DIFlags Flags,
@@ -905,7 +906,7 @@ class DIBasicType : public DIType {
/// Return the signedness of this type, or std::nullopt if this type is
/// neither signed nor unsigned.
- std::optional<Signedness> getSignedness() const;
+ LLVM_ABI std::optional<Signedness> getSignedness() const;
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DIBasicTypeKind ||
@@ -963,7 +964,7 @@ class DIFixedPointType : public DIBasicType {
SizeInBits, AlignInBits, Encoding, Flags, Kind, Factor,
Numerator, Denominator, Storage, ShouldCreate);
}
- static DIFixedPointType *
+ LLVM_ABI static DIFixedPointType *
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name,
uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding,
DIFlags Flags, unsigned Kind, int Factor, APInt Numerator,
@@ -986,8 +987,8 @@ class DIFixedPointType : public DIBasicType {
LastFixedPointKind = FixedPointRational,
};
- static std::optional<FixedPointKind> getFixedPointKind(StringRef Str);
- static const char *fixedPointKindString(FixedPointKind);
+ LLVM_ABI static std::optional<FixedPointKind> getFixedPointKind(StringRef Str);
+ LLVM_ABI static const char *fixedPointKindString(FixedPointKind);
DEFINE_MDNODE_GET(DIFixedPointType,
(unsigned Tag, MDString *Name, uint64_t SizeInBits,
@@ -1010,7 +1011,7 @@ class DIFixedPointType : public DIBasicType {
bool isDecimal() const { return Kind == FixedPointDecimal; }
bool isRational() const { return Kind == FixedPointRational; }
- bool isSigned() const;
+ LLVM_ABI bool isSigned() const;
FixedPointKind getKind() const { return static_cast<FixedPointKind>(Kind); }
@@ -1062,7 +1063,7 @@ class DIStringType : public DIType {
StringLength, StrLenExp, StrLocationExp, SizeInBits,
AlignInBits, Encoding, Storage, ShouldCreate);
}
- static DIStringType *getImpl(LLVMContext &Context, unsigned Tag,
+ LLVM_ABI static DIStringType *getImpl(LLVMContext &Context, unsigned Tag,
MDString *Name, Metadata *StringLength,
Metadata *StrLenExp, Metadata *StrLocationExp,
uint64_t SizeInBits, uint32_t AlignInBits,
@@ -1193,7 +1194,7 @@ class DIDerivedType : public DIType {
DWARFAddressSpace, PtrAuthData, Flags, ExtraData,
Annotations.get(), Storage, ShouldCreate);
}
- static DIDerivedType *
+ LLVM_ABI static DIDerivedType *
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
unsigned Line, Metadata *Scope, Metadata *BaseType,
uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
@@ -1247,7 +1248,7 @@ class DIDerivedType : public DIType {
return DWARFAddressSpace;
}
- std::optional<PtrAuthData> getPtrAuthData() const;
+ LLVM_ABI std::optional<PtrAuthData> getPtrAuthData() const;
/// Get extra data associated with this derived type.
///
@@ -1273,19 +1274,19 @@ class DIDerivedType : public DIType {
/// Get casted version of extra data.
/// @{
- DIType *getClassType() const;
+ LLVM_ABI DIType *getClassType() const;
DIObjCProperty *getObjCProperty() const {
return dyn_cast_or_null<DIObjCProperty>(getExtraData());
}
- uint32_t getVBPtrOffset() const;
+ LLVM_ABI uint32_t getVBPtrOffset() const;
- Constant *getStorageOffsetInBits() const;
+ LLVM_ABI Constant *getStorageOffsetInBits() const;
- Constant *getConstant() const;
+ LLVM_ABI Constant *getConstant() const;
- Constant *getDiscriminantValue() const;
+ LLVM_ABI Constant *getDiscriminantValue() const;
/// @}
static bool classof(const Metadata *MD) {
@@ -1330,7 +1331,7 @@ class DISubrangeType : public DIType {
UpperBound, Stride, Bias, Storage, ShouldCreate);
}
- static DISubrangeType *getImpl(LLVMContext &Context, MDString *Name,
+ LLVM_ABI static DISubrangeType *getImpl(LLVMContext &Context, MDString *Name,
Metadata *File, unsigned Line, Metadata *Scope,
uint64_t SizeInBits, uint32_t AlignInBits,
DIFlags Flags, Metadata *BaseType,
@@ -1345,7 +1346,7 @@ class DISubrangeType : public DIType {
getRawUpperBound(), getRawStride(), getRawBias());
}
- BoundType convertRawToBound(Metadata *IN) const;
+ LLVM_ABI BoundType convertRawToBound(Metadata *IN) const;
public:
DEFINE_MDNODE_GET(DISubrangeType,
@@ -1448,7 +1449,7 @@ class DICompositeType : public DIType {
Associated, Allocated, Rank, Annotations.get(), Specification,
NumExtraInhabitants, BitStride, Storage, ShouldCreate);
}
- static DICompositeType *
+ LLVM_ABI static DICompositeType *
getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *File,
unsigned Line, Metadata *Scope, Metadata *BaseType,
uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
@@ -1518,7 +1519,7 @@ class DICompositeType : public DIType {
/// a new node.
///
/// Else, returns \c nullptr.
- static DICompositeType *
+ LLVM_ABI static DICompositeType *
getODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits,
@@ -1529,7 +1530,7 @@ class DICompositeType : public DIType {
Metadata *Discriminator, Metadata *DataLocation,
Metadata *Associated, Metadata *Allocated, Metadata *Rank,
Metadata *Annotations, Metadata *BitStride);
- static DICompositeType *getODRTypeIfExists(LLVMContext &Context,
+ LLVM_ABI static DICompositeType *getODRTypeIfExists(LLVMContext &Context,
MDString &Identifier);
/// Build a DICompositeType with the given ODR identifier.
@@ -1541,7 +1542,7 @@ class DICompositeType : public DIType {
///
/// If not \a LLVMContext::isODRUniquingDebugTypes(), this function returns
/// nullptr.
- static DICompositeType *
+ LLVM_ABI static DICompositeType *
buildODRType(LLVMContext &Context, MDString &Identifier, unsigned Tag,
MDString *Name, Metadata *File, unsigned Line, Metadata *Scope,
Metadata *BaseType, uint64_t SizeInBits, uint32_t AlignInBits,
@@ -1674,7 +1675,7 @@ class DISubroutineType : public DIType {
bool ShouldCreate = true) {
return getImpl(Context, Flags, CC, TypeArray.get(), Storage, ShouldCreate);
}
- static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
+ LLVM_ABI static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
uint8_t CC, Metadata *TypeArray,
StorageType Storage,
bool ShouldCreate = true);
@@ -1734,10 +1735,10 @@ class DICompileUnit : public DIScope {
LastDebugNameTableKind = Apple
};
- static std::optional<DebugEmissionKind> getEmissionKind(StringRef Str);
- static const char *emissionKindString(DebugEmissionKind EK);
- static std::optional<DebugNameTableKind> getNameTableKind(StringRef Str);
- static const char *nameTableKindString(DebugNameTableKind PK);
+ LLVM_ABI static std::optional<DebugEmissionKind> getEmissionKind(StringRef Str);
+ LLVM_ABI static const char *emissionKindString(DebugEmissionKind EK);
+ LLVM_ABI static std::optional<DebugNameTableKind> getNameTableKind(StringRef Str);
+ LLVM_ABI static const char *nameTableKindString(DebugNameTableKind PK);
private:
unsigned SourceLanguage;
@@ -1778,7 +1779,7 @@ class DICompileUnit : public DIScope {
getCanonicalMDString(Context, SysRoot),
getCanonicalMDString(Context, SDK), Storage, ShouldCreate);
}
- static DICompileUnit *
+ LLVM_ABI static DICompileUnit *
getImpl(LLVMContext &Context, unsigned SourceLanguage, Metadata *File,
MDString *Producer, bool IsOptimized, MDString *Flags,
unsigned RuntimeVersion, MDString *SplitDebugFilename,
@@ -1931,11 +1932,11 @@ class DILocalScope : public DIScope {
///
/// Return this if it's an \a DISubprogram; otherwise, look up the scope
/// chain.
- DISubprogram *getSubprogram() const;
+ LLVM_ABI DISubprogram *getSubprogram() const;
/// Traverses the scope chain rooted at RootScope until it hits a Subprogram,
/// recreating the chain with "NewSP" instead.
- static DILocalScope *
+ LLVM_ABI static DILocalScope *
cloneScopeForSubprogram(DILocalScope &RootScope, DISubprogram &NewSP,
LLVMContext &Ctx,
DenseMap<const MDNode *, MDNode *> &Cache);
@@ -1944,7 +1945,7 @@ class DILocalScope : public DIScope {
///
/// Return this if it's not a \a DILexicalBlockFIle; otherwise, look up the
/// scope chain.
- DILocalScope *getNonLexicalBlockFileScope() const;
+ LLVM_ABI DILocalScope *getNonLexicalBlockFileScope() const;
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DISubprogramKind ||
@@ -1978,18 +1979,18 @@ class DISubprogram : public DILocalScope {
LLVM_MARK_AS_BITMASK_ENUM(SPFlagLargest)
};
- static DISPFlags getFlag(StringRef Flag);
- static StringRef getFlagString(DISPFlags Flag);
+ LLVM_ABI static DISPFlags getFlag(StringRef Flag);
+ LLVM_ABI static StringRef getFlagString(DISPFlags Flag);
/// Split up a flags bitfield for easier printing.
///
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
/// any remaining (unrecognized) bits.
- static DISPFlags splitFlags(DISPFlags Flags,
+ LLVM_ABI static DISPFlags splitFlags(DISPFlags Flags,
SmallVectorImpl<DISPFlags> &SplitFlags);
// Helper for converting old bitfields to new flags word.
- static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition,
+ LLVM_ABI static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition,
bool IsOptimized,
unsigned Virtuality = SPFlagNonvirtual,
bool IsMainSubprogram = false);
@@ -2021,7 +2022,7 @@ class DISubprogram : public DILocalScope {
getCanonicalMDString(Context, TargetFuncName),
Storage, ShouldCreate);
}
- static DISubprogram *
+ LLVM_ABI static DISubprogram *
getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
unsigned ScopeLine, Metadata *ContainingType, unsigned VirtualIndex,
@@ -2218,7 +2219,7 @@ class DISubprogram : public DILocalScope {
/// Check if this subprogram describes the given function.
///
/// FIXME: Should this be looking through bitcasts?
- bool describes(const Function *F) const;
+ LLVM_ABI bool describes(const Function *F) const;
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DISubprogramKind;
@@ -2245,7 +2246,7 @@ class DILocation : public MDNode {
ArrayRef<Metadata *> MDs, bool ImplicitCode);
~DILocation() { dropAllReferences(); }
- static DILocation *getImpl(LLVMContext &Context, unsigned Line,
+ LLVM_ABI static DILocation *getImpl(LLVMContext &Context, unsigned Line,
unsigned Column, Metadata *Scope,
Metadata *InlinedAt, bool ImplicitCode,
uint64_t AtomGroup, uint8_t AtomRank,
@@ -2443,13 +2444,13 @@ class DILocation : public MDNode {
/// use the scope of any location.
///
/// \p LocA \p LocB: The locations to be merged.
- static DILocation *getMergedLocation(DILocation *LocA, DILocation *LocB);
+ LLVM_ABI static DILocation *getMergedLocation(DILocation *LocA, DILocation *LocB);
/// Try to combine the vector of locations passed as input in a single one.
/// This function applies getMergedLocation() repeatedly left-to-right.
///
/// \p Locs: The locations to be merged.
- static DILocation *getMergedLocations(ArrayRef<DILocation *> Locs);
+ LLVM_ABI static DILocation *getMergedLocations(ArrayRef<DILocation *> Locs);
/// Return the masked discriminator value for an input discrimnator value D
/// (i.e. zero out the (B+1)-th and above bits for D (B is 0-base).
@@ -2498,11 +2499,11 @@ class DILocation : public MDNode {
/// The return is std::nullopt if the values cannot be encoded in 32 bits -
/// for example, values for BD or DF larger than 12 bits. Otherwise, the
/// return is the encoded value.
- static std::optional<unsigned> encodeDiscriminator(unsigned BD, unsigned DF,
+ LLVM_ABI static std::optional<unsigned> encodeDiscriminator(unsigned BD, unsigned DF,
unsigned CI);
/// Raw decoder for values in an encoded discriminator D.
- static void decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF,
+ LLVM_ABI static void decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF,
unsigned &CI);
/// Returns the duplication factor for a given encoded discriminator \p D, or
@@ -2537,7 +2538,7 @@ class DILocation : public MDNode {
class DILexicalBlockBase : public DILocalScope {
protected:
- DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage,
+ LLVM_ABI DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage,
ArrayRef<Metadata *> Ops);
~DILexicalBlockBase() = default;
@@ -2584,7 +2585,7 @@ class DILexicalBlock : public DILexicalBlockBase {
ShouldCreate);
}
- static DILexicalBlock *getImpl(LLVMContext &Context, Metadata *Scope,
+ LLVM_ABI static DILexicalBlock *getImpl(LLVMContext &Context, Metadata *Scope,
Metadata *File, unsigned Line, unsigned Column,
StorageType Storage, bool ShouldCreate = true);
@@ -2633,7 +2634,7 @@ class DILexicalBlockFile : public DILexicalBlockBase {
ShouldCreate);
}
- static DILexicalBlockFile *getImpl(LLVMContext &Context, Metadata *Scope,
+ LLVM_ABI static DILexicalBlockFile *getImpl(LLVMContext &Context, Metadata *Scope,
Metadata *File, unsigned Discriminator,
StorageType Storage,
bool ShouldCreate = true);
@@ -2754,7 +2755,7 @@ class DINamespace : public DIScope {
return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
ExportSymbols, Storage, ShouldCreate);
}
- static DINamespace *getImpl(LLVMContext &Context, Metadata *Scope,
+ LLVM_ABI static DINamespace *getImpl(LLVMContext &Context, Metadata *Scope,
MDString *Name, bool ExportSymbols,
StorageType Storage, bool ShouldCreate = true);
@@ -2808,7 +2809,7 @@ class DIModule : public DIScope {
getCanonicalMDString(Context, APINotesFile), LineNo, IsDecl,
Storage, ShouldCreate);
}
- static DIModule *getImpl(LLVMContext &Context, Metadata *File,
+ LLVM_ABI static DIModule *getImpl(LLVMContext &Context, Metadata *File,
Metadata *Scope, MDString *Name,
MDString *ConfigurationMacros, MDString *IncludePath,
MDString *APINotesFile, unsigned LineNo, bool IsDecl,
@@ -2900,7 +2901,7 @@ class DITemplateTypeParameter : public DITemplateParameter {
return getImpl(Context, getCanonicalMDString(Context, Name), Type,
IsDefault, Storage, ShouldCreate);
}
- static DITemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
+ LLVM_ABI static DITemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
Metadata *Type, bool IsDefault,
StorageType Storage,
bool ShouldCreate = true);
@@ -2943,7 +2944,7 @@ class DITemplateValueParameter : public DITemplateParameter {
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
IsDefault, Value, Storage, ShouldCreate);
}
- static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
+ LLVM_ABI static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
MDString *Name, Metadata *Type,
bool IsDefault, Metadata *Value,
StorageType Storage,
@@ -2980,7 +2981,7 @@ class DIVariable : public DINode {
unsigned Line;
protected:
- DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, signed Line,
+ LLVM_ABI DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, signed Line,
ArrayRef<Metadata *> Ops, uint32_t AlignInBits = 0);
~DIVariable() = default;
@@ -2993,7 +2994,7 @@ class DIVariable : public DINode {
uint32_t getAlignInBits() const { return SubclassData32; }
uint32_t getAlignInBytes() const { return getAlignInBits() / CHAR_BIT; }
/// Determines the size of the variable's type.
- std::optional<uint64_t> getSizeInBits() const;
+ LLVM_ABI std::optional<uint64_t> getSizeInBits() const;
/// Return the signedness of this variable's type, or std::nullopt if this
/// type is neither signed nor unsigned.
@@ -3052,7 +3053,7 @@ class DIExpression : public MDNode {
Elements(Elements.begin(), Elements.end()) {}
~DIExpression() = default;
- static DIExpression *getImpl(LLVMContext &Context,
+ LLVM_ABI static DIExpression *getImpl(LLVMContext &Context,
ArrayRef<uint64_t> Elements, StorageType Storage,
bool ShouldCreate = true);
@@ -3077,7 +3078,7 @@ class DIExpression : public MDNode {
enum SignedOrUnsignedConstant { SignedConstant, UnsignedConstant };
/// Determine whether this represents a constant value, if so
// return it's sign information.
- std::optional<SignedOrUnsignedConstant> isConstant() const;
+ LLVM_ABI std::optional<SignedOrUnsignedConstant> isConstant() const;
/// Return the number of unique location operands referred to (via
/// DW_OP_LLVM_arg) in this expression; this is not necessarily the number of
@@ -3087,7 +3088,7 @@ class DIExpression : public MDNode {
/// DW_OP_LLVM_arg 0, DW_OP_mul)
/// This function would return 2, as there are two unique location operands
/// (0 and 1).
- uint64_t getNumLocationOperands() const;
+ LLVM_ABI uint64_t getNumLocationOperands() const;
using element_iterator = ArrayRef<uint64_t>::iterator;
@@ -3120,7 +3121,7 @@ class DIExpression : public MDNode {
/// Return the size of the operand.
///
/// Return the number of elements in the operand (1 + args).
- unsigned getSize() const;
+ LLVM_ABI unsigned getSize() const;
/// Append the elements of this operand to \p V.
void appendToVector(SmallVectorImpl<uint64_t> &V) const {
@@ -3193,17 +3194,17 @@ class DIExpression : public MDNode {
}
/// @}
- bool isValid() const;
+ LLVM_ABI bool isValid() const;
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DIExpressionKind;
}
/// Return whether the first element a DW_OP_deref.
- bool startsWithDeref() const;
+ LLVM_ABI bool startsWithDeref() const;
/// Return whether there is exactly one operator and it is a DW_OP_deref;
- bool isDeref() const;
+ LLVM_ABI bool isDeref() const;
using FragmentInfo = DbgVariableFragmentInfo;
@@ -3211,10 +3212,10 @@ class DIExpression : public MDNode {
/// aren't known to be zero/sign (depending on the type of Var) and which
/// are within the size of this fragment (if it is one). If we can't deduce
/// anything from the expression this will return the size of Var.
- std::optional<uint64_t> getActiveBits(DIVariable *Var);
+ LLVM_ABI std::optional<uint64_t> getActiveBits(DIVariable *Var);
/// Retrieve the details of this fragment expression.
- static std::optional<FragmentInfo> getFragmentInfo(expr_op_iterator Start,
+ LLVM_ABI static std::optional<FragmentInfo> getFragmentInfo(expr_op_iterator Start,
expr_op_iterator End);
/// Retrieve the details of this fragment expression.
@@ -3226,23 +3227,23 @@ class DIExpression : public MDNode {
bool isFragment() const { return getFragmentInfo().has_value(); }
/// Return whether this is an implicit location description.
- bool isImplicit() const;
+ LLVM_ABI bool isImplicit() const;
/// Return whether the location is computed on the expression stack, meaning
/// it cannot be a simple register location.
- bool isComplex() const;
+ LLVM_ABI bool isComplex() const;
/// Return whether the evaluated expression makes use of a single location at
/// the start of the expression, i.e. if it contains only a single
/// DW_OP_LLVM_arg op as its first operand, or if it contains none.
- bool isSingleLocationExpression() const;
+ LLVM_ABI bool isSingleLocationExpression() const;
/// Returns a reference to the elements contained in this expression, skipping
/// past the leading `DW_OP_LLVM_arg, 0` if one is present.
/// Similar to `convertToNonVariadicExpression`, but faster and cheaper - it
/// does not check whether the expression is a single-location expression, and
/// it returns elements rather than creating a new DIExpression.
- std::optional<ArrayRef<uint64_t>> getSingleLocationExpressionElements() const;
+ LLVM_ABI std::optional<ArrayRef<uint64_t>> getSingleLocationExpressionElements() const;
/// Removes all elements from \p Expr that do not apply to an undef debug
/// value, which includes every operator that computes the value/location on
@@ -3250,12 +3251,12 @@ class DIExpression : public MDNode {
/// of this function always a single-location expression) while leaving
/// everything that defines what the computed value applies to, i.e. the
/// fragment information.
- static const DIExpression *convertToUndefExpression(const DIExpression *Expr);
+ LLVM_ABI static const DIExpression *convertToUndefExpression(const DIExpression *Expr);
/// If \p Expr is a non-variadic expression (i.e. one that does not contain
/// DW_OP_LLVM_arg), returns \p Expr converted to variadic form by adding a
/// leading [DW_OP_LLVM_arg, 0] to the expression; otherwise returns \p Expr.
- static const DIExpression *
+ LLVM_ABI static const DIExpression *
convertToVariadicExpression(const DIExpression *Expr);
/// If \p Expr is a valid single-location expression, i.e. it refers to only a
@@ -3265,7 +3266,7 @@ class DIExpression : public MDNode {
/// See also `getSingleLocationExpressionElements` above, which skips
/// checking `isSingleLocationExpression` and returns a list of elements
/// rather than a DIExpression.
- static std::optional<const DIExpression *>
+ LLVM_ABI static std::optional<const DIExpression *>
convertToNonVariadicExpression(const DIExpression *Expr);
/// Inserts the elements of \p Expr into \p Ops modified to a canonical form,
@@ -3273,7 +3274,7 @@ class DIExpression : public MDNode {
/// implied derefence from the \p IsIndirect flag into the expression. This
/// allows us to check equivalence between expressions with differing
/// directness or variadicness.
- static void canonicalizeExpressionOps(SmallVectorImpl<uint64_t> &Ops,
+ LLVM_ABI static void canonicalizeExpressionOps(SmallVectorImpl<uint64_t> &Ops,
const DIExpression *Expr,
bool IsIndirect);
@@ -3288,17 +3289,17 @@ class DIExpression : public MDNode {
/// whose second operand is an immediate value.
/// \p SecondExpr and \p SecondIndirect have the same meaning as the prior
/// arguments, but apply to the second debug value.
- static bool isEqualExpression(const DIExpression *FirstExpr,
+ LLVM_ABI static bool isEqualExpression(const DIExpression *FirstExpr,
bool FirstIndirect,
const DIExpression *SecondExpr,
bool SecondIndirect);
/// Append \p Ops with operations to apply the \p Offset.
- static void appendOffset(SmallVectorImpl<uint64_t> &Ops, int64_t Offset);
+ LLVM_ABI static void appendOffset(SmallVectorImpl<uint64_t> &Ops, int64_t Offset);
/// If this is a constant offset, extract it. If there is no expression,
/// return true with an offset of zero.
- bool extractIfOffset(int64_t &Offset) const;
+ LLVM_ABI bool extractIfOffset(int64_t &Offset) const;
/// Assuming that the expression operates on an address, extract a constant
/// offset and the successive ops. Return false if the expression contains
@@ -3307,17 +3308,17 @@ class DIExpression : public MDNode {
///
/// We don't try very hard to interpret the expression because we assume that
/// foldConstantMath has canonicalized the expression.
- bool extractLeadingOffset(int64_t &OffsetInBytes,
+ LLVM_ABI bool extractLeadingOffset(int64_t &OffsetInBytes,
SmallVectorImpl<uint64_t> &RemainingOps) const;
/// Returns true iff this DIExpression contains at least one instance of
/// `DW_OP_LLVM_arg, n` for all n in [0, N).
- bool hasAllLocationOps(unsigned N) const;
+ LLVM_ABI bool hasAllLocationOps(unsigned N) const;
/// Checks if the last 4 elements of the expression are DW_OP_constu <DWARF
/// Address Space> DW_OP_swap DW_OP_xderef and extracts the <DWARF Address
/// Space>.
- static const DIExpression *extractAddressClass(const DIExpression *Expr,
+ LLVM_ABI static const DIExpression *extractAddressClass(const DIExpression *Expr,
unsigned &AddrClass);
/// Used for DIExpression::prepend.
@@ -3331,12 +3332,12 @@ class DIExpression : public MDNode {
/// Prepend \p DIExpr with a deref and offset operation and optionally turn it
/// into a stack value or/and an entry value.
- static DIExpression *prepend(const DIExpression *Expr, uint8_t Flags,
+ LLVM_ABI static DIExpression *prepend(const DIExpression *Expr, uint8_t Flags,
int64_t Offset = 0);
/// Prepend \p DIExpr with the given opcodes and optionally turn it into a
/// stack value.
- static DIExpression *prependOpcodes(const DIExpression *Expr,
+ LLVM_ABI static DIExpression *prependOpcodes(const DIExpression *Expr,
SmallVectorImpl<uint64_t> &Ops,
bool StackValue = false,
bool EntryValue = false);
@@ -3345,20 +3346,20 @@ class DIExpression : public MDNode {
/// returned expression is a stack value only if \p DIExpr is a stack value.
/// If \p DIExpr describes a fragment, the returned expression will describe
/// the same fragment.
- static DIExpression *append(const DIExpression *Expr, ArrayRef<uint64_t> Ops);
+ LLVM_ABI static DIExpression *append(const DIExpression *Expr, ArrayRef<uint64_t> Ops);
/// Convert \p DIExpr into a stack value if it isn't one already by appending
/// DW_OP_deref if needed, and appending \p Ops to the resulting expression.
/// If \p DIExpr describes a fragment, the returned expression will describe
/// the same fragment.
- static DIExpression *appendToStack(const DIExpression *Expr,
+ LLVM_ABI static DIExpression *appendToStack(const DIExpression *Expr,
ArrayRef<uint64_t> Ops);
/// Create a copy of \p Expr by appending the given list of \p Ops to each
/// instance of the operand `DW_OP_LLVM_arg, \p ArgNo`. This is used to
/// modify a specific location used by \p Expr, such as when salvaging that
/// location.
- static DIExpression *appendOpsToArg(const DIExpression *Expr,
+ LLVM_ABI static DIExpression *appendOpsToArg(const DIExpression *Expr,
ArrayRef<uint64_t> Ops, unsigned ArgNo,
bool StackValue = false);
@@ -3368,7 +3369,7 @@ class DIExpression : public MDNode {
/// for all Arg > \p OldArg.
/// This is used when replacing one of the operands of a debug value list
/// with another operand in the same list and deleting the old operand.
- static DIExpression *replaceArg(const DIExpression *Expr, uint64_t OldArg,
+ LLVM_ABI static DIExpression *replaceArg(const DIExpression *Expr, uint64_t OldArg,
uint64_t NewArg);
/// Create a DIExpression to describe one part of an aggregate variable that
@@ -3382,7 +3383,7 @@ class DIExpression : public MDNode {
/// \return Creating a fragment expression may fail if \c Expr
/// contains arithmetic operations that would be
/// truncated.
- static std::optional<DIExpression *>
+ LLVM_ABI static std::optional<DIExpression *>
createFragmentExpression(const DIExpression *Expr, unsigned OffsetInBits,
unsigned SizeInBits);
@@ -3432,7 +3433,7 @@ class DIExpression : public MDNode {
/// and offsets because different debug records store the information in
/// different places (dbg_assign has two DIExpressions - one contains the
/// fragment info for the entire intrinsic).
- static bool calculateFragmentIntersect(
+ LLVM_ABI static bool calculateFragmentIntersect(
const DataLayout &DL, const Value *SliceStart, uint64_t SliceOffsetInBits,
uint64_t SliceSizeInBits, const Value *DbgPtr, int64_t DbgPtrOffsetInBits,
int64_t DbgExtractOffsetInBits, DIExpression::FragmentInfo VarFrag,
@@ -3442,11 +3443,11 @@ class DIExpression : public MDNode {
using ExtOps = std::array<uint64_t, 6>;
/// Returns the ops for a zero- or sign-extension in a DIExpression.
- static ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed);
+ LLVM_ABI static ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed);
/// Append a zero- or sign-extension to \p Expr. Converts the expression to a
/// stack value if it isn't one already.
- static DIExpression *appendExt(const DIExpression *Expr, unsigned FromSize,
+ LLVM_ABI static DIExpression *appendExt(const DIExpression *Expr, unsigned FromSize,
unsigned ToSize, bool Signed);
/// Check if fragments overlap between a pair of FragmentInfos.
@@ -3471,18 +3472,18 @@ class DIExpression : public MDNode {
/// Check if the expression consists of exactly one entry value operand.
/// (This is the only configuration of entry values that is supported.)
- bool isEntryValue() const;
+ LLVM_ABI bool isEntryValue() const;
/// Try to shorten an expression with an initial constant operand.
/// Returns a new expression and constant on success, or the original
/// expression and constant on failure.
- std::pair<DIExpression *, const ConstantInt *>
+ LLVM_ABI std::pair<DIExpression *, const ConstantInt *>
constantFold(const ConstantInt *CI);
/// Try to shorten an expression with constant math operations that can be
/// evaluated at compile time. Returns a new expression on success, or the old
/// expression if there is nothing to be reduced.
- DIExpression *foldConstantMath();
+ LLVM_ABI DIExpression *foldConstantMath();
};
inline bool operator==(const DIExpression::FragmentInfo &A,
@@ -3620,7 +3621,7 @@ class DIGlobalVariable : public DIVariable {
cast_or_null<Metadata>(TemplateParams), AlignInBits,
Annotations.get(), Storage, ShouldCreate);
}
- static DIGlobalVariable *
+ LLVM_ABI static DIGlobalVariable *
getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
MDString *LinkageName, Metadata *File, unsigned Line, Metadata *Type,
bool IsLocalToUnit, bool IsDefinition,
@@ -3695,7 +3696,7 @@ class DICommonBlock : public DIScope {
return getImpl(Context, Scope, Decl, getCanonicalMDString(Context, Name),
File, LineNo, Storage, ShouldCreate);
}
- static DICommonBlock *getImpl(LLVMContext &Context, Metadata *Scope,
+ LLVM_ABI static DICommonBlock *getImpl(LLVMContext &Context, Metadata *Scope,
Metadata *Decl, MDString *Name, Metadata *File,
unsigned LineNo, StorageType Storage,
bool ShouldCreate = true);
@@ -3764,7 +3765,7 @@ class DILocalVariable : public DIVariable {
Line, Type, Arg, Flags, AlignInBits, Annotations.get(),
Storage, ShouldCreate);
}
- static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
+ LLVM_ABI static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
MDString *Name, Metadata *File, unsigned Line,
Metadata *Type, unsigned Arg, DIFlags Flags,
uint32_t AlignInBits, Metadata *Annotations,
@@ -3843,7 +3844,7 @@ class DILabel : public DINode {
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
Line, Storage, ShouldCreate);
}
- static DILabel *getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
+ LLVM_ABI static DILabel *getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
Metadata *File, unsigned Line, StorageType Storage,
bool ShouldCreate = true);
@@ -3912,7 +3913,7 @@ class DIObjCProperty : public DINode {
getCanonicalMDString(Context, SetterName), Attributes, Type,
Storage, ShouldCreate);
}
- static DIObjCProperty *getImpl(LLVMContext &Context, MDString *Name,
+ LLVM_ABI static DIObjCProperty *getImpl(LLVMContext &Context, MDString *Name,
Metadata *File, unsigned Line,
MDString *GetterName, MDString *SetterName,
unsigned Attributes, Metadata *Type,
@@ -3994,7 +3995,7 @@ class DIImportedEntity : public DINode {
getCanonicalMDString(Context, Name), Elements.get(), Storage,
ShouldCreate);
}
- static DIImportedEntity *
+ LLVM_ABI static DIImportedEntity *
getImpl(LLVMContext &Context, unsigned Tag, Metadata *Scope, Metadata *Entity,
Metadata *File, unsigned Line, MDString *Name, Metadata *Elements,
StorageType Storage, bool ShouldCreate = true);
@@ -4048,7 +4049,7 @@ class DIGlobalVariableExpression : public MDNode {
: MDNode(C, DIGlobalVariableExpressionKind, Storage, Ops) {}
~DIGlobalVariableExpression() = default;
- static DIGlobalVariableExpression *
+ LLVM_ABI static DIGlobalVariableExpression *
getImpl(LLVMContext &Context, Metadata *Variable, Metadata *Expression,
StorageType Storage, bool ShouldCreate = true);
@@ -4151,7 +4152,7 @@ class DIMacro : public DIMacroNode {
return getImpl(Context, MIType, Line, getCanonicalMDString(Context, Name),
getCanonicalMDString(Context, Value), Storage, ShouldCreate);
}
- static DIMacro *getImpl(LLVMContext &Context, unsigned MIType, unsigned Line,
+ LLVM_ABI static DIMacro *getImpl(LLVMContext &Context, unsigned MIType, unsigned Line,
MDString *Name, MDString *Value, StorageType Storage,
bool ShouldCreate = true);
@@ -4207,7 +4208,7 @@ class DIMacroFile : public DIMacroNode {
Elements.get(), Storage, ShouldCreate);
}
- static DIMacroFile *getImpl(LLVMContext &Context, unsigned MIType,
+ LLVM_ABI static DIMacroFile *getImpl(LLVMContext &Context, unsigned MIType,
unsigned Line, Metadata *File, Metadata *Elements,
StorageType Storage, bool ShouldCreate = true);
@@ -4268,12 +4269,12 @@ class DIArgList : public Metadata, ReplaceableMetadataImpl {
}
~DIArgList() { untrack(); }
- void track();
- void untrack();
+ LLVM_ABI void track();
+ LLVM_ABI void untrack();
void dropAllReferences(bool Untrack);
public:
- static DIArgList *get(LLVMContext &Context, ArrayRef<ValueAsMetadata *> Args);
+ LLVM_ABI static DIArgList *get(LLVMContext &Context, ArrayRef<ValueAsMetadata *> Args);
ArrayRef<ValueAsMetadata *> getArgs() const { return Args; }
@@ -4288,7 +4289,7 @@ class DIArgList : public Metadata, ReplaceableMetadataImpl {
return ReplaceableMetadataImpl::getAllDbgVariableRecordUsers();
}
- void handleChangedOperand(void *Ref, Metadata *New);
+ LLVM_ABI void handleChangedOperand(void *Ref, Metadata *New);
};
/// Identifies a unique instance of a variable.
@@ -4311,11 +4312,11 @@ class DebugVariable {
/// Fragment that will overlap all other fragments. Used as default when
/// caller demands a fragment.
- static const FragmentInfo DefaultFragment;
+ LLVM_ABI static const FragmentInfo DefaultFragment;
public:
- DebugVariable(const DbgVariableIntrinsic *DII);
- DebugVariable(const DbgVariableRecord *DVR);
+ LLVM_ABI DebugVariable(const DbgVariableIntrinsic *DII);
+ LLVM_ABI DebugVariable(const DbgVariableRecord *DVR);
DebugVariable(const DILocalVariable *Var,
std::optional<FragmentInfo> FragmentInfo,
@@ -4382,7 +4383,7 @@ template <> struct DenseMapInfo<DebugVariable> {
/// information).
class DebugVariableAggregate : public DebugVariable {
public:
- DebugVariableAggregate(const DbgVariableIntrinsic *DVI);
+ LLVM_ABI DebugVariableAggregate(const DbgVariableIntrinsic *DVI);
DebugVariableAggregate(const DebugVariable &V)
: DebugVariable(V.getVariable(), std::nullopt, V.getInlinedAt()) {}
};
diff --git a/llvm/include/llvm/IR/DebugLoc.h b/llvm/include/llvm/IR/DebugLoc.h
index ffb8ed458e36b..02bcc9bfae222 100644
--- a/llvm/include/llvm/IR/DebugLoc.h
+++ b/llvm/include/llvm/IR/DebugLoc.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_DEBUGLOC_H
#define LLVM_IR_DEBUGLOC_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/TrackingMDRef.h"
#include "llvm/Support/DataTypes.h"
@@ -66,7 +67,7 @@ namespace llvm {
DILocAndCoverageTracking(const MDNode *Loc)
: TrackingMDNodeRef(const_cast<MDNode *>(Loc)),
Kind(DebugLocKind::Normal) {}
- DILocAndCoverageTracking(const DILocation *Loc);
+ LLVM_ABI DILocAndCoverageTracking(const DILocation *Loc);
// Explicit DebugLocKind, which always means a nullptr MDNode*.
DILocAndCoverageTracking(DebugLocKind Kind)
: TrackingMDNodeRef(nullptr), Kind(Kind) {}
@@ -106,7 +107,7 @@ namespace llvm {
DebugLoc() = default;
/// Construct from an \a DILocation.
- DebugLoc(const DILocation *L);
+ LLVM_ABI DebugLoc(const DILocation *L);
/// Construct from an \a MDNode.
///
@@ -114,7 +115,7 @@ namespace llvm {
/// accessors will crash. However, construction from other nodes is
/// supported in order to handle forward references when reading textual
/// IR.
- explicit DebugLoc(const MDNode *N);
+ LLVM_ABI explicit DebugLoc(const MDNode *N);
#if LLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING
DebugLoc(DebugLocKind Kind) : Loc(Kind) {}
@@ -145,7 +146,7 @@ namespace llvm {
///
/// \pre !*this or \c isa<DILocation>(getAsMDNode()).
/// @{
- DILocation *get() const;
+ LLVM_ABI DILocation *get() const;
operator DILocation *() const { return get(); }
DILocation *operator->() const { return get(); }
DILocation &operator*() const { return *get(); }
@@ -166,7 +167,7 @@ namespace llvm {
/// Rebuild the entire inlined-at chain for this instruction so that the top of
/// the chain now is inlined-at the new call site.
/// \param InlinedAt The new outermost inlined-at in the chain.
- static DebugLoc appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt,
+ LLVM_ABI static DebugLoc appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt,
LLVMContext &Ctx,
DenseMap<const MDNode *, MDNode *> &Cache);
@@ -180,19 +181,19 @@ namespace llvm {
getInlinedAt() == Other.getInlinedAt();
}
- unsigned getLine() const;
- unsigned getCol() const;
- MDNode *getScope() const;
- DILocation *getInlinedAt() const;
+ LLVM_ABI unsigned getLine() const;
+ LLVM_ABI unsigned getCol() const;
+ LLVM_ABI MDNode *getScope() const;
+ LLVM_ABI DILocation *getInlinedAt() const;
/// Get the fully inlined-at scope for a DebugLoc.
///
/// Gets the inlined-at scope for a DebugLoc.
- MDNode *getInlinedAtScope() const;
+ LLVM_ABI MDNode *getInlinedAtScope() const;
/// Rebuild the entire inline-at chain by replacing the subprogram at the
/// end of the chain with NewSP.
- static DebugLoc
+ LLVM_ABI static DebugLoc
replaceInlinedAtSubprogram(const DebugLoc &DL, DISubprogram &NewSP,
LLVMContext &Ctx,
DenseMap<const MDNode *, MDNode *> &Cache);
@@ -204,22 +205,22 @@ namespace llvm {
///
/// FIXME: Remove this. Users should use DILocation/DILocalScope API to
/// find the subprogram, and then DILocation::get().
- DebugLoc getFnDebugLoc() const;
+ LLVM_ABI DebugLoc getFnDebugLoc() const;
/// Return \c this as a bar \a MDNode.
MDNode *getAsMDNode() const { return Loc; }
/// Check if the DebugLoc corresponds to an implicit code.
- bool isImplicitCode() const;
- void setImplicitCode(bool ImplicitCode);
+ LLVM_ABI bool isImplicitCode() const;
+ LLVM_ABI void setImplicitCode(bool ImplicitCode);
bool operator==(const DebugLoc &DL) const { return Loc == DL.Loc; }
bool operator!=(const DebugLoc &DL) const { return Loc != DL.Loc; }
- void dump() const;
+ LLVM_ABI void dump() const;
/// prints source location /path/to/file.exe:line:col @[inlined at]
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
};
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 37db7894d173d..d37420a77083c 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -47,6 +47,7 @@
#ifndef LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
#define LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/iterator.h"
@@ -149,20 +150,20 @@ class DbgRecord : public ilist_node<DbgRecord> {
/// Methods that dispatch to subclass implementations. These need to be
/// manually updated when a new subclass is added.
///@{
- void deleteRecord();
- DbgRecord *clone() const;
- void print(raw_ostream &O, bool IsForDebug = false) const;
- void print(raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug) const;
- bool isIdenticalToWhenDefined(const DbgRecord &R) const;
+ LLVM_ABI void deleteRecord();
+ LLVM_ABI DbgRecord *clone() const;
+ LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI bool isIdenticalToWhenDefined(const DbgRecord &R) const;
/// Convert this DbgRecord back into an appropriate llvm.dbg.* intrinsic.
/// \p InsertBefore Optional position to insert this intrinsic.
/// \returns A new llvm.dbg.* intrinsic representiung this DbgRecord.
- DbgInfoIntrinsic *createDebugIntrinsic(Module *M,
+ LLVM_ABI DbgInfoIntrinsic *createDebugIntrinsic(Module *M,
Instruction *InsertBefore) const;
///@}
/// Same as isIdenticalToWhenDefined but checks DebugLoc too.
- bool isEquivalentTo(const DbgRecord &R) const;
+ LLVM_ABI bool isEquivalentTo(const DbgRecord &R) const;
Kind getRecordKind() const { return RecordKind; }
@@ -171,44 +172,44 @@ class DbgRecord : public ilist_node<DbgRecord> {
DbgMarker *getMarker() { return Marker; }
const DbgMarker *getMarker() const { return Marker; }
- BasicBlock *getBlock();
- const BasicBlock *getBlock() const;
+ LLVM_ABI BasicBlock *getBlock();
+ LLVM_ABI const BasicBlock *getBlock() const;
- Function *getFunction();
- const Function *getFunction() const;
+ LLVM_ABI Function *getFunction();
+ LLVM_ABI const Function *getFunction() const;
- Module *getModule();
- const Module *getModule() const;
+ LLVM_ABI Module *getModule();
+ LLVM_ABI const Module *getModule() const;
- LLVMContext &getContext();
- const LLVMContext &getContext() const;
+ LLVM_ABI LLVMContext &getContext();
+ LLVM_ABI const LLVMContext &getContext() const;
- const Instruction *getInstruction() const;
- const BasicBlock *getParent() const;
- BasicBlock *getParent();
+ LLVM_ABI const Instruction *getInstruction() const;
+ LLVM_ABI const BasicBlock *getParent() const;
+ LLVM_ABI BasicBlock *getParent();
- void removeFromParent();
- void eraseFromParent();
+ LLVM_ABI void removeFromParent();
+ LLVM_ABI void eraseFromParent();
DbgRecord *getNextNode() { return &*std::next(getIterator()); }
DbgRecord *getPrevNode() { return &*std::prev(getIterator()); }
// Some generic lambdas supporting intrinsic-based debug-info mean we need
// to support both iterator and instruction position based insertion.
- void insertBefore(DbgRecord *InsertBefore);
- void insertAfter(DbgRecord *InsertAfter);
- void moveBefore(DbgRecord *MoveBefore);
- void moveAfter(DbgRecord *MoveAfter);
+ LLVM_ABI void insertBefore(DbgRecord *InsertBefore);
+ LLVM_ABI void insertAfter(DbgRecord *InsertAfter);
+ LLVM_ABI void moveBefore(DbgRecord *MoveBefore);
+ LLVM_ABI void moveAfter(DbgRecord *MoveAfter);
- void insertBefore(self_iterator InsertBefore);
- void insertAfter(self_iterator InsertAfter);
- void moveBefore(self_iterator MoveBefore);
- void moveAfter(self_iterator MoveAfter);
+ LLVM_ABI void insertBefore(self_iterator InsertBefore);
+ LLVM_ABI void insertAfter(self_iterator InsertAfter);
+ LLVM_ABI void moveBefore(self_iterator MoveBefore);
+ LLVM_ABI void moveAfter(self_iterator MoveAfter);
DebugLoc getDebugLoc() const { return DbgLoc; }
void setDebugLoc(DebugLoc Loc) { DbgLoc = std::move(Loc); }
- void dump() const;
+ LLVM_ABI void dump() const;
using self_iterator = simple_ilist<DbgRecord>::iterator;
using const_self_iterator = simple_ilist<DbgRecord>::const_iterator;
@@ -237,19 +238,19 @@ class DbgLabelRecord : public DbgRecord {
DbgLabelRecord(MDNode *Label, MDNode *DL);
public:
- DbgLabelRecord(DILabel *Label, DebugLoc DL);
+ LLVM_ABI DbgLabelRecord(DILabel *Label, DebugLoc DL);
/// For use during parsing; creates a DbgLabelRecord from as-of-yet unresolved
/// MDNodes. Trying to access the resulting DbgLabelRecord's fields before
/// they are resolved, or if they resolve to the wrong type, will result in a
/// crash.
- static DbgLabelRecord *createUnresolvedDbgLabelRecord(MDNode *Label,
+ LLVM_ABI static DbgLabelRecord *createUnresolvedDbgLabelRecord(MDNode *Label,
MDNode *DL);
- DbgLabelRecord *clone() const;
- void print(raw_ostream &O, bool IsForDebug = false) const;
- void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
- DbgLabelInst *createDebugIntrinsic(Module *M,
+ LLVM_ABI DbgLabelRecord *clone() const;
+ LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI DbgLabelInst *createDebugIntrinsic(Module *M,
Instruction *InsertBefore) const;
void setLabel(DILabel *NewLabel) { Label = NewLabel; }
@@ -296,14 +297,14 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
public:
/// Create a new DbgVariableRecord representing the intrinsic \p DVI, for
/// example the assignment represented by a dbg.value.
- DbgVariableRecord(const DbgVariableIntrinsic *DVI);
- DbgVariableRecord(const DbgVariableRecord &DVR);
+ LLVM_ABI DbgVariableRecord(const DbgVariableIntrinsic *DVI);
+ LLVM_ABI DbgVariableRecord(const DbgVariableRecord &DVR);
/// Directly construct a new DbgVariableRecord representing a dbg.value
/// intrinsic assigning \p Location to the DV / Expr / DI variable.
- DbgVariableRecord(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
+ LLVM_ABI DbgVariableRecord(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
const DILocation *DI,
LocationType Type = LocationType::Value);
- DbgVariableRecord(Metadata *Value, DILocalVariable *Variable,
+ LLVM_ABI DbgVariableRecord(Metadata *Value, DILocalVariable *Variable,
DIExpression *Expression, DIAssignID *AssignID,
Metadata *Address, DIExpression *AddressExpression,
const DILocation *DI);
@@ -325,36 +326,36 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
/// for all types of DbgVariableRecords for simplicity while parsing, but
/// asserts if any necessary fields are empty or unused fields are not empty,
/// i.e. if the #dbg_assign fields are used for a non-dbg-assign type.
- static DbgVariableRecord *
+ LLVM_ABI static DbgVariableRecord *
createUnresolvedDbgVariableRecord(LocationType Type, Metadata *Val,
MDNode *Variable, MDNode *Expression,
MDNode *AssignID, Metadata *Address,
MDNode *AddressExpression, MDNode *DI);
- static DbgVariableRecord *
+ LLVM_ABI static DbgVariableRecord *
createDVRAssign(Value *Val, DILocalVariable *Variable,
DIExpression *Expression, DIAssignID *AssignID,
Value *Address, DIExpression *AddressExpression,
const DILocation *DI);
- static DbgVariableRecord *
+ LLVM_ABI static DbgVariableRecord *
createLinkedDVRAssign(Instruction *LinkedInstr, Value *Val,
DILocalVariable *Variable, DIExpression *Expression,
Value *Address, DIExpression *AddressExpression,
const DILocation *DI);
- static DbgVariableRecord *createDbgVariableRecord(Value *Location,
+ LLVM_ABI static DbgVariableRecord *createDbgVariableRecord(Value *Location,
DILocalVariable *DV,
DIExpression *Expr,
const DILocation *DI);
- static DbgVariableRecord *
+ LLVM_ABI static DbgVariableRecord *
createDbgVariableRecord(Value *Location, DILocalVariable *DV,
DIExpression *Expr, const DILocation *DI,
DbgVariableRecord &InsertBefore);
- static DbgVariableRecord *createDVRDeclare(Value *Address,
+ LLVM_ABI static DbgVariableRecord *createDVRDeclare(Value *Address,
DILocalVariable *DV,
DIExpression *Expr,
const DILocation *DI);
- static DbgVariableRecord *
+ LLVM_ABI static DbgVariableRecord *
createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr,
const DILocation *DI, DbgVariableRecord &InsertBefore);
@@ -412,20 +413,20 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
/// Get the locations corresponding to the variable referenced by the debug
/// info intrinsic. Depending on the intrinsic, this could be the
/// variable's value or its address.
- iterator_range<location_op_iterator> location_ops() const;
+ LLVM_ABI iterator_range<location_op_iterator> location_ops() const;
- Value *getVariableLocationOp(unsigned OpIdx) const;
+ LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
- void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
+ LLVM_ABI void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
bool AllowEmpty = false);
- void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
+ LLVM_ABI void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
/// Adding a new location operand will always result in this intrinsic using
/// an ArgList, and must always be accompanied by a new expression that uses
/// the new operand.
- void addVariableLocationOps(ArrayRef<Value *> NewValues,
+ LLVM_ABI void addVariableLocationOps(ArrayRef<Value *> NewValues,
DIExpression *NewExpr);
- unsigned getNumVariableLocationOps() const;
+ LLVM_ABI unsigned getNumVariableLocationOps() const;
bool hasArgList() const { return isa<DIArgList>(getRawLocation()); }
/// Returns true if this DbgVariableRecord has no empty MDNodes in its
@@ -442,8 +443,8 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
LocationType getType() const { return Type; }
- void setKillLocation();
- bool isKillLocation() const;
+ LLVM_ABI void setKillLocation();
+ LLVM_ABI bool isKillLocation() const;
void setVariable(DILocalVariable *NewVar) { Variable = NewVar; }
DILocalVariable *getVariable() const { return Variable.get(); };
@@ -474,7 +475,7 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
resetDebugValue(0, NewLocation);
}
- std::optional<DbgVariableFragmentInfo> getFragment() const;
+ LLVM_ABI std::optional<DbgVariableFragmentInfo> getFragment() const;
/// Get the FragmentInfo for the variable if it exists, otherwise return a
/// FragmentInfo that covers the entire variable if the variable size is
/// known, otherwise return a zero-sized fragment.
@@ -487,7 +488,7 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
}
/// Get the size (in bits) of the variable, or fragment of the variable that
/// is described.
- std::optional<uint64_t> getFragmentSizeInBits() const;
+ LLVM_ABI std::optional<uint64_t> getFragmentSizeInBits() const;
bool isEquivalentTo(const DbgVariableRecord &Other) const {
return DbgLoc == Other.DbgLoc && isIdenticalToWhenDefined(Other);
@@ -505,12 +506,12 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
/// @{
bool isDbgAssign() const { return getType() == LocationType::Assign; }
- Value *getAddress() const;
+ LLVM_ABI Value *getAddress() const;
Metadata *getRawAddress() const {
return isDbgAssign() ? DebugValues[1] : DebugValues[0];
}
Metadata *getRawAssignID() const { return DebugValues[2]; }
- DIAssignID *getAssignID() const;
+ LLVM_ABI DIAssignID *getAssignID() const;
DIExpression *getAddressExpression() const { return AddressExpression.get(); }
MDNode *getRawAddressExpression() const {
return AddressExpression.getAsMDNode();
@@ -518,31 +519,31 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
void setAddressExpression(DIExpression *NewExpr) {
AddressExpression = NewExpr;
}
- void setAssignId(DIAssignID *New);
+ LLVM_ABI void setAssignId(DIAssignID *New);
void setAddress(Value *V) { resetDebugValue(1, ValueAsMetadata::get(V)); }
/// Kill the address component.
- void setKillAddress();
+ LLVM_ABI void setKillAddress();
/// Check whether this kills the address component. This doesn't take into
/// account the position of the intrinsic, therefore a returned value of false
/// does not guarentee the address is a valid location for the variable at the
/// intrinsic's position in IR.
- bool isKillAddress() const;
+ LLVM_ABI bool isKillAddress() const;
/// @}
- DbgVariableRecord *clone() const;
+ LLVM_ABI DbgVariableRecord *clone() const;
/// Convert this DbgVariableRecord back into a dbg.value intrinsic.
/// \p InsertBefore Optional position to insert this intrinsic.
/// \returns A new dbg.value intrinsic representiung this DbgVariableRecord.
- DbgVariableIntrinsic *createDebugIntrinsic(Module *M,
+ LLVM_ABI DbgVariableIntrinsic *createDebugIntrinsic(Module *M,
Instruction *InsertBefore) const;
/// Handle changes to the location of the Value(s) that we refer to happening
/// "under our feet".
- void handleChangedLocation(Metadata *NewLocation);
+ LLVM_ABI void handleChangedLocation(Metadata *NewLocation);
- void print(raw_ostream &O, bool IsForDebug = false) const;
- void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
/// Support type inquiry through isa, cast, and dyn_cast.
static bool classof(const DbgRecord *E) {
@@ -594,42 +595,42 @@ class DbgMarker {
simple_ilist<DbgRecord> StoredDbgRecords;
bool empty() const { return StoredDbgRecords.empty(); }
- const BasicBlock *getParent() const;
- BasicBlock *getParent();
+ LLVM_ABI const BasicBlock *getParent() const;
+ LLVM_ABI BasicBlock *getParent();
/// Handle the removal of a marker: the position of debug-info has gone away,
/// but the stored debug records should not. Drop them onto the next
/// instruction, or otherwise work out what to do with them.
- void removeMarker();
- void dump() const;
+ LLVM_ABI void removeMarker();
+ LLVM_ABI void dump() const;
- void removeFromParent();
- void eraseFromParent();
+ LLVM_ABI void removeFromParent();
+ LLVM_ABI void eraseFromParent();
/// Implement operator<< on DbgMarker.
- void print(raw_ostream &O, bool IsForDebug = false) const;
- void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
/// Produce a range over all the DbgRecords in this Marker.
- iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange();
- iterator_range<simple_ilist<DbgRecord>::const_iterator>
+ LLVM_ABI iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange();
+ LLVM_ABI iterator_range<simple_ilist<DbgRecord>::const_iterator>
getDbgRecordRange() const;
/// Transfer any DbgRecords from \p Src into this DbgMarker. If \p
/// InsertAtHead is true, place them before existing DbgRecords, otherwise
/// afterwards.
- void absorbDebugValues(DbgMarker &Src, bool InsertAtHead);
+ LLVM_ABI void absorbDebugValues(DbgMarker &Src, bool InsertAtHead);
/// Transfer the DbgRecords in \p Range from \p Src into this DbgMarker. If
/// \p InsertAtHead is true, place them before existing DbgRecords, otherwise
// afterwards.
- void absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
+ LLVM_ABI void absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
DbgMarker &Src, bool InsertAtHead);
/// Insert a DbgRecord into this DbgMarker, at the end of the list. If
/// \p InsertAtHead is true, at the start.
- void insertDbgRecord(DbgRecord *New, bool InsertAtHead);
+ LLVM_ABI void insertDbgRecord(DbgRecord *New, bool InsertAtHead);
/// Insert a DbgRecord prior to a DbgRecord contained within this marker.
- void insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore);
+ LLVM_ABI void insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore);
/// Insert a DbgRecord after a DbgRecord contained within this marker.
- void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter);
+ LLVM_ABI void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter);
/// Clone all DbgMarkers from \p From into this marker. There are numerous
/// options to customise the source/destination, due to gnarliness, see class
/// comment.
@@ -638,16 +639,16 @@ class DbgMarker {
/// \p InsertAtHead Place the cloned DbgRecords at the start of
/// StoredDbgRecords
/// \returns Range over all the newly cloned DbgRecords
- iterator_range<simple_ilist<DbgRecord>::iterator>
+ LLVM_ABI iterator_range<simple_ilist<DbgRecord>::iterator>
cloneDebugInfoFrom(DbgMarker *From,
std::optional<simple_ilist<DbgRecord>::iterator> FromHere,
bool InsertAtHead = false);
/// Erase all DbgRecords in this DbgMarker.
- void dropDbgRecords();
+ LLVM_ABI void dropDbgRecords();
/// Erase a single DbgRecord from this marker. In an ideal future, we would
/// never erase an assignment in this way, but it's the equivalent to
/// erasing a debug intrinsic from a block.
- void dropOneDbgRecord(DbgRecord *DR);
+ LLVM_ABI void dropOneDbgRecord(DbgRecord *DR);
/// We generally act like all llvm Instructions have a range of DbgRecords
/// attached to them, but in reality sometimes we don't allocate the DbgMarker
@@ -656,7 +657,7 @@ class DbgMarker {
/// static markers range instead. This will bite us if someone tries to insert
/// a DbgRecord in that range, but they should be using the Official (TM) API
/// for that.
- static DbgMarker EmptyDbgMarker;
+ LLVM_ABI static DbgMarker EmptyDbgMarker;
static iterator_range<simple_ilist<DbgRecord>::iterator>
getEmptyDbgRecordRange() {
return make_range(EmptyDbgMarker.StoredDbgRecords.end(),
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index fba6f45d37d1d..0f45ec047bb10 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -63,7 +63,7 @@ class IntegerType : public Type {
/// that instance will be returned. Otherwise a new one will be created. Only
/// one instance with a given NumBits value is ever created.
/// Get or create an IntegerType instance.
- static IntegerType *get(LLVMContext &C, unsigned NumBits);
+ LLVM_ABI static IntegerType *get(LLVMContext &C, unsigned NumBits);
/// Returns type twice as wide the input type.
IntegerType *getExtendedType() const {
@@ -88,7 +88,7 @@ class IntegerType : public Type {
/// For example, this is 0xFF for an 8 bit integer, 0xFFFF for i16, etc.
/// @returns a bit mask with ones set for all the bits of this type.
/// Get a bit mask for this type.
- APInt getMask() const;
+ LLVM_ABI APInt getMask() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Type *T) {
@@ -110,17 +110,17 @@ class FunctionType : public Type {
FunctionType &operator=(const FunctionType &) = delete;
/// This static method is the primary way of constructing a FunctionType.
- static FunctionType *get(Type *Result,
+ LLVM_ABI static FunctionType *get(Type *Result,
ArrayRef<Type*> Params, bool isVarArg);
/// Create a FunctionType taking no parameters.
- static FunctionType *get(Type *Result, bool isVarArg);
+ LLVM_ABI static FunctionType *get(Type *Result, bool isVarArg);
/// Return true if the specified type is valid as a return type.
- static bool isValidReturnType(Type *RetTy);
+ LLVM_ABI static bool isValidReturnType(Type *RetTy);
/// Return true if the specified type is valid as an argument type.
- static bool isValidArgumentType(Type *ArgTy);
+ LLVM_ABI static bool isValidArgumentType(Type *ArgTy);
bool isVarArg() const { return getSubclassData()!=0; }
Type *getReturnType() const { return ContainedTys[0]; }
@@ -243,15 +243,15 @@ class StructType : public Type {
StructType &operator=(const StructType &) = delete;
/// This creates an identified struct.
- static StructType *create(LLVMContext &Context, StringRef Name);
- static StructType *create(LLVMContext &Context);
+ LLVM_ABI static StructType *create(LLVMContext &Context, StringRef Name);
+ LLVM_ABI static StructType *create(LLVMContext &Context);
- static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
+ LLVM_ABI static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
bool isPacked = false);
- static StructType *create(ArrayRef<Type *> Elements);
- static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements,
+ LLVM_ABI static StructType *create(ArrayRef<Type *> Elements);
+ LLVM_ABI static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements,
StringRef Name, bool isPacked = false);
- static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements);
+ LLVM_ABI static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements);
template <class... Tys>
static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
create(StringRef Name, Type *elt1, Tys *... elts) {
@@ -260,11 +260,11 @@ class StructType : public Type {
}
/// This static method is the primary way to create a literal StructType.
- static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
+ LLVM_ABI static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
bool isPacked = false);
/// Create an empty structure type.
- static StructType *get(LLVMContext &Context, bool isPacked = false);
+ LLVM_ABI static StructType *get(LLVMContext &Context, bool isPacked = false);
/// This static method is a convenience method for creating structure types by
/// specifying the elements as arguments. Note that this method always returns
@@ -279,7 +279,7 @@ class StructType : public Type {
/// Return the type with the specified name, or null if there is none by that
/// name.
- static StructType *getTypeByName(LLVMContext &C, StringRef Name);
+ LLVM_ABI static StructType *getTypeByName(LLVMContext &C, StringRef Name);
bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }
@@ -292,21 +292,21 @@ class StructType : public Type {
bool isOpaque() const { return (getSubclassData() & SCDB_HasBody) == 0; }
/// isSized - Return true if this is a sized type.
- bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
+ LLVM_ABI bool isSized(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
/// Returns true if this struct contains a scalable vector.
- bool isScalableTy(SmallPtrSetImpl<const Type *> &Visited) const;
+ LLVM_ABI bool isScalableTy(SmallPtrSetImpl<const Type *> &Visited) const;
using Type::isScalableTy;
/// Return true if this type is or contains a target extension type that
/// disallows being used as a global.
- bool
+ LLVM_ABI bool
containsNonGlobalTargetExtType(SmallPtrSetImpl<const Type *> &Visited) const;
using Type::containsNonGlobalTargetExtType;
/// Return true if this type is or contains a target extension type that
/// disallows being used as a local.
- bool
+ LLVM_ABI bool
containsNonLocalTargetExtType(SmallPtrSetImpl<const Type *> &Visited) const;
using Type::containsNonLocalTargetExtType;
@@ -316,11 +316,11 @@ class StructType : public Type {
/// when calling this function.
/// {{<vscale x 2 x i32>, <vscale x 4 x i64>},
/// {<vscale x 2 x i32>, <vscale x 4 x i64>}}
- bool containsHomogeneousScalableVectorTypes() const;
+ LLVM_ABI bool containsHomogeneousScalableVectorTypes() const;
/// Return true if this struct is non-empty and all element types are the
/// same.
- bool containsHomogeneousTypes() const;
+ LLVM_ABI bool containsHomogeneousTypes() const;
/// Return true if this is a named struct that has a non-empty name.
bool hasName() const { return SymbolTableEntry != nullptr; }
@@ -328,26 +328,26 @@ class StructType : public Type {
/// Return the name for this struct type if it has an identity.
/// This may return an empty string for an unnamed struct type. Do not call
/// this on an literal type.
- StringRef getName() const;
+ LLVM_ABI StringRef getName() const;
/// Change the name of this type to the specified name, or to a name with a
/// suffix if there is a collision. Do not call this on an literal type.
- void setName(StringRef Name);
+ LLVM_ABI void setName(StringRef Name);
/// Specify a body for an opaque identified type, which must not make the type
/// recursive.
- void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
+ LLVM_ABI void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
/// Specify a body for an opaque identified type or return an error if it
/// would make the type recursive.
- Error setBodyOrError(ArrayRef<Type *> Elements, bool isPacked = false);
+ LLVM_ABI Error setBodyOrError(ArrayRef<Type *> Elements, bool isPacked = false);
/// Return an error if the body for an opaque identified type would make it
/// recursive.
- Error checkBody(ArrayRef<Type *> Elements);
+ LLVM_ABI Error checkBody(ArrayRef<Type *> Elements);
/// Return true if the specified type is valid as a element type.
- static bool isValidElementType(Type *ElemTy);
+ LLVM_ABI static bool isValidElementType(Type *ElemTy);
// Iterator access to the elements.
using element_iterator = Type::subtype_iterator;
@@ -359,7 +359,7 @@ class StructType : public Type {
}
/// Return true if this is layout identical to the specified struct.
- bool isLayoutIdentical(StructType *Other) const;
+ LLVM_ABI bool isLayoutIdentical(StructType *Other) const;
/// Random access to the elements
unsigned getNumElements() const { return NumContainedTys; }
@@ -368,9 +368,9 @@ class StructType : public Type {
return ContainedTys[N];
}
/// Given an index value into the type, return the type of the element.
- Type *getTypeAtIndex(const Value *V) const;
+ LLVM_ABI Type *getTypeAtIndex(const Value *V) const;
Type *getTypeAtIndex(unsigned N) const { return getElementType(N); }
- bool indexValid(const Value *V) const;
+ LLVM_ABI bool indexValid(const Value *V) const;
bool indexValid(unsigned Idx) const { return Idx < getNumElements(); }
/// Methods for support type inquiry through isa, cast, and dyn_cast.
@@ -408,10 +408,10 @@ class ArrayType : public Type {
Type *getElementType() const { return ContainedType; }
/// This static method is the primary way to construct an ArrayType
- static ArrayType *get(Type *ElementType, uint64_t NumElements);
+ LLVM_ABI static ArrayType *get(Type *ElementType, uint64_t NumElements);
/// Return true if the specified type is valid as a element type.
- static bool isValidElementType(Type *ElemTy);
+ LLVM_ABI static bool isValidElementType(Type *ElemTy);
/// Methods for support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Type *T) {
@@ -451,7 +451,7 @@ class VectorType : public Type {
/// vscale is a runtime-constant integer greater than 0.
const unsigned ElementQuantity;
- VectorType(Type *ElType, unsigned EQ, Type::TypeID TID);
+ LLVM_ABI VectorType(Type *ElType, unsigned EQ, Type::TypeID TID);
public:
VectorType(const VectorType &) = delete;
@@ -460,7 +460,7 @@ class VectorType : public Type {
Type *getElementType() const { return ContainedType; }
/// This static method is the primary way to construct an VectorType.
- static VectorType *get(Type *ElementType, ElementCount EC);
+ LLVM_ABI static VectorType *get(Type *ElementType, ElementCount EC);
static VectorType *get(Type *ElementType, unsigned NumElements,
bool Scalable) {
@@ -572,7 +572,7 @@ class VectorType : public Type {
}
/// Return true if the specified type is valid as a element type.
- static bool isValidElementType(Type *ElemTy);
+ LLVM_ABI static bool isValidElementType(Type *ElemTy);
/// Return an ElementCount instance to represent the (possibly scalable)
/// number of elements in the vector.
@@ -592,7 +592,7 @@ class FixedVectorType : public VectorType {
: VectorType(ElTy, NumElts, FixedVectorTyID) {}
public:
- static FixedVectorType *get(Type *ElementType, unsigned NumElts);
+ LLVM_ABI static FixedVectorType *get(Type *ElementType, unsigned NumElts);
static FixedVectorType *get(Type *ElementType, const FixedVectorType *FVTy) {
return get(ElementType, FVTy->getNumElements());
@@ -639,7 +639,7 @@ class ScalableVectorType : public VectorType {
: VectorType(ElTy, MinNumElts, ScalableVectorTyID) {}
public:
- static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts);
+ LLVM_ABI static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts);
static ScalableVectorType *get(Type *ElementType,
const ScalableVectorType *SVTy) {
@@ -702,12 +702,12 @@ class PointerType : public Type {
/// This constructs a pointer to an object of the specified type in a numbered
/// address space.
- [[deprecated("PointerType::get with pointee type is pending removal. Use "
+ LLVM_ABI [[deprecated("PointerType::get with pointee type is pending removal. Use "
"Context overload.")]]
static PointerType *get(Type *ElementType, unsigned AddressSpace);
/// This constructs an opaque pointer to an object in a numbered address
/// space.
- static PointerType *get(LLVMContext &C, unsigned AddressSpace);
+ LLVM_ABI static PointerType *get(LLVMContext &C, unsigned AddressSpace);
/// This constructs a pointer to an object of the specified type in the
/// default address space (address space zero).
@@ -727,10 +727,10 @@ class PointerType : public Type {
}
/// Return true if the specified type is valid as a element type.
- static bool isValidElementType(Type *ElemTy);
+ LLVM_ABI static bool isValidElementType(Type *ElemTy);
/// Return true if we can load or store from a pointer to this type.
- static bool isLoadableOrStorableType(Type *ElemTy);
+ LLVM_ABI static bool isLoadableOrStorableType(Type *ElemTy);
/// Return the address space of the Pointer type.
inline unsigned getAddressSpace() const { return getSubclassData(); }
@@ -788,14 +788,14 @@ class TargetExtType : public Type {
/// Return a target extension type having the specified name and optional
/// type and integer parameters.
- static TargetExtType *get(LLVMContext &Context, StringRef Name,
+ LLVM_ABI static TargetExtType *get(LLVMContext &Context, StringRef Name,
ArrayRef<Type *> Types = {},
ArrayRef<unsigned> Ints = {});
/// Return a target extension type having the specified name and optional
/// type and integer parameters, or an appropriate Error if it fails the
/// parameters check.
- static Expected<TargetExtType *> getOrError(LLVMContext &Context,
+ LLVM_ABI static Expected<TargetExtType *> getOrError(LLVMContext &Context,
StringRef Name,
ArrayRef<Type *> Types = {},
ArrayRef<unsigned> Ints = {});
@@ -803,7 +803,7 @@ class TargetExtType : public Type {
/// Check that a newly created target extension type has the expected number
/// of type parameters and integer parameters, returning the type itself if OK
/// or an appropriate Error if not.
- static Expected<TargetExtType *> checkParams(TargetExtType *TTy);
+ LLVM_ABI static Expected<TargetExtType *> checkParams(TargetExtType *TTy);
/// Return the name for this target extension type. Two distinct target
/// extension types may have the same name if their type or integer parameters
@@ -845,13 +845,13 @@ class TargetExtType : public Type {
};
/// Returns true if the target extension type contains the given property.
- bool hasProperty(Property Prop) const;
+ LLVM_ABI bool hasProperty(Property Prop) const;
/// Returns an underlying layout type for the target extension type. This
/// type can be used to query size and alignment information, if it is
/// appropriate (although note that the layout type may also be void). It is
/// not legal to bitcast between this type and the layout type, however.
- Type *getLayoutType() const;
+ LLVM_ABI Type *getLayoutType() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Type *T) { return T->getTypeID() == TargetExtTyID; }
diff --git a/llvm/include/llvm/IR/DiagnosticHandler.h b/llvm/include/llvm/IR/DiagnosticHandler.h
index 1f0544b9fa9f8..cfd70ce978fdc 100644
--- a/llvm/include/llvm/IR/DiagnosticHandler.h
+++ b/llvm/include/llvm/IR/DiagnosticHandler.h
@@ -12,6 +12,7 @@
#ifndef LLVM_IR_DIAGNOSTICHANDLER_H
#define LLVM_IR_DIAGNOSTICHANDLER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
namespace llvm {
@@ -21,7 +22,7 @@ class DiagnosticInfo;
/// The handleDiagnostics method must be overriden by the subclasses to handle
/// diagnostic. The *RemarkEnabled methods can be overriden to control
/// which remarks are enabled.
-struct DiagnosticHandler {
+struct LLVM_ABI DiagnosticHandler {
void *DiagnosticContext = nullptr;
bool HasErrors = false;
DiagnosticHandler(void *DiagContext = nullptr)
diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h
index a1113134f6a34..9509a3715b76b 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_DIAGNOSTICINFO_H
#define LLVM_IR_DIAGNOSTICINFO_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
@@ -103,14 +104,14 @@ enum DiagnosticKind {
/// The returned ID will be greater than or equal to DK_FirstPluginKind.
/// Thus, the plugin identifiers will not conflict with the
/// DiagnosticKind values.
-int getNextAvailablePluginDiagnosticKind();
+LLVM_ABI int getNextAvailablePluginDiagnosticKind();
/// This is the base abstract class for diagnostic reporting in
/// the backend.
/// The print method must be overloaded by the subclasses to print a
/// user-friendly message in the client of the backend (let us call it a
/// frontend).
-class DiagnosticInfo {
+class LLVM_ABI DiagnosticInfo {
private:
/// Kind defines the kind of report this is about.
const /* DiagnosticKind */ int Kind;
@@ -138,7 +139,7 @@ class DiagnosticInfo {
using DiagnosticHandlerFunction = std::function<void(const DiagnosticInfo &)>;
-class DiagnosticInfoGeneric : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoGeneric : public DiagnosticInfo {
const Twine &MsgStr;
const Instruction *Inst = nullptr;
@@ -167,7 +168,7 @@ class DiagnosticInfoGeneric : public DiagnosticInfo {
/// Diagnostic information for inline asm reporting.
/// This is basically a message and an optional location.
-class DiagnosticInfoInlineAsm : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoInlineAsm : public DiagnosticInfo {
private:
/// Optional line information. 0 if not set.
uint64_t LocCookie = 0;
@@ -206,7 +207,7 @@ class DiagnosticInfoInlineAsm : public DiagnosticInfo {
/// Diagnostic information for debug metadata version reporting.
/// This is basically a module and a version.
-class DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
private:
/// The module that is concerned by this debug metadata version diagnostic.
const Module &M;
@@ -233,7 +234,7 @@ class DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
};
/// Diagnostic information for stripping invalid debug metadata.
-class DiagnosticInfoIgnoringInvalidDebugMetadata : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoIgnoringInvalidDebugMetadata : public DiagnosticInfo {
private:
/// The module that is concerned by this debug metadata version diagnostic.
const Module &M;
@@ -255,7 +256,7 @@ class DiagnosticInfoIgnoringInvalidDebugMetadata : public DiagnosticInfo {
};
/// Diagnostic information for the sample profiler.
-class DiagnosticInfoSampleProfile : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoSampleProfile : public DiagnosticInfo {
public:
DiagnosticInfoSampleProfile(StringRef FileName, unsigned LineNum,
const Twine &Msg,
@@ -294,7 +295,7 @@ class DiagnosticInfoSampleProfile : public DiagnosticInfo {
};
/// Diagnostic information for the PGO profiler.
-class DiagnosticInfoPGOProfile : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoPGOProfile : public DiagnosticInfo {
public:
DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg,
DiagnosticSeverity Severity = DS_Error)
@@ -325,20 +326,20 @@ class DiagnosticLocation {
public:
DiagnosticLocation() = default;
- DiagnosticLocation(const DebugLoc &DL);
- DiagnosticLocation(const DISubprogram *SP);
+ LLVM_ABI DiagnosticLocation(const DebugLoc &DL);
+ LLVM_ABI DiagnosticLocation(const DISubprogram *SP);
bool isValid() const { return File; }
/// Return the full path to the file.
- std::string getAbsolutePath() const;
+ LLVM_ABI std::string getAbsolutePath() const;
/// Return the file name relative to the compilation directory.
- StringRef getRelativePath() const;
+ LLVM_ABI StringRef getRelativePath() const;
unsigned getLine() const { return Line; }
unsigned getColumn() const { return Column; }
};
/// Common features for diagnostics with an associated location.
-class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoWithLocationBase : public DiagnosticInfo {
void anchor() override;
public:
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
@@ -376,7 +377,7 @@ class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
DiagnosticLocation Loc;
};
-class DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationBase {
private:
/// Message to be reported.
const Twine &MsgStr;
@@ -401,7 +402,7 @@ class DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationBase {
}
};
-class DiagnosticInfoRegAllocFailure : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoRegAllocFailure : public DiagnosticInfoWithLocationBase {
private:
/// Message to be reported.
const Twine &MsgStr;
@@ -429,7 +430,7 @@ class DiagnosticInfoRegAllocFailure : public DiagnosticInfoWithLocationBase {
/// Diagnostic information for stack size etc. reporting.
/// This is basically a function and a size.
-class DiagnosticInfoResourceLimit : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoResourceLimit : public DiagnosticInfoWithLocationBase {
private:
/// The function that is concerned by this resource limit diagnostic.
const Function &Fn;
@@ -464,7 +465,7 @@ class DiagnosticInfoResourceLimit : public DiagnosticInfoWithLocationBase {
}
};
-class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
+class LLVM_ABI DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
void anchor() override;
public:
@@ -484,7 +485,7 @@ class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
/// Common features for diagnostics dealing with optimization remarks
/// that are used by both IR and MIR passes.
-class DiagnosticInfoOptimizationBase : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoOptimizationBase : public DiagnosticInfoWithLocationBase {
public:
/// Used to set IsVerbose via the stream interface.
struct setIsVerbose {};
@@ -504,21 +505,21 @@ class DiagnosticInfoOptimizationBase : public DiagnosticInfoWithLocationBase {
DiagnosticLocation Loc;
explicit Argument(StringRef Str = "") : Key("String"), Val(Str) {}
- Argument(StringRef Key, const Value *V);
- Argument(StringRef Key, const Type *T);
- Argument(StringRef Key, StringRef S);
+ LLVM_ABI Argument(StringRef Key, const Value *V);
+ LLVM_ABI Argument(StringRef Key, const Type *T);
+ LLVM_ABI Argument(StringRef Key, StringRef S);
Argument(StringRef Key, const char *S) : Argument(Key, StringRef(S)) {};
- Argument(StringRef Key, int N);
- Argument(StringRef Key, float N);
- Argument(StringRef Key, long N);
- Argument(StringRef Key, long long N);
- Argument(StringRef Key, unsigned N);
- Argument(StringRef Key, unsigned long N);
- Argument(StringRef Key, unsigned long long N);
- Argument(StringRef Key, ElementCount EC);
+ LLVM_ABI Argument(StringRef Key, int N);
+ LLVM_ABI Argument(StringRef Key, float N);
+ LLVM_ABI Argument(StringRef Key, long N);
+ LLVM_ABI Argument(StringRef Key, long long N);
+ LLVM_ABI Argument(StringRef Key, unsigned N);
+ LLVM_ABI Argument(StringRef Key, unsigned long N);
+ LLVM_ABI Argument(StringRef Key, unsigned long long N);
+ LLVM_ABI Argument(StringRef Key, ElementCount EC);
Argument(StringRef Key, bool B) : Key(Key), Val(B ? "true" : "false") {}
- Argument(StringRef Key, DebugLoc dl);
- Argument(StringRef Key, InstructionCost C);
+ LLVM_ABI Argument(StringRef Key, DebugLoc dl);
+ LLVM_ABI Argument(StringRef Key, InstructionCost C);
};
/// \p PassName is the name of the pass emitting this diagnostic. \p
@@ -658,7 +659,7 @@ operator<<(RemarkT &&R,
/// Common features for diagnostics dealing with optimization remarks
/// that are used by IR passes.
-class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
+class LLVM_ABI DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
void anchor() override;
public:
/// \p PassName is the name of the pass emitting this diagnostic. \p
@@ -725,7 +726,7 @@ class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
};
/// Diagnostic information for applied optimization remarks.
-class OptimizationRemark : public DiagnosticInfoIROptimization {
+class LLVM_ABI OptimizationRemark : public DiagnosticInfoIROptimization {
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass=, then the diagnostic will
@@ -770,7 +771,7 @@ class OptimizationRemark : public DiagnosticInfoIROptimization {
};
/// Diagnostic information for missed-optimization remarks.
-class OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
+class LLVM_ABI OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-missed=, then the
@@ -816,7 +817,7 @@ class OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
};
/// Diagnostic information for optimization analysis remarks.
-class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
+class LLVM_ABI OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-analysis=, then the
@@ -889,7 +890,7 @@ class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
/// Diagnostic information for optimization analysis remarks related to
/// floating-point non-commutativity.
-class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
+class LLVM_ABI OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
void anchor() override;
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
@@ -931,7 +932,7 @@ class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
/// Diagnostic information for optimization analysis remarks related to
/// pointer aliasing.
-class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
+class LLVM_ABI OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
void anchor() override;
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
@@ -972,7 +973,7 @@ class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
/// Diagnostic information for machine IR parser.
// FIXME: Remove this, use DiagnosticInfoSrcMgr instead.
-class DiagnosticInfoMIRParser : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoMIRParser : public DiagnosticInfo {
const SMDiagnostic &Diagnostic;
public:
@@ -990,7 +991,7 @@ class DiagnosticInfoMIRParser : public DiagnosticInfo {
};
/// Diagnostic information for IR instrumentation reporting.
-class DiagnosticInfoInstrumentation : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoInstrumentation : public DiagnosticInfo {
const Twine &Msg;
public:
@@ -1006,7 +1007,7 @@ class DiagnosticInfoInstrumentation : public DiagnosticInfo {
};
/// Diagnostic information for ISel fallback path.
-class DiagnosticInfoISelFallback : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoISelFallback : public DiagnosticInfo {
/// The function that is concerned by this diagnostic.
const Function &Fn;
@@ -1028,7 +1029,7 @@ class DiagnosticInfoISelFallback : public DiagnosticInfo {
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)
/// Diagnostic information for optimization failures.
-class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
+class LLVM_ABI DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
public:
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
/// the location information to use in the diagnostic. If line table
@@ -1060,7 +1061,7 @@ class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
};
/// Diagnostic information for unsupported feature in backend.
-class DiagnosticInfoUnsupported : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoUnsupported : public DiagnosticInfoWithLocationBase {
private:
Twine Msg;
@@ -1088,7 +1089,7 @@ class DiagnosticInfoUnsupported : public DiagnosticInfoWithLocationBase {
};
/// Diagnostic information for MisExpect analysis.
-class DiagnosticInfoMisExpect : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoMisExpect : public DiagnosticInfoWithLocationBase {
public:
DiagnosticInfoMisExpect(const Instruction *Inst, const Twine &Msg);
@@ -1125,7 +1126,7 @@ static DiagnosticSeverity getDiagnosticSeverity(SourceMgr::DiagKind DK) {
}
/// Diagnostic information for SMDiagnostic reporting.
-class DiagnosticInfoSrcMgr : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoSrcMgr : public DiagnosticInfo {
const SMDiagnostic &Diagnostic;
StringRef ModName;
@@ -1151,9 +1152,9 @@ class DiagnosticInfoSrcMgr : public DiagnosticInfo {
}
};
-void diagnoseDontCall(const CallInst &CI);
+LLVM_ABI void diagnoseDontCall(const CallInst &CI);
-class DiagnosticInfoDontCall : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoDontCall : public DiagnosticInfo {
StringRef CalleeName;
StringRef Note;
uint64_t LocCookie;
diff --git a/llvm/include/llvm/IR/DiagnosticPrinter.h b/llvm/include/llvm/IR/DiagnosticPrinter.h
index 2df6fc3dfe739..331fc94aeb314 100644
--- a/llvm/include/llvm/IR/DiagnosticPrinter.h
+++ b/llvm/include/llvm/IR/DiagnosticPrinter.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_DIAGNOSTICPRINTER_H
#define LLVM_IR_DIAGNOSTICPRINTER_H
+#include "llvm/Support/Compiler.h"
#include <string>
namespace llvm {
@@ -58,7 +59,7 @@ class DiagnosticPrinter {
};
/// Basic diagnostic printer that uses an underlying raw_ostream.
-class DiagnosticPrinterRawOStream : public DiagnosticPrinter {
+class LLVM_ABI DiagnosticPrinterRawOStream : public DiagnosticPrinter {
protected:
raw_ostream &Stream;
diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h
index 287f419f893db..1ef84efe52781 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_DOMINATORS_H
#define LLVM_IR_DOMINATORS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMapInfo.h"
@@ -114,13 +115,13 @@ class BasicBlockEdge {
}
/// Check if this is the only edge between Start and End.
- bool isSingleEdge() const;
+ LLVM_ABI bool isSingleEdge() const;
};
template <> struct DenseMapInfo<BasicBlockEdge> {
using BBInfo = DenseMapInfo<const BasicBlock *>;
- static unsigned getHashValue(const BasicBlockEdge *V);
+ LLVM_ABI static unsigned getHashValue(const BasicBlockEdge *V);
static inline BasicBlockEdge getEmptyKey() {
return BasicBlockEdge(BBInfo::getEmptyKey(), BBInfo::getEmptyKey());
@@ -170,14 +171,14 @@ class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
}
/// Handle invalidation explicitly.
- bool invalidate(Function &F, const PreservedAnalyses &PA,
+ LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &);
// Ensure base-class overloads are visible.
using Base::dominates;
/// Return true if the (end of the) basic block BB dominates the use U.
- bool dominates(const BasicBlock *BB, const Use &U) const;
+ LLVM_ABI bool dominates(const BasicBlock *BB, const Use &U) const;
/// Return true if value Def dominates use U, in the sense that Def is
/// available at U, and could be substituted as the used value without
@@ -188,11 +189,11 @@ class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
/// * Def does not dominate a use in Def itself (outside of degenerate cases
/// like unreachable code or trivial phi cycles).
/// * Invoke Defs only dominate uses in their default destination.
- bool dominates(const Value *Def, const Use &U) const;
+ LLVM_ABI bool dominates(const Value *Def, const Use &U) const;
/// Return true if value Def dominates all possible uses inside instruction
/// User. Same comments as for the Use-based API apply.
- bool dominates(const Value *Def, const Instruction *User) const;
+ LLVM_ABI bool dominates(const Value *Def, const Instruction *User) const;
bool dominates(const Value *Def, BasicBlock::iterator User) const {
return dominates(Def, &*User);
}
@@ -202,34 +203,34 @@ class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
///
/// Does not accept Value to avoid ambiguity with dominance checks between
/// two basic blocks.
- bool dominates(const Instruction *Def, const BasicBlock *BB) const;
+ LLVM_ABI bool dominates(const Instruction *Def, const BasicBlock *BB) const;
/// Return true if an edge dominates a use.
///
/// If BBE is not a unique edge between start and end of the edge, it can
/// never dominate the use.
- bool dominates(const BasicBlockEdge &BBE, const Use &U) const;
- bool dominates(const BasicBlockEdge &BBE, const BasicBlock *BB) const;
+ LLVM_ABI bool dominates(const BasicBlockEdge &BBE, const Use &U) const;
+ LLVM_ABI bool dominates(const BasicBlockEdge &BBE, const BasicBlock *BB) const;
/// Returns true if edge \p BBE1 dominates edge \p BBE2.
- bool dominates(const BasicBlockEdge &BBE1, const BasicBlockEdge &BBE2) const;
+ LLVM_ABI bool dominates(const BasicBlockEdge &BBE1, const BasicBlockEdge &BBE2) const;
// Ensure base class overloads are visible.
using Base::isReachableFromEntry;
/// Provide an overload for a Use.
- bool isReachableFromEntry(const Use &U) const;
+ LLVM_ABI bool isReachableFromEntry(const Use &U) const;
// Ensure base class overloads are visible.
using Base::findNearestCommonDominator;
/// Find the nearest instruction I that dominates both I1 and I2, in the sense
/// that a result produced before I will be available at both I1 and I2.
- Instruction *findNearestCommonDominator(Instruction *I1,
+ LLVM_ABI Instruction *findNearestCommonDominator(Instruction *I1,
Instruction *I2) const;
// Pop up a GraphViz/gv window with the Dominator Tree rendered using `dot`.
- void viewGraph(const Twine &Name, const Twine &Title);
- void viewGraph();
+ LLVM_ABI void viewGraph(const Twine &Name, const Twine &Title);
+ LLVM_ABI void viewGraph();
};
//===-------------------------------------
@@ -285,7 +286,7 @@ class DominatorTreeAnalysis : public AnalysisInfoMixin<DominatorTreeAnalysis> {
using Result = DominatorTree;
/// Run the analysis pass over a function and produce a dominator tree.
- DominatorTree run(Function &F, FunctionAnalysisManager &);
+ LLVM_ABI DominatorTree run(Function &F, FunctionAnalysisManager &);
};
/// Printer pass for the \c DominatorTree.
@@ -294,16 +295,16 @@ class DominatorTreePrinterPass
raw_ostream &OS;
public:
- explicit DominatorTreePrinterPass(raw_ostream &OS);
+ LLVM_ABI explicit DominatorTreePrinterPass(raw_ostream &OS);
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
/// Verifier pass for the \c DominatorTree.
struct DominatorTreeVerifierPass : PassInfoMixin<DominatorTreeVerifierPass> {
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
@@ -311,10 +312,10 @@ struct DominatorTreeVerifierPass : PassInfoMixin<DominatorTreeVerifierPass> {
///
/// This check is expensive and is disabled by default. `-verify-dom-info`
/// allows selectively enabling the check without needing to recompile.
-extern bool VerifyDomInfo;
+LLVM_ABI extern bool VerifyDomInfo;
/// Legacy analysis pass which computes a \c DominatorTree.
-class DominatorTreeWrapperPass : public FunctionPass {
+class LLVM_ABI DominatorTreeWrapperPass : public FunctionPass {
DominatorTree DT;
public:
diff --git a/llvm/include/llvm/IR/DroppedVariableStats.h b/llvm/include/llvm/IR/DroppedVariableStats.h
index ebd74a69a8b91..a01dd75c221eb 100644
--- a/llvm/include/llvm/IR/DroppedVariableStats.h
+++ b/llvm/include/llvm/IR/DroppedVariableStats.h
@@ -14,6 +14,7 @@
#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATS_H
#define LLVM_CODEGEN_DROPPEDVARIABLESTATS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include <tuple>
@@ -39,7 +40,7 @@ using VarID =
/// statistics.
class DroppedVariableStats {
public:
- DroppedVariableStats(bool DroppedVarStatsEnabled);
+ LLVM_ABI DroppedVariableStats(bool DroppedVarStatsEnabled);
virtual ~DroppedVariableStats() {}
@@ -50,9 +51,9 @@ class DroppedVariableStats {
bool getPassDroppedVariables() { return PassDroppedVariables; }
protected:
- void setup();
+ LLVM_ABI void setup();
- void cleanup();
+ LLVM_ABI void cleanup();
bool DroppedVariableStatsEnabled = false;
struct DebugVariables {
@@ -75,26 +76,26 @@ class DroppedVariableStats {
SmallVector<DenseMap<StringRef, DenseMap<VarID, DILocation *>>> InlinedAts;
/// Calculate the number of dropped variables in an llvm::Function or
/// llvm::MachineFunction and print the relevant information to stdout.
- void calculateDroppedStatsAndPrint(DebugVariables &DbgVariables,
+ LLVM_ABI void calculateDroppedStatsAndPrint(DebugVariables &DbgVariables,
StringRef FuncName, StringRef PassID,
StringRef FuncOrModName,
StringRef PassLevel, const Function *Func);
/// Check if a \p Var has been dropped or is a false positive. Also update the
/// \p DroppedCount if a debug variable is dropped.
- bool updateDroppedCount(DILocation *DbgLoc, const DIScope *Scope,
+ LLVM_ABI bool updateDroppedCount(DILocation *DbgLoc, const DIScope *Scope,
const DIScope *DbgValScope,
DenseMap<VarID, DILocation *> &InlinedAtsMap,
VarID Var, unsigned &DroppedCount);
/// Run code to populate relevant data structures over an llvm::Function or
/// llvm::MachineFunction.
- void run(DebugVariables &DbgVariables, StringRef FuncName, bool Before);
+ LLVM_ABI void run(DebugVariables &DbgVariables, StringRef FuncName, bool Before);
/// Populate the VarIDSet and InlinedAtMap with the relevant information
/// needed for before and after pass analysis to determine dropped variable
/// status.
- void populateVarIDSetAndInlinedMap(
+ LLVM_ABI void populateVarIDSetAndInlinedMap(
const DILocalVariable *DbgVar, DebugLoc DbgLoc, DenseSet<VarID> &VarIDSet,
DenseMap<StringRef, DenseMap<VarID, DILocation *>> &InlinedAtsMap,
StringRef FuncName, bool Before);
diff --git a/llvm/include/llvm/IR/DroppedVariableStatsIR.h b/llvm/include/llvm/IR/DroppedVariableStatsIR.h
index 72b91dbc7ed52..454cd1afaaffb 100644
--- a/llvm/include/llvm/IR/DroppedVariableStatsIR.h
+++ b/llvm/include/llvm/IR/DroppedVariableStatsIR.h
@@ -14,6 +14,7 @@
#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
#define LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/DroppedVariableStats.h"
namespace llvm {
@@ -28,7 +29,7 @@ class DILocation;
/// A class to collect and print dropped debug information due to LLVM IR
/// optimization passes. After every LLVM IR pass is run, it will print how many
/// #dbg_values were dropped due to that pass.
-class DroppedVariableStatsIR : public DroppedVariableStats {
+class LLVM_ABI DroppedVariableStatsIR : public DroppedVariableStats {
public:
DroppedVariableStatsIR(bool DroppedVarStatsEnabled)
: llvm::DroppedVariableStats(DroppedVarStatsEnabled) {}
diff --git a/llvm/include/llvm/IR/EHPersonalities.h b/llvm/include/llvm/IR/EHPersonalities.h
index c70f832de40b4..d21b68dff095b 100644
--- a/llvm/include/llvm/IR/EHPersonalities.h
+++ b/llvm/include/llvm/IR/EHPersonalities.h
@@ -9,6 +9,7 @@
#ifndef LLVM_IR_EHPERSONALITIES_H
#define LLVM_IR_EHPERSONALITIES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/TinyPtrVector.h"
@@ -39,11 +40,11 @@ enum class EHPersonality {
/// See if the given exception handling personality function is one
/// that we understand. If so, return a description of it; otherwise return
/// Unknown.
-EHPersonality classifyEHPersonality(const Value *Pers);
+LLVM_ABI EHPersonality classifyEHPersonality(const Value *Pers);
-StringRef getEHPersonalityName(EHPersonality Pers);
+LLVM_ABI StringRef getEHPersonalityName(EHPersonality Pers);
-EHPersonality getDefaultEHPersonality(const Triple &T);
+LLVM_ABI EHPersonality getDefaultEHPersonality(const Triple &T);
/// Returns true if this personality function catches asynchronous
/// exceptions.
@@ -104,7 +105,7 @@ inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
llvm_unreachable("invalid enum");
}
-bool canSimplifyInvokeNoUnwind(const Function *F);
+LLVM_ABI bool canSimplifyInvokeNoUnwind(const Function *F);
typedef TinyPtrVector<BasicBlock *> ColorVector;
@@ -112,7 +113,7 @@ typedef TinyPtrVector<BasicBlock *> ColorVector;
/// this will recompute which blocks are in which funclet. It is possible that
/// some blocks are in multiple funclets. Consider this analysis to be
/// expensive.
-DenseMap<BasicBlock *, ColorVector> colorEHFunclets(Function &F);
+LLVM_ABI DenseMap<BasicBlock *, ColorVector> colorEHFunclets(Function &F);
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/FMF.h b/llvm/include/llvm/IR/FMF.h
index da274a1d6ec43..416eeb13f9382 100644
--- a/llvm/include/llvm/IR/FMF.h
+++ b/llvm/include/llvm/IR/FMF.h
@@ -104,7 +104,7 @@ class FastMathFlags {
}
/// Print fast-math flags to \p O.
- void print(raw_ostream &O) const;
+ LLVM_ABI void print(raw_ostream &O) const;
/// Intersect rewrite-based flags
static inline FastMathFlags intersectRewrite(FastMathFlags LHS,
diff --git a/llvm/include/llvm/IR/FPEnv.h b/llvm/include/llvm/IR/FPEnv.h
index a0197377759da..053588243a366 100644
--- a/llvm/include/llvm/IR/FPEnv.h
+++ b/llvm/include/llvm/IR/FPEnv.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_FPENV_H
#define LLVM_IR_FPENV_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/IR/FMF.h"
#include <optional>
@@ -46,19 +47,19 @@ enum ExceptionBehavior : uint8_t {
/// Returns a valid RoundingMode enumerator when given a string
/// that is valid as input in constrained intrinsic rounding mode
/// metadata.
-std::optional<RoundingMode> convertStrToRoundingMode(StringRef);
+LLVM_ABI std::optional<RoundingMode> convertStrToRoundingMode(StringRef);
/// For any RoundingMode enumerator, returns a string valid as input in
/// constrained intrinsic rounding mode metadata.
-std::optional<StringRef> convertRoundingModeToStr(RoundingMode);
+LLVM_ABI std::optional<StringRef> convertRoundingModeToStr(RoundingMode);
/// Returns a valid ExceptionBehavior enumerator when given a string
/// valid as input in constrained intrinsic exception behavior metadata.
-std::optional<fp::ExceptionBehavior> convertStrToExceptionBehavior(StringRef);
+LLVM_ABI std::optional<fp::ExceptionBehavior> convertStrToExceptionBehavior(StringRef);
/// For any ExceptionBehavior enumerator, returns a string valid as
/// input in constrained intrinsic exception behavior metadata.
-std::optional<StringRef> convertExceptionBehaviorToStr(fp::ExceptionBehavior);
+LLVM_ABI std::optional<StringRef> convertExceptionBehaviorToStr(fp::ExceptionBehavior);
/// Returns true if the exception handling behavior and rounding mode
/// match what is used in the default floating point environment.
@@ -70,7 +71,7 @@ inline bool isDefaultFPEnvironment(fp::ExceptionBehavior EB, RoundingMode RM) {
/// strictfp function. If the instruction is already a constrained intrinsic or
/// does not have a constrained intrinsic counterpart, the function returns
/// zero.
-Intrinsic::ID getConstrainedIntrinsicID(const Instruction &Instr);
+LLVM_ABI Intrinsic::ID getConstrainedIntrinsicID(const Instruction &Instr);
/// Returns true if the rounding mode RM may be QRM at compile time or
/// at run time.
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 6d4a53da7ff22..e5e509c14963e 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -17,6 +17,7 @@
#ifndef LLVM_IR_FUNCTION_H
#define LLVM_IR_FUNCTION_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
@@ -1052,7 +1053,7 @@ namespace CallingConv {
// TODO: Need similar function for support of argument in position. General
// version on FunctionType + Attributes + CallingConv::ID?
-LLVM_READNONE
+LLVM_ABI LLVM_READNONE
bool supportsNonVoidReturnType(CallingConv::ID CC);
} // namespace CallingConv
@@ -1061,7 +1062,7 @@ bool supportsNonVoidReturnType(CallingConv::ID CC);
/// Null pointer access in non-zero address space is not considered undefined.
/// Return value: false => null pointer dereference is undefined.
/// Return value: true => null pointer dereference is not undefined.
-bool NullPointerIsDefined(const Function *F, unsigned AS = 0);
+LLVM_ABI bool NullPointerIsDefined(const Function *F, unsigned AS = 0);
template <> struct OperandTraits<Function> : public HungoffOperandTraits {};
diff --git a/llvm/include/llvm/IR/GlobalAlias.h b/llvm/include/llvm/IR/GlobalAlias.h
index 3db6984c4a30c..991d03dcd08c4 100644
--- a/llvm/include/llvm/IR/GlobalAlias.h
+++ b/llvm/include/llvm/IR/GlobalAlias.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_GLOBALALIAS_H
#define LLVM_IR_GLOBALALIAS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/OperandTraits.h"
@@ -39,26 +40,26 @@ class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
/// If a parent module is specified, the alias is automatically inserted into
/// the end of the specified module's alias list.
- static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
+ LLVM_ABI static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
LinkageTypes Linkage, const Twine &Name,
Constant *Aliasee, Module *Parent);
// Without the Aliasee.
- static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
+ LLVM_ABI static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
LinkageTypes Linkage, const Twine &Name,
Module *Parent);
// The module is taken from the Aliasee.
- static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
+ LLVM_ABI static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
LinkageTypes Linkage, const Twine &Name,
GlobalValue *Aliasee);
// Type, Parent and AddressSpace taken from the Aliasee.
- static GlobalAlias *create(LinkageTypes Linkage, const Twine &Name,
+ LLVM_ABI static GlobalAlias *create(LinkageTypes Linkage, const Twine &Name,
GlobalValue *Aliasee);
// Linkage, Type, Parent and AddressSpace taken from the Aliasee.
- static GlobalAlias *create(const Twine &Name, GlobalValue *Aliasee);
+ LLVM_ABI static GlobalAlias *create(const Twine &Name, GlobalValue *Aliasee);
// allocate space for exactly one operand
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -74,21 +75,21 @@ class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
/// removeFromParent - This method unlinks 'this' from the containing module,
/// but does not delete it.
///
- void removeFromParent();
+ LLVM_ABI void removeFromParent();
/// eraseFromParent - This method unlinks 'this' from the containing module
/// and deletes it.
///
- void eraseFromParent();
+ LLVM_ABI void eraseFromParent();
/// These methods retrieve and set alias target.
- void setAliasee(Constant *Aliasee);
+ LLVM_ABI void setAliasee(Constant *Aliasee);
const Constant *getAliasee() const {
return static_cast<Constant *>(Op<0>().get());
}
Constant *getAliasee() { return static_cast<Constant *>(Op<0>().get()); }
- const GlobalObject *getAliaseeObject() const;
+ LLVM_ABI const GlobalObject *getAliaseeObject() const;
GlobalObject *getAliaseeObject() {
return const_cast<GlobalObject *>(
static_cast<const GlobalAlias *>(this)->getAliaseeObject());
diff --git a/llvm/include/llvm/IR/GlobalIFunc.h b/llvm/include/llvm/IR/GlobalIFunc.h
index 0d2f152cef403..f8694a26fb5f6 100644
--- a/llvm/include/llvm/IR/GlobalIFunc.h
+++ b/llvm/include/llvm/IR/GlobalIFunc.h
@@ -17,6 +17,7 @@
#ifndef LLVM_IR_GLOBALIFUNC_H
#define LLVM_IR_GLOBALIFUNC_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/GlobalObject.h"
@@ -45,7 +46,7 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
/// If a parent module is specified, the ifunc is automatically inserted into
/// the end of the specified module's ifunc list.
- static GlobalIFunc *create(Type *Ty, unsigned AddressSpace,
+ LLVM_ABI static GlobalIFunc *create(Type *Ty, unsigned AddressSpace,
LinkageTypes Linkage, const Twine &Name,
Constant *Resolver, Module *Parent);
@@ -62,10 +63,10 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
/// This method unlinks 'this' from the containing module, but does not
/// delete it.
- void removeFromParent();
+ LLVM_ABI void removeFromParent();
/// This method unlinks 'this' from the containing module and deletes it.
- void eraseFromParent();
+ LLVM_ABI void eraseFromParent();
/// These methods retrieve and set ifunc resolver function.
void setResolver(Constant *Resolver) { Op<0>().set(Resolver); }
@@ -76,7 +77,7 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
// Return the resolver function after peeling off potential ConstantExpr
// indirection.
- const Function *getResolverFunction() const;
+ LLVM_ABI const Function *getResolverFunction() const;
Function *getResolverFunction() {
return const_cast<Function *>(
static_cast<const GlobalIFunc *>(this)->getResolverFunction());
@@ -96,7 +97,7 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
// is already a global object, then apply the operation to it directly. If
// target is a GlobalExpr or a GlobalAlias, evaluate it to its base object and
// apply the operation for the base object and all aliases along the path.
- void applyAlongResolverPath(function_ref<void(const GlobalValue &)> Op) const;
+ LLVM_ABI void applyAlongResolverPath(function_ref<void(const GlobalValue &)> Op) const;
};
template <>
diff --git a/llvm/include/llvm/IR/GlobalObject.h b/llvm/include/llvm/IR/GlobalObject.h
index 73c1b87d67717..fa9cd27026b5c 100644
--- a/llvm/include/llvm/IR/GlobalObject.h
+++ b/llvm/include/llvm/IR/GlobalObject.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_GLOBALOBJECT_H
#define LLVM_IR_GLOBALOBJECT_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Value.h"
@@ -45,7 +46,7 @@ class GlobalObject : public GlobalValue {
: GlobalValue(Ty, VTy, AllocInfo, Linkage, Name, AddressSpace) {
setGlobalValueSubClassData(0);
}
- ~GlobalObject();
+ LLVM_ABI ~GlobalObject();
Comdat *ObjComdat = nullptr;
enum {
@@ -83,12 +84,12 @@ class GlobalObject : public GlobalValue {
}
/// Sets the alignment attribute of the GlobalObject.
- void setAlignment(Align Align);
+ LLVM_ABI void setAlignment(Align Align);
/// Sets the alignment attribute of the GlobalObject.
/// This method will be deprecated as the alignment property should always be
/// defined.
- void setAlignment(MaybeAlign Align);
+ LLVM_ABI void setAlignment(MaybeAlign Align);
unsigned getGlobalObjectSubClassData() const {
unsigned ValueData = getGlobalValueSubClassData();
@@ -122,18 +123,18 @@ class GlobalObject : public GlobalValue {
///
/// Setting the section to the empty string tells LLVM to choose an
/// appropriate default object file section.
- void setSection(StringRef S);
+ LLVM_ABI void setSection(StringRef S);
/// Set the section prefix for this global object.
- void setSectionPrefix(StringRef Prefix);
+ LLVM_ABI void setSectionPrefix(StringRef Prefix);
/// Get the section prefix for this global object.
- std::optional<StringRef> getSectionPrefix() const;
+ LLVM_ABI std::optional<StringRef> getSectionPrefix() const;
bool hasComdat() const { return getComdat() != nullptr; }
const Comdat *getComdat() const { return ObjComdat; }
Comdat *getComdat() { return ObjComdat; }
- void setComdat(Comdat *C);
+ LLVM_ABI void setComdat(Comdat *C);
using Value::addMetadata;
using Value::clearMetadata;
@@ -145,21 +146,21 @@ class GlobalObject : public GlobalValue {
using Value::setMetadata;
/// Copy metadata from Src, adjusting offsets by Offset.
- void copyMetadata(const GlobalObject *Src, unsigned Offset);
+ LLVM_ABI void copyMetadata(const GlobalObject *Src, unsigned Offset);
- void addTypeMetadata(unsigned Offset, Metadata *TypeID);
- void setVCallVisibilityMetadata(VCallVisibility Visibility);
- VCallVisibility getVCallVisibility() const;
+ LLVM_ABI void addTypeMetadata(unsigned Offset, Metadata *TypeID);
+ LLVM_ABI void setVCallVisibilityMetadata(VCallVisibility Visibility);
+ LLVM_ABI VCallVisibility getVCallVisibility() const;
/// Returns true if the alignment of the value can be unilaterally
/// increased.
///
/// Note that for functions this is the alignment of the code, not the
/// alignment of a function pointer.
- bool canIncreaseAlignment() const;
+ LLVM_ABI bool canIncreaseAlignment() const;
protected:
- void copyAttributesFrom(const GlobalObject *Src);
+ LLVM_ABI void copyAttributesFrom(const GlobalObject *Src);
public:
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -176,7 +177,7 @@ class GlobalObject : public GlobalValue {
(Val ? Mask : 0u));
}
- StringRef getSectionImpl() const;
+ LLVM_ABI StringRef getSectionImpl() const;
};
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index d9ecbb9f8f936..ae5320901dd85 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -17,6 +17,7 @@
#ifndef LLVM_IR_GLOBALVALUE_H
#define LLVM_IR_GLOBALVALUE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Constant.h"
@@ -162,7 +163,7 @@ class GlobalValue : public Constant {
/// Returns true if the global is a function definition with the nobuiltin
/// attribute.
- bool isNobuiltinFnDef() const;
+ LLVM_ABI bool isNobuiltinFnDef() const;
protected:
/// The intrinsic ID for this subclass (which must be a Function).
@@ -240,7 +241,7 @@ class GlobalValue : public Constant {
}
bool hasComdat() const { return getComdat() != nullptr; }
- const Comdat *getComdat() const;
+ LLVM_ABI const Comdat *getComdat() const;
Comdat *getComdat() {
return const_cast<Comdat *>(
static_cast<const GlobalValue *>(this)->getComdat());
@@ -289,7 +290,7 @@ class GlobalValue : public Constant {
}
bool hasSection() const { return !getSection().empty(); }
- StringRef getSection() const;
+ LLVM_ABI StringRef getSection() const;
/// Global values are always pointers.
PointerType *getType() const { return cast<PointerType>(User::getType()); }
@@ -310,8 +311,8 @@ class GlobalValue : public Constant {
bool hasPartition() const {
return HasPartition;
}
- StringRef getPartition() const;
- void setPartition(StringRef Part);
+ LLVM_ABI StringRef getPartition() const;
+ LLVM_ABI void setPartition(StringRef Part);
// ASan, HWASan and Memtag sanitizers have some instrumentation that applies
// specifically to global variables.
@@ -354,14 +355,14 @@ class GlobalValue : public Constant {
};
bool hasSanitizerMetadata() const { return HasSanitizerMetadata; }
- const SanitizerMetadata &getSanitizerMetadata() const;
+ LLVM_ABI const SanitizerMetadata &getSanitizerMetadata() const;
// Note: Not byref as it's a POD and otherwise it's too easy to call
// G.setSanitizerMetadata(G2.getSanitizerMetadata()), and the argument becomes
// dangling when the backing storage allocates the metadata for `G`, as the
// storage is shared between `G1` and `G2`.
- void setSanitizerMetadata(SanitizerMetadata Meta);
- void removeSanitizerMetadata();
- void setNoSanitizeMetadata();
+ LLVM_ABI void setSanitizerMetadata(SanitizerMetadata Meta);
+ LLVM_ABI void removeSanitizerMetadata();
+ LLVM_ABI void setNoSanitizeMetadata();
bool isTagged() const {
return hasSanitizerMetadata() && getSanitizerMetadata().Memtag;
@@ -506,8 +507,8 @@ class GlobalValue : public Constant {
/// *arbitrary* definition at link time or load time. We cannot do any IPO or
/// inlining across interposable call edges, since the callee can be
/// replaced with something arbitrary.
- bool isInterposable() const;
- bool canBenefitFromLocalAlias() const;
+ LLVM_ABI bool isInterposable() const;
+ LLVM_ABI bool canBenefitFromLocalAlias() const;
bool hasExternalLinkage() const { return isExternalLinkage(getLinkage()); }
bool hasAvailableExternallyLinkage() const {
@@ -555,7 +556,7 @@ class GlobalValue : public Constant {
protected:
/// Copy all additional attributes (those not needed to create a GlobalValue)
/// from the GlobalValue Src to this one.
- void copyAttributesFrom(const GlobalValue *Src);
+ LLVM_ABI void copyAttributesFrom(const GlobalValue *Src);
public:
/// If the given string begins with the GlobalValue name mangling escape
@@ -579,20 +580,20 @@ class GlobalValue : public Constant {
/// used as the key for a global lookup (e.g. profile or ThinLTO).
/// The value's original name is \c Name and has linkage of type
/// \c Linkage. The value is defined in module \c FileName.
- static std::string getGlobalIdentifier(StringRef Name,
+ LLVM_ABI static std::string getGlobalIdentifier(StringRef Name,
GlobalValue::LinkageTypes Linkage,
StringRef FileName);
private:
/// Return the modified name for this global value suitable to be
/// used as the key for a global lookup (e.g. profile or ThinLTO).
- std::string getGlobalIdentifier() const;
+ LLVM_ABI std::string getGlobalIdentifier() const;
public:
/// Return a 64-bit global unique ID constructed from the name of a global
/// symbol. Since this call doesn't supply the linkage or defining filename,
/// the GUID computation will assume that the global has external linkage.
- static GUID getGUIDAssumingExternalLinkage(StringRef GlobalName);
+ LLVM_ABI static GUID getGUIDAssumingExternalLinkage(StringRef GlobalName);
/// Return a 64-bit global unique ID constructed from global value name
/// (i.e. returned by getGlobalIdentifier()).
@@ -610,16 +611,16 @@ class GlobalValue : public Constant {
/// If this function's Module is being lazily streamed in functions from disk
/// or some other source, this method can be used to check to see if the
/// function has been read in yet or not.
- bool isMaterializable() const;
+ LLVM_ABI bool isMaterializable() const;
/// Make sure this GlobalValue is fully read.
- Error materialize();
+ LLVM_ABI Error materialize();
/// @}
/// Return true if the primary definition of this global value is outside of
/// the current translation unit.
- bool isDeclaration() const;
+ LLVM_ABI bool isDeclaration() const;
bool isDeclarationForLinker() const {
if (hasAvailableExternallyLinkage())
@@ -638,25 +639,25 @@ class GlobalValue : public Constant {
return !(isDeclarationForLinker() || isWeakForLinker());
}
- const GlobalObject *getAliaseeObject() const;
+ LLVM_ABI const GlobalObject *getAliaseeObject() const;
GlobalObject *getAliaseeObject() {
return const_cast<GlobalObject *>(
static_cast<const GlobalValue *>(this)->getAliaseeObject());
}
/// Returns whether this is a reference to an absolute symbol.
- bool isAbsoluteSymbolRef() const;
+ LLVM_ABI bool isAbsoluteSymbolRef() const;
/// If this is an absolute symbol reference, returns the range of the symbol,
/// otherwise returns std::nullopt.
- std::optional<ConstantRange> getAbsoluteSymbolRange() const;
+ LLVM_ABI std::optional<ConstantRange> getAbsoluteSymbolRange() const;
/// This method unlinks 'this' from the containing module, but does not delete
/// it.
- void removeFromParent();
+ LLVM_ABI void removeFromParent();
/// This method unlinks 'this' from the containing module and deletes it.
- void eraseFromParent();
+ LLVM_ABI void eraseFromParent();
/// Get the module that this global value is contained inside of...
Module *getParent() { return Parent; }
@@ -665,7 +666,7 @@ class GlobalValue : public Constant {
/// Get the data layout of the module this global belongs to.
///
/// Requires the global to have a parent module.
- const DataLayout &getDataLayout() const;
+ LLVM_ABI const DataLayout &getDataLayout() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -680,7 +681,7 @@ class GlobalValue : public Constant {
/// is not normally profitable to omit them from the .o symbol table. Using
/// this analysis makes sense when the information can be passed down to the
/// linker or we are in LTO.
- bool canBeOmittedFromSymbolTable() const;
+ LLVM_ABI bool canBeOmittedFromSymbolTable() const;
};
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/GlobalVariable.h b/llvm/include/llvm/IR/GlobalVariable.h
index 5ea5d3b11cd9a..29aee6aa7b516 100644
--- a/llvm/include/llvm/IR/GlobalVariable.h
+++ b/llvm/include/llvm/IR/GlobalVariable.h
@@ -19,6 +19,7 @@
#ifndef LLVM_IR_GLOBALVARIABLE_H
#define LLVM_IR_GLOBALVARIABLE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/IR/Attributes.h"
@@ -57,13 +58,13 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
public:
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
- GlobalVariable(Type *Ty, bool isConstant, LinkageTypes Linkage,
+ LLVM_ABI GlobalVariable(Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer = nullptr, const Twine &Name = "",
ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0,
bool isExternallyInitialized = false);
/// GlobalVariable ctor - This creates a global and inserts it before the
/// specified other global.
- GlobalVariable(Module &M, Type *Ty, bool isConstant, LinkageTypes Linkage,
+ LLVM_ABI GlobalVariable(Module &M, Type *Ty, bool isConstant, LinkageTypes Linkage,
Constant *Initializer, const Twine &Name = "",
GlobalVariable *InsertBefore = nullptr,
ThreadLocalMode = NotThreadLocal,
@@ -158,13 +159,13 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
/// setInitializer - Sets the initializer for this global variable, removing
/// any existing initializer if InitVal==NULL. The initializer must have the
/// type getValueType().
- void setInitializer(Constant *InitVal);
+ LLVM_ABI void setInitializer(Constant *InitVal);
/// replaceInitializer - Sets the initializer for this global variable, and
/// sets the value type of the global to the type of the initializer. The
/// initializer must not be null. This may affect the global's alignment if
/// it isn't explicitly set.
- void replaceInitializer(Constant *InitVal);
+ LLVM_ABI void replaceInitializer(Constant *InitVal);
/// If the value is a global constant, its value is immutable throughout the
/// runtime execution of the program. Assigning a value into the constant
@@ -182,27 +183,27 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a GlobalVariable) from the GlobalVariable Src to this one.
- void copyAttributesFrom(const GlobalVariable *Src);
+ LLVM_ABI void copyAttributesFrom(const GlobalVariable *Src);
/// removeFromParent - This method unlinks 'this' from the containing module,
/// but does not delete it.
///
- void removeFromParent();
+ LLVM_ABI void removeFromParent();
/// eraseFromParent - This method unlinks 'this' from the containing module
/// and deletes it.
///
- void eraseFromParent();
+ LLVM_ABI void eraseFromParent();
/// Drop all references in preparation to destroy the GlobalVariable. This
/// drops not only the reference to the initializer but also to any metadata.
- void dropAllReferences();
+ LLVM_ABI void dropAllReferences();
/// Attach a DIGlobalVariableExpression.
- void addDebugInfo(DIGlobalVariableExpression *GV);
+ LLVM_ABI void addDebugInfo(DIGlobalVariableExpression *GV);
/// Fill the vector with all debug info attachements.
- void getDebugInfo(SmallVectorImpl<DIGlobalVariableExpression *> &GVs) const;
+ LLVM_ABI void getDebugInfo(SmallVectorImpl<DIGlobalVariableExpression *> &GVs) const;
/// Add attribute to this global.
void addAttribute(Attribute::AttrKind Kind) {
@@ -287,11 +288,11 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
/// Change the code model for this global.
///
- void setCodeModel(CodeModel::Model CM);
+ LLVM_ABI void setCodeModel(CodeModel::Model CM);
/// Remove the code model for this global.
///
- void clearCodeModel();
+ LLVM_ABI void clearCodeModel();
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 7e0521e72ceb2..f805679578c50 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_IRBUILDER_H
#define LLVM_IR_IRBUILDER_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
@@ -57,7 +58,7 @@ class Use;
/// IRBuilder and needs to be inserted.
///
/// By default, this inserts the instruction at the insertion point.
-class IRBuilderDefaultInserter {
+class LLVM_ABI IRBuilderDefaultInserter {
public:
virtual ~IRBuilderDefaultInserter();
@@ -71,7 +72,7 @@ class IRBuilderDefaultInserter {
/// Provides an 'InsertHelper' that calls a user-provided callback after
/// performing the default insertion.
-class IRBuilderCallbackInserter : public IRBuilderDefaultInserter {
+class LLVM_ABI IRBuilderCallbackInserter : public IRBuilderDefaultInserter {
std::function<void(Instruction *)> Callback;
public:
@@ -256,11 +257,11 @@ class IRBuilderBase {
}
/// Get location information used by debugging information.
- DebugLoc getCurrentDebugLocation() const;
+ LLVM_ABI DebugLoc getCurrentDebugLocation() const;
/// If this builder has a current debug location, set it on the
/// specified instruction.
- void SetInstDebugLocation(Instruction *I) const;
+ LLVM_ABI void SetInstDebugLocation(Instruction *I) const;
/// Add all entries in MetadataToCopy to \p I.
void AddMetadataToInst(Instruction *I) const {
@@ -270,7 +271,7 @@ class IRBuilderBase {
/// Get the return type of the current function that we're emitting
/// into.
- Type *getCurrentFunctionReturnType() const;
+ LLVM_ABI Type *getCurrentFunctionReturnType() const;
/// InsertPoint - A saved insertion point.
class InsertPoint {
@@ -472,7 +473,7 @@ class IRBuilderBase {
///
/// If no module is given via \p M, it is take from the insertion point basic
/// block.
- GlobalVariable *CreateGlobalString(StringRef Str, const Twine &Name = "",
+ LLVM_ABI GlobalVariable *CreateGlobalString(StringRef Str, const Twine &Name = "",
unsigned AddressSpace = 0,
Module *M = nullptr, bool AddNull = true);
@@ -616,11 +617,11 @@ class IRBuilderBase {
return CreateMemSet(Ptr, Val, getInt64(Size), Align, isVolatile, AAInfo);
}
- CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, MaybeAlign Align,
+ LLVM_ABI CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, MaybeAlign Align,
bool isVolatile = false,
const AAMDNodes &AAInfo = AAMDNodes());
- CallInst *CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, Value *Val,
+ LLVM_ABI CallInst *CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, Value *Val,
Value *Size, bool IsVolatile = false,
const AAMDNodes &AAInfo = AAMDNodes());
@@ -637,7 +638,7 @@ class IRBuilderBase {
Ptr, Val, getInt64(Size), Align(Alignment), ElementSize, AAInfo);
}
- CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize,
+ LLVM_ABI CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize,
Value *ArraySize, ArrayRef<OperandBundleDef> OpB,
Function *MallocF = nullptr, const Twine &Name = "");
@@ -646,13 +647,13 @@ class IRBuilderBase {
/// possibly multiplied by the array size if the array size is not
/// constant 1.
/// 2. Call malloc with that argument.
- CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize,
+ LLVM_ABI CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize,
Value *ArraySize, Function *MallocF = nullptr,
const Twine &Name = "");
/// Generate the IR for a call to the builtin free function.
- CallInst *CreateFree(Value *Source, ArrayRef<OperandBundleDef> Bundles = {});
+ LLVM_ABI CallInst *CreateFree(Value *Source, ArrayRef<OperandBundleDef> Bundles = {});
- CallInst *
+ LLVM_ABI CallInst *
CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val, Value *Size,
Align Alignment, uint32_t ElementSize,
const AAMDNodes &AAInfo = AAMDNodes());
@@ -670,7 +671,7 @@ class IRBuilderBase {
isVolatile, AAInfo);
}
- CallInst *CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst,
+ LLVM_ABI CallInst *CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst,
MaybeAlign DstAlign, Value *Src,
MaybeAlign SrcAlign, Value *Size,
bool isVolatile = false,
@@ -700,7 +701,7 @@ class IRBuilderBase {
///
/// If the pointers aren't i8*, they will be converted. If alias metadata is
/// specified, it will be added to the instruction.
- CallInst *CreateElementUnorderedAtomicMemCpy(
+ LLVM_ABI CallInst *CreateElementUnorderedAtomicMemCpy(
Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size,
uint32_t ElementSize, const AAMDNodes &AAInfo = AAMDNodes());
@@ -728,7 +729,7 @@ class IRBuilderBase {
///
/// If the pointers aren't i8*, they will be converted. If alias metadata is
/// specified, it will be added to the instruction.
- CallInst *CreateElementUnorderedAtomicMemMove(
+ LLVM_ABI CallInst *CreateElementUnorderedAtomicMemMove(
Value *Dst, Align DstAlign, Value *Src, Align SrcAlign, Value *Size,
uint32_t ElementSize, const AAMDNodes &AAInfo = AAMDNodes());
@@ -740,98 +741,98 @@ class IRBuilderBase {
/// The first parameter is a scalar accumulator value. An unordered reduction
/// can be created by adding the reassoc fast-math flag to the resulting
/// sequential reduction.
- CallInst *CreateFAddReduce(Value *Acc, Value *Src);
+ LLVM_ABI CallInst *CreateFAddReduce(Value *Acc, Value *Src);
/// Create a sequential vector fmul reduction intrinsic of the source vector.
/// The first parameter is a scalar accumulator value. An unordered reduction
/// can be created by adding the reassoc fast-math flag to the resulting
/// sequential reduction.
- CallInst *CreateFMulReduce(Value *Acc, Value *Src);
+ LLVM_ABI CallInst *CreateFMulReduce(Value *Acc, Value *Src);
/// Create a vector int add reduction intrinsic of the source vector.
- CallInst *CreateAddReduce(Value *Src);
+ LLVM_ABI CallInst *CreateAddReduce(Value *Src);
/// Create a vector int mul reduction intrinsic of the source vector.
- CallInst *CreateMulReduce(Value *Src);
+ LLVM_ABI CallInst *CreateMulReduce(Value *Src);
/// Create a vector int AND reduction intrinsic of the source vector.
- CallInst *CreateAndReduce(Value *Src);
+ LLVM_ABI CallInst *CreateAndReduce(Value *Src);
/// Create a vector int OR reduction intrinsic of the source vector.
- CallInst *CreateOrReduce(Value *Src);
+ LLVM_ABI CallInst *CreateOrReduce(Value *Src);
/// Create a vector int XOR reduction intrinsic of the source vector.
- CallInst *CreateXorReduce(Value *Src);
+ LLVM_ABI CallInst *CreateXorReduce(Value *Src);
/// Create a vector integer max reduction intrinsic of the source
/// vector.
- CallInst *CreateIntMaxReduce(Value *Src, bool IsSigned = false);
+ LLVM_ABI CallInst *CreateIntMaxReduce(Value *Src, bool IsSigned = false);
/// Create a vector integer min reduction intrinsic of the source
/// vector.
- CallInst *CreateIntMinReduce(Value *Src, bool IsSigned = false);
+ LLVM_ABI CallInst *CreateIntMinReduce(Value *Src, bool IsSigned = false);
/// Create a vector float max reduction intrinsic of the source
/// vector.
- CallInst *CreateFPMaxReduce(Value *Src);
+ LLVM_ABI CallInst *CreateFPMaxReduce(Value *Src);
/// Create a vector float min reduction intrinsic of the source
/// vector.
- CallInst *CreateFPMinReduce(Value *Src);
+ LLVM_ABI CallInst *CreateFPMinReduce(Value *Src);
/// Create a vector float maximum reduction intrinsic of the source
/// vector. This variant follows the NaN and signed zero semantic of
/// llvm.maximum intrinsic.
- CallInst *CreateFPMaximumReduce(Value *Src);
+ LLVM_ABI CallInst *CreateFPMaximumReduce(Value *Src);
/// Create a vector float minimum reduction intrinsic of the source
/// vector. This variant follows the NaN and signed zero semantic of
/// llvm.minimum intrinsic.
- CallInst *CreateFPMinimumReduce(Value *Src);
+ LLVM_ABI CallInst *CreateFPMinimumReduce(Value *Src);
/// Create a lifetime.start intrinsic.
///
/// If the pointer isn't i8* it will be converted.
- CallInst *CreateLifetimeStart(Value *Ptr, ConstantInt *Size = nullptr);
+ LLVM_ABI CallInst *CreateLifetimeStart(Value *Ptr, ConstantInt *Size = nullptr);
/// Create a lifetime.end intrinsic.
///
/// If the pointer isn't i8* it will be converted.
- CallInst *CreateLifetimeEnd(Value *Ptr, ConstantInt *Size = nullptr);
+ LLVM_ABI CallInst *CreateLifetimeEnd(Value *Ptr, ConstantInt *Size = nullptr);
/// Create a call to invariant.start intrinsic.
///
/// If the pointer isn't i8* it will be converted.
- CallInst *CreateInvariantStart(Value *Ptr, ConstantInt *Size = nullptr);
+ LLVM_ABI CallInst *CreateInvariantStart(Value *Ptr, ConstantInt *Size = nullptr);
/// Create a call to llvm.threadlocal.address intrinsic.
- CallInst *CreateThreadLocalAddress(Value *Ptr);
+ LLVM_ABI CallInst *CreateThreadLocalAddress(Value *Ptr);
/// Create a call to Masked Load intrinsic
- CallInst *CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask,
+ LLVM_ABI CallInst *CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask,
Value *PassThru = nullptr, const Twine &Name = "");
/// Create a call to Masked Store intrinsic
- CallInst *CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment,
+ LLVM_ABI CallInst *CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment,
Value *Mask);
/// Create a call to Masked Gather intrinsic
- CallInst *CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment,
+ LLVM_ABI CallInst *CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment,
Value *Mask = nullptr, Value *PassThru = nullptr,
const Twine &Name = "");
/// Create a call to Masked Scatter intrinsic
- CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment,
+ LLVM_ABI CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment,
Value *Mask = nullptr);
/// Create a call to Masked Expand Load intrinsic
- CallInst *CreateMaskedExpandLoad(Type *Ty, Value *Ptr, MaybeAlign Align,
+ LLVM_ABI CallInst *CreateMaskedExpandLoad(Type *Ty, Value *Ptr, MaybeAlign Align,
Value *Mask = nullptr,
Value *PassThru = nullptr,
const Twine &Name = "");
/// Create a call to Masked Compress Store intrinsic
- CallInst *CreateMaskedCompressStore(Value *Val, Value *Ptr, MaybeAlign Align,
+ LLVM_ABI CallInst *CreateMaskedCompressStore(Value *Val, Value *Ptr, MaybeAlign Align,
Value *Mask = nullptr);
/// Return an all true boolean vector (mask) with \p NumElts lanes.
@@ -845,11 +846,11 @@ class IRBuilderBase {
///
/// The optional argument \p OpBundles specifies operand bundles that are
/// added to the call instruction.
- CallInst *CreateAssumption(Value *Cond,
+ LLVM_ABI CallInst *CreateAssumption(Value *Cond,
ArrayRef<OperandBundleDef> OpBundles = {});
/// Create a llvm.experimental.noalias.scope.decl intrinsic call.
- Instruction *CreateNoAliasScopeDeclaration(Value *Scope);
+ LLVM_ABI Instruction *CreateNoAliasScopeDeclaration(Value *Scope);
Instruction *CreateNoAliasScopeDeclaration(MDNode *ScopeTag) {
return CreateNoAliasScopeDeclaration(
MetadataAsValue::get(Context, ScopeTag));
@@ -857,7 +858,7 @@ class IRBuilderBase {
/// Create a call to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ LLVM_ABI CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
FunctionCallee ActualCallee,
ArrayRef<Value *> CallArgs,
std::optional<ArrayRef<Value *>> DeoptArgs,
@@ -866,7 +867,7 @@ class IRBuilderBase {
/// Create a call to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ LLVM_ABI CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
FunctionCallee ActualCallee, uint32_t Flags,
ArrayRef<Value *> CallArgs,
std::optional<ArrayRef<Use>> TransitionArgs,
@@ -877,7 +878,7 @@ class IRBuilderBase {
/// Conveninence function for the common case when CallArgs are filled
/// in using ArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be
/// .get()'ed to get the Value pointer.
- CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ LLVM_ABI CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
FunctionCallee ActualCallee,
ArrayRef<Use> CallArgs,
std::optional<ArrayRef<Value *>> DeoptArgs,
@@ -886,7 +887,7 @@ class IRBuilderBase {
/// Create an invoke to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- InvokeInst *
+ LLVM_ABI InvokeInst *
CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
FunctionCallee ActualInvokee, BasicBlock *NormalDest,
BasicBlock *UnwindDest, ArrayRef<Value *> InvokeArgs,
@@ -895,7 +896,7 @@ class IRBuilderBase {
/// Create an invoke to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- InvokeInst *CreateGCStatepointInvoke(
+ LLVM_ABI InvokeInst *CreateGCStatepointInvoke(
uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualInvokee,
BasicBlock *NormalDest, BasicBlock *UnwindDest, uint32_t Flags,
ArrayRef<Value *> InvokeArgs, std::optional<ArrayRef<Use>> TransitionArgs,
@@ -905,7 +906,7 @@ class IRBuilderBase {
// Convenience function for the common case when CallArgs are filled in using
// ArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be .get()'ed to
// get the Value *.
- InvokeInst *
+ LLVM_ABI InvokeInst *
CreateGCStatepointInvoke(uint64_t ID, uint32_t NumPatchBytes,
FunctionCallee ActualInvokee, BasicBlock *NormalDest,
BasicBlock *UnwindDest, ArrayRef<Use> InvokeArgs,
@@ -914,13 +915,13 @@ class IRBuilderBase {
/// Create a call to the experimental.gc.result intrinsic to extract
/// the result from a call wrapped in a statepoint.
- CallInst *CreateGCResult(Instruction *Statepoint,
+ LLVM_ABI CallInst *CreateGCResult(Instruction *Statepoint,
Type *ResultType,
const Twine &Name = "");
/// Create a call to the experimental.gc.relocate intrinsics to
/// project the relocated value of one pointer from the statepoint.
- CallInst *CreateGCRelocate(Instruction *Statepoint,
+ LLVM_ABI CallInst *CreateGCRelocate(Instruction *Statepoint,
int BaseOffset,
int DerivedOffset,
Type *ResultType,
@@ -928,50 +929,50 @@ class IRBuilderBase {
/// Create a call to the experimental.gc.pointer.base intrinsic to get the
/// base pointer for the specified derived pointer.
- CallInst *CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name = "");
/// Create a call to the experimental.gc.get.pointer.offset intrinsic to get
/// the offset of the specified derived pointer from its base.
- CallInst *CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name = "");
/// Create a call to llvm.vscale, multiplied by \p Scaling. The type of VScale
/// will be the same type as that of \p Scaling.
- Value *CreateVScale(Constant *Scaling, const Twine &Name = "");
+ LLVM_ABI Value *CreateVScale(Constant *Scaling, const Twine &Name = "");
/// Create an expression which evaluates to the number of elements in \p EC
/// at runtime.
- Value *CreateElementCount(Type *DstType, ElementCount EC);
+ LLVM_ABI Value *CreateElementCount(Type *DstType, ElementCount EC);
/// Create an expression which evaluates to the number of units in \p Size
/// at runtime. This works for both units of bits and bytes.
- Value *CreateTypeSize(Type *DstType, TypeSize Size);
+ LLVM_ABI Value *CreateTypeSize(Type *DstType, TypeSize Size);
/// Creates a vector of type \p DstType with the linear sequence <0, 1, ...>
- Value *CreateStepVector(Type *DstType, const Twine &Name = "");
+ LLVM_ABI Value *CreateStepVector(Type *DstType, const Twine &Name = "");
/// Create a call to intrinsic \p ID with 1 operand which is mangled on its
/// type.
- CallInst *CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V,
+ LLVM_ABI CallInst *CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V,
FMFSource FMFSource = {},
const Twine &Name = "");
/// Create a call to intrinsic \p ID with 2 operands which is mangled on the
/// first type.
- Value *CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS,
+ LLVM_ABI Value *CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS,
FMFSource FMFSource = {},
const Twine &Name = "");
/// Create a call to intrinsic \p ID with \p Args, mangled using \p Types. If
/// \p FMFSource is provided, copy fast-math-flags from that instruction to
/// the intrinsic.
- CallInst *CreateIntrinsic(Intrinsic::ID ID, ArrayRef<Type *> Types,
+ LLVM_ABI CallInst *CreateIntrinsic(Intrinsic::ID ID, ArrayRef<Type *> Types,
ArrayRef<Value *> Args, FMFSource FMFSource = {},
const Twine &Name = "");
/// Create a call to intrinsic \p ID with \p RetTy and \p Args. If
/// \p FMFSource is provided, copy fast-math-flags from that instruction to
/// the intrinsic.
- CallInst *CreateIntrinsic(Type *RetTy, Intrinsic::ID ID,
+ LLVM_ABI CallInst *CreateIntrinsic(Type *RetTy, Intrinsic::ID ID,
ArrayRef<Value *> Args, FMFSource FMFSource = {},
const Twine &Name = "");
@@ -1732,19 +1733,19 @@ class IRBuilderBase {
/// the created intrinsic call according to \p Rounding and \p
/// Except and it sets \p FPMathTag as the 'fpmath' metadata, using
/// defaults if a value equals nullopt/null.
- CallInst *CreateConstrainedFPIntrinsic(
+ LLVM_ABI CallInst *CreateConstrainedFPIntrinsic(
Intrinsic::ID ID, ArrayRef<Type *> Types, ArrayRef<Value *> Args,
FMFSource FMFSource, const Twine &Name, MDNode *FPMathTag = nullptr,
std::optional<RoundingMode> Rounding = std::nullopt,
std::optional<fp::ExceptionBehavior> Except = std::nullopt);
- CallInst *CreateConstrainedFPBinOp(
+ LLVM_ABI CallInst *CreateConstrainedFPBinOp(
Intrinsic::ID ID, Value *L, Value *R, FMFSource FMFSource = {},
const Twine &Name = "", MDNode *FPMathTag = nullptr,
std::optional<RoundingMode> Rounding = std::nullopt,
std::optional<fp::ExceptionBehavior> Except = std::nullopt);
- CallInst *CreateConstrainedFPUnroundedBinOp(
+ LLVM_ABI CallInst *CreateConstrainedFPUnroundedBinOp(
Intrinsic::ID ID, Value *L, Value *R, FMFSource FMFSource = {},
const Twine &Name = "", MDNode *FPMathTag = nullptr,
std::optional<fp::ExceptionBehavior> Except = std::nullopt);
@@ -1790,7 +1791,7 @@ class IRBuilderBase {
/// Create either a UnaryOperator or BinaryOperator depending on \p Opc.
/// Correct number of operands must be passed accordingly.
- Value *CreateNAryOp(unsigned Opc, ArrayRef<Value *> Ops,
+ LLVM_ABI Value *CreateNAryOp(unsigned Opc, ArrayRef<Value *> Ops,
const Twine &Name = "", MDNode *FPMathTag = nullptr);
//===--------------------------------------------------------------------===//
@@ -2271,7 +2272,7 @@ class IRBuilderBase {
return CreateCast(CastOp, V, DestTy, Name, FPMathTag);
}
- CallInst *CreateConstrainedFPCast(
+ LLVM_ABI CallInst *CreateConstrainedFPCast(
Intrinsic::ID ID, Value *V, Type *DestTy, FMFSource FMFSource = {},
const Twine &Name = "", MDNode *FPMathTag = nullptr,
std::optional<RoundingMode> Rounding = std::nullopt,
@@ -2287,7 +2288,7 @@ class IRBuilderBase {
/// casted, and then reinserted into a value of type DestTy. The leaf types
/// must be castable using a bitcast or ptrcast, because signedness is
/// not specified.
- Value *CreateAggregateCast(Value *V, Type *DestTy);
+ LLVM_ABI Value *CreateAggregateCast(Value *V, Type *DestTy);
//===--------------------------------------------------------------------===//
// Instruction creation methods: Compare Instructions
@@ -2444,12 +2445,12 @@ class IRBuilderBase {
private:
// Helper routine to create either a signaling or a quiet FP comparison.
- Value *CreateFCmpHelper(CmpInst::Predicate P, Value *LHS, Value *RHS,
+ LLVM_ABI Value *CreateFCmpHelper(CmpInst::Predicate P, Value *LHS, Value *RHS,
const Twine &Name, MDNode *FPMathTag,
FMFSource FMFSource, bool IsSignaling);
public:
- CallInst *CreateConstrainedFPCmp(
+ LLVM_ABI CallInst *CreateConstrainedFPCmp(
Intrinsic::ID ID, CmpInst::Predicate P, Value *L, Value *R,
const Twine &Name = "",
std::optional<fp::ExceptionBehavior> Except = std::nullopt);
@@ -2507,14 +2508,14 @@ class IRBuilderBase {
OpBundles, Name, FPMathTag);
}
- CallInst *CreateConstrainedFPCall(
+ LLVM_ABI CallInst *CreateConstrainedFPCall(
Function *Callee, ArrayRef<Value *> Args, const Twine &Name = "",
std::optional<RoundingMode> Rounding = std::nullopt,
std::optional<fp::ExceptionBehavior> Except = std::nullopt);
- Value *CreateSelect(Value *C, Value *True, Value *False,
+ LLVM_ABI Value *CreateSelect(Value *C, Value *True, Value *False,
const Twine &Name = "", Instruction *MDFrom = nullptr);
- Value *CreateSelectFMF(Value *C, Value *True, Value *False,
+ LLVM_ABI Value *CreateSelectFMF(Value *C, Value *True, Value *False,
FMFSource FMFSource, const Twine &Name = "",
Instruction *MDFrom = nullptr);
@@ -2632,21 +2633,21 @@ class IRBuilderBase {
/// This is intended to implement C-style pointer subtraction. As such, the
/// pointers must be appropriately aligned for their element types and
/// pointing into the same object.
- Value *CreatePtrDiff(Type *ElemTy, Value *LHS, Value *RHS,
+ LLVM_ABI Value *CreatePtrDiff(Type *ElemTy, Value *LHS, Value *RHS,
const Twine &Name = "");
/// Create a launder.invariant.group intrinsic call. If Ptr type is
/// different from pointer to i8, it's casted to pointer to i8 in the same
/// address space before call and casted back to Ptr type after call.
- Value *CreateLaunderInvariantGroup(Value *Ptr);
+ LLVM_ABI Value *CreateLaunderInvariantGroup(Value *Ptr);
/// \brief Create a strip.invariant.group intrinsic call. If Ptr type is
/// different from pointer to i8, it's casted to pointer to i8 in the same
/// address space before call and casted back to Ptr type after call.
- Value *CreateStripInvariantGroup(Value *Ptr);
+ LLVM_ABI Value *CreateStripInvariantGroup(Value *Ptr);
/// Return a vector value that contains the vector V reversed
- Value *CreateVectorReverse(Value *V, const Twine &Name = "");
+ LLVM_ABI Value *CreateVectorReverse(Value *V, const Twine &Name = "");
/// Return a vector splice intrinsic if using scalable vectors, otherwise
/// return a shufflevector. If the immediate is positive, a vector is
@@ -2655,29 +2656,29 @@ class IRBuilderBase {
/// elements from V2. Imm is a signed integer in the range
/// -VL <= Imm < VL (where VL is the runtime vector length of the
/// source/result vector)
- Value *CreateVectorSplice(Value *V1, Value *V2, int64_t Imm,
+ LLVM_ABI Value *CreateVectorSplice(Value *V1, Value *V2, int64_t Imm,
const Twine &Name = "");
/// Return a vector value that contains \arg V broadcasted to \p
/// NumElts elements.
- Value *CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name = "");
+ LLVM_ABI Value *CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name = "");
/// Return a vector value that contains \arg V broadcasted to \p
/// EC elements.
- Value *CreateVectorSplat(ElementCount EC, Value *V, const Twine &Name = "");
+ LLVM_ABI Value *CreateVectorSplat(ElementCount EC, Value *V, const Twine &Name = "");
- Value *CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base,
+ LLVM_ABI Value *CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base,
unsigned Dimension, unsigned LastIndex,
MDNode *DbgInfo);
- Value *CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex,
+ LLVM_ABI Value *CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex,
MDNode *DbgInfo);
- Value *CreatePreserveStructAccessIndex(Type *ElTy, Value *Base,
+ LLVM_ABI Value *CreatePreserveStructAccessIndex(Type *ElTy, Value *Base,
unsigned Index, unsigned FieldIndex,
MDNode *DbgInfo);
- Value *createIsFPClass(Value *FPNum, unsigned Test);
+ LLVM_ABI Value *createIsFPClass(Value *FPNum, unsigned Test);
private:
/// Helper function that creates an assume intrinsic call that
@@ -2694,7 +2695,7 @@ class IRBuilderBase {
/// An optional offset can be provided, and if it is provided, the offset
/// must be subtracted from the provided pointer to get the pointer with the
/// specified alignment.
- CallInst *CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue,
+ LLVM_ABI CallInst *CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue,
unsigned Alignment,
Value *OffsetValue = nullptr);
@@ -2707,13 +2708,13 @@ class IRBuilderBase {
///
/// This overload handles the condition where the Alignment is dependent
/// on an existing value rather than a static value.
- CallInst *CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue,
+ LLVM_ABI CallInst *CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue,
Value *Alignment,
Value *OffsetValue = nullptr);
/// Create an assume intrinsic call that represents an dereferencable
/// assumption on the provided pointer.
- CallInst *CreateDereferenceableAssumption(Value *PtrValue, Value *SizeValue);
+ LLVM_ABI CallInst *CreateDereferenceableAssumption(Value *PtrValue, Value *SizeValue);
};
/// This provides a uniform API for creating instructions and inserting
diff --git a/llvm/include/llvm/IR/IRBuilderFolder.h b/llvm/include/llvm/IR/IRBuilderFolder.h
index 921001c8a5d51..b81ea3d087c6e 100644
--- a/llvm/include/llvm/IR/IRBuilderFolder.h
+++ b/llvm/include/llvm/IR/IRBuilderFolder.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_IRBUILDERFOLDER_H
#define LLVM_IR_IRBUILDERFOLDER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/GEPNoWrapFlags.h"
#include "llvm/IR/InstrTypes.h"
@@ -22,7 +23,7 @@
namespace llvm {
/// IRBuilderFolder - Interface for constant folding in IRBuilder.
-class IRBuilderFolder {
+class LLVM_ABI IRBuilderFolder {
public:
virtual ~IRBuilderFolder();
diff --git a/llvm/include/llvm/IR/IRPrintingPasses.h b/llvm/include/llvm/IR/IRPrintingPasses.h
index 8928ecfce313e..23c81063035a1 100644
--- a/llvm/include/llvm/IR/IRPrintingPasses.h
+++ b/llvm/include/llvm/IR/IRPrintingPasses.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_IRPRINTINGPASSES_H
#define LLVM_IR_IRPRINTINGPASSES_H
+#include "llvm/Support/Compiler.h"
#include <string>
namespace llvm {
@@ -26,23 +27,23 @@ class Pass;
/// Create and return a pass that writes the module to the specified
/// \c raw_ostream.
-ModulePass *createPrintModulePass(raw_ostream &OS,
+LLVM_ABI ModulePass *createPrintModulePass(raw_ostream &OS,
const std::string &Banner = "",
bool ShouldPreserveUseListOrder = false);
/// Create and return a pass that prints functions to the specified
/// \c raw_ostream as they are processed.
-FunctionPass *createPrintFunctionPass(raw_ostream &OS,
+LLVM_ABI FunctionPass *createPrintFunctionPass(raw_ostream &OS,
const std::string &Banner = "");
/// Print out a name of an LLVM value without any prefixes.
///
/// The name is surrounded with ""'s and escaped if it has any special or
/// non-printable characters in it.
-void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name);
+LLVM_ABI void printLLVMNameWithoutPrefix(raw_ostream &OS, StringRef Name);
/// Return true if a pass is for IR printing.
-bool isIRPrintingPass(Pass *P);
+LLVM_ABI bool isIRPrintingPass(Pass *P);
} // namespace llvm
diff --git a/llvm/include/llvm/IR/InlineAsm.h b/llvm/include/llvm/IR/InlineAsm.h
index 3501c877a5c22..c05b7578f6748 100644
--- a/llvm/include/llvm/IR/InlineAsm.h
+++ b/llvm/include/llvm/IR/InlineAsm.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_INLINEASM_H
#define LLVM_IR_INLINEASM_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -63,7 +64,7 @@ class InlineAsm final : public Value {
/// InlineAsm::get - Return the specified uniqued inline asm string.
///
- static InlineAsm *get(FunctionType *Ty, StringRef AsmString,
+ LLVM_ABI static InlineAsm *get(FunctionType *Ty, StringRef AsmString,
StringRef Constraints, bool hasSideEffects,
bool isAlignStack = false,
AsmDialect asmDialect = AD_ATT, bool canThrow = false);
@@ -81,15 +82,15 @@ class InlineAsm final : public Value {
/// getFunctionType - InlineAsm's are always pointers to functions.
///
- FunctionType *getFunctionType() const;
+ LLVM_ABI FunctionType *getFunctionType() const;
StringRef getAsmString() const { return AsmString; }
StringRef getConstraintString() const { return Constraints; }
- void collectAsmStrs(SmallVectorImpl<StringRef> &AsmStrs) const;
+ LLVM_ABI void collectAsmStrs(SmallVectorImpl<StringRef> &AsmStrs) const;
/// This static method can be used by the parser to check to see if the
/// specified constraint string is legal for the type.
- static Error verify(FunctionType *Ty, StringRef Constraints);
+ LLVM_ABI static Error verify(FunctionType *Ty, StringRef Constraints);
// Constraint String Parsing
enum ConstraintPrefix {
@@ -169,11 +170,11 @@ class InlineAsm final : public Value {
/// Parse - Analyze the specified string (e.g. "=*&{eax}") and fill in the
/// fields in this structure. If the constraint string is not understood,
/// return true, otherwise return false.
- bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar);
+ LLVM_ABI bool Parse(StringRef Str, ConstraintInfoVector &ConstraintsSoFar);
/// selectAlternative - Point this constraint to the alternative constraint
/// indicated by the index.
- void selectAlternative(unsigned index);
+ LLVM_ABI void selectAlternative(unsigned index);
/// Whether this constraint corresponds to an argument.
bool hasArg() const {
@@ -184,7 +185,7 @@ class InlineAsm final : public Value {
/// ParseConstraints - Split up the constraint string into the specific
/// constraints and their prefixes. If this returns an empty vector, and if
/// the constraint string itself isn't empty, there was an error parsing.
- static ConstraintInfoVector ParseConstraints(StringRef ConstraintString);
+ LLVM_ABI static ConstraintInfoVector ParseConstraints(StringRef ConstraintString);
/// ParseConstraints - Parse the constraints of this inlineasm object,
/// returning them the same way that ParseConstraints(str) does.
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 8e47e3c7b3a7c..17f5cc7b18fbc 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_INSTRTYPES_H
#define LLVM_IR_INSTRTYPES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
@@ -101,13 +102,13 @@ class UnaryOperator : public UnaryInstruction {
void AssertOK();
protected:
- UnaryOperator(UnaryOps iType, Value *S, Type *Ty, const Twine &Name,
+ LLVM_ABI UnaryOperator(UnaryOps iType, Value *S, Type *Ty, const Twine &Name,
InsertPosition InsertBefore);
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- UnaryOperator *cloneImpl() const;
+ LLVM_ABI UnaryOperator *cloneImpl() const;
public:
/// Construct a unary instruction, given the opcode and an operand.
@@ -115,7 +116,7 @@ class UnaryOperator : public UnaryInstruction {
/// into a BasicBlock right before the specified instruction. The specified
/// Instruction is allowed to be a dereferenced end iterator.
///
- static UnaryOperator *Create(UnaryOps Op, Value *S,
+ LLVM_ABI static UnaryOperator *Create(UnaryOps Op, Value *S,
const Twine &Name = Twine(),
InsertPosition InsertBefore = nullptr);
@@ -173,13 +174,13 @@ class BinaryOperator : public Instruction {
void AssertOK();
protected:
- BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
+ LLVM_ABI BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
const Twine &Name, InsertPosition InsertBefore);
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- BinaryOperator *cloneImpl() const;
+ LLVM_ABI BinaryOperator *cloneImpl() const;
public:
// allocate space for exactly two operands
@@ -194,7 +195,7 @@ class BinaryOperator : public Instruction {
/// into a BasicBlock right before the specified instruction. The specified
/// Instruction is allowed to be a dereferenced end iterator.
///
- static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
+ LLVM_ABI static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
const Twine &Name = Twine(),
InsertPosition InsertBefore = nullptr);
@@ -360,11 +361,11 @@ class BinaryOperator : public Instruction {
///
/// Create the NEG and NOT instructions out of SUB and XOR instructions.
///
- static BinaryOperator *CreateNeg(Value *Op, const Twine &Name = "",
+ LLVM_ABI static BinaryOperator *CreateNeg(Value *Op, const Twine &Name = "",
InsertPosition InsertBefore = nullptr);
- static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
+ LLVM_ABI static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
InsertPosition InsertBefore = nullptr);
- static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
+ LLVM_ABI static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
InsertPosition InsertBefore = nullptr);
BinaryOps getOpcode() const {
@@ -376,7 +377,7 @@ class BinaryOperator : public Instruction {
/// does not modify the semantics of the instruction. If the instruction
/// cannot be reversed (ie, it's a Div), then return true.
///
- bool swapOperands();
+ LLVM_ABI bool swapOperands();
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
@@ -457,7 +458,7 @@ class CastInst : public UnaryInstruction {
/// constructor has insert-before-instruction semantics to automatically
/// insert the new CastInst before InsertBefore (if it is non-null).
/// Construct any of the CastInst subclasses
- static CastInst *Create(
+ LLVM_ABI static CastInst *Create(
Instruction::CastOps, ///< The opcode of the cast instruction
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
@@ -466,7 +467,7 @@ class CastInst : public UnaryInstruction {
);
/// Create a ZExt or BitCast cast instruction
- static CastInst *CreateZExtOrBitCast(
+ LLVM_ABI static CastInst *CreateZExtOrBitCast(
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
@@ -474,7 +475,7 @@ class CastInst : public UnaryInstruction {
);
/// Create a SExt or BitCast cast instruction
- static CastInst *CreateSExtOrBitCast(
+ LLVM_ABI static CastInst *CreateSExtOrBitCast(
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
@@ -482,7 +483,7 @@ class CastInst : public UnaryInstruction {
);
/// Create a BitCast, AddrSpaceCast or a PtrToInt cast instruction.
- static CastInst *CreatePointerCast(
+ LLVM_ABI static CastInst *CreatePointerCast(
Value *S, ///< The pointer value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
@@ -490,7 +491,7 @@ class CastInst : public UnaryInstruction {
);
/// Create a BitCast or an AddrSpaceCast cast instruction.
- static CastInst *CreatePointerBitCastOrAddrSpaceCast(
+ LLVM_ABI static CastInst *CreatePointerBitCastOrAddrSpaceCast(
Value *S, ///< The pointer value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
@@ -503,7 +504,7 @@ class CastInst : public UnaryInstruction {
/// creates a PtrToInt cast. If the value is an integer type and the
/// destination a pointer type, creates an IntToPtr cast. Otherwise, creates
/// a bitcast.
- static CastInst *CreateBitOrPointerCast(
+ LLVM_ABI static CastInst *CreateBitOrPointerCast(
Value *S, ///< The pointer value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
@@ -511,7 +512,7 @@ class CastInst : public UnaryInstruction {
);
/// Create a ZExt, BitCast, or Trunc for int -> int casts.
- static CastInst *CreateIntegerCast(
+ LLVM_ABI static CastInst *CreateIntegerCast(
Value *S, ///< The pointer value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
bool isSigned, ///< Whether to regard S as signed or not
@@ -520,7 +521,7 @@ class CastInst : public UnaryInstruction {
);
/// Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
- static CastInst *CreateFPCast(
+ LLVM_ABI static CastInst *CreateFPCast(
Value *S, ///< The floating point value to be casted
Type *Ty, ///< The floating point type to cast to
const Twine &Name = "", ///< Name for the instruction
@@ -528,7 +529,7 @@ class CastInst : public UnaryInstruction {
);
/// Create a Trunc or BitCast cast instruction
- static CastInst *CreateTruncOrBitCast(
+ LLVM_ABI static CastInst *CreateTruncOrBitCast(
Value *S, ///< The value to be casted (operand 0)
Type *Ty, ///< The type to which cast should be made
const Twine &Name = "", ///< Name for the instruction
@@ -536,7 +537,7 @@ class CastInst : public UnaryInstruction {
);
/// Check whether a bitcast between these types is valid
- static bool isBitCastable(
+ LLVM_ABI static bool isBitCastable(
Type *SrcTy, ///< The Type from which the value should be cast.
Type *DestTy ///< The Type to which the value should be cast.
);
@@ -546,7 +547,7 @@ class CastInst : public UnaryInstruction {
///
/// This ensures that any pointer<->integer cast has enough bits in the
/// integer and any other cast is a bitcast.
- static bool isBitOrNoopPointerCastable(
+ LLVM_ABI static bool isBitOrNoopPointerCastable(
Type *SrcTy, ///< The Type from which the value should be cast.
Type *DestTy, ///< The Type to which the value should be cast.
const DataLayout &DL);
@@ -554,7 +555,7 @@ class CastInst : public UnaryInstruction {
/// Returns the opcode necessary to cast Val into Ty using usual casting
/// rules.
/// Infer the opcode for cast operand and type
- static Instruction::CastOps getCastOpcode(
+ LLVM_ABI static Instruction::CastOps getCastOpcode(
const Value *Val, ///< The value to cast
bool SrcIsSigned, ///< Whether to treat the source as signed
Type *Ty, ///< The Type to which the value should be casted
@@ -566,7 +567,7 @@ class CastInst : public UnaryInstruction {
/// logic, this method is provided.
/// @returns true iff the cast has only integral typed operand and dest type.
/// Determine if this is an integer-only cast.
- bool isIntegerCast() const;
+ LLVM_ABI bool isIntegerCast() const;
/// A no-op cast is one that can be effected without changing any bits.
/// It implies that the source and destination types are the same size. The
@@ -575,7 +576,7 @@ class CastInst : public UnaryInstruction {
/// is the same size as the pointer. However, pointer size varies with
/// platform. Note that a precondition of this method is that the cast is
/// legal - i.e. the instruction formed with these operands would verify.
- static bool isNoopCast(
+ LLVM_ABI static bool isNoopCast(
Instruction::CastOps Opcode, ///< Opcode of cast
Type *SrcTy, ///< SrcTy of cast
Type *DstTy, ///< DstTy of cast
@@ -585,7 +586,7 @@ class CastInst : public UnaryInstruction {
/// Determine if this cast is a no-op cast.
///
/// \param DL is the DataLayout to determine pointer size.
- bool isNoopCast(const DataLayout &DL) const;
+ LLVM_ABI bool isNoopCast(const DataLayout &DL) const;
/// Determine how a pair of casts can be eliminated, if they can be at all.
/// This is a helper function for both CastInst and ConstantExpr.
@@ -593,7 +594,7 @@ class CastInst : public UnaryInstruction {
/// returns Instruction::CastOps value for a cast that can replace
/// the pair, casting SrcTy to DstTy.
/// Determine if a cast pair is eliminable
- static unsigned isEliminableCastPair(
+ LLVM_ABI static unsigned isEliminableCastPair(
Instruction::CastOps firstOpcode, ///< Opcode of first cast
Instruction::CastOps secondOpcode, ///< Opcode of second cast
Type *SrcTy, ///< SrcTy of 1st cast
@@ -618,7 +619,7 @@ class CastInst : public UnaryInstruction {
/// Opcode op is valid or not.
/// @returns true iff the proposed cast is valid.
/// Determine if a cast is valid without creating one.
- static bool castIsValid(Instruction::CastOps op, Type *SrcTy, Type *DstTy);
+ LLVM_ABI static bool castIsValid(Instruction::CastOps op, Type *SrcTy, Type *DstTy);
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy) {
return castIsValid(op, S->getType(), DstTy);
}
@@ -723,7 +724,7 @@ class CmpInst : public Instruction {
}
protected:
- CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS,
+ LLVM_ABI CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS,
Value *RHS, const Twine &Name = "",
InsertPosition InsertBefore = nullptr,
Instruction *FlagsSource = nullptr);
@@ -738,7 +739,7 @@ class CmpInst : public Instruction {
/// instruction into a BasicBlock right before the specified instruction.
/// The specified Instruction is allowed to be a dereferenced end iterator.
/// Create a CmpInst
- static CmpInst *Create(OtherOps Op, Predicate Pred, Value *S1, Value *S2,
+ LLVM_ABI static CmpInst *Create(OtherOps Op, Predicate Pred, Value *S1, Value *S2,
const Twine &Name = "",
InsertPosition InsertBefore = nullptr);
@@ -748,7 +749,7 @@ class CmpInst : public Instruction {
/// right before the specified instruction. The specified Instruction is
/// allowed to be a dereferenced end iterator.
/// Create a CmpInst
- static CmpInst *CreateWithCopiedFlags(OtherOps Op, Predicate Pred, Value *S1,
+ LLVM_ABI static CmpInst *CreateWithCopiedFlags(OtherOps Op, Predicate Pred, Value *S1,
Value *S2,
const Instruction *FlagsSource,
const Twine &Name = "",
@@ -775,7 +776,7 @@ class CmpInst : public Instruction {
return P >= FIRST_ICMP_PREDICATE && P <= LAST_ICMP_PREDICATE;
}
- static StringRef getPredicateName(Predicate P);
+ LLVM_ABI static StringRef getPredicateName(Predicate P);
bool isFPPredicate() const { return isFPPredicate(getPredicate()); }
bool isIntPredicate() const { return isIntPredicate(getPredicate()); }
@@ -814,7 +815,7 @@ class CmpInst : public Instruction {
/// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
/// @returns the inverse predicate for predicate provided in \p pred.
/// Return the inverse of a given predicate
- static Predicate getInversePredicate(Predicate pred);
+ LLVM_ABI static Predicate getInversePredicate(Predicate pred);
/// For example, EQ->EQ, SLE->SGE, ULT->UGT,
/// OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
@@ -829,12 +830,12 @@ class CmpInst : public Instruction {
/// This is a static version that you can use without an instruction
/// available.
/// Return the predicate as if the operands were swapped.
- static Predicate getSwappedPredicate(Predicate pred);
+ LLVM_ABI static Predicate getSwappedPredicate(Predicate pred);
/// This is a static version that you can use without an instruction
/// available.
/// @returns true if the comparison predicate is strict, false otherwise.
- static bool isStrictPredicate(Predicate predicate);
+ LLVM_ABI static bool isStrictPredicate(Predicate predicate);
/// @returns true if the comparison predicate is strict, false otherwise.
/// Determine if this instruction is using an strict comparison predicate.
@@ -843,7 +844,7 @@ class CmpInst : public Instruction {
/// This is a static version that you can use without an instruction
/// available.
/// @returns true if the comparison predicate is non-strict, false otherwise.
- static bool isNonStrictPredicate(Predicate predicate);
+ LLVM_ABI static bool isNonStrictPredicate(Predicate predicate);
/// @returns true if the comparison predicate is non-strict, false otherwise.
/// Determine if this instruction is using an non-strict comparison predicate.
@@ -862,7 +863,7 @@ class CmpInst : public Instruction {
/// @returns the strict version of comparison provided in \p pred.
/// If \p pred is not a strict comparison predicate, returns \p pred.
/// Returns the strict version of non-strict comparisons.
- static Predicate getStrictPredicate(Predicate pred);
+ LLVM_ABI static Predicate getStrictPredicate(Predicate pred);
/// For example, SGT -> SGE, SLT -> SLE, ULT -> ULE, UGT -> UGE.
/// Returns the non-strict version of strict comparisons.
@@ -875,12 +876,12 @@ class CmpInst : public Instruction {
/// @returns the non-strict version of comparison provided in \p pred.
/// If \p pred is not a strict comparison predicate, returns \p pred.
/// Returns the non-strict version of strict comparisons.
- static Predicate getNonStrictPredicate(Predicate pred);
+ LLVM_ABI static Predicate getNonStrictPredicate(Predicate pred);
/// This is a static version that you can use without an instruction
/// available.
/// Return the flipped strictness of predicate
- static Predicate getFlippedStrictnessPredicate(Predicate pred);
+ LLVM_ABI static Predicate getFlippedStrictnessPredicate(Predicate pred);
/// For predicate of kind "is X or equal to 0" returns the predicate "is X".
/// For predicate of kind "is X" returns the predicate "is X or equal to 0".
@@ -898,16 +899,16 @@ class CmpInst : public Instruction {
/// This is just a convenience that dispatches to the subclasses.
/// Swap the operands and adjust predicate accordingly to retain
/// the same comparison.
- void swapOperands();
+ LLVM_ABI void swapOperands();
/// This is just a convenience that dispatches to the subclasses.
/// Determine if this CmpInst is commutative.
- bool isCommutative() const;
+ LLVM_ABI bool isCommutative() const;
/// Determine if this is an equals/not equals predicate.
/// This is a static version that you can use without an instruction
/// available.
- static bool isEquality(Predicate pred);
+ LLVM_ABI static bool isEquality(Predicate pred);
/// Determine if this is an equals/not equals predicate.
bool isEquality() const { return isEquality(getPredicate()); }
@@ -915,7 +916,7 @@ class CmpInst : public Instruction {
/// Determine if one operand of this compare can always be replaced by the
/// other operand, ignoring provenance considerations. If \p Invert, check for
/// equivalence with the inverse predicate.
- bool isEquivalence(bool Invert = false) const;
+ LLVM_ABI bool isEquivalence(bool Invert = false) const;
/// Return true if the predicate is relational (not EQ or NE).
static bool isRelational(Predicate P) { return !isEquality(P); }
@@ -949,23 +950,23 @@ class CmpInst : public Instruction {
/// @returns true if the predicate is unsigned, false otherwise.
/// Determine if the predicate is an unsigned operation.
- static bool isUnsigned(Predicate predicate);
+ LLVM_ABI static bool isUnsigned(Predicate predicate);
/// @returns true if the predicate is signed, false otherwise.
/// Determine if the predicate is an signed operation.
- static bool isSigned(Predicate predicate);
+ LLVM_ABI static bool isSigned(Predicate predicate);
/// Determine if the predicate is an ordered operation.
- static bool isOrdered(Predicate predicate);
+ LLVM_ABI static bool isOrdered(Predicate predicate);
/// Determine if the predicate is an unordered operation.
- static bool isUnordered(Predicate predicate);
+ LLVM_ABI static bool isUnordered(Predicate predicate);
/// Determine if the predicate is true when comparing a value with itself.
- static bool isTrueWhenEqual(Predicate predicate);
+ LLVM_ABI static bool isTrueWhenEqual(Predicate predicate);
/// Determine if the predicate is false when comparing a value with itself.
- static bool isFalseWhenEqual(Predicate predicate);
+ LLVM_ABI static bool isFalseWhenEqual(Predicate predicate);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
@@ -1000,7 +1001,7 @@ struct OperandTraits<CmpInst> : public FixedNumOperandTraits<CmpInst, 2> {
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CmpInst, Value)
-raw_ostream &operator<<(raw_ostream &OS, CmpInst::Predicate Pred);
+LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, CmpInst::Predicate Pred);
/// A lightweight accessor for an operand bundle meant to be passed
/// around by value.
@@ -1148,7 +1149,7 @@ class CallBase : public Instruction {
/// Get the number of extra operands for instructions that don't have a fixed
/// number of extra operands.
- unsigned getNumSubclassExtraOperandsDynamic() const;
+ LLVM_ABI unsigned getNumSubclassExtraOperandsDynamic() const;
public:
using Instruction::getContext;
@@ -1159,7 +1160,7 @@ class CallBase : public Instruction {
/// The returned call instruction is identical \p CB in every way except that
/// the operand bundles for the new instruction are set to the operand bundles
/// in \p Bundles.
- static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
+ LLVM_ABI static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
InsertPosition InsertPt = nullptr);
/// Create a clone of \p CB with the operand bundle with the tag matching
@@ -1167,16 +1168,16 @@ class CallBase : public Instruction {
///
/// The returned call instruction is identical \p CI in every way except that
/// the specified operand bundle has been replaced.
- static CallBase *Create(CallBase *CB, OperandBundleDef Bundle,
+ LLVM_ABI static CallBase *Create(CallBase *CB, OperandBundleDef Bundle,
InsertPosition InsertPt = nullptr);
/// Create a clone of \p CB with operand bundle \p OB added.
- static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
+ LLVM_ABI static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
OperandBundleDef OB,
InsertPosition InsertPt = nullptr);
/// Create a clone of \p CB with operand bundle \p ID removed.
- static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
+ LLVM_ABI static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
InsertPosition InsertPt = nullptr);
/// Return the convergence control token for this call, if it exists.
@@ -1346,7 +1347,7 @@ class CallBase : public Instruction {
}
/// Return true if the callsite is an indirect call.
- bool isIndirectCall() const;
+ LLVM_ABI bool isIndirectCall() const;
/// Determine whether the passed iterator points to the callee operand's Use.
bool isCallee(Value::const_user_iterator UI) const {
@@ -1357,22 +1358,22 @@ class CallBase : public Instruction {
bool isCallee(const Use *U) const { return &getCalledOperandUse() == U; }
/// Helper to get the caller (the parent function).
- Function *getCaller();
+ LLVM_ABI Function *getCaller();
const Function *getCaller() const {
return const_cast<CallBase *>(this)->getCaller();
}
/// Tests if this call site must be tail call optimized. Only a CallInst can
/// be tail call optimized.
- bool isMustTailCall() const;
+ LLVM_ABI bool isMustTailCall() const;
/// Tests if this call site is marked as a tail call.
- bool isTailCall() const;
+ LLVM_ABI bool isTailCall() const;
/// Returns the intrinsic ID of the intrinsic called or
/// Intrinsic::not_intrinsic if the called function is not an intrinsic, or if
/// this is an indirect call.
- Intrinsic::ID getIntrinsicID() const;
+ LLVM_ABI Intrinsic::ID getIntrinsicID() const;
void setCalledOperand(Value *V) { Op<CalledOperandOpEndIdx>() = V; }
@@ -1600,7 +1601,7 @@ class CallBase : public Instruction {
}
/// Determine whether the argument or parameter has the given attribute.
- bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const;
+ LLVM_ABI bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const;
/// Return true if this argument has the nonnull attribute on either the
/// CallBase instruction or the called function. Also returns true if at least
@@ -1608,7 +1609,7 @@ class CallBase : public Instruction {
/// addrspace(0). If \p AllowUndefOrPoison is true, respect the semantics of
/// nonnull attribute and return true even if the argument can be undef or
/// poison.
- bool paramHasNonNullAttr(unsigned ArgNo, bool AllowUndefOrPoison) const;
+ LLVM_ABI bool paramHasNonNullAttr(unsigned ArgNo, bool AllowUndefOrPoison) const;
/// Get the attribute of a given kind at a position.
Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const {
@@ -1683,7 +1684,7 @@ class CallBase : public Instruction {
}
/// Return which pointer components this operand may capture.
- CaptureInfo getCaptureInfo(unsigned OpNo) const;
+ LLVM_ABI CaptureInfo getCaptureInfo(unsigned OpNo) const;
/// Determine whether this data operand is not captured.
// FIXME: Once this API is no longer duplicated in `CallSite`, rename this to
@@ -1695,7 +1696,7 @@ class CallBase : public Instruction {
/// Returns whether the call has an argument that has an attribute like
/// captures(ret: address, provenance), where the return capture components
/// are not a subset of the other capture components.
- bool hasArgumentWithAdditionalReturnCaptureComponents() const;
+ LLVM_ABI bool hasArgumentWithAdditionalReturnCaptureComponents() const;
/// Determine whether this argument is passed by value.
bool isByValArgument(unsigned ArgNo) const {
@@ -1862,20 +1863,20 @@ class CallBase : public Instruction {
/// Extract a test mask for disallowed floating-point value classes for the
/// return value.
- FPClassTest getRetNoFPClass() const;
+ LLVM_ABI FPClassTest getRetNoFPClass() const;
/// Extract a test mask for disallowed floating-point value classes for the
/// parameter.
- FPClassTest getParamNoFPClass(unsigned i) const;
+ LLVM_ABI FPClassTest getParamNoFPClass(unsigned i) const;
/// If this return value has a range attribute, return the value range of the
/// argument. Otherwise, std::nullopt is returned.
- std::optional<ConstantRange> getRange() const;
+ LLVM_ABI std::optional<ConstantRange> getRange() const;
/// Return true if the return value is known to be not null.
/// This may be because it has the nonnull attribute, or because at least
/// one byte is dereferenceable and the pointer is in addrspace(0).
- bool isReturnNonNull() const;
+ LLVM_ABI bool isReturnNonNull() const;
/// Determine if the return value is marked with NoAlias attribute.
bool returnDoesNotAlias() const {
@@ -1890,7 +1891,7 @@ class CallBase : public Instruction {
/// If one of the arguments has the specified attribute, returns its
/// operand value. Otherwise, return nullptr.
- Value *getArgOperandWithAttribute(Attribute::AttrKind Kind) const;
+ LLVM_ABI Value *getArgOperandWithAttribute(Attribute::AttrKind Kind) const;
/// Return true if the call should not be treated as a call to a
/// builtin.
@@ -1906,35 +1907,35 @@ class CallBase : public Instruction {
bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
void setIsNoInline() { addFnAttr(Attribute::NoInline); }
- MemoryEffects getMemoryEffects() const;
- void setMemoryEffects(MemoryEffects ME);
+ LLVM_ABI MemoryEffects getMemoryEffects() const;
+ LLVM_ABI void setMemoryEffects(MemoryEffects ME);
/// Determine if the call does not access memory.
- bool doesNotAccessMemory() const;
- void setDoesNotAccessMemory();
+ LLVM_ABI bool doesNotAccessMemory() const;
+ LLVM_ABI void setDoesNotAccessMemory();
/// Determine if the call does not access or only reads memory.
- bool onlyReadsMemory() const;
- void setOnlyReadsMemory();
+ LLVM_ABI bool onlyReadsMemory() const;
+ LLVM_ABI void setOnlyReadsMemory();
/// Determine if the call does not access or only writes memory.
- bool onlyWritesMemory() const;
- void setOnlyWritesMemory();
+ LLVM_ABI bool onlyWritesMemory() const;
+ LLVM_ABI void setOnlyWritesMemory();
/// Determine if the call can access memmory only using pointers based
/// on its arguments.
- bool onlyAccessesArgMemory() const;
- void setOnlyAccessesArgMemory();
+ LLVM_ABI bool onlyAccessesArgMemory() const;
+ LLVM_ABI void setOnlyAccessesArgMemory();
/// Determine if the function may only access memory that is
/// inaccessible from the IR.
- bool onlyAccessesInaccessibleMemory() const;
- void setOnlyAccessesInaccessibleMemory();
+ LLVM_ABI bool onlyAccessesInaccessibleMemory() const;
+ LLVM_ABI void setOnlyAccessesInaccessibleMemory();
/// Determine if the function may only access memory that is
/// either inaccessible from the IR or pointed to by its arguments.
- bool onlyAccessesInaccessibleMemOrArgMem() const;
- void setOnlyAccessesInaccessibleMemOrArgMem();
+ LLVM_ABI bool onlyAccessesInaccessibleMemOrArgMem() const;
+ LLVM_ABI void setOnlyAccessesInaccessibleMemOrArgMem();
/// Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
@@ -2107,7 +2108,7 @@ class CallBase : public Instruction {
/// OperandBundleUser to a vector of OperandBundleDefs. Note:
/// OperandBundeUses and OperandBundleDefs are non-trivially *different*
/// representations of operand bundles (see documentation above).
- void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const;
+ LLVM_ABI void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const;
/// Return the operand bundle for the operand at index OpIdx.
///
@@ -2119,11 +2120,11 @@ class CallBase : public Instruction {
/// Return true if this operand bundle user has operand bundles that
/// may read from the heap.
- bool hasReadingOperandBundles() const;
+ LLVM_ABI bool hasReadingOperandBundles() const;
/// Return true if this operand bundle user has operand bundles that
/// may write to the heap.
- bool hasClobberingOperandBundles() const;
+ LLVM_ABI bool hasClobberingOperandBundles() const;
/// Return true if the bundle operand at index \p OpIdx has the
/// attribute \p A.
@@ -2281,7 +2282,7 @@ class CallBase : public Instruction {
///
/// Each \p OperandBundleDef instance is tracked by a OperandBundleInfo
/// instance allocated in this User's descriptor.
- op_iterator populateBundleOperandInfos(ArrayRef<OperandBundleDef> Bundles,
+ LLVM_ABI op_iterator populateBundleOperandInfos(ArrayRef<OperandBundleDef> Bundles,
const unsigned BeginIndex);
/// Return true if the call has deopt state bundle.
@@ -2294,7 +2295,7 @@ class CallBase : public Instruction {
///
/// It is an error to call this with an OpIdx that does not correspond to an
/// bundle operand.
- BundleOpInfo &getBundleOpInfoForOperand(unsigned OpIdx);
+ LLVM_ABI BundleOpInfo &getBundleOpInfoForOperand(unsigned OpIdx);
const BundleOpInfo &getBundleOpInfoForOperand(unsigned OpIdx) const {
return const_cast<CallBase *>(this)->getBundleOpInfoForOperand(OpIdx);
}
@@ -2312,8 +2313,8 @@ class CallBase : public Instruction {
// End of operand bundle API.
private:
- bool hasFnAttrOnCalledFunction(Attribute::AttrKind Kind) const;
- bool hasFnAttrOnCalledFunction(StringRef Kind) const;
+ LLVM_ABI bool hasFnAttrOnCalledFunction(Attribute::AttrKind Kind) const;
+ LLVM_ABI bool hasFnAttrOnCalledFunction(StringRef Kind) const;
template <typename AttrKind> bool hasFnAttrImpl(AttrKind Kind) const {
if (Attrs.hasFnAttr(Kind))
@@ -2350,7 +2351,7 @@ class FuncletPadInst : public Instruction {
private:
FuncletPadInst(const FuncletPadInst &CPI, AllocInfo AllocInfo);
- explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
+ LLVM_ABI explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
ArrayRef<Value *> Args, AllocInfo AllocInfo,
const Twine &NameStr, InsertPosition InsertBefore);
@@ -2362,7 +2363,7 @@ class FuncletPadInst : public Instruction {
friend class CatchPadInst;
friend class CleanupPadInst;
- FuncletPadInst *cloneImpl() const;
+ LLVM_ABI FuncletPadInst *cloneImpl() const;
public:
/// Provide fast operand accessors
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index d8069b2fb02a4..9c71e64cc2a3d 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_INSTRUCTION_H
#define LLVM_IR_INSTRUCTION_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/StringRef.h"
@@ -42,7 +43,7 @@ template <> struct ilist_alloc_traits<Instruction> {
static inline void deleteNode(Instruction *V);
};
-iterator_range<simple_ilist<DbgRecord>::iterator>
+LLVM_ABI iterator_range<simple_ilist<DbgRecord>::iterator>
getDbgRecordRange(DbgMarker *);
class InsertPosition {
@@ -52,10 +53,10 @@ class InsertPosition {
public:
InsertPosition(std::nullptr_t) : InsertAt() {}
- LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
+ LLVM_ABI LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
"BasicBlock::iterator")
InsertPosition(Instruction *InsertBefore);
- InsertPosition(BasicBlock *InsertAtEnd);
+ LLVM_ABI InsertPosition(BasicBlock *InsertAtEnd);
InsertPosition(InstListType::iterator InsertAt) : InsertAt(InsertAt) {}
operator InstListType::iterator() const { return InsertAt; }
bool isValid() const { return InsertAt.isValid(); }
@@ -95,7 +96,7 @@ class Instruction : public User,
/// \p InsertAtHead Whether the cloned DbgRecords should be placed at the end
/// or the beginning of existing DbgRecords attached to this.
/// \returns A range over the newly cloned DbgRecords.
- iterator_range<simple_ilist<DbgRecord>::iterator> cloneDebugInfoFrom(
+ LLVM_ABI iterator_range<simple_ilist<DbgRecord>::iterator> cloneDebugInfoFrom(
const Instruction *From,
std::optional<simple_ilist<DbgRecord>::iterator> FromHere = std::nullopt,
bool InsertAtHead = false);
@@ -108,26 +109,26 @@ class Instruction : public User,
/// Return an iterator to the position of the "Next" DbgRecord after this
/// instruction, or std::nullopt. This is the position to pass to
/// BasicBlock::reinsertInstInDbgRecords when re-inserting an instruction.
- std::optional<simple_ilist<DbgRecord>::iterator> getDbgReinsertionPosition();
+ LLVM_ABI std::optional<simple_ilist<DbgRecord>::iterator> getDbgReinsertionPosition();
/// Returns true if any DbgRecords are attached to this instruction.
- bool hasDbgRecords() const;
+ LLVM_ABI bool hasDbgRecords() const;
/// Transfer any DbgRecords on the position \p It onto this instruction,
/// by simply adopting the sequence of DbgRecords (which is efficient) if
/// possible, by merging two sequences otherwise.
- void adoptDbgRecords(BasicBlock *BB, InstListType::iterator It,
+ LLVM_ABI void adoptDbgRecords(BasicBlock *BB, InstListType::iterator It,
bool InsertAtHead);
/// Erase any DbgRecords attached to this instruction.
- void dropDbgRecords();
+ LLVM_ABI void dropDbgRecords();
/// Erase a single DbgRecord \p I that is attached to this instruction.
- void dropOneDbgRecord(DbgRecord *I);
+ LLVM_ABI void dropOneDbgRecord(DbgRecord *I);
/// Handle the debug-info implications of this instruction being removed. Any
/// attached DbgRecords need to "fall" down onto the next instruction.
- void handleMarkerRemoval();
+ LLVM_ABI void handleMarkerRemoval();
protected:
// The 15 first bits of `Value::SubclassData` are available for subclasses of
@@ -158,7 +159,7 @@ class Instruction : public User,
using HasMetadataField = Bitfield::Element<bool, 15, 1>;
protected:
- ~Instruction(); // Use deleteValue() to delete a generic Instruction.
+ LLVM_ABI ~Instruction(); // Use deleteValue() to delete a generic Instruction.
public:
Instruction(const Instruction &) = delete;
@@ -174,7 +175,7 @@ class Instruction : public User,
///
/// Note: this is undefined behavior if the instruction does not have a
/// parent, or the parent basic block does not have a parent function.
- const Module *getModule() const;
+ LLVM_ABI const Module *getModule() const;
Module *getModule() {
return const_cast<Module *>(
static_cast<const Instruction *>(this)->getModule());
@@ -184,7 +185,7 @@ class Instruction : public User,
///
/// Note: it is undefined behavior to call this on an instruction not
/// currently inserted into a function.
- const Function *getFunction() const;
+ LLVM_ABI const Function *getFunction() const;
Function *getFunction() {
return const_cast<Function *>(
static_cast<const Instruction *>(this)->getFunction());
@@ -193,16 +194,16 @@ class Instruction : public User,
/// Get the data layout of the module this instruction belongs to.
///
/// Requires the instruction to have a parent module.
- const DataLayout &getDataLayout() const;
+ LLVM_ABI const DataLayout &getDataLayout() const;
/// This method unlinks 'this' from the containing basic block, but does not
/// delete it.
- void removeFromParent();
+ LLVM_ABI void removeFromParent();
/// This method unlinks 'this' from the containing basic block and deletes it.
///
/// \returns an iterator pointing to the element after the erased one
- InstListType::iterator eraseFromParent();
+ LLVM_ABI InstListType::iterator eraseFromParent();
/// Insert an unlinked instruction into a basic block immediately before
/// the specified instruction.
@@ -211,27 +212,27 @@ class Instruction : public User,
/// start of a block such as BasicBlock::getFirstNonPHIIt must be passed into
/// insertBefore without unwrapping/rewrapping. For all other positions, call
/// getIterator to fetch the instruction iterator.
- LLVM_DEPRECATED("Use iterators as instruction positions", "")
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "")
void insertBefore(Instruction *InsertPos);
/// Insert an unlinked instruction into a basic block immediately before
/// the specified position.
- void insertBefore(InstListType::iterator InsertPos);
+ LLVM_ABI void insertBefore(InstListType::iterator InsertPos);
/// Insert an unlinked instruction into a basic block immediately after the
/// specified instruction.
- void insertAfter(Instruction *InsertPos);
+ LLVM_ABI void insertAfter(Instruction *InsertPos);
/// Insert an unlinked instruction into a basic block immediately after the
/// specified position.
- void insertAfter(InstListType::iterator InsertPos);
+ LLVM_ABI void insertAfter(InstListType::iterator InsertPos);
/// Inserts an unlinked instruction into \p ParentBB at position \p It and
/// returns the iterator of the inserted instruction.
- InstListType::iterator insertInto(BasicBlock *ParentBB,
+ LLVM_ABI InstListType::iterator insertInto(BasicBlock *ParentBB,
InstListType::iterator It);
- void insertBefore(BasicBlock &BB, InstListType::iterator InsertPos);
+ LLVM_ABI void insertBefore(BasicBlock &BB, InstListType::iterator InsertPos);
/// Unlink this instruction from its current basic block and insert it into
/// the basic block that MovePos lives in, right before MovePos.
@@ -240,22 +241,22 @@ class Instruction : public User,
/// start of a block such as BasicBlock::getFirstNonPHIIt must be passed into
/// moveBefore without unwrapping/rewrapping. For all other positions, call
/// getIterator to fetch the instruction iterator.
- LLVM_DEPRECATED("Use iterators as instruction positions", "")
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "")
void moveBefore(Instruction *MovePos);
/// Unlink this instruction from its current basic block and insert it into
/// the basic block that MovePos lives in, right before MovePos.
- void moveBefore(InstListType::iterator InsertPos);
+ LLVM_ABI void moveBefore(InstListType::iterator InsertPos);
/// Perform a \ref moveBefore operation, while signalling that the caller
/// intends to preserve the original ordering of instructions. This implicitly
/// means that any adjacent debug-info should move with this instruction.
- void moveBeforePreserving(InstListType::iterator MovePos);
+ LLVM_ABI void moveBeforePreserving(InstListType::iterator MovePos);
/// Perform a \ref moveBefore operation, while signalling that the caller
/// intends to preserve the original ordering of instructions. This implicitly
/// means that any adjacent debug-info should move with this instruction.
- void moveBeforePreserving(BasicBlock &BB, InstListType::iterator I);
+ LLVM_ABI void moveBeforePreserving(BasicBlock &BB, InstListType::iterator I);
/// Perform a \ref moveBefore operation, while signalling that the caller
/// intends to preserve the original ordering of instructions. This implicitly
@@ -263,7 +264,7 @@ class Instruction : public User,
///
/// Deprecated in favour of the iterator-accepting flavour of
/// moveBeforePreserving, as all insertions should be at iterator positions.
- LLVM_DEPRECATED("Use iterators as instruction positions", "")
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "")
void moveBeforePreserving(Instruction *MovePos);
private:
@@ -275,32 +276,32 @@ class Instruction : public User,
/// Unlink this instruction and insert into BB before I.
///
/// \pre I is a valid iterator into BB.
- void moveBefore(BasicBlock &BB, InstListType::iterator I);
+ LLVM_ABI void moveBefore(BasicBlock &BB, InstListType::iterator I);
/// Unlink this instruction from its current basic block and insert it into
/// the basic block that MovePos lives in, right after MovePos.
- void moveAfter(Instruction *MovePos);
+ LLVM_ABI void moveAfter(Instruction *MovePos);
/// Unlink this instruction from its current basic block and insert it into
/// the basic block that MovePos lives in, right after MovePos.
- void moveAfter(InstListType::iterator MovePos);
+ LLVM_ABI void moveAfter(InstListType::iterator MovePos);
/// See \ref moveBeforePreserving .
- void moveAfterPreserving(Instruction *MovePos);
+ LLVM_ABI void moveAfterPreserving(Instruction *MovePos);
/// Given an instruction Other in the same basic block as this instruction,
/// return true if this instruction comes before Other. In this worst case,
/// this takes linear time in the number of instructions in the block. The
/// results are cached, so in common cases when the block remains unmodified,
/// it takes constant time.
- bool comesBefore(const Instruction *Other) const;
+ LLVM_ABI bool comesBefore(const Instruction *Other) const;
/// Get the first insertion point at which the result of this instruction
/// is defined. This is *not* the directly following instruction in a number
/// of cases, e.g. phi nodes or terminators that return values. This function
/// may return null if the insertion after the definition is not possible,
/// e.g. due to a catchswitch terminator.
- std::optional<InstListType::iterator> getInsertionPointAfterDef();
+ LLVM_ABI std::optional<InstListType::iterator> getInsertionPointAfterDef();
//===--------------------------------------------------------------------===//
// Subclass classification.
@@ -322,9 +323,9 @@ class Instruction : public User,
/// It checks if this instruction is the only user of at least one of
/// its operands.
- bool isOnlyUserOfAnyOperand();
+ LLVM_ABI bool isOnlyUserOfAnyOperand();
- static const char *getOpcodeName(unsigned Opcode);
+ LLVM_ABI static const char *getOpcodeName(unsigned Opcode);
static inline bool isTerminator(unsigned Opcode) {
return Opcode >= TermOpsBegin && Opcode < TermOpsEnd;
@@ -405,7 +406,7 @@ class Instruction : public User,
// Return true if this instruction contains loop metadata other than
// a debug location
- bool hasNonDebugLocLoopMetadata() const;
+ LLVM_ABI bool hasNonDebugLocLoopMetadata() const;
/// Return true if this instruction has metadata attached to it other than a
/// debug location.
@@ -455,22 +456,22 @@ class Instruction : public User,
/// Set the metadata of the specified kind to the specified node. This updates
/// or replaces metadata if already present, or removes it if Node is null.
- void setMetadata(unsigned KindID, MDNode *Node);
- void setMetadata(StringRef Kind, MDNode *Node);
+ LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node);
+ LLVM_ABI void setMetadata(StringRef Kind, MDNode *Node);
/// Copy metadata from \p SrcInst to this instruction. \p WL, if not empty,
/// specifies the list of meta data that needs to be copied. If \p WL is
/// empty, all meta data will be copied.
- void copyMetadata(const Instruction &SrcInst,
+ LLVM_ABI void copyMetadata(const Instruction &SrcInst,
ArrayRef<unsigned> WL = ArrayRef<unsigned>());
/// Erase all metadata that matches the predicate.
- void eraseMetadataIf(function_ref<bool(unsigned, MDNode *)> Pred);
+ LLVM_ABI void eraseMetadataIf(function_ref<bool(unsigned, MDNode *)> Pred);
/// If the instruction has "branch_weights" MD_prof metadata and the MDNode
/// has three operands (including name string), swap the order of the
/// metadata.
- void swapProfMetadata();
+ LLVM_ABI void swapProfMetadata();
/// Drop all unknown metadata except for debug locations.
/// @{
@@ -478,31 +479,31 @@ class Instruction : public User,
/// convenience method for passes to do so.
/// dropUBImplyingAttrsAndUnknownMetadata should be used instead of
/// this API if the Instruction being modified is a call.
- void dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs = {});
+ LLVM_ABI void dropUnknownNonDebugMetadata(ArrayRef<unsigned> KnownIDs = {});
/// @}
/// Adds an !annotation metadata node with \p Annotation to this instruction.
/// If this instruction already has !annotation metadata, append \p Annotation
/// to the existing node.
- void addAnnotationMetadata(StringRef Annotation);
+ LLVM_ABI void addAnnotationMetadata(StringRef Annotation);
/// Adds an !annotation metadata node with an array of \p Annotations
/// as a tuple to this instruction. If this instruction already has
/// !annotation metadata, append the tuple to
/// the existing node.
- void addAnnotationMetadata(SmallVector<StringRef> Annotations);
+ LLVM_ABI void addAnnotationMetadata(SmallVector<StringRef> Annotations);
/// Returns the AA metadata for this instruction.
- AAMDNodes getAAMetadata() const;
+ LLVM_ABI AAMDNodes getAAMetadata() const;
/// Sets the AA metadata on this instruction from the AAMDNodes structure.
- void setAAMetadata(const AAMDNodes &N);
+ LLVM_ABI void setAAMetadata(const AAMDNodes &N);
/// Sets the nosanitize metadata on this instruction.
- void setNoSanitizeMetadata();
+ LLVM_ABI void setNoSanitizeMetadata();
/// Retrieve total raw weight values of a branch.
/// Returns true on success with profile total weights filled in.
/// Returns false if no metadata was found.
- bool extractProfTotalWeight(uint64_t &TotalVal) const;
+ LLVM_ABI bool extractProfTotalWeight(uint64_t &TotalVal) const;
/// Set the debug location information for this instruction.
void setDebugLoc(DebugLoc Loc) { DbgLoc = std::move(Loc); }
@@ -512,52 +513,52 @@ class Instruction : public User,
/// Fetch the debug location for this node, unless this is a debug intrinsic,
/// in which case fetch the debug location of the next non-debug node.
- const DebugLoc &getStableDebugLoc() const;
+ LLVM_ABI const DebugLoc &getStableDebugLoc() const;
/// Set or clear the nuw flag on this instruction, which must be an operator
/// which supports this flag. See LangRef.html for the meaning of this flag.
- void setHasNoUnsignedWrap(bool b = true);
+ LLVM_ABI void setHasNoUnsignedWrap(bool b = true);
/// Set or clear the nsw flag on this instruction, which must be an operator
/// which supports this flag. See LangRef.html for the meaning of this flag.
- void setHasNoSignedWrap(bool b = true);
+ LLVM_ABI void setHasNoSignedWrap(bool b = true);
/// Set or clear the exact flag on this instruction, which must be an operator
/// which supports this flag. See LangRef.html for the meaning of this flag.
- void setIsExact(bool b = true);
+ LLVM_ABI void setIsExact(bool b = true);
/// Set or clear the nneg flag on this instruction, which must be a zext
/// instruction.
- void setNonNeg(bool b = true);
+ LLVM_ABI void setNonNeg(bool b = true);
/// Determine whether the no unsigned wrap flag is set.
- bool hasNoUnsignedWrap() const LLVM_READONLY;
+ LLVM_ABI bool hasNoUnsignedWrap() const LLVM_READONLY;
/// Determine whether the no signed wrap flag is set.
- bool hasNoSignedWrap() const LLVM_READONLY;
+ LLVM_ABI bool hasNoSignedWrap() const LLVM_READONLY;
/// Determine whether the the nneg flag is set.
- bool hasNonNeg() const LLVM_READONLY;
+ LLVM_ABI bool hasNonNeg() const LLVM_READONLY;
/// Return true if this operator has flags which may cause this instruction
/// to evaluate to poison despite having non-poison inputs.
- bool hasPoisonGeneratingFlags() const LLVM_READONLY;
+ LLVM_ABI bool hasPoisonGeneratingFlags() const LLVM_READONLY;
/// Drops flags that may cause this instruction to evaluate to poison despite
/// having non-poison inputs.
- void dropPoisonGeneratingFlags();
+ LLVM_ABI void dropPoisonGeneratingFlags();
/// Return true if this instruction has poison-generating metadata.
- bool hasPoisonGeneratingMetadata() const LLVM_READONLY;
+ LLVM_ABI bool hasPoisonGeneratingMetadata() const LLVM_READONLY;
/// Drops metadata that may generate poison.
- void dropPoisonGeneratingMetadata();
+ LLVM_ABI void dropPoisonGeneratingMetadata();
/// Return true if this instruction has poison-generating attribute.
- bool hasPoisonGeneratingReturnAttributes() const LLVM_READONLY;
+ LLVM_ABI bool hasPoisonGeneratingReturnAttributes() const LLVM_READONLY;
/// Drops return attributes that may generate poison.
- void dropPoisonGeneratingReturnAttributes();
+ LLVM_ABI void dropPoisonGeneratingReturnAttributes();
/// Return true if this instruction has poison-generating flags,
/// return attributes or metadata.
@@ -578,109 +579,109 @@ class Instruction : public User,
/// dropUnknownNonDebugMetadata). For calls, it also drops parameter and
/// return attributes that can cause undefined behaviour. Both of these should
/// be done by passes which move instructions in IR.
- void dropUBImplyingAttrsAndUnknownMetadata(ArrayRef<unsigned> KnownIDs = {});
+ LLVM_ABI void dropUBImplyingAttrsAndUnknownMetadata(ArrayRef<unsigned> KnownIDs = {});
/// Drop any attributes or metadata that can cause immediate undefined
/// behavior. Retain other attributes/metadata on a best-effort basis.
/// This should be used when speculating instructions.
- void dropUBImplyingAttrsAndMetadata();
+ LLVM_ABI void dropUBImplyingAttrsAndMetadata();
/// Return true if this instruction has UB-implying attributes
/// that can cause immediate undefined behavior.
- bool hasUBImplyingAttrs() const LLVM_READONLY;
+ LLVM_ABI bool hasUBImplyingAttrs() const LLVM_READONLY;
/// Determine whether the exact flag is set.
- bool isExact() const LLVM_READONLY;
+ LLVM_ABI bool isExact() const LLVM_READONLY;
/// Set or clear all fast-math-flags on this instruction, which must be an
/// operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setFast(bool B);
+ LLVM_ABI void setFast(bool B);
/// Set or clear the reassociation flag on this instruction, which must be
/// an operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasAllowReassoc(bool B);
+ LLVM_ABI void setHasAllowReassoc(bool B);
/// Set or clear the no-nans flag on this instruction, which must be an
/// operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasNoNaNs(bool B);
+ LLVM_ABI void setHasNoNaNs(bool B);
/// Set or clear the no-infs flag on this instruction, which must be an
/// operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasNoInfs(bool B);
+ LLVM_ABI void setHasNoInfs(bool B);
/// Set or clear the no-signed-zeros flag on this instruction, which must be
/// an operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasNoSignedZeros(bool B);
+ LLVM_ABI void setHasNoSignedZeros(bool B);
/// Set or clear the allow-reciprocal flag on this instruction, which must be
/// an operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasAllowReciprocal(bool B);
+ LLVM_ABI void setHasAllowReciprocal(bool B);
/// Set or clear the allow-contract flag on this instruction, which must be
/// an operator which supports this flag. See LangRef.html for the meaning of
/// this flag.
- void setHasAllowContract(bool B);
+ LLVM_ABI void setHasAllowContract(bool B);
/// Set or clear the approximate-math-functions flag on this instruction,
/// which must be an operator which supports this flag. See LangRef.html for
/// the meaning of this flag.
- void setHasApproxFunc(bool B);
+ LLVM_ABI void setHasApproxFunc(bool B);
/// Convenience function for setting multiple fast-math flags on this
/// instruction, which must be an operator which supports these flags. See
/// LangRef.html for the meaning of these flags.
- void setFastMathFlags(FastMathFlags FMF);
+ LLVM_ABI void setFastMathFlags(FastMathFlags FMF);
/// Convenience function for transferring all fast-math flag values to this
/// instruction, which must be an operator which supports these flags. See
/// LangRef.html for the meaning of these flags.
- void copyFastMathFlags(FastMathFlags FMF);
+ LLVM_ABI void copyFastMathFlags(FastMathFlags FMF);
/// Determine whether all fast-math-flags are set.
- bool isFast() const LLVM_READONLY;
+ LLVM_ABI bool isFast() const LLVM_READONLY;
/// Determine whether the allow-reassociation flag is set.
- bool hasAllowReassoc() const LLVM_READONLY;
+ LLVM_ABI bool hasAllowReassoc() const LLVM_READONLY;
/// Determine whether the no-NaNs flag is set.
- bool hasNoNaNs() const LLVM_READONLY;
+ LLVM_ABI bool hasNoNaNs() const LLVM_READONLY;
/// Determine whether the no-infs flag is set.
- bool hasNoInfs() const LLVM_READONLY;
+ LLVM_ABI bool hasNoInfs() const LLVM_READONLY;
/// Determine whether the no-signed-zeros flag is set.
- bool hasNoSignedZeros() const LLVM_READONLY;
+ LLVM_ABI bool hasNoSignedZeros() const LLVM_READONLY;
/// Determine whether the allow-reciprocal flag is set.
- bool hasAllowReciprocal() const LLVM_READONLY;
+ LLVM_ABI bool hasAllowReciprocal() const LLVM_READONLY;
/// Determine whether the allow-contract flag is set.
- bool hasAllowContract() const LLVM_READONLY;
+ LLVM_ABI bool hasAllowContract() const LLVM_READONLY;
/// Determine whether the approximate-math-functions flag is set.
- bool hasApproxFunc() const LLVM_READONLY;
+ LLVM_ABI bool hasApproxFunc() const LLVM_READONLY;
/// Convenience function for getting all the fast-math flags, which must be an
/// operator which supports these flags. See LangRef.html for the meaning of
/// these flags.
- FastMathFlags getFastMathFlags() const LLVM_READONLY;
+ LLVM_ABI FastMathFlags getFastMathFlags() const LLVM_READONLY;
/// Copy I's fast-math flags
- void copyFastMathFlags(const Instruction *I);
+ LLVM_ABI void copyFastMathFlags(const Instruction *I);
/// Convenience method to copy supported exact, fast-math, and (optionally)
/// wrapping flags from V to this instruction.
- void copyIRFlags(const Value *V, bool IncludeWrapFlags = true);
+ LLVM_ABI void copyIRFlags(const Value *V, bool IncludeWrapFlags = true);
/// Logical 'and' of any supported wrapping, exact, and fast-math flags of
/// V and this instruction.
- void andIRFlags(const Value *V);
+ LLVM_ABI void andIRFlags(const Value *V);
/// Merge 2 debug locations and apply it to the Instruction. If the
/// instruction is a CallIns, we need to traverse the inline chain to find
@@ -695,13 +696,13 @@ class Instruction : public User,
/// applications, thus the N-way merging should be in code path.
/// The DebugLoc attached to this instruction will be overwritten by the
/// merged DebugLoc.
- void applyMergedLocation(DILocation *LocA, DILocation *LocB);
+ LLVM_ABI void applyMergedLocation(DILocation *LocA, DILocation *LocB);
/// Updates the debug location given that the instruction has been hoisted
/// from a block to a predecessor of that block.
/// Note: it is undefined behavior to call this on an instruction not
/// currently inserted into a function.
- void updateLocationAfterHoist();
+ LLVM_ABI void updateLocationAfterHoist();
/// Drop the instruction's debug location. This does not guarantee removal
/// of the !dbg source location attachment, as it must set a line 0 location
@@ -709,7 +710,7 @@ class Instruction : public User,
/// removal of the !dbg attachment, use the \ref setDebugLoc() API.
/// Note: it is undefined behavior to call this on an instruction not
/// currently inserted into a function.
- void dropLocation();
+ LLVM_ABI void dropLocation();
/// Merge the DIAssignID metadata from this instruction and those attached to
/// instructions in \p SourceInstructions. This process performs a RAUW on
@@ -720,12 +721,12 @@ class Instruction : public User,
/// SourceInstructions does then the merged one will be attached to
/// it. However, instructions without attachments in \p SourceInstructions
/// are not modified.
- void mergeDIAssignID(ArrayRef<const Instruction *> SourceInstructions);
+ LLVM_ABI void mergeDIAssignID(ArrayRef<const Instruction *> SourceInstructions);
private:
// These are all implemented in Metadata.cpp.
- MDNode *getMetadataImpl(StringRef Kind) const;
- void
+ LLVM_ABI MDNode *getMetadataImpl(StringRef Kind) const;
+ LLVM_ABI void
getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned, MDNode *>> &) const;
/// Update the LLVMContext ID-to-Instruction(s) mapping. If \p ID is nullptr
@@ -743,7 +744,7 @@ class Instruction : public User,
///
/// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
///
- bool isAssociative() const LLVM_READONLY;
+ LLVM_ABI bool isAssociative() const LLVM_READONLY;
static bool isAssociative(unsigned Opcode) {
return Opcode == And || Opcode == Or || Opcode == Xor ||
Opcode == Add || Opcode == Mul;
@@ -756,7 +757,7 @@ class Instruction : public User,
/// In LLVM, these are the commutative operators, plus SetEQ and SetNE, when
/// applied to any type.
///
- bool isCommutative() const LLVM_READONLY;
+ LLVM_ABI bool isCommutative() const LLVM_READONLY;
static bool isCommutative(unsigned Opcode) {
switch (Opcode) {
case Add: case FAdd:
@@ -794,10 +795,10 @@ class Instruction : public User,
}
/// Return true if this instruction may modify memory.
- bool mayWriteToMemory() const LLVM_READONLY;
+ LLVM_ABI bool mayWriteToMemory() const LLVM_READONLY;
/// Return true if this instruction may read memory.
- bool mayReadFromMemory() const LLVM_READONLY;
+ LLVM_ABI bool mayReadFromMemory() const LLVM_READONLY;
/// Return true if this instruction may read or write memory.
bool mayReadOrWriteMemory() const {
@@ -806,26 +807,26 @@ class Instruction : public User,
/// Return true if this instruction has an AtomicOrdering of unordered or
/// higher.
- bool isAtomic() const LLVM_READONLY;
+ LLVM_ABI bool isAtomic() const LLVM_READONLY;
/// Return true if this atomic instruction loads from memory.
- bool hasAtomicLoad() const LLVM_READONLY;
+ LLVM_ABI bool hasAtomicLoad() const LLVM_READONLY;
/// Return true if this atomic instruction stores to memory.
- bool hasAtomicStore() const LLVM_READONLY;
+ LLVM_ABI bool hasAtomicStore() const LLVM_READONLY;
/// Return true if this instruction has a volatile memory access.
- bool isVolatile() const LLVM_READONLY;
+ LLVM_ABI bool isVolatile() const LLVM_READONLY;
/// Return the type this instruction accesses in memory, if any.
- Type *getAccessType() const LLVM_READONLY;
+ LLVM_ABI Type *getAccessType() const LLVM_READONLY;
/// Return true if this instruction may throw an exception.
///
/// If IncludePhaseOneUnwind is set, this will also include cases where
/// phase one unwinding may unwind past this frame due to skipping of
/// cleanup landingpads.
- bool mayThrow(bool IncludePhaseOneUnwind = false) const LLVM_READONLY;
+ LLVM_ABI bool mayThrow(bool IncludePhaseOneUnwind = false) const LLVM_READONLY;
/// Return true if this instruction behaves like a memory fence: it can load
/// or store to memory location without being given a memory location.
@@ -855,7 +856,7 @@ class Instruction : public User,
/// effects because the newly allocated memory is completely invisible to
/// instructions which don't use the returned value. For cases where this
/// matters, isSafeToSpeculativelyExecute may be more appropriate.
- bool mayHaveSideEffects() const LLVM_READONLY;
+ LLVM_ABI bool mayHaveSideEffects() const LLVM_READONLY;
/// Return true if the instruction can be removed if the result is unused.
///
@@ -863,11 +864,11 @@ class Instruction : public User,
/// results are unused. Specifically terminator instructions and calls that
/// may have side effects cannot be removed without semantically changing the
/// generated program.
- bool isSafeToRemove() const LLVM_READONLY;
+ LLVM_ABI bool isSafeToRemove() const LLVM_READONLY;
/// Return true if the instruction will return (unwinding is considered as
/// a form of returning control flow here).
- bool willReturn() const LLVM_READONLY;
+ LLVM_ABI bool willReturn() const LLVM_READONLY;
/// Return true if the instruction is a variety of EH-block.
bool isEHPad() const {
@@ -884,19 +885,19 @@ class Instruction : public User,
/// Return true if the instruction is a llvm.lifetime.start or
/// llvm.lifetime.end marker.
- bool isLifetimeStartOrEnd() const LLVM_READONLY;
+ LLVM_ABI bool isLifetimeStartOrEnd() const LLVM_READONLY;
/// Return true if the instruction is a llvm.launder.invariant.group or
/// llvm.strip.invariant.group.
- bool isLaunderOrStripInvariantGroup() const LLVM_READONLY;
+ LLVM_ABI bool isLaunderOrStripInvariantGroup() const LLVM_READONLY;
/// Return true if the instruction is a DbgInfoIntrinsic or PseudoProbeInst.
- bool isDebugOrPseudoInst() const LLVM_READONLY;
+ LLVM_ABI bool isDebugOrPseudoInst() const LLVM_READONLY;
/// Return a pointer to the next non-debug instruction in the same basic
/// block as 'this', or nullptr if no such instruction exists. Skip any pseudo
/// operations if \c SkipPseudoOp is true.
- const Instruction *
+ LLVM_ABI const Instruction *
getNextNonDebugInstruction(bool SkipPseudoOp = false) const;
Instruction *getNextNonDebugInstruction(bool SkipPseudoOp = false) {
return const_cast<Instruction *>(
@@ -907,7 +908,7 @@ class Instruction : public User,
/// Return a pointer to the previous non-debug instruction in the same basic
/// block as 'this', or nullptr if no such instruction exists. Skip any pseudo
/// operations if \c SkipPseudoOp is true.
- const Instruction *
+ LLVM_ABI const Instruction *
getPrevNonDebugInstruction(bool SkipPseudoOp = false) const;
Instruction *getPrevNonDebugInstruction(bool SkipPseudoOp = false) {
return const_cast<Instruction *>(
@@ -920,17 +921,17 @@ class Instruction : public User,
/// * The instruction has no parent
/// * The instruction has no name
///
- Instruction *clone() const;
+ LLVM_ABI Instruction *clone() const;
/// Return true if the specified instruction is exactly identical to the
/// current one. This means that all operands match and any extra information
/// (e.g. load is volatile) agree.
- bool isIdenticalTo(const Instruction *I) const LLVM_READONLY;
+ LLVM_ABI bool isIdenticalTo(const Instruction *I) const LLVM_READONLY;
/// This is like isIdenticalTo, except that it ignores the
/// SubclassOptionalData flags, which may specify conditions under which the
/// instruction's result is undefined.
- bool
+ LLVM_ABI bool
isIdenticalToWhenDefined(const Instruction *I,
bool IntersectAttrs = false) const LLVM_READONLY;
@@ -954,7 +955,7 @@ class Instruction : public User,
/// @returns true if the specified instruction is the same operation as
/// the current one.
/// Determine if one instruction is the same operation as another.
- bool isSameOperationAs(const Instruction *I, unsigned flags = 0) const LLVM_READONLY;
+ LLVM_ABI bool isSameOperationAs(const Instruction *I, unsigned flags = 0) const LLVM_READONLY;
/// This function determines if the speficied instruction has the same
/// "special" characteristics as the current one. This means that opcode
@@ -964,28 +965,28 @@ class Instruction : public User,
/// @returns true if the specific instruction has the same opcde specific
/// characteristics as the current one. Determine if one instruction has the
/// same state as another.
- bool hasSameSpecialState(const Instruction *I2, bool IgnoreAlignment = false,
+ LLVM_ABI bool hasSameSpecialState(const Instruction *I2, bool IgnoreAlignment = false,
bool IntersectAttrs = false) const LLVM_READONLY;
/// Return true if there are any uses of this instruction in blocks other than
/// the specified block. Note that PHI nodes are considered to evaluate their
/// operands in the corresponding predecessor block.
- bool isUsedOutsideOfBlock(const BasicBlock *BB) const LLVM_READONLY;
+ LLVM_ABI bool isUsedOutsideOfBlock(const BasicBlock *BB) const LLVM_READONLY;
/// Return the number of successors that this instruction has. The instruction
/// must be a terminator.
- unsigned getNumSuccessors() const LLVM_READONLY;
+ LLVM_ABI unsigned getNumSuccessors() const LLVM_READONLY;
/// Return the specified successor. This instruction must be a terminator.
- BasicBlock *getSuccessor(unsigned Idx) const LLVM_READONLY;
+ LLVM_ABI BasicBlock *getSuccessor(unsigned Idx) const LLVM_READONLY;
/// Update the specified successor to point at the provided block. This
/// instruction must be a terminator.
- void setSuccessor(unsigned Idx, BasicBlock *BB);
+ LLVM_ABI void setSuccessor(unsigned Idx, BasicBlock *BB);
/// Replace specified successor OldBB to point at the provided block.
/// This instruction must be a terminator.
- void replaceSuccessorWith(BasicBlock *OldBB, BasicBlock *NewBB);
+ LLVM_ABI void replaceSuccessorWith(BasicBlock *OldBB, BasicBlock *NewBB);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -1083,7 +1084,7 @@ class Instruction : public User,
setValueSubclassData(Storage);
}
- Instruction(Type *Ty, unsigned iType, AllocInfo AllocInfo,
+ LLVM_ABI Instruction(Type *Ty, unsigned iType, AllocInfo AllocInfo,
InsertPosition InsertBefore = nullptr);
private:
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index c164f76eb335b..82607262214df 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_INSTRUCTIONS_H
#define LLVM_IR_INSTRUCTIONS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/MapVector.h"
@@ -74,21 +75,21 @@ class AllocaInst : public UnaryInstruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- AllocaInst *cloneImpl() const;
+ LLVM_ABI AllocaInst *cloneImpl() const;
public:
- explicit AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
+ LLVM_ABI explicit AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
const Twine &Name, InsertPosition InsertBefore);
- AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
+ LLVM_ABI AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
InsertPosition InsertBefore);
- AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, Align Align,
+ LLVM_ABI AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, Align Align,
const Twine &Name = "", InsertPosition InsertBefore = nullptr);
/// Return true if there is an allocation size parameter to the allocation
/// instruction that is not 1.
- bool isArrayAllocation() const;
+ LLVM_ABI bool isArrayAllocation() const;
/// Get the number of elements allocated. For a simple allocation of a single
/// element, this will return a constant 1 value.
@@ -107,11 +108,11 @@ class AllocaInst : public UnaryInstruction {
/// Get allocation size in bytes. Returns std::nullopt if size can't be
/// determined, e.g. in case of a VLA.
- std::optional<TypeSize> getAllocationSize(const DataLayout &DL) const;
+ LLVM_ABI std::optional<TypeSize> getAllocationSize(const DataLayout &DL) const;
/// Get allocation size in bits. Returns std::nullopt if size can't be
/// determined, e.g. in case of a VLA.
- std::optional<TypeSize> getAllocationSizeInBits(const DataLayout &DL) const;
+ LLVM_ABI std::optional<TypeSize> getAllocationSizeInBits(const DataLayout &DL) const;
/// Return the type that is being allocated by the instruction.
Type *getAllocatedType() const { return AllocatedType; }
@@ -132,7 +133,7 @@ class AllocaInst : public UnaryInstruction {
/// Return true if this alloca is in the entry block of the function and is a
/// constant size. If so, the code generator will fold it into the
/// prolog/epilog code, so it is basically free.
- bool isStaticAlloca() const;
+ LLVM_ABI bool isStaticAlloca() const;
/// Return true if this alloca is used as an inalloca argument to a call. Such
/// allocas are never considered static even if they are in the entry block.
@@ -187,16 +188,16 @@ class LoadInst : public UnaryInstruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- LoadInst *cloneImpl() const;
+ LLVM_ABI LoadInst *cloneImpl() const;
public:
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr,
+ LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr,
InsertPosition InsertBefore);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
+ LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
InsertPosition InsertBefore);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
+ LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
Align Align, InsertPosition InsertBefore = nullptr);
- LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
+ LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
Align Align, AtomicOrdering Order,
SyncScope::ID SSID = SyncScope::System,
InsertPosition InsertBefore = nullptr);
@@ -305,15 +306,15 @@ class StoreInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- StoreInst *cloneImpl() const;
+ LLVM_ABI StoreInst *cloneImpl() const;
public:
- StoreInst(Value *Val, Value *Ptr, InsertPosition InsertBefore);
- StoreInst(Value *Val, Value *Ptr, bool isVolatile,
+ LLVM_ABI StoreInst(Value *Val, Value *Ptr, InsertPosition InsertBefore);
+ LLVM_ABI StoreInst(Value *Val, Value *Ptr, bool isVolatile,
InsertPosition InsertBefore);
- StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
+ LLVM_ABI StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
InsertPosition InsertBefore = nullptr);
- StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
+ LLVM_ABI StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System,
InsertPosition InsertBefore = nullptr);
@@ -432,12 +433,12 @@ class FenceInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- FenceInst *cloneImpl() const;
+ LLVM_ABI FenceInst *cloneImpl() const;
public:
// Ordering may only be Acquire, Release, AcquireRelease, or
// SequentiallyConsistent.
- FenceInst(LLVMContext &C, AtomicOrdering Ordering,
+ LLVM_ABI FenceInst(LLVMContext &C, AtomicOrdering Ordering,
SyncScope::ID SSID = SyncScope::System,
InsertPosition InsertBefore = nullptr);
@@ -514,10 +515,10 @@ class AtomicCmpXchgInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- AtomicCmpXchgInst *cloneImpl() const;
+ LLVM_ABI AtomicCmpXchgInst *cloneImpl() const;
public:
- AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment,
+ LLVM_ABI AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment,
AtomicOrdering SuccessOrdering,
AtomicOrdering FailureOrdering, SyncScope::ID SSID,
InsertPosition InsertBefore = nullptr);
@@ -706,7 +707,7 @@ class AtomicRMWInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- AtomicRMWInst *cloneImpl() const;
+ LLVM_ABI AtomicRMWInst *cloneImpl() const;
public:
/// This enumeration lists the possible modifications atomicrmw can make. In
@@ -793,7 +794,7 @@ class AtomicRMWInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};
public:
- AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment,
+ LLVM_ABI AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment,
AtomicOrdering Ordering, SyncScope::ID SSID,
InsertPosition InsertBefore = nullptr);
@@ -812,7 +813,7 @@ class AtomicRMWInst : public Instruction {
BinOp getOperation() const { return getSubclassData<OperationField>(); }
- static StringRef getOperationName(BinOp Op);
+ LLVM_ABI static StringRef getOperationName(BinOp Op);
static bool isFPOperation(BinOp Op) {
switch (Op) {
@@ -954,13 +955,13 @@ class GetElementPtrInst : public Instruction {
ArrayRef<Value *> IdxList, AllocInfo AllocInfo,
const Twine &NameStr, InsertPosition InsertBefore);
- void init(Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr);
+ LLVM_ABI void init(Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- GetElementPtrInst *cloneImpl() const;
+ LLVM_ABI GetElementPtrInst *cloneImpl() const;
public:
static GetElementPtrInst *Create(Type *PointeeType, Value *Ptr,
@@ -1018,17 +1019,17 @@ class GetElementPtrInst : public Instruction {
///
/// Null is returned if the indices are invalid for the specified
/// source element type.
- static Type *getIndexedType(Type *Ty, ArrayRef<Value *> IdxList);
- static Type *getIndexedType(Type *Ty, ArrayRef<Constant *> IdxList);
- static Type *getIndexedType(Type *Ty, ArrayRef<uint64_t> IdxList);
+ LLVM_ABI static Type *getIndexedType(Type *Ty, ArrayRef<Value *> IdxList);
+ LLVM_ABI static Type *getIndexedType(Type *Ty, ArrayRef<Constant *> IdxList);
+ LLVM_ABI static Type *getIndexedType(Type *Ty, ArrayRef<uint64_t> IdxList);
/// Return the type of the element at the given index of an indexable
/// type. This is equivalent to "getIndexedType(Agg, {Zero, Idx})".
///
/// Returns null if the type can't be indexed, or the given index is not
/// legal for the given type.
- static Type *getTypeAtIndex(Type *Ty, Value *Idx);
- static Type *getTypeAtIndex(Type *Ty, uint64_t Idx);
+ LLVM_ABI static Type *getTypeAtIndex(Type *Ty, Value *Idx);
+ LLVM_ABI static Type *getTypeAtIndex(Type *Ty, uint64_t Idx);
inline op_iterator idx_begin() { return op_begin()+1; }
inline const_op_iterator idx_begin() const { return op_begin()+1; }
@@ -1092,32 +1093,32 @@ class GetElementPtrInst : public Instruction {
/// Return true if all of the indices of this GEP are
/// zeros. If so, the result pointer and the first operand have the same
/// value, just potentially different types.
- bool hasAllZeroIndices() const;
+ LLVM_ABI bool hasAllZeroIndices() const;
/// Return true if all of the indices of this GEP are
/// constant integers. If so, the result pointer and the first operand have
/// a constant offset between them.
- bool hasAllConstantIndices() const;
+ LLVM_ABI bool hasAllConstantIndices() const;
/// Set nowrap flags for GEP instruction.
- void setNoWrapFlags(GEPNoWrapFlags NW);
+ LLVM_ABI void setNoWrapFlags(GEPNoWrapFlags NW);
/// Set or clear the inbounds flag on this GEP instruction.
/// See LangRef.html for the meaning of inbounds on a getelementptr.
/// TODO: Remove this method in favor of setNoWrapFlags().
- void setIsInBounds(bool b = true);
+ LLVM_ABI void setIsInBounds(bool b = true);
/// Get the nowrap flags for the GEP instruction.
- GEPNoWrapFlags getNoWrapFlags() const;
+ LLVM_ABI GEPNoWrapFlags getNoWrapFlags() const;
/// Determine whether the GEP has the inbounds flag.
- bool isInBounds() const;
+ LLVM_ABI bool isInBounds() const;
/// Determine whether the GEP has the nusw flag.
- bool hasNoUnsignedSignedWrap() const;
+ LLVM_ABI bool hasNoUnsignedSignedWrap() const;
/// Determine whether the GEP has the nuw flag.
- bool hasNoUnsignedWrap() const;
+ LLVM_ABI bool hasNoUnsignedWrap() const;
/// Accumulate the constant address offset of this GEP if possible.
///
@@ -1127,8 +1128,8 @@ class GetElementPtrInst : public Instruction {
/// undefined (it is *not* preserved!). The APInt passed into this routine
/// must be at least as wide as the IntPtr type for the address space of
/// the base GEP pointer.
- bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const;
- bool collectOffset(const DataLayout &DL, unsigned BitWidth,
+ LLVM_ABI bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const;
+ LLVM_ABI bool collectOffset(const DataLayout &DL, unsigned BitWidth,
SmallMapVector<Value *, APInt, 4> &VariableOffsets,
APInt &ConstantOffset) const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1184,7 +1185,7 @@ class ICmpInst: public CmpInst {
friend class Instruction;
/// Clone an identical ICmpInst
- ICmpInst *cloneImpl() const;
+ LLVM_ABI ICmpInst *cloneImpl() const;
public:
/// Constructor with insertion semantics.
@@ -1262,7 +1263,7 @@ class ICmpInst: public CmpInst {
}
/// Return the signed version of the predicate: static variant.
- static Predicate getSignedPredicate(Predicate Pred);
+ LLVM_ABI static Predicate getSignedPredicate(Predicate Pred);
/// For example, EQ->EQ, SLE->ULE, UGT->UGT, etc.
/// @returns the predicate that would be the result if the operand were
@@ -1273,13 +1274,13 @@ class ICmpInst: public CmpInst {
}
/// Return the unsigned version of the predicate: static variant.
- static Predicate getUnsignedPredicate(Predicate Pred);
+ LLVM_ABI static Predicate getUnsignedPredicate(Predicate Pred);
/// For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->EQ
/// @returns the unsigned version of the signed predicate pred or
/// the signed version of the signed predicate pred.
/// Static variant.
- static Predicate getFlippedSignednessPredicate(Predicate Pred);
+ LLVM_ABI static Predicate getFlippedSignednessPredicate(Predicate Pred);
/// For example, SLT->ULT, ULT->SLT, SLE->ULE, ULE->SLE, EQ->EQ
/// @returns the unsigned version of the signed predicate pred or
@@ -1290,7 +1291,7 @@ class ICmpInst: public CmpInst {
/// Determine if Pred1 implies Pred2 is true, false, or if nothing can be
/// inferred about the implication, when two compares have matching operands.
- static std::optional<bool> isImpliedByMatchingCmp(CmpPredicate Pred1,
+ LLVM_ABI static std::optional<bool> isImpliedByMatchingCmp(CmpPredicate Pred1,
CmpPredicate Pred2);
void setSameSign(bool B = true) {
@@ -1373,12 +1374,12 @@ class ICmpInst: public CmpInst {
}
/// Return result of `LHS Pred RHS` comparison.
- static bool compare(const APInt &LHS, const APInt &RHS,
+ LLVM_ABI static bool compare(const APInt &LHS, const APInt &RHS,
ICmpInst::Predicate Pred);
/// Return result of `LHS Pred RHS`, if it can be determined from the
/// KnownBits. Otherwise return nullopt.
- static std::optional<bool> compare(const KnownBits &LHS, const KnownBits &RHS,
+ LLVM_ABI static std::optional<bool> compare(const KnownBits &LHS, const KnownBits &RHS,
ICmpInst::Predicate Pred);
// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1413,7 +1414,7 @@ class FCmpInst: public CmpInst {
friend class Instruction;
/// Clone an identical FCmpInst
- FCmpInst *cloneImpl() const;
+ LLVM_ABI FCmpInst *cloneImpl() const;
public:
/// Constructor with insertion semantics.
@@ -1480,7 +1481,7 @@ class FCmpInst: public CmpInst {
static auto predicates() { return FCmpPredicates(); }
/// Return result of `LHS Pred RHS` comparison.
- static bool compare(const APFloat &LHS, const APFloat &RHS,
+ LLVM_ABI static bool compare(const APFloat &LHS, const APFloat &RHS,
FCmpInst::Predicate Pred);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -1511,10 +1512,10 @@ class CallInst : public CallBase {
InsertPosition InsertBefore)
: CallInst(Ty, Func, Args, {}, NameStr, AllocInfo, InsertBefore) {}
- explicit CallInst(FunctionType *Ty, Value *F, const Twine &NameStr,
+ LLVM_ABI explicit CallInst(FunctionType *Ty, Value *F, const Twine &NameStr,
AllocInfo AllocInfo, InsertPosition InsertBefore);
- void init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
+ LLVM_ABI void init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
void init(FunctionType *FTy, Value *Func, const Twine &NameStr);
@@ -1530,7 +1531,7 @@ class CallInst : public CallBase {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- CallInst *cloneImpl() const;
+ LLVM_ABI CallInst *cloneImpl() const;
public:
static CallInst *Create(FunctionType *Ty, Value *F, const Twine &NameStr = "",
@@ -1587,7 +1588,7 @@ class CallInst : public CallBase {
/// The returned call instruction is identical \p CI in every way except that
/// the operand bundles for the new instruction are set to the operand bundles
/// in \p Bundles.
- static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
+ LLVM_ABI static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
InsertPosition InsertPt = nullptr);
// Note that 'musttail' implies 'tail'.
@@ -1649,7 +1650,7 @@ class CallInst : public CallBase {
}
/// Updates profile metadata by scaling it by \p S / \p T.
- void updateProfWeight(uint64_t S, uint64_t T);
+ LLVM_ABI void updateProfWeight(uint64_t S, uint64_t T);
private:
// Shadow Instruction::setInstructionSubclassData with a private forwarding
@@ -1698,7 +1699,7 @@ class SelectInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- SelectInst *cloneImpl() const;
+ LLVM_ABI SelectInst *cloneImpl() const;
public:
static SelectInst *Create(Value *C, Value *S1, Value *S2,
@@ -1729,7 +1730,7 @@ class SelectInst : public Instruction {
/// Return a string if the specified operands are invalid
/// for a select operation, otherwise return null.
- static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
+ LLVM_ABI static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1765,7 +1766,7 @@ class VAArgInst : public UnaryInstruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- VAArgInst *cloneImpl() const;
+ LLVM_ABI VAArgInst *cloneImpl() const;
public:
VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
@@ -1797,14 +1798,14 @@ class VAArgInst : public UnaryInstruction {
class ExtractElementInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};
- ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
+ LLVM_ABI ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- ExtractElementInst *cloneImpl() const;
+ LLVM_ABI ExtractElementInst *cloneImpl() const;
public:
static ExtractElementInst *Create(Value *Vec, Value *Idx,
@@ -1816,7 +1817,7 @@ class ExtractElementInst : public Instruction {
/// Return true if an extractelement instruction can be
/// formed with the specified operands.
- static bool isValidOperands(const Value *Vec, const Value *Idx);
+ LLVM_ABI static bool isValidOperands(const Value *Vec, const Value *Idx);
Value *getVectorOperand() { return Op<0>(); }
Value *getIndexOperand() { return Op<1>(); }
@@ -1856,7 +1857,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ExtractElementInst, Value)
class InsertElementInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{3};
- InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
+ LLVM_ABI InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
@@ -1864,7 +1865,7 @@ class InsertElementInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- InsertElementInst *cloneImpl() const;
+ LLVM_ABI InsertElementInst *cloneImpl() const;
public:
static InsertElementInst *Create(Value *Vec, Value *NewElt, Value *Idx,
@@ -1876,7 +1877,7 @@ class InsertElementInst : public Instruction {
/// Return true if an insertelement instruction can be
/// formed with the specified operands.
- static bool isValidOperands(const Value *Vec, const Value *NewElt,
+ LLVM_ABI static bool isValidOperands(const Value *Vec, const Value *NewElt,
const Value *Idx);
/// Overload to return most specific vector type.
@@ -1930,17 +1931,17 @@ class ShuffleVectorInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- ShuffleVectorInst *cloneImpl() const;
+ LLVM_ABI ShuffleVectorInst *cloneImpl() const;
public:
- ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr = "",
+ LLVM_ABI ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
- ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr = "",
+ LLVM_ABI ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
- ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
+ LLVM_ABI ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
- ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
+ LLVM_ABI ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
@@ -1949,13 +1950,13 @@ class ShuffleVectorInst : public Instruction {
/// Swap the operands and adjust the mask to preserve the semantics
/// of the instruction.
- void commute();
+ LLVM_ABI void commute();
/// Return true if a shufflevector instruction can be
/// formed with the specified operands.
- static bool isValidOperands(const Value *V1, const Value *V2,
+ LLVM_ABI static bool isValidOperands(const Value *V1, const Value *V2,
const Value *Mask);
- static bool isValidOperands(const Value *V1, const Value *V2,
+ LLVM_ABI static bool isValidOperands(const Value *V1, const Value *V2,
ArrayRef<int> Mask);
/// Overload to return most specific vector type.
@@ -1973,7 +1974,7 @@ class ShuffleVectorInst : public Instruction {
/// Convert the input shuffle mask operand to a vector of integers. Undefined
/// elements of the mask are returned as PoisonMaskElem.
- static void getShuffleMask(const Constant *Mask,
+ LLVM_ABI static void getShuffleMask(const Constant *Mask,
SmallVectorImpl<int> &Result);
/// Return the mask for this instruction as a vector of integers. Undefined
@@ -1988,10 +1989,10 @@ class ShuffleVectorInst : public Instruction {
/// shufflevector.
Constant *getShuffleMaskForBitcode() const { return ShuffleMaskForBitcode; }
- static Constant *convertShuffleMaskForBitcode(ArrayRef<int> Mask,
+ LLVM_ABI static Constant *convertShuffleMaskForBitcode(ArrayRef<int> Mask,
Type *ResultTy);
- void setShuffleMask(ArrayRef<int> Mask);
+ LLVM_ABI void setShuffleMask(ArrayRef<int> Mask);
ArrayRef<int> getShuffleMask() const { return ShuffleMask; }
@@ -2023,7 +2024,7 @@ class ShuffleVectorInst : public Instruction {
/// Example: <7,5,undef,7>
/// This assumes that vector operands (of length \p NumSrcElts) are the same
/// length as the mask.
- static bool isSingleSourceMask(ArrayRef<int> Mask, int NumSrcElts);
+ LLVM_ABI static bool isSingleSourceMask(ArrayRef<int> Mask, int NumSrcElts);
static bool isSingleSourceMask(const Constant *Mask, int NumSrcElts) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2045,7 +2046,7 @@ class ShuffleVectorInst : public Instruction {
/// necessarily a no-op because it may change the number of elements from its
/// input vectors or it may provide demanded bits knowledge via undef lanes.
/// Example: <undef,undef,2,3>
- static bool isIdentityMask(ArrayRef<int> Mask, int NumSrcElts);
+ LLVM_ABI static bool isIdentityMask(ArrayRef<int> Mask, int NumSrcElts);
static bool isIdentityMask(const Constant *Mask, int NumSrcElts) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
@@ -2074,16 +2075,16 @@ class ShuffleVectorInst : public Instruction {
/// Return true if this shuffle lengthens exactly one source vector with
/// undefs in the high elements.
- bool isIdentityWithPadding() const;
+ LLVM_ABI bool isIdentityWithPadding() const;
/// Return true if this shuffle extracts the first N elements of exactly one
/// source vector.
- bool isIdentityWithExtract() const;
+ LLVM_ABI bool isIdentityWithExtract() const;
/// Return true if this shuffle concatenates its 2 source vectors. This
/// returns false if either input is undefined. In that case, the shuffle is
/// is better classified as an identity with padding operation.
- bool isConcat() const;
+ LLVM_ABI bool isConcat() const;
/// Return true if this shuffle mask chooses elements from its source vectors
/// without lane crossings. A shuffle using this mask would be
@@ -2093,7 +2094,7 @@ class ShuffleVectorInst : public Instruction {
/// In that case, the shuffle is better classified as an identity shuffle.
/// This assumes that vector operands are the same length as the mask
/// (a length-changing shuffle can never be equivalent to a vector select).
- static bool isSelectMask(ArrayRef<int> Mask, int NumSrcElts);
+ LLVM_ABI static bool isSelectMask(ArrayRef<int> Mask, int NumSrcElts);
static bool isSelectMask(const Constant *Mask, int NumSrcElts) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2118,7 +2119,7 @@ class ShuffleVectorInst : public Instruction {
/// Example: <7,6,undef,4>
/// This assumes that vector operands (of length \p NumSrcElts) are the same
/// length as the mask.
- static bool isReverseMask(ArrayRef<int> Mask, int NumSrcElts);
+ LLVM_ABI static bool isReverseMask(ArrayRef<int> Mask, int NumSrcElts);
static bool isReverseMask(const Constant *Mask, int NumSrcElts) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2139,7 +2140,7 @@ class ShuffleVectorInst : public Instruction {
/// Example: <4,undef,undef,4>
/// This assumes that vector operands (of length \p NumSrcElts) are the same
/// length as the mask.
- static bool isZeroEltSplatMask(ArrayRef<int> Mask, int NumSrcElts);
+ LLVM_ABI static bool isZeroEltSplatMask(ArrayRef<int> Mask, int NumSrcElts);
static bool isZeroEltSplatMask(const Constant *Mask, int NumSrcElts) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2190,7 +2191,7 @@ class ShuffleVectorInst : public Instruction {
/// ; Transposed matrix
/// t0 = < a, e, c, g > = shufflevector m0, m1 < 0, 4, 2, 6 >
/// t1 = < b, f, d, h > = shufflevector m0, m1 < 1, 5, 3, 7 >
- static bool isTransposeMask(ArrayRef<int> Mask, int NumSrcElts);
+ LLVM_ABI static bool isTransposeMask(ArrayRef<int> Mask, int NumSrcElts);
static bool isTransposeMask(const Constant *Mask, int NumSrcElts) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2213,7 +2214,7 @@ class ShuffleVectorInst : public Instruction {
/// Example: shufflevector <4 x n> A, <4 x n> B, <1,2,3,4>
/// This assumes that vector operands (of length \p NumSrcElts) are the same
/// length as the mask.
- static bool isSpliceMask(ArrayRef<int> Mask, int NumSrcElts, int &Index);
+ LLVM_ABI static bool isSpliceMask(ArrayRef<int> Mask, int NumSrcElts, int &Index);
static bool isSpliceMask(const Constant *Mask, int NumSrcElts, int &Index) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2233,7 +2234,7 @@ class ShuffleVectorInst : public Instruction {
/// Return true if this shuffle mask is an extract subvector mask.
/// A valid extract subvector mask returns a smaller vector from a single
/// source operand. The base extraction index is returned as well.
- static bool isExtractSubvectorMask(ArrayRef<int> Mask, int NumSrcElts,
+ LLVM_ABI static bool isExtractSubvectorMask(ArrayRef<int> Mask, int NumSrcElts,
int &Index);
static bool isExtractSubvectorMask(const Constant *Mask, int NumSrcElts,
int &Index) {
@@ -2263,7 +2264,7 @@ class ShuffleVectorInst : public Instruction {
/// A valid insert subvector mask inserts the lowest elements of a second
/// source operand into an in-place first source operand.
/// Both the sub vector width and the insertion index is returned.
- static bool isInsertSubvectorMask(ArrayRef<int> Mask, int NumSrcElts,
+ LLVM_ABI static bool isInsertSubvectorMask(ArrayRef<int> Mask, int NumSrcElts,
int &NumSubElts, int &Index);
static bool isInsertSubvectorMask(const Constant *Mask, int NumSrcElts,
int &NumSubElts, int &Index) {
@@ -2293,7 +2294,7 @@ class ShuffleVectorInst : public Instruction {
/// in a vector \p ReplicationFactor times.
/// For example, the mask for \p ReplicationFactor=3 and \p VF=4 is:
/// <0,0,0,1,1,1,2,2,2,3,3,3>
- static bool isReplicationMask(ArrayRef<int> Mask, int &ReplicationFactor,
+ LLVM_ABI static bool isReplicationMask(ArrayRef<int> Mask, int &ReplicationFactor,
int &VF);
static bool isReplicationMask(const Constant *Mask, int &ReplicationFactor,
int &VF) {
@@ -2308,7 +2309,7 @@ class ShuffleVectorInst : public Instruction {
}
/// Return true if this shuffle mask is a replication mask.
- bool isReplicationMask(int &ReplicationFactor, int &VF) const;
+ LLVM_ABI bool isReplicationMask(int &ReplicationFactor, int &VF) const;
/// Return true if this shuffle mask represents "clustered" mask of size VF,
/// i.e. each index between [0..VF) is used exactly once in each submask of
@@ -2319,11 +2320,11 @@ class ShuffleVectorInst : public Instruction {
/// 0, 1, 2, 3, 3, 3, 1, 0 - not "clustered", because
/// element 3 is used twice in the second submask
/// (3,3,1,0) and index 2 is not used at all.
- static bool isOneUseSingleSourceMask(ArrayRef<int> Mask, int VF);
+ LLVM_ABI static bool isOneUseSingleSourceMask(ArrayRef<int> Mask, int VF);
/// Return true if this shuffle mask is a one-use-single-source("clustered")
/// mask.
- bool isOneUseSingleSourceMask(int VF) const;
+ LLVM_ABI bool isOneUseSingleSourceMask(int VF) const;
/// Change values in a shuffle permute mask assuming the two vector operands
/// of length InVecNumElts have swapped position.
@@ -2339,7 +2340,7 @@ class ShuffleVectorInst : public Instruction {
}
/// Return if this shuffle interleaves its two input vectors together.
- bool isInterleave(unsigned Factor);
+ LLVM_ABI bool isInterleave(unsigned Factor);
/// Return true if the mask interleaves one or more input vectors together.
///
@@ -2360,7 +2361,7 @@ class ShuffleVectorInst : public Instruction {
/// Note that this does not check if the input vectors are consecutive:
/// It will return true for masks such as
/// <0, 4, 6, 1, 5, 7> (Factor=3, LaneLen=2)
- static bool isInterleaveMask(ArrayRef<int> Mask, unsigned Factor,
+ LLVM_ABI static bool isInterleaveMask(ArrayRef<int> Mask, unsigned Factor,
unsigned NumInputElts,
SmallVectorImpl<unsigned> &StartIndexes);
static bool isInterleaveMask(ArrayRef<int> Mask, unsigned Factor,
@@ -2372,7 +2373,7 @@ class ShuffleVectorInst : public Instruction {
/// Check if the mask is a DE-interleave mask of the given factor
/// \p Factor like:
/// <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>
- static bool isDeInterleaveMaskOfFactor(ArrayRef<int> Mask, unsigned Factor,
+ LLVM_ABI static bool isDeInterleaveMaskOfFactor(ArrayRef<int> Mask, unsigned Factor,
unsigned &Index);
static bool isDeInterleaveMaskOfFactor(ArrayRef<int> Mask, unsigned Factor) {
unsigned Unused;
@@ -2390,7 +2391,7 @@ class ShuffleVectorInst : public Instruction {
///
/// If it can be expressed as a rotation, returns the number of subelements to
/// group by in NumSubElts and the number of bits to rotate left in RotateAmt.
- static bool isBitRotateMask(ArrayRef<int> Mask, unsigned EltSizeInBits,
+ LLVM_ABI static bool isBitRotateMask(ArrayRef<int> Mask, unsigned EltSizeInBits,
unsigned MinSubElts, unsigned MaxSubElts,
unsigned &NumSubElts, unsigned &RotateAmt);
@@ -2428,13 +2429,13 @@ class ExtractValueInst : public UnaryInstruction {
inline ExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
const Twine &NameStr, InsertPosition InsertBefore);
- void init(ArrayRef<unsigned> Idxs, const Twine &NameStr);
+ LLVM_ABI void init(ArrayRef<unsigned> Idxs, const Twine &NameStr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- ExtractValueInst *cloneImpl() const;
+ LLVM_ABI ExtractValueInst *cloneImpl() const;
public:
static ExtractValueInst *Create(Value *Agg, ArrayRef<unsigned> Idxs,
@@ -2448,7 +2449,7 @@ class ExtractValueInst : public UnaryInstruction {
/// with an extractvalue instruction with the specified parameters.
///
/// Null is returned if the indices are invalid for the specified type.
- static Type *getIndexedType(Type *Agg, ArrayRef<unsigned> Idxs);
+ LLVM_ABI static Type *getIndexedType(Type *Agg, ArrayRef<unsigned> Idxs);
using idx_iterator = const unsigned*;
@@ -2524,14 +2525,14 @@ class InsertValueInst : public Instruction {
const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
- void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
+ LLVM_ABI void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
const Twine &NameStr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- InsertValueInst *cloneImpl() const;
+ LLVM_ABI InsertValueInst *cloneImpl() const;
public:
// allocate space for exactly two operands
@@ -2642,7 +2643,7 @@ class PHINode : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- PHINode *cloneImpl() const;
+ LLVM_ABI PHINode *cloneImpl() const;
// allocHungoffUses - this is more complicated than the generic
// User::allocHungoffUses, because we have to allocate Uses for the incoming
@@ -2771,7 +2772,7 @@ class PHINode : public Instruction {
/// dummy values. The only time there should be zero incoming values to a PHI
/// node is when the block is dead, so this strategy is sound.
///
- Value *removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty = true);
+ LLVM_ABI Value *removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty = true);
Value *removeIncomingValue(const BasicBlock *BB, bool DeletePHIIfEmpty=true) {
int Idx = getBasicBlockIndex(BB);
@@ -2781,7 +2782,7 @@ class PHINode : public Instruction {
/// Remove all incoming values for which the predicate returns true.
/// The predicate accepts the incoming value index.
- void removeIncomingValueIf(function_ref<bool(unsigned)> Predicate,
+ LLVM_ABI void removeIncomingValueIf(function_ref<bool(unsigned)> Predicate,
bool DeletePHIIfEmpty = true);
/// Return the first index of the specified basic
@@ -2815,12 +2816,12 @@ class PHINode : public Instruction {
/// If the specified PHI node always merges together the
/// same value, return the value, otherwise return null.
- Value *hasConstantValue() const;
+ LLVM_ABI Value *hasConstantValue() const;
/// Whether the specified PHI node always merges
/// together the same value, assuming undefs are equal to a unique
/// non-undef value.
- bool hasConstantOrUndefValue() const;
+ LLVM_ABI bool hasConstantOrUndefValue() const;
/// If the PHI node is complete which means all of its parent's predecessors
/// have incoming value in this PHI, return true, otherwise return false.
@@ -2840,7 +2841,7 @@ class PHINode : public Instruction {
}
private:
- void growOperands();
+ LLVM_ABI void growOperands();
};
template <> struct OperandTraits<PHINode> : public HungoffOperandTraits {};
@@ -2880,21 +2881,21 @@ class LandingPadInst : public Instruction {
// Allocate space for exactly zero operands.
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
- void growOperands(unsigned Size);
+ LLVM_ABI void growOperands(unsigned Size);
void init(unsigned NumReservedValues, const Twine &NameStr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- LandingPadInst *cloneImpl() const;
+ LLVM_ABI LandingPadInst *cloneImpl() const;
public:
void operator delete(void *Ptr) { User::operator delete(Ptr); }
/// Constructors - NumReservedClauses is a hint for the number of incoming
/// clauses that this landingpad will have (use 0 if you really have no idea).
- static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
+ LLVM_ABI static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
@@ -2910,7 +2911,7 @@ class LandingPadInst : public Instruction {
void setCleanup(bool V) { setSubclassData<CleanupField>(V); }
/// Add a catch or filter clause to the landing pad.
- void addClause(Constant *ClauseVal);
+ LLVM_ABI void addClause(Constant *ClauseVal);
/// Get the value of the clause at index Idx. Use isCatch/isFilter to
/// determine what type of clause this is.
@@ -2974,14 +2975,14 @@ class ReturnInst : public Instruction {
//
// NOTE: If the Value* passed is of type void then the constructor behaves as
// if it was passed NULL.
- explicit ReturnInst(LLVMContext &C, Value *retVal, AllocInfo AllocInfo,
+ LLVM_ABI explicit ReturnInst(LLVMContext &C, Value *retVal, AllocInfo AllocInfo,
InsertPosition InsertBefore);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- ReturnInst *cloneImpl() const;
+ LLVM_ABI ReturnInst *cloneImpl() const;
public:
static ReturnInst *Create(LLVMContext &C, Value *retVal = nullptr,
@@ -3050,9 +3051,9 @@ class BranchInst : public Instruction {
// BranchInst(BB* T, BB *F, Value *C, Inst *I) - 'br C, T, F', insert before I
// BranchInst(BB* B, BB *I) - 'br B' insert at end
// BranchInst(BB* T, BB *F, Value *C, BB *I) - 'br C, T, F', insert at end
- explicit BranchInst(BasicBlock *IfTrue, AllocInfo AllocInfo,
+ LLVM_ABI explicit BranchInst(BasicBlock *IfTrue, AllocInfo AllocInfo,
InsertPosition InsertBefore);
- BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
+ LLVM_ABI BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
AllocInfo AllocInfo, InsertPosition InsertBefore);
void AssertOK();
@@ -3061,7 +3062,7 @@ class BranchInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- BranchInst *cloneImpl() const;
+ LLVM_ABI BranchInst *cloneImpl() const;
public:
/// Iterator type that casts an operand to a basic block.
@@ -3138,7 +3139,7 @@ class BranchInst : public Instruction {
/// Swaps the successors of the branch instruction. This also swaps any
/// branch weight metadata associated with the instruction so that it
/// continues to map correctly to each operand.
- void swapSuccessors();
+ LLVM_ABI void swapSuccessors();
iterator_range<succ_op_iterator> successors() {
return make_range(
@@ -3188,7 +3189,7 @@ class SwitchInst : public Instruction {
/// default destination. The number of additional cases can be specified here
/// to make memory allocation more efficient. This constructor can also
/// auto-insert before another instruction.
- SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
+ LLVM_ABI SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
InsertPosition InsertBefore);
// allocate space for exactly zero operands
@@ -3201,7 +3202,7 @@ class SwitchInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- SwitchInst *cloneImpl() const;
+ LLVM_ABI SwitchInst *cloneImpl() const;
public:
void operator delete(void *Ptr) { User::operator delete(Ptr); }
@@ -3479,7 +3480,7 @@ class SwitchInst : public Instruction {
/// Note:
/// This action invalidates case_end(). Old case_end() iterator will
/// point to the added case.
- void addCase(ConstantInt *OnVal, BasicBlock *Dest);
+ LLVM_ABI void addCase(ConstantInt *OnVal, BasicBlock *Dest);
/// This method removes the specified case and its successor from the switch
/// instruction. Note that this operation may reorder the remaining cases at
@@ -3488,7 +3489,7 @@ class SwitchInst : public Instruction {
/// This action invalidates iterators for all cases following the one removed,
/// including the case_end() iterator. It returns an iterator for the next
/// case.
- CaseIt removeCase(CaseIt I);
+ LLVM_ABI CaseIt removeCase(CaseIt I);
unsigned getNumSuccessors() const { return getNumOperands()/2; }
BasicBlock *getSuccessor(unsigned idx) const {
@@ -3517,9 +3518,9 @@ class SwitchInstProfUpdateWrapper {
bool Changed = false;
protected:
- MDNode *buildProfBranchWeightsMD();
+ LLVM_ABI MDNode *buildProfBranchWeightsMD();
- void init();
+ LLVM_ABI void init();
public:
using CaseWeightOpt = std::optional<uint32_t>;
@@ -3536,20 +3537,20 @@ class SwitchInstProfUpdateWrapper {
/// Delegate the call to the underlying SwitchInst::removeCase() and remove
/// correspondent branch weight.
- SwitchInst::CaseIt removeCase(SwitchInst::CaseIt I);
+ LLVM_ABI SwitchInst::CaseIt removeCase(SwitchInst::CaseIt I);
/// Delegate the call to the underlying SwitchInst::addCase() and set the
/// specified branch weight for the added case.
- void addCase(ConstantInt *OnVal, BasicBlock *Dest, CaseWeightOpt W);
+ LLVM_ABI void addCase(ConstantInt *OnVal, BasicBlock *Dest, CaseWeightOpt W);
/// Delegate the call to the underlying SwitchInst::eraseFromParent() and mark
/// this object to not touch the underlying SwitchInst in destructor.
- Instruction::InstListType::iterator eraseFromParent();
+ LLVM_ABI Instruction::InstListType::iterator eraseFromParent();
- void setSuccessorWeight(unsigned idx, CaseWeightOpt W);
- CaseWeightOpt getSuccessorWeight(unsigned idx);
+ LLVM_ABI void setSuccessorWeight(unsigned idx, CaseWeightOpt W);
+ LLVM_ABI CaseWeightOpt getSuccessorWeight(unsigned idx);
- static CaseWeightOpt getSuccessorWeight(const SwitchInst &SI, unsigned idx);
+ LLVM_ABI static CaseWeightOpt getSuccessorWeight(const SwitchInst &SI, unsigned idx);
};
template <> struct OperandTraits<SwitchInst> : public HungoffOperandTraits {};
@@ -3576,7 +3577,7 @@ class IndirectBrInst : public Instruction {
/// Address to jump to. The number of expected destinations can be specified
/// here to make memory allocation more efficient. This constructor can also
/// autoinsert before another instruction.
- IndirectBrInst(Value *Address, unsigned NumDests,
+ LLVM_ABI IndirectBrInst(Value *Address, unsigned NumDests,
InsertPosition InsertBefore);
// allocate space for exactly zero operands
@@ -3589,7 +3590,7 @@ class IndirectBrInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- IndirectBrInst *cloneImpl() const;
+ LLVM_ABI IndirectBrInst *cloneImpl() const;
public:
void operator delete(void *Ptr) { User::operator delete(Ptr); }
@@ -3644,11 +3645,11 @@ class IndirectBrInst : public Instruction {
/// Add a destination.
///
- void addDestination(BasicBlock *Dest);
+ LLVM_ABI void addDestination(BasicBlock *Dest);
/// This method removes the specified successor from the
/// indirectbr instruction.
- void removeDestination(unsigned i);
+ LLVM_ABI void removeDestination(unsigned i);
unsigned getNumSuccessors() const { return getNumOperands()-1; }
BasicBlock *getSuccessor(unsigned i) const {
@@ -3710,7 +3711,7 @@ class InvokeInst : public CallBase {
ArrayRef<OperandBundleDef> Bundles, AllocInfo AllocInfo,
const Twine &NameStr, InsertPosition InsertBefore);
- void init(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
+ LLVM_ABI void init(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
BasicBlock *IfException, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
@@ -3726,7 +3727,7 @@ class InvokeInst : public CallBase {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- InvokeInst *cloneImpl() const;
+ LLVM_ABI InvokeInst *cloneImpl() const;
public:
static InvokeInst *Create(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
@@ -3776,7 +3777,7 @@ class InvokeInst : public CallBase {
/// The returned invoke instruction is identical to \p II in every way except
/// that the operand bundles for the new instruction are set to the operand
/// bundles in \p Bundles.
- static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
+ LLVM_ABI static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
InsertPosition InsertPt = nullptr);
// get*Dest - Return the destination basic blocks...
@@ -3795,7 +3796,7 @@ class InvokeInst : public CallBase {
/// Get the landingpad instruction from the landing pad
/// block (the unwind destination).
- LandingPadInst *getLandingPadInst() const;
+ LLVM_ABI LandingPadInst *getLandingPadInst() const;
BasicBlock *getSuccessor(unsigned i) const {
assert(i < 2 && "Successor # out of range for invoke!");
@@ -3813,7 +3814,7 @@ class InvokeInst : public CallBase {
unsigned getNumSuccessors() const { return 2; }
/// Updates profile metadata by scaling it by \p S / \p T.
- void updateProfWeight(uint64_t S, uint64_t T);
+ LLVM_ABI void updateProfWeight(uint64_t S, uint64_t T);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
@@ -3864,7 +3865,7 @@ class CallBrInst : public CallBase {
AllocInfo AllocInfo, const Twine &NameStr,
InsertPosition InsertBefore);
- void init(FunctionType *FTy, Value *Func, BasicBlock *DefaultDest,
+ LLVM_ABI void init(FunctionType *FTy, Value *Func, BasicBlock *DefaultDest,
ArrayRef<BasicBlock *> IndirectDests, ArrayRef<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
@@ -3880,7 +3881,7 @@ class CallBrInst : public CallBase {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- CallBrInst *cloneImpl() const;
+ LLVM_ABI CallBrInst *cloneImpl() const;
public:
static CallBrInst *Create(FunctionType *Ty, Value *Func,
@@ -3934,7 +3935,7 @@ class CallBrInst : public CallBase {
/// The returned callbr instruction is identical to \p CBI in every way
/// except that the operand bundles for the new instruction are set to the
/// operand bundles in \p Bundles.
- static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
+ LLVM_ABI static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
InsertPosition InsertBefore = nullptr);
/// Return the number of callbr indirect dest labels.
@@ -4026,13 +4027,13 @@ class ResumeInst : public Instruction {
ResumeInst(const ResumeInst &RI);
- explicit ResumeInst(Value *Exn, InsertPosition InsertBefore = nullptr);
+ LLVM_ABI explicit ResumeInst(Value *Exn, InsertPosition InsertBefore = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- ResumeInst *cloneImpl() const;
+ LLVM_ABI ResumeInst *cloneImpl() const;
public:
static ResumeInst *Create(Value *Exn, InsertPosition InsertBefore = nullptr) {
@@ -4093,7 +4094,7 @@ class CatchSwitchInst : public Instruction {
/// default destination. The number of additional handlers can be specified
/// here to make memory allocation more efficient.
/// This constructor can also autoinsert before another instruction.
- CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
+ LLVM_ABI CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
unsigned NumHandlers, const Twine &NameStr,
InsertPosition InsertBefore);
@@ -4107,7 +4108,7 @@ class CatchSwitchInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- CatchSwitchInst *cloneImpl() const;
+ LLVM_ABI CatchSwitchInst *cloneImpl() const;
public:
void operator delete(void *Ptr) { return User::operator delete(Ptr); }
@@ -4207,9 +4208,9 @@ class CatchSwitchInst : public Instruction {
/// Note:
/// This action invalidates handler_end(). Old handler_end() iterator will
/// point to the added handler.
- void addHandler(BasicBlock *Dest);
+ LLVM_ABI void addHandler(BasicBlock *Dest);
- void removeHandler(handler_iterator HI);
+ LLVM_ABI void removeHandler(handler_iterator HI);
unsigned getNumSuccessors() const { return getNumOperands() - 1; }
BasicBlock *getSuccessor(unsigned Idx) const {
@@ -4312,7 +4313,7 @@ class CatchReturnInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};
CatchReturnInst(const CatchReturnInst &RI);
- CatchReturnInst(Value *CatchPad, BasicBlock *BB, InsertPosition InsertBefore);
+ LLVM_ABI CatchReturnInst(Value *CatchPad, BasicBlock *BB, InsertPosition InsertBefore);
void init(Value *CatchPad, BasicBlock *BB);
@@ -4320,7 +4321,7 @@ class CatchReturnInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- CatchReturnInst *cloneImpl() const;
+ LLVM_ABI CatchReturnInst *cloneImpl() const;
public:
static CatchReturnInst *Create(Value *CatchPad, BasicBlock *BB,
@@ -4388,7 +4389,7 @@ class CleanupReturnInst : public Instruction {
private:
CleanupReturnInst(const CleanupReturnInst &RI, AllocInfo AllocInfo);
- CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
+ LLVM_ABI CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
AllocInfo AllocInfo, InsertPosition InsertBefore = nullptr);
void init(Value *CleanupPad, BasicBlock *UnwindBB);
@@ -4397,7 +4398,7 @@ class CleanupReturnInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- CleanupReturnInst *cloneImpl() const;
+ LLVM_ABI CleanupReturnInst *cloneImpl() const;
public:
static CleanupReturnInst *Create(Value *CleanupPad,
@@ -4487,10 +4488,10 @@ class UnreachableInst : public Instruction {
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
- UnreachableInst *cloneImpl() const;
+ LLVM_ABI UnreachableInst *cloneImpl() const;
public:
- explicit UnreachableInst(LLVMContext &C,
+ LLVM_ABI explicit UnreachableInst(LLVMContext &C,
InsertPosition InsertBefore = nullptr);
// allocate space for exactly zero operands
@@ -4508,7 +4509,7 @@ class UnreachableInst : public Instruction {
}
// Whether to do target lowering in SelectionDAG.
- bool shouldLowerToTrap(bool TrapUnreachable, bool NoTrapAfterNoreturn) const;
+ LLVM_ABI bool shouldLowerToTrap(bool TrapUnreachable, bool NoTrapAfterNoreturn) const;
private:
BasicBlock *getSuccessor(unsigned idx) const {
@@ -4531,13 +4532,13 @@ class TruncInst : public CastInst {
friend class Instruction;
/// Clone an identical TruncInst
- TruncInst *cloneImpl() const;
+ LLVM_ABI TruncInst *cloneImpl() const;
public:
enum { AnyWrap = 0, NoUnsignedWrap = (1 << 0), NoSignedWrap = (1 << 1) };
/// Constructor with insert-before-instruction semantics
- TruncInst(Value *S, ///< The value to be truncated
+ LLVM_ABI TruncInst(Value *S, ///< The value to be truncated
Type *Ty, ///< The (smaller) type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4597,11 +4598,11 @@ class ZExtInst : public CastInst {
friend class Instruction;
/// Clone an identical ZExtInst
- ZExtInst *cloneImpl() const;
+ LLVM_ABI ZExtInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- ZExtInst(Value *S, ///< The value to be zero extended
+ LLVM_ABI ZExtInst(Value *S, ///< The value to be zero extended
Type *Ty, ///< The type to zero extend to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4628,11 +4629,11 @@ class SExtInst : public CastInst {
friend class Instruction;
/// Clone an identical SExtInst
- SExtInst *cloneImpl() const;
+ LLVM_ABI SExtInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- SExtInst(Value *S, ///< The value to be sign extended
+ LLVM_ABI SExtInst(Value *S, ///< The value to be sign extended
Type *Ty, ///< The type to sign extend to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4659,10 +4660,10 @@ class FPTruncInst : public CastInst {
friend class Instruction;
/// Clone an identical FPTruncInst
- FPTruncInst *cloneImpl() const;
+ LLVM_ABI FPTruncInst *cloneImpl() const;
public: /// Constructor with insert-before-instruction semantics
- FPTruncInst(Value *S, ///< The value to be truncated
+ LLVM_ABI FPTruncInst(Value *S, ///< The value to be truncated
Type *Ty, ///< The type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4689,11 +4690,11 @@ class FPExtInst : public CastInst {
friend class Instruction;
/// Clone an identical FPExtInst
- FPExtInst *cloneImpl() const;
+ LLVM_ABI FPExtInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- FPExtInst(Value *S, ///< The value to be extended
+ LLVM_ABI FPExtInst(Value *S, ///< The value to be extended
Type *Ty, ///< The type to extend to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4720,11 +4721,11 @@ class UIToFPInst : public CastInst {
friend class Instruction;
/// Clone an identical UIToFPInst
- UIToFPInst *cloneImpl() const;
+ LLVM_ABI UIToFPInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- UIToFPInst(Value *S, ///< The value to be converted
+ LLVM_ABI UIToFPInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4751,11 +4752,11 @@ class SIToFPInst : public CastInst {
friend class Instruction;
/// Clone an identical SIToFPInst
- SIToFPInst *cloneImpl() const;
+ LLVM_ABI SIToFPInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- SIToFPInst(Value *S, ///< The value to be converted
+ LLVM_ABI SIToFPInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4782,11 +4783,11 @@ class FPToUIInst : public CastInst {
friend class Instruction;
/// Clone an identical FPToUIInst
- FPToUIInst *cloneImpl() const;
+ LLVM_ABI FPToUIInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- FPToUIInst(Value *S, ///< The value to be converted
+ LLVM_ABI FPToUIInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4813,11 +4814,11 @@ class FPToSIInst : public CastInst {
friend class Instruction;
/// Clone an identical FPToSIInst
- FPToSIInst *cloneImpl() const;
+ LLVM_ABI FPToSIInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- FPToSIInst(Value *S, ///< The value to be converted
+ LLVM_ABI FPToSIInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4844,7 +4845,7 @@ class IntToPtrInst : public CastInst {
friend class Instruction;
/// Constructor with insert-before-instruction semantics
- IntToPtrInst(Value *S, ///< The value to be converted
+ LLVM_ABI IntToPtrInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4852,7 +4853,7 @@ class IntToPtrInst : public CastInst {
);
/// Clone an identical IntToPtrInst.
- IntToPtrInst *cloneImpl() const;
+ LLVM_ABI IntToPtrInst *cloneImpl() const;
/// Returns the address space of this instruction's pointer type.
unsigned getAddressSpace() const {
@@ -4879,11 +4880,11 @@ class PtrToIntInst : public CastInst {
friend class Instruction;
/// Clone an identical PtrToIntInst.
- PtrToIntInst *cloneImpl() const;
+ LLVM_ABI PtrToIntInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- PtrToIntInst(Value *S, ///< The value to be converted
+ LLVM_ABI PtrToIntInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4922,11 +4923,11 @@ class BitCastInst : public CastInst {
friend class Instruction;
/// Clone an identical BitCastInst.
- BitCastInst *cloneImpl() const;
+ LLVM_ABI BitCastInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- BitCastInst(Value *S, ///< The value to be casted
+ LLVM_ABI BitCastInst(Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4954,11 +4955,11 @@ class AddrSpaceCastInst : public CastInst {
friend class Instruction;
/// Clone an identical AddrSpaceCastInst.
- AddrSpaceCastInst *cloneImpl() const;
+ LLVM_ABI AddrSpaceCastInst *cloneImpl() const;
public:
/// Constructor with insert-before-instruction semantics
- AddrSpaceCastInst(
+ LLVM_ABI AddrSpaceCastInst(
Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
@@ -5116,10 +5117,10 @@ class FreezeInst : public UnaryInstruction {
friend class Instruction;
/// Clone an identical FreezeInst
- FreezeInst *cloneImpl() const;
+ LLVM_ABI FreezeInst *cloneImpl() const;
public:
- explicit FreezeInst(Value *S, const Twine &NameStr = "",
+ LLVM_ABI explicit FreezeInst(Value *S, const Twine &NameStr = "",
InsertPosition InsertBefore = nullptr);
// Methods for support type inquiry through isa, cast, and dyn_cast:
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 1217a628dcb29..7d9e26ded6534 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -23,6 +23,7 @@
#ifndef LLVM_IR_INTRINSICINST_H
#define LLVM_IR_INTRINSICINST_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
@@ -126,7 +127,7 @@ class IntrinsicInst : public CallInst {
/// Check if the intrinsic might lower into a regular function call in the
/// course of IR transformations
- static bool mayLowerToFunctionCall(Intrinsic::ID IID);
+ LLVM_ABI static bool mayLowerToFunctionCall(Intrinsic::ID IID);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const CallInst *I) {
@@ -257,8 +258,8 @@ class RawLocationWrapper {
/// Get the locations corresponding to the variable referenced by the debug
/// info intrinsic. Depending on the intrinsic, this could be the
/// variable's value or its address.
- iterator_range<location_op_iterator> location_ops() const;
- Value *getVariableLocationOp(unsigned OpIdx) const;
+ LLVM_ABI iterator_range<location_op_iterator> location_ops() const;
+ LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
unsigned getNumVariableLocationOps() const {
if (hasArgList())
return cast<DIArgList>(getRawLocation())->getArgs().size();
@@ -310,17 +311,17 @@ class DbgVariableIntrinsic : public DbgInfoIntrinsic {
/// Get the locations corresponding to the variable referenced by the debug
/// info intrinsic. Depending on the intrinsic, this could be the
/// variable's value or its address.
- iterator_range<location_op_iterator> location_ops() const;
+ LLVM_ABI iterator_range<location_op_iterator> location_ops() const;
- Value *getVariableLocationOp(unsigned OpIdx) const;
+ LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
- void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
+ LLVM_ABI void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
bool AllowEmpty = false);
- void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
+ LLVM_ABI void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
/// Adding a new location operand will always result in this intrinsic using
/// an ArgList, and must always be accompanied by a new expression that uses
/// the new operand.
- void addVariableLocationOps(ArrayRef<Value *> NewValues,
+ LLVM_ABI void addVariableLocationOps(ArrayRef<Value *> NewValues,
DIExpression *NewExpr);
void setVariable(DILocalVariable *NewVar) {
@@ -401,7 +402,7 @@ class DbgVariableIntrinsic : public DbgInfoIntrinsic {
/// Get the size (in bits) of the variable, or fragment of the variable that
/// is described.
- std::optional<uint64_t> getFragmentSizeInBits() const;
+ LLVM_ABI std::optional<uint64_t> getFragmentSizeInBits() const;
/// Get the FragmentInfo for the variable.
std::optional<DIExpression::FragmentInfo> getFragment() const {
@@ -500,7 +501,7 @@ class DbgAssignIntrinsic : public DbgValueInst {
};
public:
- Value *getAddress() const;
+ LLVM_ABI Value *getAddress() const;
Metadata *getRawAddress() const {
return cast<MetadataAsValue>(getArgOperand(OpAddress))->getMetadata();
}
@@ -518,16 +519,16 @@ class DbgAssignIntrinsic : public DbgValueInst {
setArgOperand(OpAddressExpr,
MetadataAsValue::get(NewExpr->getContext(), NewExpr));
}
- void setAssignId(DIAssignID *New);
- void setAddress(Value *V);
+ LLVM_ABI void setAssignId(DIAssignID *New);
+ LLVM_ABI void setAddress(Value *V);
/// Kill the address component.
- void setKillAddress();
+ LLVM_ABI void setKillAddress();
/// Check whether this kills the address component. This doesn't take into
/// account the position of the intrinsic, therefore a returned value of false
/// does not guarentee the address is a valid location for the variable at the
/// intrinsic's position in IR.
- bool isKillAddress() const;
- void setValue(Value *V);
+ LLVM_ABI bool isKillAddress() const;
+ LLVM_ABI void setValue(Value *V);
/// \name Casting methods
/// @{
static bool classof(const IntrinsicInst *I) {
@@ -568,51 +569,51 @@ class VPIntrinsic : public IntrinsicInst {
/// \brief Declares a llvm.vp.* intrinsic in \p M that matches the parameters
/// \p Params. Additionally, the load and gather intrinsics require
/// \p ReturnType to be specified.
- static Function *getOrInsertDeclarationForParams(Module *M, Intrinsic::ID,
+ LLVM_ABI static Function *getOrInsertDeclarationForParams(Module *M, Intrinsic::ID,
Type *ReturnType,
ArrayRef<Value *> Params);
- static std::optional<unsigned> getMaskParamPos(Intrinsic::ID IntrinsicID);
- static std::optional<unsigned> getVectorLengthParamPos(
+ LLVM_ABI static std::optional<unsigned> getMaskParamPos(Intrinsic::ID IntrinsicID);
+ LLVM_ABI static std::optional<unsigned> getVectorLengthParamPos(
Intrinsic::ID IntrinsicID);
/// The llvm.vp.* intrinsics for this instruction Opcode
- static Intrinsic::ID getForOpcode(unsigned OC);
+ LLVM_ABI static Intrinsic::ID getForOpcode(unsigned OC);
/// The llvm.vp.* intrinsics for this intrinsic ID \p Id. Return \p Id if it
/// is already a VP intrinsic.
- static Intrinsic::ID getForIntrinsic(Intrinsic::ID Id);
+ LLVM_ABI static Intrinsic::ID getForIntrinsic(Intrinsic::ID Id);
// Whether \p ID is a VP intrinsic ID.
- static bool isVPIntrinsic(Intrinsic::ID);
+ LLVM_ABI static bool isVPIntrinsic(Intrinsic::ID);
/// \return The mask parameter or nullptr.
- Value *getMaskParam() const;
- void setMaskParam(Value *);
+ LLVM_ABI Value *getMaskParam() const;
+ LLVM_ABI void setMaskParam(Value *);
/// \return The vector length parameter or nullptr.
- Value *getVectorLengthParam() const;
- void setVectorLengthParam(Value *);
+ LLVM_ABI Value *getVectorLengthParam() const;
+ LLVM_ABI void setVectorLengthParam(Value *);
/// \return Whether the vector length param can be ignored.
- bool canIgnoreVectorLengthParam() const;
+ LLVM_ABI bool canIgnoreVectorLengthParam() const;
/// \return The static element count (vector number of elements) the vector
/// length parameter applies to.
- ElementCount getStaticVectorLength() const;
+ LLVM_ABI ElementCount getStaticVectorLength() const;
/// \return The alignment of the pointer used by this load/store/gather or
/// scatter.
- MaybeAlign getPointerAlignment() const;
+ LLVM_ABI MaybeAlign getPointerAlignment() const;
// MaybeAlign setPointerAlignment(Align NewAlign); // TODO
/// \return The pointer operand of this load,store, gather or scatter.
- Value *getMemoryPointerParam() const;
- static std::optional<unsigned> getMemoryPointerParamPos(Intrinsic::ID);
+ LLVM_ABI Value *getMemoryPointerParam() const;
+ LLVM_ABI static std::optional<unsigned> getMemoryPointerParamPos(Intrinsic::ID);
/// \return The data (payload) operand of this store or scatter.
- Value *getMemoryDataParam() const;
- static std::optional<unsigned> getMemoryDataParamPos(Intrinsic::ID);
+ LLVM_ABI Value *getMemoryDataParam() const;
+ LLVM_ABI static std::optional<unsigned> getMemoryDataParamPos(Intrinsic::ID);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const IntrinsicInst *I) {
@@ -638,27 +639,27 @@ class VPIntrinsic : public IntrinsicInst {
}
// Equivalent non-predicated opcode
- static std::optional<unsigned> getFunctionalOpcodeForVP(Intrinsic::ID ID);
+ LLVM_ABI static std::optional<unsigned> getFunctionalOpcodeForVP(Intrinsic::ID ID);
// Equivalent non-predicated intrinsic ID
- static std::optional<Intrinsic::ID>
+ LLVM_ABI static std::optional<Intrinsic::ID>
getFunctionalIntrinsicIDForVP(Intrinsic::ID ID);
// Equivalent non-predicated constrained ID
- static std::optional<Intrinsic::ID>
+ LLVM_ABI static std::optional<Intrinsic::ID>
getConstrainedIntrinsicIDForVP(Intrinsic::ID ID);
};
/// This represents vector predication reduction intrinsics.
class VPReductionIntrinsic : public VPIntrinsic {
public:
- static bool isVPReduction(Intrinsic::ID ID);
+ LLVM_ABI static bool isVPReduction(Intrinsic::ID ID);
- unsigned getStartParamPos() const;
- unsigned getVectorParamPos() const;
+ LLVM_ABI unsigned getStartParamPos() const;
+ LLVM_ABI unsigned getVectorParamPos() const;
- static std::optional<unsigned> getStartParamPos(Intrinsic::ID ID);
- static std::optional<unsigned> getVectorParamPos(Intrinsic::ID ID);
+ LLVM_ABI static std::optional<unsigned> getStartParamPos(Intrinsic::ID ID);
+ LLVM_ABI static std::optional<unsigned> getVectorParamPos(Intrinsic::ID ID);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
/// @{
@@ -673,7 +674,7 @@ class VPReductionIntrinsic : public VPIntrinsic {
class VPCastIntrinsic : public VPIntrinsic {
public:
- static bool isVPCast(Intrinsic::ID ID);
+ LLVM_ABI static bool isVPCast(Intrinsic::ID ID);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
/// @{
@@ -688,9 +689,9 @@ class VPCastIntrinsic : public VPIntrinsic {
class VPCmpIntrinsic : public VPIntrinsic {
public:
- static bool isVPCmp(Intrinsic::ID ID);
+ LLVM_ABI static bool isVPCmp(Intrinsic::ID ID);
- CmpInst::Predicate getPredicate() const;
+ LLVM_ABI CmpInst::Predicate getPredicate() const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
/// @{
@@ -705,7 +706,7 @@ class VPCmpIntrinsic : public VPIntrinsic {
class VPBinOpIntrinsic : public VPIntrinsic {
public:
- static bool isVPBinOp(Intrinsic::ID ID);
+ LLVM_ABI static bool isVPBinOp(Intrinsic::ID ID);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
/// @{
@@ -722,13 +723,13 @@ class VPBinOpIntrinsic : public VPIntrinsic {
/// This is the common base class for constrained floating point intrinsics.
class ConstrainedFPIntrinsic : public IntrinsicInst {
public:
- unsigned getNonMetadataArgCount() const;
- std::optional<RoundingMode> getRoundingMode() const;
- std::optional<fp::ExceptionBehavior> getExceptionBehavior() const;
- bool isDefaultFPEnvironment() const;
+ LLVM_ABI unsigned getNonMetadataArgCount() const;
+ LLVM_ABI std::optional<RoundingMode> getRoundingMode() const;
+ LLVM_ABI std::optional<fp::ExceptionBehavior> getExceptionBehavior() const;
+ LLVM_ABI bool isDefaultFPEnvironment() const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
- static bool classof(const IntrinsicInst *I);
+ LLVM_ABI static bool classof(const IntrinsicInst *I);
static bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
@@ -737,7 +738,7 @@ class ConstrainedFPIntrinsic : public IntrinsicInst {
/// Constrained floating point compare intrinsics.
class ConstrainedFPCmpIntrinsic : public ConstrainedFPIntrinsic {
public:
- FCmpInst::Predicate getPredicate() const;
+ LLVM_ABI FCmpInst::Predicate getPredicate() const;
bool isSignaling() const {
return getIntrinsicID() == Intrinsic::experimental_constrained_fcmps;
}
@@ -914,13 +915,13 @@ class BinaryOpIntrinsic : public IntrinsicInst {
Value *getRHS() const { return const_cast<Value *>(getArgOperand(1)); }
/// Returns the binary operation underlying the intrinsic.
- Instruction::BinaryOps getBinaryOp() const;
+ LLVM_ABI Instruction::BinaryOps getBinaryOp() const;
/// Whether the intrinsic is signed or unsigned.
- bool isSigned() const;
+ LLVM_ABI bool isSigned() const;
/// Returns one of OBO::NoSignedWrap or OBO::NoUnsignedWrap.
- unsigned getNoWrapKind() const;
+ LLVM_ABI unsigned getNoWrapKind() const;
};
/// Represents an op.with.overflow intrinsic.
@@ -1475,10 +1476,10 @@ class InstrProfCntrInstBase : public InstrProfInstBase {
}
// The number of counters for the instrumented function.
- ConstantInt *getNumCounters() const;
+ LLVM_ABI ConstantInt *getNumCounters() const;
// The index of the counter that this instruction acts on.
- ConstantInt *getIndex() const;
- void setIndex(uint32_t Idx);
+ LLVM_ABI ConstantInt *getIndex() const;
+ LLVM_ABI void setIndex(uint32_t Idx);
};
/// This represents the llvm.instrprof.cover intrinsic.
@@ -1502,7 +1503,7 @@ class InstrProfIncrementInst : public InstrProfCntrInstBase {
static bool classof(const Value *V) {
return isa<IntrinsicInst>(V) && classof(cast<IntrinsicInst>(V));
}
- Value *getStep() const;
+ LLVM_ABI Value *getStep() const;
};
/// This represents the llvm.instrprof.increment.step intrinsic.
@@ -1534,8 +1535,8 @@ class InstrProfCallsite : public InstrProfCntrInstBase {
(CB.isIndirectCall() ||
(CB.getCalledFunction() && !CB.getCalledFunction()->isIntrinsic()));
}
- Value *getCallee() const;
- void setCallee(Value *Callee);
+ LLVM_ABI Value *getCallee() const;
+ LLVM_ABI void setCallee(Value *Callee);
};
/// This represents the llvm.instrprof.timestamp intrinsic.
@@ -1701,7 +1702,7 @@ class GCProjectionInst : public IntrinsicInst {
}
/// The statepoint with which this gc.relocate is associated.
- const Value *getStatepoint() const;
+ LLVM_ABI const Value *getStatepoint() const;
};
/// Represents calls to the gc.relocate intrinsic.
@@ -1728,8 +1729,8 @@ class GCRelocateInst : public GCProjectionInst {
return cast<ConstantInt>(getArgOperand(2))->getZExtValue();
}
- Value *getBasePtr() const;
- Value *getDerivedPtr() const;
+ LLVM_ABI Value *getBasePtr() const;
+ LLVM_ABI Value *getDerivedPtr() const;
};
/// Represents calls to the gc.result intrinsic.
@@ -1789,9 +1790,9 @@ class ConvergenceControlInst : public IntrinsicInst {
return getIntrinsicID() == Intrinsic::experimental_convergence_loop;
}
- static ConvergenceControlInst *CreateAnchor(BasicBlock &BB);
- static ConvergenceControlInst *CreateEntry(BasicBlock &BB);
- static ConvergenceControlInst *CreateLoop(BasicBlock &BB,
+ LLVM_ABI static ConvergenceControlInst *CreateAnchor(BasicBlock &BB);
+ LLVM_ABI static ConvergenceControlInst *CreateEntry(BasicBlock &BB);
+ LLVM_ABI static ConvergenceControlInst *CreateLoop(BasicBlock &BB,
ConvergenceControlInst *Parent);
};
diff --git a/llvm/include/llvm/IR/Intrinsics.h b/llvm/include/llvm/IR/Intrinsics.h
index 7aa6cbe93c132..3b6e29e0c1bb8 100644
--- a/llvm/include/llvm/IR/Intrinsics.h
+++ b/llvm/include/llvm/IR/Intrinsics.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_INTRINSICS_H
#define LLVM_IR_INTRINSICS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/TypeSize.h"
#include <optional>
@@ -53,11 +54,11 @@ namespace Intrinsic {
/// Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
/// Note, this version is for intrinsics with no overloads. Use the other
/// version of getName if overloads are required.
- StringRef getName(ID id);
+ LLVM_ABI StringRef getName(ID id);
/// Return the LLVM name for an intrinsic, without encoded types for
/// overloading, such as "llvm.ssa.copy".
- StringRef getBaseName(ID id);
+ LLVM_ABI StringRef getBaseName(ID id);
/// Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx" or
/// "llvm.ssa.copy.p0s_s.1". Note, this version of getName supports overloads.
@@ -65,31 +66,31 @@ namespace Intrinsic {
/// overloads are required, it is safe to use this version, but better to use
/// the StringRef version. If one of the types is based on an unnamed type, a
/// function type will be computed. Providing FT will avoid this computation.
- std::string getName(ID Id, ArrayRef<Type *> Tys, Module *M,
+ LLVM_ABI std::string getName(ID Id, ArrayRef<Type *> Tys, Module *M,
FunctionType *FT = nullptr);
/// Return the LLVM name for an intrinsic. This is a special version only to
/// be used by LLVMIntrinsicCopyOverloadedName. It only supports overloads
/// based on named types.
- std::string getNameNoUnnamedTypes(ID Id, ArrayRef<Type *> Tys);
+ LLVM_ABI std::string getNameNoUnnamedTypes(ID Id, ArrayRef<Type *> Tys);
/// Return the function type for an intrinsic.
- FunctionType *getType(LLVMContext &Context, ID id, ArrayRef<Type *> Tys = {});
+ LLVM_ABI FunctionType *getType(LLVMContext &Context, ID id, ArrayRef<Type *> Tys = {});
/// Returns true if the intrinsic can be overloaded.
- bool isOverloaded(ID id);
+ LLVM_ABI bool isOverloaded(ID id);
/// isTargetIntrinsic - Returns true if IID is an intrinsic specific to a
/// certain target. If it is a generic intrinsic false is returned.
- bool isTargetIntrinsic(ID IID);
+ LLVM_ABI bool isTargetIntrinsic(ID IID);
- ID lookupIntrinsicID(StringRef Name);
+ LLVM_ABI ID lookupIntrinsicID(StringRef Name);
/// Return the attributes for an intrinsic.
- AttributeList getAttributes(LLVMContext &C, ID id, FunctionType *FT);
+ LLVM_ABI AttributeList getAttributes(LLVMContext &C, ID id, FunctionType *FT);
/// Return the function attributes for an intrinsic.
- AttributeSet getFnAttributes(LLVMContext &C, ID id);
+ LLVM_ABI AttributeSet getFnAttributes(LLVMContext &C, ID id);
/// Look up the Function declaration of the intrinsic \p id in the Module
/// \p M. If it does not exist, add a declaration and return it. Otherwise,
@@ -99,7 +100,7 @@ namespace Intrinsic {
/// using iAny, fAny, vAny, or pAny). For a declaration of an overloaded
/// intrinsic, Tys must provide exactly one type for each overloaded type in
/// the intrinsic.
- Function *getOrInsertDeclaration(Module *M, ID id, ArrayRef<Type *> Tys = {});
+ LLVM_ABI Function *getOrInsertDeclaration(Module *M, ID id, ArrayRef<Type *> Tys = {});
LLVM_DEPRECATED("Use getOrInsertDeclaration instead",
"getOrInsertDeclaration")
@@ -110,25 +111,25 @@ namespace Intrinsic {
/// Look up the Function declaration of the intrinsic \p id in the Module
/// \p M and return it if it exists. Otherwise, return nullptr. This version
/// supports non-overloaded intrinsics.
- Function *getDeclarationIfExists(const Module *M, ID id);
+ LLVM_ABI Function *getDeclarationIfExists(const Module *M, ID id);
/// This version supports overloaded intrinsics.
- Function *getDeclarationIfExists(Module *M, ID id, ArrayRef<Type *> Tys,
+ LLVM_ABI Function *getDeclarationIfExists(Module *M, ID id, ArrayRef<Type *> Tys,
FunctionType *FT = nullptr);
/// Map a Clang builtin name to an intrinsic ID.
- ID getIntrinsicForClangBuiltin(StringRef TargetPrefix, StringRef BuiltinName);
+ LLVM_ABI ID getIntrinsicForClangBuiltin(StringRef TargetPrefix, StringRef BuiltinName);
/// Map a MS builtin name to an intrinsic ID.
- ID getIntrinsicForMSBuiltin(StringRef TargetPrefix, StringRef BuiltinName);
+ LLVM_ABI ID getIntrinsicForMSBuiltin(StringRef TargetPrefix, StringRef BuiltinName);
/// Returns true if the intrinsic ID is for one of the "Constrained
/// Floating-Point Intrinsics".
- bool isConstrainedFPIntrinsic(ID QID);
+ LLVM_ABI bool isConstrainedFPIntrinsic(ID QID);
/// Returns true if the intrinsic ID is for one of the "Constrained
/// Floating-Point Intrinsics" that take rounding mode metadata.
- bool hasConstrainedFPRoundingModeOperand(ID QID);
+ LLVM_ABI bool hasConstrainedFPRoundingModeOperand(ID QID);
/// This is a type descriptor which explains the type requirements of an
/// intrinsic. This is returned by getIntrinsicInfoTableEntries.
@@ -232,7 +233,7 @@ namespace Intrinsic {
/// Return the IIT table descriptor for the specified intrinsic into an array
/// of IITDescriptors.
- void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl<IITDescriptor> &T);
+ LLVM_ABI void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl<IITDescriptor> &T);
enum MatchIntrinsicTypesResult {
MatchIntrinsicTypes_Match = 0,
@@ -246,7 +247,7 @@ namespace Intrinsic {
///
/// Returns false if the given type matches with the constraints, true
/// otherwise.
- MatchIntrinsicTypesResult
+ LLVM_ABI MatchIntrinsicTypesResult
matchIntrinsicSignature(FunctionType *FTy, ArrayRef<IITDescriptor> &Infos,
SmallVectorImpl<Type *> &ArgTys);
@@ -254,7 +255,7 @@ namespace Intrinsic {
/// be called after all the fixed arguments have been matched first.
///
/// This method returns true on error.
- bool matchIntrinsicVarArg(bool isVarArg, ArrayRef<IITDescriptor> &Infos);
+ LLVM_ABI bool matchIntrinsicVarArg(bool isVarArg, ArrayRef<IITDescriptor> &Infos);
/// Gets the type arguments of an intrinsic call by matching type contraints
/// specified by the .td file. The overloaded types are pushed into the
@@ -262,17 +263,17 @@ namespace Intrinsic {
///
/// Returns false if the given ID and function type combination is not a
/// valid intrinsic call.
- bool getIntrinsicSignature(Intrinsic::ID, FunctionType *FT,
+ LLVM_ABI bool getIntrinsicSignature(Intrinsic::ID, FunctionType *FT,
SmallVectorImpl<Type *> &ArgTys);
/// Same as previous, but accepts a Function instead of ID and FunctionType.
- bool getIntrinsicSignature(Function *F, SmallVectorImpl<Type *> &ArgTys);
+ LLVM_ABI bool getIntrinsicSignature(Function *F, SmallVectorImpl<Type *> &ArgTys);
// Checks if the intrinsic name matches with its signature and if not
// returns the declaration with the same signature and remangled name.
// An existing GlobalValue with the wanted name but with a wrong prototype
// or of the wrong kind will be renamed by adding ".renamed" to the name.
- std::optional<Function *> remangleIntrinsicFunction(Function *F);
+ LLVM_ABI std::optional<Function *> remangleIntrinsicFunction(Function *F);
} // End Intrinsic namespace
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h
index 6dde7a968b570..f8056590b7f8f 100644
--- a/llvm/include/llvm/IR/LLVMContext.h
+++ b/llvm/include/llvm/IR/LLVMContext.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_LLVMCONTEXT_H
#define LLVM_IR_LLVMCONTEXT_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/IR/DiagnosticHandler.h"
#include "llvm/Support/CBindingWrapping.h"
@@ -67,10 +68,10 @@ enum {
class LLVMContext {
public:
LLVMContextImpl *const pImpl;
- LLVMContext();
+ LLVM_ABI LLVMContext();
LLVMContext(const LLVMContext &) = delete;
LLVMContext &operator=(const LLVMContext &) = delete;
- ~LLVMContext();
+ LLVM_ABI ~LLVMContext();
// Pinned metadata names, which always have the same value. This is a
// compile-time performance optimization, not a correctness optimization.
@@ -100,68 +101,68 @@ class LLVMContext {
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
/// This ID is uniqued across modules in the current LLVMContext.
- unsigned getMDKindID(StringRef Name) const;
+ LLVM_ABI unsigned getMDKindID(StringRef Name) const;
/// getMDKindNames - Populate client supplied SmallVector with the name for
/// custom metadata IDs registered in this LLVMContext.
- void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
+ LLVM_ABI void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
/// getOperandBundleTags - Populate client supplied SmallVector with the
/// bundle tags registered in this LLVMContext. The bundle tags are ordered
/// by increasing bundle IDs.
/// \see LLVMContext::getOperandBundleTagID
- void getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const;
+ LLVM_ABI void getOperandBundleTags(SmallVectorImpl<StringRef> &Result) const;
/// getOrInsertBundleTag - Returns the Tag to use for an operand bundle of
/// name TagName.
- StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef TagName) const;
+ LLVM_ABI StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef TagName) const;
/// getOperandBundleTagID - Maps a bundle tag to an integer ID. Every bundle
/// tag registered with an LLVMContext has an unique ID.
- uint32_t getOperandBundleTagID(StringRef Tag) const;
+ LLVM_ABI uint32_t getOperandBundleTagID(StringRef Tag) const;
/// getOrInsertSyncScopeID - Maps synchronization scope name to
/// synchronization scope ID. Every synchronization scope registered with
/// LLVMContext has unique ID except pre-defined ones.
- SyncScope::ID getOrInsertSyncScopeID(StringRef SSN);
+ LLVM_ABI SyncScope::ID getOrInsertSyncScopeID(StringRef SSN);
/// getSyncScopeNames - Populates client supplied SmallVector with
/// synchronization scope names registered with LLVMContext. Synchronization
/// scope names are ordered by increasing synchronization scope IDs.
- void getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const;
+ LLVM_ABI void getSyncScopeNames(SmallVectorImpl<StringRef> &SSNs) const;
/// getSyncScopeName - Returns the name of a SyncScope::ID
/// registered with LLVMContext, if any.
- std::optional<StringRef> getSyncScopeName(SyncScope::ID Id) const;
+ LLVM_ABI std::optional<StringRef> getSyncScopeName(SyncScope::ID Id) const;
/// Define the GC for a function
- void setGC(const Function &Fn, std::string GCName);
+ LLVM_ABI void setGC(const Function &Fn, std::string GCName);
/// Return the GC for a function
- const std::string &getGC(const Function &Fn);
+ LLVM_ABI const std::string &getGC(const Function &Fn);
/// Remove the GC for a function
- void deleteGC(const Function &Fn);
+ LLVM_ABI void deleteGC(const Function &Fn);
/// Return true if the Context runtime configuration is set to discard all
/// value names. When true, only GlobalValue names will be available in the
/// IR.
- bool shouldDiscardValueNames() const;
+ LLVM_ABI bool shouldDiscardValueNames() const;
/// Set the Context runtime configuration to discard all value name (but
/// GlobalValue). Clients can use this flag to save memory and runtime,
/// especially in release mode.
- void setDiscardValueNames(bool Discard);
+ LLVM_ABI void setDiscardValueNames(bool Discard);
/// Whether there is a string map for uniquing debug info
/// identifiers across the context. Off by default.
- bool isODRUniquingDebugTypes() const;
- void enableDebugTypeODRUniquing();
- void disableDebugTypeODRUniquing();
+ LLVM_ABI bool isODRUniquingDebugTypes() const;
+ LLVM_ABI void enableDebugTypeODRUniquing();
+ LLVM_ABI void disableDebugTypeODRUniquing();
/// generateMachineFunctionNum - Get a unique number for MachineFunction
/// that associated with the given Function.
- unsigned generateMachineFunctionNum(Function &);
+ LLVM_ABI unsigned generateMachineFunctionNum(Function &);
/// Defines the type of a yield callback.
/// \see LLVMContext::setYieldCallback.
@@ -175,7 +176,7 @@ class LLVMContext {
///
/// LLVMContext doesn't take ownership or interpret either of these
/// pointers.
- void setDiagnosticHandlerCallBack(
+ LLVM_ABI void setDiagnosticHandlerCallBack(
DiagnosticHandler::DiagnosticHandlerTy DiagHandler,
void *DiagContext = nullptr, bool RespectFilters = false);
@@ -186,36 +187,36 @@ class LLVMContext {
/// expects enabled diagnostics.
///
/// Ownership of this pointer is moved to LLVMContextImpl.
- void setDiagnosticHandler(std::unique_ptr<DiagnosticHandler> &&DH,
+ LLVM_ABI void setDiagnosticHandler(std::unique_ptr<DiagnosticHandler> &&DH,
bool RespectFilters = false);
/// getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by
/// setDiagnosticHandlerCallBack.
- DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack() const;
+ LLVM_ABI DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack() const;
/// getDiagnosticContext - Return the diagnostic context set by
/// setDiagnosticContext.
- void *getDiagnosticContext() const;
+ LLVM_ABI void *getDiagnosticContext() const;
/// getDiagHandlerPtr - Returns const raw pointer of DiagnosticHandler set by
/// setDiagnosticHandler.
- const DiagnosticHandler *getDiagHandlerPtr() const;
+ LLVM_ABI const DiagnosticHandler *getDiagHandlerPtr() const;
/// getDiagnosticHandler - transfers ownership of DiagnosticHandler unique_ptr
/// to caller.
- std::unique_ptr<DiagnosticHandler> getDiagnosticHandler();
+ LLVM_ABI std::unique_ptr<DiagnosticHandler> getDiagnosticHandler();
/// Return if a code hotness metric should be included in optimization
/// diagnostics.
- bool getDiagnosticsHotnessRequested() const;
+ LLVM_ABI bool getDiagnosticsHotnessRequested() const;
/// Set if a code hotness metric should be included in optimization
/// diagnostics.
- void setDiagnosticsHotnessRequested(bool Requested);
+ LLVM_ABI void setDiagnosticsHotnessRequested(bool Requested);
- bool getMisExpectWarningRequested() const;
- void setMisExpectWarningRequested(bool Requested);
- void setDiagnosticsMisExpectTolerance(std::optional<uint32_t> Tolerance);
- uint32_t getDiagnosticsMisExpectTolerance() const;
+ LLVM_ABI bool getMisExpectWarningRequested() const;
+ LLVM_ABI void setMisExpectWarningRequested(bool Requested);
+ LLVM_ABI void setDiagnosticsMisExpectTolerance(std::optional<uint32_t> Tolerance);
+ LLVM_ABI uint32_t getDiagnosticsMisExpectTolerance() const;
/// Return the minimum hotness value a diagnostic would need in order
/// to be included in optimization diagnostics.
@@ -227,14 +228,14 @@ class LLVMContext {
/// profile summary. Note that in case of missing profile
/// summary, threshold will be kept at "MAX", effectively
/// suppresses all remarks output.
- uint64_t getDiagnosticsHotnessThreshold() const;
+ LLVM_ABI uint64_t getDiagnosticsHotnessThreshold() const;
/// Set the minimum hotness value a diagnostic needs in order to be
/// included in optimization diagnostics.
- void setDiagnosticsHotnessThreshold(std::optional<uint64_t> Threshold);
+ LLVM_ABI void setDiagnosticsHotnessThreshold(std::optional<uint64_t> Threshold);
/// Return if hotness threshold is requested from PSI.
- bool isDiagnosticsHotnessThresholdSetFromPSI() const;
+ LLVM_ABI bool isDiagnosticsHotnessThresholdSetFromPSI() const;
/// The "main remark streamer" used by all the specialized remark streamers.
/// This streamer keeps generic remark metadata in memory throughout the life
@@ -243,9 +244,9 @@ class LLVMContext {
///
/// All specialized remark streamers should convert remarks to
/// llvm::remarks::Remark and emit them through this streamer.
- remarks::RemarkStreamer *getMainRemarkStreamer();
- const remarks::RemarkStreamer *getMainRemarkStreamer() const;
- void setMainRemarkStreamer(
+ LLVM_ABI remarks::RemarkStreamer *getMainRemarkStreamer();
+ LLVM_ABI const remarks::RemarkStreamer *getMainRemarkStreamer() const;
+ LLVM_ABI void setMainRemarkStreamer(
std::unique_ptr<remarks::RemarkStreamer> MainRemarkStreamer);
/// The "LLVM remark streamer" used by LLVM to serialize remark diagnostics
@@ -253,14 +254,14 @@ class LLVMContext {
///
/// If it does not exist, diagnostics are not saved in a file but only emitted
/// via the diagnostic handler.
- LLVMRemarkStreamer *getLLVMRemarkStreamer();
- const LLVMRemarkStreamer *getLLVMRemarkStreamer() const;
- void
+ LLVM_ABI LLVMRemarkStreamer *getLLVMRemarkStreamer();
+ LLVM_ABI const LLVMRemarkStreamer *getLLVMRemarkStreamer() const;
+ LLVM_ABI void
setLLVMRemarkStreamer(std::unique_ptr<LLVMRemarkStreamer> RemarkStreamer);
/// Get the prefix that should be printed in front of a diagnostic of
/// the given \p Severity
- static const char *getDiagnosticMessagePrefix(DiagnosticSeverity Severity);
+ LLVM_ABI static const char *getDiagnosticMessagePrefix(DiagnosticSeverity Severity);
/// Report a message to the currently installed diagnostic handler.
///
@@ -272,7 +273,7 @@ class LLVMContext {
/// The diagnostic message will be implicitly prefixed with a severity keyword
/// according to \p DI.getSeverity(), i.e., "error: " for \a DS_Error,
/// "warning: " for \a DS_Warning, and "note: " for \a DS_Note.
- void diagnose(const DiagnosticInfo &DI);
+ LLVM_ABI void diagnose(const DiagnosticInfo &DI);
/// Registers a yield callback with the given context.
///
@@ -291,33 +292,33 @@ class LLVMContext {
/// yield callback are allowed to be used. Any other API calls into the
/// context are not supported until the yield callback function returns
/// control to LLVM. Other LLVM contexts are unaffected by this restriction.
- void setYieldCallback(YieldCallbackTy Callback, void *OpaqueHandle);
+ LLVM_ABI void setYieldCallback(YieldCallbackTy Callback, void *OpaqueHandle);
/// Calls the yield callback (if applicable).
///
/// This transfers control of the current thread back to the client, which may
/// suspend the current thread. Only call this method when LLVM doesn't hold
/// any global mutex or cannot block the execution in another LLVM context.
- void yield();
+ LLVM_ABI void yield();
/// emitError - Emit an error message to the currently installed error handler
/// with optional location information. This function returns, so code should
/// be prepared to drop the erroneous construct on the floor and "not crash".
/// The generated code need not be correct. The error message will be
/// implicitly prefixed with "error: " and should not end with a ".".
- void emitError(const Instruction *I, const Twine &ErrorStr);
- void emitError(const Twine &ErrorStr);
+ LLVM_ABI void emitError(const Instruction *I, const Twine &ErrorStr);
+ LLVM_ABI void emitError(const Twine &ErrorStr);
/// Access the object which can disable optional passes and individual
/// optimizations at compile time.
- OptPassGate &getOptPassGate() const;
+ LLVM_ABI OptPassGate &getOptPassGate() const;
/// Set the object which can disable optional passes and individual
/// optimizations at compile time.
///
/// The lifetime of the object must be guaranteed to extend as long as the
/// LLVMContext is used by compilation.
- void setOptPassGate(OptPassGate&);
+ LLVM_ABI void setOptPassGate(OptPassGate&);
/// Get or set the current "default" target CPU (target-cpu function
/// attribute). The intent is that compiler frontends will set this to a value
@@ -328,20 +329,20 @@ class LLVMContext {
/// Function::createWithDefaultAttr() will create functions with this
/// attribute. This function should only be called by passes that run at
/// compile time and not by the backend or LTO passes.
- StringRef getDefaultTargetCPU();
- void setDefaultTargetCPU(StringRef CPU);
+ LLVM_ABI StringRef getDefaultTargetCPU();
+ LLVM_ABI void setDefaultTargetCPU(StringRef CPU);
/// Similar to {get,set}DefaultTargetCPU() but for default target-features.
- StringRef getDefaultTargetFeatures();
- void setDefaultTargetFeatures(StringRef Features);
+ LLVM_ABI StringRef getDefaultTargetFeatures();
+ LLVM_ABI void setDefaultTargetFeatures(StringRef Features);
/// Key Instructions: update the highest number atom group emitted for any
/// function.
- void updateDILocationAtomGroupWaterline(uint64_t G);
+ LLVM_ABI void updateDILocationAtomGroupWaterline(uint64_t G);
/// Key Instructions: get the next free atom group number and increment
/// the global tracker.
- uint64_t incNextDILocationAtomGroup();
+ LLVM_ABI uint64_t incNextDILocationAtomGroup();
private:
// Module needs access to the add/removeModule methods.
diff --git a/llvm/include/llvm/IR/LLVMRemarkStreamer.h b/llvm/include/llvm/IR/LLVMRemarkStreamer.h
index 7e78c4f806b40..232e1875fe71a 100644
--- a/llvm/include/llvm/IR/LLVMRemarkStreamer.h
+++ b/llvm/include/llvm/IR/LLVMRemarkStreamer.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_LLVMREMARKSTREAMER_H
#define LLVM_IR_LLVMREMARKSTREAMER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Remarks/Remark.h"
#include "llvm/Support/Error.h"
#include <memory>
@@ -41,7 +42,7 @@ class LLVMRemarkStreamer {
public:
LLVMRemarkStreamer(remarks::RemarkStreamer &RS) : RS(RS) {}
/// Emit a diagnostic through the streamer.
- void emit(const DiagnosticInfoOptimizationBase &Diag);
+ LLVM_ABI void emit(const DiagnosticInfoOptimizationBase &Diag);
};
template <typename ThisError>
@@ -62,27 +63,27 @@ struct LLVMRemarkSetupErrorInfo : public ErrorInfo<ThisError> {
struct LLVMRemarkSetupFileError
: LLVMRemarkSetupErrorInfo<LLVMRemarkSetupFileError> {
- static char ID;
+ LLVM_ABI static char ID;
using LLVMRemarkSetupErrorInfo<
LLVMRemarkSetupFileError>::LLVMRemarkSetupErrorInfo;
};
struct LLVMRemarkSetupPatternError
: LLVMRemarkSetupErrorInfo<LLVMRemarkSetupPatternError> {
- static char ID;
+ LLVM_ABI static char ID;
using LLVMRemarkSetupErrorInfo<
LLVMRemarkSetupPatternError>::LLVMRemarkSetupErrorInfo;
};
struct LLVMRemarkSetupFormatError
: LLVMRemarkSetupErrorInfo<LLVMRemarkSetupFormatError> {
- static char ID;
+ LLVM_ABI static char ID;
using LLVMRemarkSetupErrorInfo<
LLVMRemarkSetupFormatError>::LLVMRemarkSetupErrorInfo;
};
/// Setup optimization remarks that output to a file.
-Expected<std::unique_ptr<ToolOutputFile>>
+LLVM_ABI Expected<std::unique_ptr<ToolOutputFile>>
setupLLVMOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
StringRef RemarksPasses, StringRef RemarksFormat,
bool RemarksWithHotness,
@@ -91,7 +92,7 @@ setupLLVMOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
/// Setup optimization remarks that output directly to a raw_ostream.
/// \p OS is managed by the caller and should be open for writing as long as \p
/// Context is streaming remarks to it.
-Error setupLLVMOptimizationRemarks(
+LLVM_ABI Error setupLLVMOptimizationRemarks(
LLVMContext &Context, raw_ostream &OS, StringRef RemarksPasses,
StringRef RemarksFormat, bool RemarksWithHotness,
std::optional<uint64_t> RemarksHotnessThreshold = 0);
diff --git a/llvm/include/llvm/IR/LegacyPassManager.h b/llvm/include/llvm/IR/LegacyPassManager.h
index b3a4820ba0e49..f553246d3f8d9 100644
--- a/llvm/include/llvm/IR/LegacyPassManager.h
+++ b/llvm/include/llvm/IR/LegacyPassManager.h
@@ -16,6 +16,7 @@
#ifndef LLVM_IR_LEGACYPASSMANAGER_H
#define LLVM_IR_LEGACYPASSMANAGER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/CBindingWrapping.h"
namespace llvm {
@@ -28,7 +29,7 @@ namespace legacy {
// Whether or not -debug-pass has been specified. For use to check if it's
// specified alongside the new PM.
-bool debugPassSpecified();
+LLVM_ABI bool debugPassSpecified();
class PassManagerImpl;
class FunctionPassManagerImpl;
@@ -36,7 +37,7 @@ class FunctionPassManagerImpl;
/// PassManagerBase - An abstract interface to allow code to add passes to
/// a pass manager without having to hard-code what kind of pass manager
/// it is.
-class PassManagerBase {
+class LLVM_ABI PassManagerBase {
public:
virtual ~PassManagerBase();
@@ -49,7 +50,7 @@ class PassManagerBase {
};
/// PassManager manages ModulePassManagers
-class PassManager : public PassManagerBase {
+class LLVM_ABI PassManager : public PassManagerBase {
public:
PassManager();
@@ -68,7 +69,7 @@ class PassManager : public PassManagerBase {
};
/// FunctionPassManager manages FunctionPasses.
-class FunctionPassManager : public PassManagerBase {
+class LLVM_ABI FunctionPassManager : public PassManagerBase {
public:
/// FunctionPassManager ctor - This initializes the pass manager. It needs,
/// but does not take ownership of, the specified Module.
diff --git a/llvm/include/llvm/IR/LegacyPassManagers.h b/llvm/include/llvm/IR/LegacyPassManagers.h
index 6c490791fda4b..39d38059d706d 100644
--- a/llvm/include/llvm/IR/LegacyPassManagers.h
+++ b/llvm/include/llvm/IR/LegacyPassManagers.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_LEGACYPASSMANAGERS_H
#define LLVM_IR_LEGACYPASSMANAGERS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -106,7 +107,7 @@ enum PassDebuggingString {
/// PassManagerPrettyStackEntry - This is used to print informative information
/// about what pass is running when/if a stack trace is generated.
-class PassManagerPrettyStackEntry : public PrettyStackTraceEntry {
+class LLVM_ABI PassManagerPrettyStackEntry : public PrettyStackTraceEntry {
Pass *P;
Value *V;
Module *M;
@@ -139,12 +140,12 @@ class PMStack {
iterator begin() const { return S.rbegin(); }
iterator end() const { return S.rend(); }
- void pop();
+ LLVM_ABI void pop();
PMDataManager *top() const { return S.back(); }
- void push(PMDataManager *PM);
+ LLVM_ABI void push(PMDataManager *PM);
bool empty() const { return S.empty(); }
- void dump() const;
+ LLVM_ABI void dump() const;
private:
std::vector<PMDataManager *> S;
@@ -155,7 +156,7 @@ class PMStack {
//
/// PMTopLevelManager manages LastUser info and collects common APIs used by
/// top level pass managers.
-class PMTopLevelManager {
+class LLVM_ABI PMTopLevelManager {
protected:
explicit PMTopLevelManager(PMDataManager *PMDM);
@@ -292,7 +293,7 @@ class PMTopLevelManager {
/// PMDataManager provides the common place to manage the analysis data
/// used by pass managers.
-class PMDataManager {
+class LLVM_ABI PMDataManager {
public:
explicit PMDataManager() { initializeAnalysisInfo(); }
@@ -454,7 +455,7 @@ class PMDataManager {
/// It batches all function passes and basic block pass managers together and
/// sequence them to process one function at a time before processing next
/// function.
-class FPPassManager : public ModulePass, public PMDataManager {
+class LLVM_ABI FPPassManager : public ModulePass, public PMDataManager {
public:
static char ID;
explicit FPPassManager() : ModulePass(ID) {}
diff --git a/llvm/include/llvm/IR/LegacyPassNameParser.h b/llvm/include/llvm/IR/LegacyPassNameParser.h
index c33b9fc404729..65a0c857f2278 100644
--- a/llvm/include/llvm/IR/LegacyPassNameParser.h
+++ b/llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -25,6 +25,7 @@
#ifndef LLVM_IR_LEGACYPASSNAMEPARSER_H
#define LLVM_IR_LEGACYPASSNAMEPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
@@ -38,7 +39,7 @@ namespace llvm {
// PassNameParser class - Make use of the pass registration mechanism to
// automatically add a command line argument to opt for each pass.
//
-class PassNameParser : public PassRegistrationListener,
+class LLVM_ABI PassNameParser : public PassRegistrationListener,
public cl::parser<const PassInfo*> {
public:
PassNameParser(cl::Option &O);
diff --git a/llvm/include/llvm/IR/MDBuilder.h b/llvm/include/llvm/IR/MDBuilder.h
index ce4e1da656049..745bb673e9387 100644
--- a/llvm/include/llvm/IR/MDBuilder.h
+++ b/llvm/include/llvm/IR/MDBuilder.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_MDBUILDER_H
#define LLVM_IR_MDBUILDER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
@@ -40,10 +41,10 @@ class MDBuilder {
MDBuilder(LLVMContext &context) : Context(context) {}
/// Return the given string as metadata.
- MDString *createString(StringRef Str);
+ LLVM_ABI MDString *createString(StringRef Str);
/// Return the given constant as metadata.
- ConstantAsMetadata *createConstant(Constant *C);
+ LLVM_ABI ConstantAsMetadata *createConstant(Constant *C);
//===------------------------------------------------------------------===//
// FPMath metadata.
@@ -52,7 +53,7 @@ class MDBuilder {
/// Return metadata with the given settings. The special value 0.0
/// for the Accuracy parameter indicates the default (maximal precision)
/// setting.
- MDNode *createFPMath(float Accuracy);
+ LLVM_ABI MDNode *createFPMath(float Accuracy);
//===------------------------------------------------------------------===//
// Prof metadata.
@@ -62,41 +63,41 @@ class MDBuilder {
/// @param TrueWeight the weight of the true branch
/// @param FalseWeight the weight of the false branch
/// @param Do these weights come from __builtin_expect*
- MDNode *createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight,
+ LLVM_ABI MDNode *createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight,
bool IsExpected = false);
/// Return metadata containing two branch weights, with significant bias
/// towards `true` destination.
- MDNode *createLikelyBranchWeights();
+ LLVM_ABI MDNode *createLikelyBranchWeights();
/// Return metadata containing two branch weights, with significant bias
/// towards `false` destination.
- MDNode *createUnlikelyBranchWeights();
+ LLVM_ABI MDNode *createUnlikelyBranchWeights();
/// Return metadata containing a number of branch weights.
/// @param Weights the weights of all the branches
/// @param Do these weights come from __builtin_expect*
- MDNode *createBranchWeights(ArrayRef<uint32_t> Weights,
+ LLVM_ABI MDNode *createBranchWeights(ArrayRef<uint32_t> Weights,
bool IsExpected = false);
/// Return metadata specifying that a branch or switch is unpredictable.
- MDNode *createUnpredictable();
+ LLVM_ABI MDNode *createUnpredictable();
/// Return metadata containing the entry \p Count for a function, a boolean
/// \Synthetic indicating whether the counts were synthetized, and the
/// GUIDs stored in \p Imports that need to be imported for sample PGO, to
/// enable the same inlines as the profiled optimized binary
- MDNode *createFunctionEntryCount(uint64_t Count, bool Synthetic,
+ LLVM_ABI MDNode *createFunctionEntryCount(uint64_t Count, bool Synthetic,
const DenseSet<GlobalValue::GUID> *Imports);
/// Return metadata containing the section prefix for a global object.
- MDNode *createGlobalObjectSectionPrefix(StringRef Prefix);
+ LLVM_ABI MDNode *createGlobalObjectSectionPrefix(StringRef Prefix);
/// Return metadata containing the pseudo probe descriptor for a function.
- MDNode *createPseudoProbeDesc(uint64_t GUID, uint64_t Hash, StringRef FName);
+ LLVM_ABI MDNode *createPseudoProbeDesc(uint64_t GUID, uint64_t Hash, StringRef FName);
/// Return metadata containing llvm statistics.
- MDNode *
+ LLVM_ABI MDNode *
createLLVMStats(ArrayRef<std::pair<StringRef, uint64_t>> LLVMStatsVec);
//===------------------------------------------------------------------===//
@@ -104,10 +105,10 @@ class MDBuilder {
//===------------------------------------------------------------------===//
/// Return metadata describing the range [Lo, Hi).
- MDNode *createRange(const APInt &Lo, const APInt &Hi);
+ LLVM_ABI MDNode *createRange(const APInt &Lo, const APInt &Hi);
/// Return metadata describing the range [Lo, Hi).
- MDNode *createRange(Constant *Lo, Constant *Hi);
+ LLVM_ABI MDNode *createRange(Constant *Lo, Constant *Hi);
//===------------------------------------------------------------------===//
// Callees metadata.
@@ -115,22 +116,22 @@ class MDBuilder {
/// Return metadata indicating the possible callees of indirect
/// calls.
- MDNode *createCallees(ArrayRef<Function *> Callees);
+ LLVM_ABI MDNode *createCallees(ArrayRef<Function *> Callees);
//===------------------------------------------------------------------===//
// Callback metadata.
//===------------------------------------------------------------------===//
/// Return metadata describing a callback (see llvm::AbstractCallSite).
- MDNode *createCallbackEncoding(unsigned CalleeArgNo, ArrayRef<int> Arguments,
+ LLVM_ABI MDNode *createCallbackEncoding(unsigned CalleeArgNo, ArrayRef<int> Arguments,
bool VarArgsArePassed);
/// Merge the new callback encoding \p NewCB into \p ExistingCallbacks.
- MDNode *mergeCallbackEncodings(MDNode *ExistingCallbacks, MDNode *NewCB);
+ LLVM_ABI MDNode *mergeCallbackEncodings(MDNode *ExistingCallbacks, MDNode *NewCB);
/// Return metadata feeding to the CodeGen about how to generate a function
/// prologue for the "function" santizier.
- MDNode *createRTTIPointerPrologue(Constant *PrologueSig, Constant *RTTI);
+ LLVM_ABI MDNode *createRTTIPointerPrologue(Constant *PrologueSig, Constant *RTTI);
//===------------------------------------------------------------------===//
// PC sections metadata.
@@ -140,7 +141,7 @@ class MDBuilder {
using PCSection = std::pair<StringRef, SmallVector<Constant *>>;
/// Return metadata for PC sections.
- MDNode *createPCSections(ArrayRef<PCSection> Sections);
+ LLVM_ABI MDNode *createPCSections(ArrayRef<PCSection> Sections);
//===------------------------------------------------------------------===//
// AA metadata.
@@ -150,7 +151,7 @@ class MDBuilder {
/// Return metadata appropriate for a AA root node (scope or TBAA).
/// Each returned node is distinct from all other metadata and will never
/// be identified (uniqued) with anything else.
- MDNode *createAnonymousAARoot(StringRef Name = StringRef(),
+ LLVM_ABI MDNode *createAnonymousAARoot(StringRef Name = StringRef(),
MDNode *Extra = nullptr);
public:
@@ -179,21 +180,21 @@ class MDBuilder {
/// Return metadata appropriate for a TBAA root node with the given
/// name. This may be identified (uniqued) with other roots with the same
/// name.
- MDNode *createTBAARoot(StringRef Name);
+ LLVM_ABI MDNode *createTBAARoot(StringRef Name);
/// Return metadata appropriate for an alias scope domain node with
/// the given name. This may be identified (uniqued) with other roots with
/// the same name.
- MDNode *createAliasScopeDomain(StringRef Name);
+ LLVM_ABI MDNode *createAliasScopeDomain(StringRef Name);
/// Return metadata appropriate for an alias scope node with
/// the given name. This may be identified (uniqued) with other scopes with
/// the same name and domain.
- MDNode *createAliasScope(StringRef Name, MDNode *Domain);
+ LLVM_ABI MDNode *createAliasScope(StringRef Name, MDNode *Domain);
/// Return metadata for a non-root TBAA node with the given name,
/// parent in the TBAA tree, and value for 'pointsToConstantMemory'.
- MDNode *createTBAANode(StringRef Name, MDNode *Parent,
+ LLVM_ABI MDNode *createTBAANode(StringRef Name, MDNode *Parent,
bool isConstant = false);
struct TBAAStructField {
@@ -206,27 +207,27 @@ class MDBuilder {
/// Return metadata for a tbaa.struct node with the given
/// struct field descriptions.
- MDNode *createTBAAStructNode(ArrayRef<TBAAStructField> Fields);
+ LLVM_ABI MDNode *createTBAAStructNode(ArrayRef<TBAAStructField> Fields);
/// Return metadata for a TBAA struct node in the type DAG
/// with the given name, a list of pairs (offset, field type in the type DAG).
- MDNode *
+ LLVM_ABI MDNode *
createTBAAStructTypeNode(StringRef Name,
ArrayRef<std::pair<MDNode *, uint64_t>> Fields);
/// Return metadata for a TBAA scalar type node with the
/// given name, an offset and a parent in the TBAA type DAG.
- MDNode *createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
+ LLVM_ABI MDNode *createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
uint64_t Offset = 0);
/// Return metadata for a TBAA tag node with the given
/// base type, access type and offset relative to the base type.
- MDNode *createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
+ LLVM_ABI MDNode *createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
uint64_t Offset, bool IsConstant = false);
/// Return metadata for a TBAA type node in the TBAA type DAG with the
/// given parent type, size in bytes, type identifier and a list of fields.
- MDNode *createTBAATypeNode(MDNode *Parent, uint64_t Size, Metadata *Id,
+ LLVM_ABI MDNode *createTBAATypeNode(MDNode *Parent, uint64_t Size, Metadata *Id,
ArrayRef<TBAAStructField> Fields =
ArrayRef<TBAAStructField>());
@@ -234,16 +235,16 @@ class MDBuilder {
/// final access type, offset of the access relative to the base type, size of
/// the access and flag indicating whether the accessed object can be
/// considered immutable for the purposes of the TBAA analysis.
- MDNode *createTBAAAccessTag(MDNode *BaseType, MDNode *AccessType,
+ LLVM_ABI MDNode *createTBAAAccessTag(MDNode *BaseType, MDNode *AccessType,
uint64_t Offset, uint64_t Size,
bool IsImmutable = false);
/// Return mutable version of the given mutable or immutable TBAA
/// access tag.
- MDNode *createMutableTBAAAccessTag(MDNode *Tag);
+ LLVM_ABI MDNode *createMutableTBAAAccessTag(MDNode *Tag);
/// Return metadata containing an irreducible loop header weight.
- MDNode *createIrrLoopHeaderWeight(uint64_t Weight);
+ LLVM_ABI MDNode *createIrrLoopHeaderWeight(uint64_t Weight);
};
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/Mangler.h b/llvm/include/llvm/IR/Mangler.h
index edbd0a5efb5dc..d6ab5674b1a29 100644
--- a/llvm/include/llvm/IR/Mangler.h
+++ b/llvm/include/llvm/IR/Mangler.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_MANGLER_H
#define LLVM_IR_MANGLER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
@@ -36,32 +37,32 @@ class Mangler {
/// Print the appropriate prefix and the specified global variable's name.
/// If the global variable doesn't have a name, this fills in a unique name
/// for the global.
- void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
+ LLVM_ABI void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
bool CannotUsePrivateLabel) const;
- void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
+ LLVM_ABI void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
bool CannotUsePrivateLabel) const;
/// Print the appropriate prefix and the specified name as the global variable
/// name. GVName must not be empty.
- static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
+ LLVM_ABI static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
const DataLayout &DL);
- static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
+ LLVM_ABI static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
const Twine &GVName, const DataLayout &DL);
};
-void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
+LLVM_ABI void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
const Triple &TT, Mangler &Mangler);
-void emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV,
+LLVM_ABI void emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV,
const Triple &T, Mangler &M);
/// Returns the ARM64EC mangled function name unless the input is already
/// mangled.
-std::optional<std::string> getArm64ECMangledFunctionName(StringRef Name);
+LLVM_ABI std::optional<std::string> getArm64ECMangledFunctionName(StringRef Name);
/// Returns the ARM64EC demangled function name, unless the input is not
/// mangled.
-std::optional<std::string> getArm64ECDemangledFunctionName(StringRef Name);
+LLVM_ABI std::optional<std::string> getArm64ECDemangledFunctionName(StringRef Name);
/// Check if an ARM64EC function name is mangled.
bool inline isArm64ECMangledFunctionName(StringRef Name) {
diff --git a/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h b/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
index a9ded6034d0b4..8011878478bc2 100644
--- a/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
+++ b/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
@@ -18,6 +18,7 @@
#ifndef LLVM_IR_MEMORYMODELRELAXATIONANNOTATIONS_H
#define LLVM_IR_MEMORYMODELRELAXATIONANNOTATIONS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringRef.h"
#include <tuple> // for std::pair
@@ -52,8 +53,8 @@ class MMRAMetadata {
/// \name Constructors
/// @{
MMRAMetadata() = default;
- MMRAMetadata(const Instruction &I);
- MMRAMetadata(MDNode *MD);
+ LLVM_ABI MMRAMetadata(const Instruction &I);
+ LLVM_ABI MMRAMetadata(MDNode *MD);
/// @}
/// \name Metadata Helpers & Builders
@@ -61,14 +62,14 @@ class MMRAMetadata {
/// Combines \p A and \p B according to MMRA semantics.
/// \returns !mmra metadata for the combined MMRAs.
- static MDNode *combine(LLVMContext &Ctx, const MMRAMetadata &A,
+ LLVM_ABI static MDNode *combine(LLVMContext &Ctx, const MMRAMetadata &A,
const MMRAMetadata &B);
/// Creates !mmra metadata for a single tag.
///
/// !mmra metadata can either be a single tag, or a MDTuple containing
/// multiple tags.
- static MDTuple *getTagMD(LLVMContext &Ctx, StringRef Prefix,
+ LLVM_ABI static MDTuple *getTagMD(LLVMContext &Ctx, StringRef Prefix,
StringRef Suffix);
static MDTuple *getTagMD(LLVMContext &Ctx, const TagT &T) {
return getTagMD(Ctx, T.first, T.second);
@@ -76,10 +77,10 @@ class MMRAMetadata {
/// Creates !mmra metadata from \p Tags.
/// \returns nullptr or a MDTuple* from \p Tags.
- static MDTuple *getMD(LLVMContext &Ctx, ArrayRef<TagT> Tags);
+ LLVM_ABI static MDTuple *getMD(LLVMContext &Ctx, ArrayRef<TagT> Tags);
/// \returns true if \p MD is a well-formed MMRA tag.
- static bool isTagMD(const Metadata *MD);
+ LLVM_ABI static bool isTagMD(const Metadata *MD);
/// @}
@@ -92,25 +93,25 @@ class MMRAMetadata {
}
/// \returns whether this set of tags is compatible with \p Other.
- bool isCompatibleWith(const MMRAMetadata &Other) const;
+ LLVM_ABI bool isCompatibleWith(const MMRAMetadata &Other) const;
/// @}
/// \name Content Queries
/// @{
- bool hasTag(StringRef Prefix, StringRef Suffix) const;
- bool hasTagWithPrefix(StringRef Prefix) const;
+ LLVM_ABI bool hasTag(StringRef Prefix, StringRef Suffix) const;
+ LLVM_ABI bool hasTagWithPrefix(StringRef Prefix) const;
- const_iterator begin() const;
- const_iterator end() const;
- bool empty() const;
- unsigned size() const;
+ LLVM_ABI const_iterator begin() const;
+ LLVM_ABI const_iterator end() const;
+ LLVM_ABI bool empty() const;
+ LLVM_ABI unsigned size() const;
/// @}
- void print(raw_ostream &OS) const;
- void dump() const;
+ LLVM_ABI void print(raw_ostream &OS) const;
+ LLVM_ABI void dump() const;
operator bool() const { return !Tags.empty(); }
bool operator==(const MMRAMetadata &Other) const {
@@ -125,7 +126,7 @@ class MMRAMetadata {
};
/// \returns true if \p I can have !mmra metadata.
-bool canInstructionHaveMMRAs(const Instruction &I);
+LLVM_ABI bool canInstructionHaveMMRAs(const Instruction &I);
} // namespace llvm
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index 3d06edeed6c46..393abc6d9599d 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_METADATA_H
#define LLVM_IR_METADATA_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
@@ -110,8 +111,8 @@ class Metadata {
/// the nullptr version is easy to call from a debugger.
///
/// @{
- void dump() const;
- void dump(const Module *M) const;
+ LLVM_ABI void dump() const;
+ LLVM_ABI void dump(const Module *M) const;
/// @}
/// Print.
@@ -121,9 +122,9 @@ class Metadata {
/// If \c M is provided, metadata nodes will be numbered canonically;
/// otherwise, pointer addresses are substituted.
/// @{
- void print(raw_ostream &OS, const Module *M = nullptr,
+ LLVM_ABI void print(raw_ostream &OS, const Module *M = nullptr,
bool IsForDebug = false) const;
- void print(raw_ostream &OS, ModuleSlotTracker &MST, const Module *M = nullptr,
+ LLVM_ABI void print(raw_ostream &OS, ModuleSlotTracker &MST, const Module *M = nullptr,
bool IsForDebug = false) const;
/// @}
@@ -134,8 +135,8 @@ class Metadata {
/// If \c M is provided, metadata nodes will be numbered canonically;
/// otherwise, pointer addresses are substituted.
/// @{
- void printAsOperand(raw_ostream &OS, const Module *M = nullptr) const;
- void printAsOperand(raw_ostream &OS, ModuleSlotTracker &MST,
+ LLVM_ABI void printAsOperand(raw_ostream &OS, const Module *M = nullptr) const;
+ LLVM_ABI void printAsOperand(raw_ostream &OS, ModuleSlotTracker &MST,
const Module *M = nullptr) const;
/// @}
@@ -189,10 +190,10 @@ class MetadataAsValue : public Value {
void dropUse() { MD = nullptr; }
public:
- ~MetadataAsValue();
+ LLVM_ABI ~MetadataAsValue();
- static MetadataAsValue *get(LLVMContext &Context, Metadata *MD);
- static MetadataAsValue *getIfExists(LLVMContext &Context, Metadata *MD);
+ LLVM_ABI static MetadataAsValue *get(LLVMContext &Context, Metadata *MD);
+ LLVM_ABI static MetadataAsValue *getIfExists(LLVMContext &Context, Metadata *MD);
Metadata *getMetadata() const { return MD; }
@@ -224,15 +225,15 @@ class DebugValueUser {
ArrayRef<Metadata *> getDebugValues() const { return DebugValues; }
public:
- DbgVariableRecord *getUser();
- const DbgVariableRecord *getUser() const;
+ LLVM_ABI DbgVariableRecord *getUser();
+ LLVM_ABI const DbgVariableRecord *getUser() const;
/// To be called by ReplaceableMetadataImpl::replaceAllUsesWith, where `Old`
/// is a pointer to one of the pointers in `DebugValues` (so should be type
/// Metadata**), and `NewDebugValue` is the new Metadata* that is replacing
/// *Old.
/// For manually replacing elements of DebugValues,
/// `resetDebugValue(Idx, NewDebugValue)` should be used instead.
- void handleChangedValue(void *Old, Metadata *NewDebugValue);
+ LLVM_ABI void handleChangedValue(void *Old, Metadata *NewDebugValue);
DebugValueUser() = default;
explicit DebugValueUser(std::array<Metadata *, 3> DebugValues)
: DebugValues(DebugValues) {
@@ -289,13 +290,13 @@ class DebugValueUser {
}
private:
- void trackDebugValue(size_t Idx);
- void trackDebugValues();
+ LLVM_ABI void trackDebugValue(size_t Idx);
+ LLVM_ABI void trackDebugValues();
- void untrackDebugValue(size_t Idx);
- void untrackDebugValues();
+ LLVM_ABI void untrackDebugValue(size_t Idx);
+ LLVM_ABI void untrackDebugValues();
- void retrackDebugValues(DebugValueUser &X);
+ LLVM_ABI void retrackDebugValues(DebugValueUser &X);
};
/// API for tracking metadata references through RAUW and deletion.
@@ -351,7 +352,7 @@ class MetadataTracking {
///
/// Stops \c *MD from tracking \c MD.
static void untrack(Metadata *&MD) { untrack(&MD, *MD); }
- static void untrack(void *Ref, Metadata &MD);
+ LLVM_ABI static void untrack(void *Ref, Metadata &MD);
/// Move tracking from one reference to another.
///
@@ -364,10 +365,10 @@ class MetadataTracking {
static bool retrack(Metadata *&MD, Metadata *&New) {
return retrack(&MD, *MD, &New);
}
- static bool retrack(void *Ref, Metadata &MD, void *New);
+ LLVM_ABI static bool retrack(void *Ref, Metadata &MD, void *New);
/// Check whether metadata is replaceable.
- static bool isReplaceable(const Metadata &MD);
+ LLVM_ABI static bool isReplaceable(const Metadata &MD);
using OwnerTy = PointerUnion<MetadataAsValue *, Metadata *, DebugValueUser *>;
@@ -375,7 +376,7 @@ class MetadataTracking {
/// Track a reference to metadata for an owner.
///
/// Generalized version of tracking.
- static bool track(void *Ref, Metadata &MD, OwnerTy Owner);
+ LLVM_ABI static bool track(void *Ref, Metadata &MD, OwnerTy Owner);
};
/// Shared implementation of use-lists for replaceable metadata.
@@ -406,20 +407,20 @@ class ReplaceableMetadataImpl {
/// Replace all uses of this with MD.
///
/// Replace all uses of this with \c MD, which is allowed to be null.
- void replaceAllUsesWith(Metadata *MD);
+ LLVM_ABI void replaceAllUsesWith(Metadata *MD);
/// Replace all uses of the constant with Undef in debug info metadata
- static void SalvageDebugInfo(const Constant &C);
+ LLVM_ABI static void SalvageDebugInfo(const Constant &C);
/// Returns the list of all DIArgList users of this.
- SmallVector<Metadata *> getAllArgListUsers();
+ LLVM_ABI SmallVector<Metadata *> getAllArgListUsers();
/// Returns the list of all DbgVariableRecord users of this.
- SmallVector<DbgVariableRecord *> getAllDbgVariableRecordUsers();
+ LLVM_ABI SmallVector<DbgVariableRecord *> getAllDbgVariableRecordUsers();
/// Resolve all uses of this.
///
/// Resolve all uses of this, turning off RAUW permanently. If \c
/// ResolveUsers, call \a MDNode::resolve() on any users whose last operand
/// is resolved.
- void resolveAllUses(bool ResolveUsers = true);
+ LLVM_ABI void resolveAllUses(bool ResolveUsers = true);
unsigned getNumUses() const { return UseMap.size(); }
@@ -471,7 +472,7 @@ class ValueAsMetadata : public Metadata, ReplaceableMetadataImpl {
~ValueAsMetadata() = default;
public:
- static ValueAsMetadata *get(Value *V);
+ LLVM_ABI static ValueAsMetadata *get(Value *V);
static ConstantAsMetadata *getConstant(Value *C) {
return cast<ConstantAsMetadata>(get(C));
@@ -481,7 +482,7 @@ class ValueAsMetadata : public Metadata, ReplaceableMetadataImpl {
return cast<LocalAsMetadata>(get(Local));
}
- static ValueAsMetadata *getIfExists(Value *V);
+ LLVM_ABI static ValueAsMetadata *getIfExists(Value *V);
static ConstantAsMetadata *getConstantIfExists(Value *C) {
return cast_or_null<ConstantAsMetadata>(getIfExists(C));
@@ -502,8 +503,8 @@ class ValueAsMetadata : public Metadata, ReplaceableMetadataImpl {
return ReplaceableMetadataImpl::getAllDbgVariableRecordUsers();
}
- static void handleDeletion(Value *V);
- static void handleRAUW(Value *From, Value *To);
+ LLVM_ABI static void handleDeletion(Value *V);
+ LLVM_ABI static void handleRAUW(Value *From, Value *To);
protected:
/// Handle collisions after \a Value::replaceAllUsesWith().
@@ -726,12 +727,12 @@ class MDString : public Metadata {
MDString &operator=(MDString &&) = delete;
MDString &operator=(const MDString &) = delete;
- static MDString *get(LLVMContext &Context, StringRef Str);
+ LLVM_ABI static MDString *get(LLVMContext &Context, StringRef Str);
static MDString *get(LLVMContext &Context, const char *Str) {
return get(Context, Str ? StringRef(Str) : StringRef());
}
- StringRef getString() const;
+ LLVM_ABI StringRef getString() const;
unsigned getLength() const { return (unsigned)getString().size(); }
@@ -783,14 +784,14 @@ struct AAMDNodes {
MDNode *NoAlias = nullptr;
// Shift tbaa Metadata node to start off bytes later
- static MDNode *shiftTBAA(MDNode *M, size_t off);
+ LLVM_ABI static MDNode *shiftTBAA(MDNode *M, size_t off);
// Shift tbaa.struct Metadata node to start off bytes later
- static MDNode *shiftTBAAStruct(MDNode *M, size_t off);
+ LLVM_ABI static MDNode *shiftTBAAStruct(MDNode *M, size_t off);
// Extend tbaa Metadata node to apply to a series of bytes of length len.
// A size of -1 denotes an unknown size.
- static MDNode *extendToTBAA(MDNode *TBAA, ssize_t len);
+ LLVM_ABI static MDNode *extendToTBAA(MDNode *TBAA, ssize_t len);
/// Given two sets of AAMDNodes that apply to the same pointer,
/// give the best AAMDNodes that are compatible with both (i.e. a set of
@@ -835,22 +836,22 @@ struct AAMDNodes {
/// Given two sets of AAMDNodes applying to potentially different locations,
/// determine the best AAMDNodes that apply to both.
- AAMDNodes merge(const AAMDNodes &Other) const;
+ LLVM_ABI AAMDNodes merge(const AAMDNodes &Other) const;
/// Determine the best AAMDNodes after concatenating two different locations
/// together. Different from `merge`, where different locations should
/// overlap each other, `concat` puts non-overlapping locations together.
- AAMDNodes concat(const AAMDNodes &Other) const;
+ LLVM_ABI AAMDNodes concat(const AAMDNodes &Other) const;
/// Create a new AAMDNode for accessing \p AccessSize bytes of this AAMDNode.
/// If this AAMDNode has !tbaa.struct and \p AccessSize matches the size of
/// the field at offset 0, get the TBAA tag describing the accessed field.
/// If such an AAMDNode already embeds !tbaa, the existing one is retrieved.
/// Finally, !tbaa.struct is zeroed out.
- AAMDNodes adjustForAccess(unsigned AccessSize);
- AAMDNodes adjustForAccess(size_t Offset, Type *AccessTy,
+ LLVM_ABI AAMDNodes adjustForAccess(unsigned AccessSize);
+ LLVM_ABI AAMDNodes adjustForAccess(size_t Offset, Type *AccessTy,
const DataLayout &DL);
- AAMDNodes adjustForAccess(size_t Offset, unsigned AccessSize);
+ LLVM_ABI AAMDNodes adjustForAccess(size_t Offset, unsigned AccessSize);
};
// Specialize DenseMapInfo for AAMDNodes.
@@ -1128,7 +1129,7 @@ class MDNode : public Metadata {
sizeof(LargeStorageVector);
}
- void *getSmallPtr();
+ LLVM_ABI void *getSmallPtr();
LargeStorageVector &getLarge() {
assert(IsLarge);
@@ -1140,12 +1141,12 @@ class MDNode : public Metadata {
return *reinterpret_cast<const LargeStorageVector *>(getLargePtr());
}
- void resizeSmall(size_t NumOps);
- void resizeSmallToLarge(size_t NumOps);
- void resize(size_t NumOps);
+ LLVM_ABI void resizeSmall(size_t NumOps);
+ LLVM_ABI void resizeSmallToLarge(size_t NumOps);
+ LLVM_ABI void resize(size_t NumOps);
- explicit Header(size_t NumOps, StorageType Storage);
- ~Header();
+ LLVM_ABI explicit Header(size_t NumOps, StorageType Storage);
+ LLVM_ABI ~Header();
MutableArrayRef<MDOperand> operands() {
if (IsLarge)
@@ -1177,12 +1178,12 @@ class MDNode : public Metadata {
ContextAndReplaceableUses Context;
protected:
- MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
+ LLVM_ABI MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = {});
~MDNode() = default;
- void *operator new(size_t Size, size_t NumOps, StorageType Storage);
- void operator delete(void *Mem);
+ LLVM_ABI void *operator new(size_t Size, size_t NumOps, StorageType Storage);
+ LLVM_ABI void operator delete(void *Mem);
/// Required by std, but never called.
void operator delete(void *, unsigned) {
@@ -1194,7 +1195,7 @@ class MDNode : public Metadata {
llvm_unreachable("Constructor throws?");
}
- void dropAllReferences();
+ LLVM_ABI void dropAllReferences();
MDOperand *mutable_begin() { return getHeader().operands().begin(); }
MDOperand *mutable_end() { return getHeader().operands().end(); }
@@ -1219,18 +1220,18 @@ class MDNode : public Metadata {
ArrayRef<Metadata *> MDs);
/// Create a (temporary) clone of this.
- TempMDNode clone() const;
+ LLVM_ABI TempMDNode clone() const;
/// Deallocate a node created by getTemporary.
///
/// Calls \c replaceAllUsesWith(nullptr) before deleting, so any remaining
/// references will be reset.
- static void deleteTemporary(MDNode *N);
+ LLVM_ABI static void deleteTemporary(MDNode *N);
LLVMContext &getContext() const { return Context.getContext(); }
/// Replace a specific operand.
- void replaceOperandWith(unsigned I, Metadata *New);
+ LLVM_ABI void replaceOperandWith(unsigned I, Metadata *New);
/// Check if node is fully resolved.
///
@@ -1272,10 +1273,10 @@ class MDNode : public Metadata {
/// resolved.
///
/// \pre No operands (or operands' operands, etc.) have \a isTemporary().
- void resolveCycles();
+ LLVM_ABI void resolveCycles();
/// Resolve a unique, unresolved node.
- void resolve();
+ LLVM_ABI void resolve();
/// Replace a temporary node with a permanent one.
///
@@ -1316,8 +1317,8 @@ class MDNode : public Metadata {
/// If \c M is provided, metadata nodes will be numbered canonically;
/// otherwise, pointer addresses are substituted.
/// @{
- void printTree(raw_ostream &OS, const Module *M = nullptr) const;
- void printTree(raw_ostream &OS, ModuleSlotTracker &MST,
+ LLVM_ABI void printTree(raw_ostream &OS, const Module *M = nullptr) const;
+ LLVM_ABI void printTree(raw_ostream &OS, ModuleSlotTracker &MST,
const Module *M = nullptr) const;
/// @}
@@ -1330,8 +1331,8 @@ class MDNode : public Metadata {
/// the nullptr version is easy to call from a debugger.
///
/// @{
- void dumpTree() const;
- void dumpTree(const Module *M) const;
+ LLVM_ABI void dumpTree() const;
+ LLVM_ABI void dumpTree(const Module *M) const;
/// @}
private:
@@ -1343,12 +1344,12 @@ class MDNode : public Metadata {
/// Set an operand.
///
/// Sets the operand directly, without worrying about uniquing.
- void setOperand(unsigned I, Metadata *New);
+ LLVM_ABI void setOperand(unsigned I, Metadata *New);
unsigned getNumUnresolved() const { return getHeader().NumUnresolved; }
void setNumUnresolved(unsigned N) { getHeader().NumUnresolved = N; }
- void storeDistinctInContext();
+ LLVM_ABI void storeDistinctInContext();
template <class T, class StoreT>
static T *storeImpl(T *N, StorageType Storage, StoreT &Store);
template <class T> static T *storeImpl(T *N, StorageType Storage);
@@ -1445,24 +1446,24 @@ class MDNode : public Metadata {
}
/// Check whether MDNode is a vtable access.
- bool isTBAAVtableAccess() const;
+ LLVM_ABI bool isTBAAVtableAccess() const;
/// Methods for metadata merging.
- static MDNode *concatenate(MDNode *A, MDNode *B);
- static MDNode *intersect(MDNode *A, MDNode *B);
- static MDNode *getMostGenericTBAA(MDNode *A, MDNode *B);
- static MDNode *getMostGenericFPMath(MDNode *A, MDNode *B);
- static MDNode *getMostGenericRange(MDNode *A, MDNode *B);
- static MDNode *getMostGenericNoaliasAddrspace(MDNode *A, MDNode *B);
- static MDNode *getMostGenericAliasScope(MDNode *A, MDNode *B);
- static MDNode *getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *concatenate(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *intersect(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericTBAA(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericFPMath(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericRange(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericNoaliasAddrspace(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericAliasScope(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B);
/// Merge !prof metadata from two instructions.
/// Currently only implemented with direct callsites with branch weights.
- static MDNode *getMergedProfMetadata(MDNode *A, MDNode *B,
+ LLVM_ABI static MDNode *getMergedProfMetadata(MDNode *A, MDNode *B,
const Instruction *AInstr,
const Instruction *BInstr);
- static MDNode *getMergedMemProfMetadata(MDNode *A, MDNode *B);
- static MDNode *getMergedCallsiteMetadata(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMergedMemProfMetadata(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMergedCallsiteMetadata(MDNode *A, MDNode *B);
};
/// Tuple of metadata.
@@ -1484,7 +1485,7 @@ class MDTuple : public MDNode {
void setHash(unsigned Hash) { SubclassData32 = Hash; }
void recalculateHash();
- static MDTuple *getImpl(LLVMContext &Context, ArrayRef<Metadata *> MDs,
+ LLVM_ABI static MDTuple *getImpl(LLVMContext &Context, ArrayRef<Metadata *> MDs,
StorageType Storage, bool ShouldCreate = true);
TempMDTuple cloneImpl() const {
@@ -1786,29 +1787,29 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
public:
NamedMDNode(const NamedMDNode &) = delete;
- ~NamedMDNode();
+ LLVM_ABI ~NamedMDNode();
/// Drop all references and remove the node from parent module.
- void eraseFromParent();
+ LLVM_ABI void eraseFromParent();
/// Remove all uses and clear node vector.
void dropAllReferences() { clearOperands(); }
/// Drop all references to this node's operands.
- void clearOperands();
+ LLVM_ABI void clearOperands();
/// Get the module that holds this named metadata collection.
inline Module *getParent() { return Parent; }
inline const Module *getParent() const { return Parent; }
- MDNode *getOperand(unsigned i) const;
- unsigned getNumOperands() const;
- void addOperand(MDNode *M);
- void setOperand(unsigned I, MDNode *New);
- StringRef getName() const;
- void print(raw_ostream &ROS, bool IsForDebug = false) const;
- void print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ LLVM_ABI MDNode *getOperand(unsigned i) const;
+ LLVM_ABI unsigned getNumOperands() const;
+ LLVM_ABI void addOperand(MDNode *M);
+ LLVM_ABI void setOperand(unsigned I, MDNode *New);
+ LLVM_ABI StringRef getName() const;
+ LLVM_ABI void print(raw_ostream &ROS, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST,
bool IsForDebug = false) const;
- void dump() const;
+ LLVM_ABI void dump() const;
// ---------------------------------------------------------------------------
// Operand Iterator interface...
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 0dc8164b9c950..04590afa3b1ab 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_MODULE_H
#define LLVM_IR_MODULE_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
@@ -817,7 +818,7 @@ class LLVM_ABI Module {
NamedMDNode *CUs;
unsigned Idx;
- void SkipNoDebugCUs();
+ LLVM_ABI void SkipNoDebugCUs();
public:
using iterator_category = std::input_iterator_tag;
@@ -851,8 +852,8 @@ class LLVM_ABI Module {
return Idx != I.Idx;
}
- DICompileUnit *operator*() const;
- DICompileUnit *operator->() const;
+ LLVM_ABI DICompileUnit *operator*() const;
+ LLVM_ABI DICompileUnit *operator->() const;
};
debug_compile_units_iterator debug_compile_units_begin() const {
@@ -1065,7 +1066,7 @@ class LLVM_ABI Module {
/// Given "llvm.used" or "llvm.compiler.used" as a global name, collect the
/// initializer elements of that global in a SmallVector and return the global
/// itself.
-GlobalVariable *collectUsedGlobalVariables(const Module &M,
+LLVM_ABI GlobalVariable *collectUsedGlobalVariables(const Module &M,
SmallVectorImpl<GlobalValue *> &Vec,
bool CompilerUsed);
diff --git a/llvm/include/llvm/IR/ModuleSlotTracker.h b/llvm/include/llvm/IR/ModuleSlotTracker.h
index 37cfc0f07280c..a3882a81e1177 100644
--- a/llvm/include/llvm/IR/ModuleSlotTracker.h
+++ b/llvm/include/llvm/IR/ModuleSlotTracker.h
@@ -9,6 +9,7 @@
#ifndef LLVM_IR_MODULESLOTTRACKER_H
#define LLVM_IR_MODULESLOTTRACKER_H
+#include "llvm/Support/Compiler.h"
#include <functional>
#include <memory>
#include <utility>
@@ -23,7 +24,7 @@ class Value;
class MDNode;
/// Abstract interface of slot tracker storage.
-class AbstractSlotTrackerStorage {
+class LLVM_ABI AbstractSlotTrackerStorage {
public:
virtual ~AbstractSlotTrackerStorage();
@@ -41,7 +42,7 @@ class AbstractSlotTrackerStorage {
///
/// If the IR changes from underneath \a ModuleSlotTracker, strings like
/// "<badref>" will be printed, or, worse, the wrong slots entirely.
-class ModuleSlotTracker {
+class LLVM_ABI ModuleSlotTracker {
/// Storage for a slot tracker.
std::unique_ptr<SlotTracker> MachineStorage;
bool ShouldCreateStorage = false;
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 65e428a3adea7..d69f7de4bb9eb 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -249,14 +249,14 @@ struct ValueInfo {
/// Returns the most constraining visibility among summaries. The
/// visibilities, ordered from least to most constraining, are: default,
/// protected and hidden.
- GlobalValue::VisibilityTypes getELFVisibility() const;
+ LLVM_ABI GlobalValue::VisibilityTypes getELFVisibility() const;
/// Checks if all summaries are DSO local (have the flag set). When DSOLocal
/// propagation has been done, set the parameter to enable fast check.
- bool isDSOLocal(bool WithDSOLocalPropagation = false) const;
+ LLVM_ABI bool isDSOLocal(bool WithDSOLocalPropagation = false) const;
/// Checks if all copies are eligible for auto-hiding (have flag set).
- bool canAutoHide() const;
+ LLVM_ABI bool canAutoHide() const;
};
inline raw_ostream &operator<<(raw_ostream &OS, const ValueInfo &VI) {
@@ -873,7 +873,7 @@ class FunctionSummary : public GlobalValueSummary {
}
/// A dummy node to reference external functions that aren't in the index
- static FunctionSummary ExternalNode;
+ LLVM_ABI static FunctionSummary ExternalNode;
private:
/// Number of instructions (ignoring debug instructions, e.g.) computed
@@ -943,7 +943,7 @@ class FunctionSummary : public GlobalValueSummary {
Allocs = std::make_unique<AllocsTy>(std::move(AllocList));
}
// Gets the number of readonly and writeonly refs in RefEdgeList
- std::pair<unsigned, unsigned> specialRefCounts() const;
+ LLVM_ABI std::pair<unsigned, unsigned> specialRefCounts() const;
/// Check if this is a function summary.
static bool classof(const GlobalValueSummary *GVS) {
@@ -1527,8 +1527,8 @@ class ModuleSummaryIndex {
bool haveGVs() const { return HaveGVs; }
- uint64_t getFlags() const;
- void setFlags(uint64_t Flags);
+ LLVM_ABI uint64_t getFlags() const;
+ LLVM_ABI void setFlags(uint64_t Flags);
uint64_t getBlockCount() const { return BlockCount; }
void addBlockCount(uint64_t C) { BlockCount += C; }
@@ -1672,7 +1672,7 @@ class ModuleSummaryIndex {
bool isGlobalValueLive(const GlobalValueSummary *GVS) const {
return !WithGlobalValueDeadStripping || GVS->isLive();
}
- bool isGUIDLive(GlobalValue::GUID GUID) const;
+ LLVM_ABI bool isGUIDLive(GlobalValue::GUID GUID) const;
/// Return a ValueInfo for the index value_type (convenient when iterating
/// index).
@@ -1796,7 +1796,7 @@ class ModuleSummaryIndex {
/// Returns the first GlobalValueSummary for \p ValueGUID, asserting that
/// there
/// is only one if \p PerModuleIndex.
- GlobalValueSummary *getGlobalValueSummary(GlobalValue::GUID ValueGUID,
+ LLVM_ABI GlobalValueSummary *getGlobalValueSummary(GlobalValue::GUID ValueGUID,
bool PerModuleIndex = true) const;
/// Table of modules, containing module hash and id.
@@ -1925,7 +1925,7 @@ class ModuleSummaryIndex {
/// Collect for the given module the list of functions it defines
/// (GUID -> Summary).
- void collectDefinedFunctionsForModule(StringRef ModulePath,
+ LLVM_ABI void collectDefinedFunctionsForModule(StringRef ModulePath,
GVSummaryMapTy &GVSummaryMap) const;
/// Collect for each module the list of Summaries it defines (GUID ->
@@ -1942,28 +1942,28 @@ class ModuleSummaryIndex {
}
/// Print to an output stream.
- void print(raw_ostream &OS, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &OS, bool IsForDebug = false) const;
/// Dump to stderr (for debugging).
- void dump() const;
+ LLVM_ABI void dump() const;
/// Export summary to dot file for GraphViz.
- void
+ LLVM_ABI void
exportToDot(raw_ostream &OS,
const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols) const;
/// Print out strongly connected components for debugging.
- void dumpSCCs(raw_ostream &OS);
+ LLVM_ABI void dumpSCCs(raw_ostream &OS);
/// Do the access attribute and DSOLocal propagation in combined index.
- void propagateAttributes(const DenseSet<GlobalValue::GUID> &PreservedSymbols);
+ LLVM_ABI void propagateAttributes(const DenseSet<GlobalValue::GUID> &PreservedSymbols);
/// Checks if we can import global variable from another module.
- bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs) const;
+ LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs) const;
/// Same as above but checks whether the global var is importable as a
/// declaration.
- bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs,
+ LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs,
bool &CanImportDecl) const;
};
diff --git a/llvm/include/llvm/IR/NoFolder.h b/llvm/include/llvm/IR/NoFolder.h
index 2a2318dfd7863..afabe0f7e843f 100644
--- a/llvm/include/llvm/IR/NoFolder.h
+++ b/llvm/include/llvm/IR/NoFolder.h
@@ -21,6 +21,7 @@
#ifndef LLVM_IR_NOFOLDER_H
#define LLVM_IR_NOFOLDER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/FMF.h"
@@ -32,7 +33,7 @@
namespace llvm {
/// NoFolder - Create "constants" (actually, instructions) with no folding.
-class NoFolder final : public IRBuilderFolder {
+class LLVM_ABI NoFolder final : public IRBuilderFolder {
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
public:
diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h
index 38f84647ec74e..065666dbff65d 100644
--- a/llvm/include/llvm/IR/Operator.h
+++ b/llvm/include/llvm/IR/Operator.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_OPERATOR_H
#define LLVM_IR_OPERATOR_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/FMF.h"
@@ -63,12 +64,12 @@ class Operator : public User {
/// Return true if this operator has flags which may cause this operator
/// to evaluate to poison despite having non-poison inputs.
- bool hasPoisonGeneratingFlags() const;
+ LLVM_ABI bool hasPoisonGeneratingFlags() const;
/// Return true if this operator has poison-generating flags,
/// return attributes or metadata. The latter two is only possible for
/// instructions.
- bool hasPoisonGeneratingAnnotations() const;
+ LLVM_ABI bool hasPoisonGeneratingAnnotations() const;
};
/// Utility class for integer operators which may exhibit overflow - Add, Sub,
@@ -336,7 +337,7 @@ class FPMathOperator : public Operator {
/// Get the maximum error permitted by this operation in ULPs. An accuracy of
/// 0.0 means that the operation should be performed with the default
/// precision.
- float getFPAccuracy() const;
+ LLVM_ABI float getFPAccuracy() const;
/// Returns true if `Ty` is a supported floating-point type for phi, select,
/// or call FPMathOperators.
@@ -438,7 +439,7 @@ class GEPOperator
/// Returns the offset of the index with an inrange attachment, or
/// std::nullopt if none.
- std::optional<ConstantRange> getInRange() const;
+ LLVM_ABI std::optional<ConstantRange> getInRange() const;
inline op_iterator idx_begin() { return op_begin()+1; }
inline const_op_iterator idx_begin() const { return op_begin()+1; }
@@ -468,8 +469,8 @@ class GEPOperator
return getPointerOperand()->getType();
}
- Type *getSourceElementType() const;
- Type *getResultElementType() const;
+ LLVM_ABI Type *getSourceElementType() const;
+ LLVM_ABI Type *getResultElementType() const;
/// Method to return the address space of the pointer operand.
unsigned getPointerAddressSpace() const {
@@ -515,7 +516,7 @@ class GEPOperator
}
/// Compute the maximum alignment that this GEP is garranteed to preserve.
- Align getMaxPreservedAlignment(const DataLayout &DL) const;
+ LLVM_ABI Align getMaxPreservedAlignment(const DataLayout &DL) const;
/// Accumulate the constant address offset of this GEP if possible.
///
@@ -534,18 +535,18 @@ class GEPOperator
///
/// The APInt passed into this routine must be at exactly as wide as the
/// IntPtr type for the address space of the base GEP pointer.
- bool accumulateConstantOffset(
+ LLVM_ABI bool accumulateConstantOffset(
const DataLayout &DL, APInt &Offset,
function_ref<bool(Value &, APInt &)> ExternalAnalysis = nullptr) const;
- static bool accumulateConstantOffset(
+ LLVM_ABI static bool accumulateConstantOffset(
Type *SourceType, ArrayRef<const Value *> Index, const DataLayout &DL,
APInt &Offset,
function_ref<bool(Value &, APInt &)> ExternalAnalysis = nullptr);
/// Collect the offset of this GEP as a map of Values to their associated
/// APInt multipliers, as well as a total Constant Offset.
- bool collectOffset(const DataLayout &DL, unsigned BitWidth,
+ LLVM_ABI bool collectOffset(const DataLayout &DL, unsigned BitWidth,
SmallMapVector<Value *, APInt, 4> &VariableOffsets,
APInt &ConstantOffset) const;
};
diff --git a/llvm/include/llvm/IR/OptBisect.h b/llvm/include/llvm/IR/OptBisect.h
index 507d415d5e112..1064eacd203ed 100644
--- a/llvm/include/llvm/IR/OptBisect.h
+++ b/llvm/include/llvm/IR/OptBisect.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_OPTBISECT_H
#define LLVM_IR_OPTBISECT_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include <limits>
@@ -40,7 +41,7 @@ class OptPassGate {
/// optimizations at compile time based on a command line option
/// (-opt-bisect-limit) in order to perform a bisecting search for
/// optimization-related problems.
-class OptBisect : public OptPassGate {
+class LLVM_ABI OptBisect : public OptPassGate {
public:
/// Default constructor. Initializes the state to "disabled". The bisection
/// will be enabled by the cl::opt call-back when the command line option
@@ -83,7 +84,7 @@ class OptBisect : public OptPassGate {
/// Singleton instance of the OptBisect class, so multiple pass managers don't
/// need to coordinate their uses of OptBisect.
-OptPassGate &getGlobalPassGate();
+LLVM_ABI OptPassGate &getGlobalPassGate();
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/PassInstrumentation.h b/llvm/include/llvm/IR/PassInstrumentation.h
index 3172cefe7e8ca..de7ffd6de77f9 100644
--- a/llvm/include/llvm/IR/PassInstrumentation.h
+++ b/llvm/include/llvm/IR/PassInstrumentation.h
@@ -163,9 +163,9 @@ class PassInstrumentationCallbacks {
}
/// Add a class name to pass name mapping for use by pass instrumentation.
- void addClassToPassName(StringRef ClassName, StringRef PassName);
+ LLVM_ABI void addClassToPassName(StringRef ClassName, StringRef PassName);
/// Get the pass name for a given pass class name.
- StringRef getPassNameForClassName(StringRef ClassName);
+ LLVM_ABI StringRef getPassNameForClassName(StringRef ClassName);
private:
friend class PassInstrumentation;
@@ -344,7 +344,7 @@ class PassInstrumentation {
}
};
-bool isSpecialPass(StringRef PassID, const std::vector<StringRef> &Specials);
+LLVM_ABI bool isSpecialPass(StringRef PassID, const std::vector<StringRef> &Specials);
/// Pseudo-analysis pass that exposes the \c PassInstrumentation to pass
/// managers.
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index b5230047b0e12..960991513526a 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -37,6 +37,7 @@
#ifndef LLVM_IR_PASSMANAGER_H
#define LLVM_IR_PASSMANAGER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -229,7 +230,7 @@ template <typename IRUnitT>
void printIRUnitNameForStackTrace(raw_ostream &OS, const IRUnitT &IR);
template <>
-void printIRUnitNameForStackTrace<Module>(raw_ostream &OS, const Module &IR);
+LLVM_ABI void printIRUnitNameForStackTrace<Module>(raw_ostream &OS, const Module &IR);
extern template class PassManager<Module>;
@@ -237,7 +238,7 @@ extern template class PassManager<Module>;
using ModulePassManager = PassManager<Module>;
template <>
-void printIRUnitNameForStackTrace<Function>(raw_ostream &OS,
+LLVM_ABI void printIRUnitNameForStackTrace<Function>(raw_ostream &OS,
const Function &IR);
extern template class PassManager<Function>;
@@ -650,7 +651,7 @@ using FunctionAnalysisManagerModuleProxy =
/// Specialization of the invalidate method for the \c
/// FunctionAnalysisManagerModuleProxy's result.
template <>
-bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
+LLVM_ABI bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
Module &M, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &Inv);
@@ -834,8 +835,8 @@ class ModuleToFunctionPassAdaptor
: Pass(std::move(Pass)), EagerlyInvalidate(EagerlyInvalidate) {}
/// Runs the function pass across every function in the module.
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
- void printPipeline(raw_ostream &OS,
+ LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+ LLVM_ABI void printPipeline(raw_ostream &OS,
function_ref<StringRef(StringRef)> MapClassName2PassName);
static bool isRequired() { return true; }
diff --git a/llvm/include/llvm/IR/PassManagerImpl.h b/llvm/include/llvm/IR/PassManagerImpl.h
index 55f504c921852..d833f2c06a76d 100644
--- a/llvm/include/llvm/IR/PassManagerImpl.h
+++ b/llvm/include/llvm/IR/PassManagerImpl.h
@@ -15,13 +15,14 @@
#ifndef LLVM_IR_PASSMANAGERIMPL_H
#define LLVM_IR_PASSMANAGERIMPL_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/PassInstrumentation.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/PrettyStackTrace.h"
-extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
namespace llvm {
diff --git a/llvm/include/llvm/IR/PassTimingInfo.h b/llvm/include/llvm/IR/PassTimingInfo.h
index b47ba7f16ef37..8f05b10ea1e27 100644
--- a/llvm/include/llvm/IR/PassTimingInfo.h
+++ b/llvm/include/llvm/IR/PassTimingInfo.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_PASSTIMINGINFO_H
#define LLVM_IR_PASSTIMINGINFO_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
@@ -31,10 +32,10 @@ class raw_ostream;
/// If -time-passes has been specified, report the timings immediately and then
/// reset the timers to zero. By default it uses the stream created by
/// CreateInfoOutputFile().
-void reportAndResetTimings(raw_ostream *OutStream = nullptr);
+LLVM_ABI void reportAndResetTimings(raw_ostream *OutStream = nullptr);
/// Request the timer for this legacy-pass-manager's pass instance.
-Timer *getPassTimer(Pass *);
+LLVM_ABI Timer *getPassTimer(Pass *);
/// This class implements -time-passes functionality for new pass manager.
/// It provides the pass-instrumentation callbacks that measure the pass
@@ -78,20 +79,20 @@ class TimePassesHandler {
static constexpr StringRef AnalysisGroupDesc =
"Analysis execution timing report";
- TimePassesHandler();
- TimePassesHandler(bool Enabled, bool PerRun = false);
+ LLVM_ABI TimePassesHandler();
+ LLVM_ABI TimePassesHandler(bool Enabled, bool PerRun = false);
/// Prints out timing information and then resets the timers.
- void print();
+ LLVM_ABI void print();
// We intend this to be unique per-compilation, thus no copies.
TimePassesHandler(const TimePassesHandler &) = delete;
void operator=(const TimePassesHandler &) = delete;
- void registerCallbacks(PassInstrumentationCallbacks &PIC);
+ LLVM_ABI void registerCallbacks(PassInstrumentationCallbacks &PIC);
/// Set a custom output stream for subsequent reporting.
- void setOutStream(raw_ostream &OutStream);
+ LLVM_ABI void setOutStream(raw_ostream &OutStream);
private:
/// Dumps information for running/triggered timers, useful for debugging
diff --git a/llvm/include/llvm/IR/ProfDataUtils.h b/llvm/include/llvm/IR/ProfDataUtils.h
index 0bea517df832e..4c6d7bc0c48b1 100644
--- a/llvm/include/llvm/IR/ProfDataUtils.h
+++ b/llvm/include/llvm/IR/ProfDataUtils.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_PROFDATAUTILS_H
#define LLVM_IR_PROFDATAUTILS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Metadata.h"
@@ -22,51 +23,51 @@
namespace llvm {
/// Checks if an Instruction has MD_prof Metadata
-bool hasProfMD(const Instruction &I);
+LLVM_ABI bool hasProfMD(const Instruction &I);
/// Checks if an MDNode contains Branch Weight Metadata
-bool isBranchWeightMD(const MDNode *ProfileData);
+LLVM_ABI bool isBranchWeightMD(const MDNode *ProfileData);
/// Checks if an instructions has Branch Weight Metadata
///
/// \param I The instruction to check
/// \returns True if I has an MD_prof node containing Branch Weights. False
/// otherwise.
-bool hasBranchWeightMD(const Instruction &I);
+LLVM_ABI bool hasBranchWeightMD(const Instruction &I);
/// Checks if an instructions has valid Branch Weight Metadata
///
/// \param I The instruction to check
/// \returns True if I has an MD_prof node containing valid Branch Weights,
/// i.e., one weight for each successor. False otherwise.
-bool hasValidBranchWeightMD(const Instruction &I);
+LLVM_ABI bool hasValidBranchWeightMD(const Instruction &I);
/// Get the branch weights metadata node
///
/// \param I The Instruction to get the weights from.
/// \returns A pointer to I's branch weights metadata node, if it exists.
/// Nullptr otherwise.
-MDNode *getBranchWeightMDNode(const Instruction &I);
+LLVM_ABI MDNode *getBranchWeightMDNode(const Instruction &I);
/// Get the valid branch weights metadata node
///
/// \param I The Instruction to get the weights from.
/// \returns A pointer to I's valid branch weights metadata node, if it exists.
/// Nullptr otherwise.
-MDNode *getValidBranchWeightMDNode(const Instruction &I);
+LLVM_ABI MDNode *getValidBranchWeightMDNode(const Instruction &I);
/// Check if Branch Weight Metadata has an "expected" field from an llvm.expect*
/// intrinsic
-bool hasBranchWeightOrigin(const Instruction &I);
+LLVM_ABI bool hasBranchWeightOrigin(const Instruction &I);
/// Check if Branch Weight Metadata has an "expected" field from an llvm.expect*
/// intrinsic
-bool hasBranchWeightOrigin(const MDNode *ProfileData);
+LLVM_ABI bool hasBranchWeightOrigin(const MDNode *ProfileData);
/// Return the offset to the first branch weight data
-unsigned getBranchWeightOffset(const MDNode *ProfileData);
+LLVM_ABI unsigned getBranchWeightOffset(const MDNode *ProfileData);
-unsigned getNumBranchWeights(const MDNode &ProfileData);
+LLVM_ABI unsigned getNumBranchWeights(const MDNode &ProfileData);
/// Extract branch weights from MD_prof metadata
///
@@ -74,17 +75,17 @@ unsigned getNumBranchWeights(const MDNode &ProfileData);
/// \param [out] Weights An output vector to fill with branch weights
/// \returns True if weights were extracted, False otherwise. When false Weights
/// will be cleared.
-bool extractBranchWeights(const MDNode *ProfileData,
+LLVM_ABI bool extractBranchWeights(const MDNode *ProfileData,
SmallVectorImpl<uint32_t> &Weights);
/// Faster version of extractBranchWeights() that skips checks and must only
/// be called with "branch_weights" metadata nodes. Supports uint32_t.
-void extractFromBranchWeightMD32(const MDNode *ProfileData,
+LLVM_ABI void extractFromBranchWeightMD32(const MDNode *ProfileData,
SmallVectorImpl<uint32_t> &Weights);
/// Faster version of extractBranchWeights() that skips checks and must only
/// be called with "branch_weights" metadata nodes. Supports uint64_t.
-void extractFromBranchWeightMD64(const MDNode *ProfileData,
+LLVM_ABI void extractFromBranchWeightMD64(const MDNode *ProfileData,
SmallVectorImpl<uint64_t> &Weights);
/// Extract branch weights attatched to an Instruction
@@ -93,7 +94,7 @@ void extractFromBranchWeightMD64(const MDNode *ProfileData,
/// \param [out] Weights An output vector to fill with branch weights
/// \returns True if weights were extracted, False otherwise. When false Weights
/// will be cleared.
-bool extractBranchWeights(const Instruction &I,
+LLVM_ABI bool extractBranchWeights(const Instruction &I,
SmallVectorImpl<uint32_t> &Weights);
/// Extract branch weights from a conditional branch or select Instruction.
@@ -103,7 +104,7 @@ bool extractBranchWeights(const Instruction &I,
/// \param [out] FalseVal will contain the branch weight for the False branch
/// \returns True on success with profile weights filled in. False if no
/// metadata or invalid metadata was found.
-bool extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
+LLVM_ABI bool extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
uint64_t &FalseVal);
/// Retrieve the total of all weights from MD_prof data.
@@ -112,7 +113,7 @@ bool extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
/// \param [out] TotalWeights input variable to fill with total weights
/// \returns True on success with profile total weights filled in. False if no
/// metadata was found.
-bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalWeights);
+LLVM_ABI bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalWeights);
/// Retrieve the total of all weights from an instruction.
///
@@ -120,18 +121,18 @@ bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalWeights);
/// \param [out] TotalWeights input variable to fill with total weights
/// \returns True on success with profile total weights filled in. False if no
/// metadata was found.
-bool extractProfTotalWeight(const Instruction &I, uint64_t &TotalWeights);
+LLVM_ABI bool extractProfTotalWeight(const Instruction &I, uint64_t &TotalWeights);
/// Create a new `branch_weights` metadata node and add or overwrite
/// a `prof` metadata reference to instruction `I`.
/// \param I the Instruction to set branch weights on.
/// \param Weights an array of weights to set on instruction I.
/// \param IsExpected were these weights added from an llvm.expect* intrinsic.
-void setBranchWeights(Instruction &I, ArrayRef<uint32_t> Weights,
+LLVM_ABI void setBranchWeights(Instruction &I, ArrayRef<uint32_t> Weights,
bool IsExpected);
/// Scaling the profile data attached to 'I' using the ratio of S/T.
-void scaleProfData(Instruction &I, uint64_t S, uint64_t T);
+LLVM_ABI void scaleProfData(Instruction &I, uint64_t S, uint64_t T);
} // namespace llvm
#endif
diff --git a/llvm/include/llvm/IR/ProfileSummary.h b/llvm/include/llvm/IR/ProfileSummary.h
index b23d5a30846a2..1325bb120868e 100644
--- a/llvm/include/llvm/IR/ProfileSummary.h
+++ b/llvm/include/llvm/IR/ProfileSummary.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_PROFILESUMMARY_H
#define LLVM_IR_PROFILESUMMARY_H
+#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
@@ -81,10 +82,10 @@ class ProfileSummary {
Kind getKind() const { return PSK; }
/// Return summary information as metadata.
- Metadata *getMD(LLVMContext &Context, bool AddPartialField = true,
+ LLVM_ABI Metadata *getMD(LLVMContext &Context, bool AddPartialField = true,
bool AddPartialProfileRatioField = true);
/// Construct profile summary from metdata.
- static ProfileSummary *getFromMD(Metadata *MD);
+ LLVM_ABI static ProfileSummary *getFromMD(Metadata *MD);
const SummaryEntryVector &getDetailedSummary() { return DetailedSummary; }
uint32_t getNumFunctions() const { return NumFunctions; }
uint64_t getMaxFunctionCount() const { return MaxFunctionCount; }
@@ -99,8 +100,8 @@ class ProfileSummary {
assert(isPartialProfile() && "Unexpected when not partial profile");
PartialProfileRatio = R;
}
- void printSummary(raw_ostream &OS) const;
- void printDetailedSummary(raw_ostream &OS) const;
+ LLVM_ABI void printSummary(raw_ostream &OS) const;
+ LLVM_ABI void printDetailedSummary(raw_ostream &OS) const;
};
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/PseudoProbe.h b/llvm/include/llvm/IR/PseudoProbe.h
index 7308904da3fd3..5c652b14650d5 100644
--- a/llvm/include/llvm/IR/PseudoProbe.h
+++ b/llvm/include/llvm/IR/PseudoProbe.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_PSEUDOPROBE_H
#define LLVM_IR_PSEUDOPROBE_H
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstdint>
#include <limits>
@@ -133,9 +134,9 @@ static inline bool hasDiscriminator(uint32_t Flags) {
return Flags & (uint32_t)PseudoProbeAttributes::HasDiscriminator;
}
-std::optional<PseudoProbe> extractProbe(const Instruction &Inst);
+LLVM_ABI std::optional<PseudoProbe> extractProbe(const Instruction &Inst);
-void setProbeDistributionFactor(Instruction &Inst, float Factor);
+LLVM_ABI void setProbeDistributionFactor(Instruction &Inst, float Factor);
} // end namespace llvm
#endif // LLVM_IR_PSEUDOPROBE_H
diff --git a/llvm/include/llvm/IR/ReplaceConstant.h b/llvm/include/llvm/IR/ReplaceConstant.h
index 8c497eb4022c3..5820d44d9668f 100644
--- a/llvm/include/llvm/IR/ReplaceConstant.h
+++ b/llvm/include/llvm/IR/ReplaceConstant.h
@@ -33,7 +33,7 @@ class Function;
///
/// If \p IncludeSelf is enabled, also convert the passed constants themselves
/// to instructions, rather than only their users.
-bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
+LLVM_ABI bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
Function *RestrictToFunc = nullptr,
bool RemoveDeadConstants = true,
bool IncludeSelf = false);
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index b3648f5a31e2a..afb366da4c43a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
#define LLVM_IR_RUNTIME_LIBCALLS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/Support/AtomicOrdering.h"
@@ -96,7 +97,7 @@ struct RuntimeLibcallsInfo {
/// Set default libcall names. If a target wants to opt-out of a libcall it
/// should be placed here.
- void initLibcalls(const Triple &TT);
+ LLVM_ABI void initLibcalls(const Triple &TT);
};
} // namespace RTLIB
diff --git a/llvm/include/llvm/IR/StructuralHash.h b/llvm/include/llvm/IR/StructuralHash.h
index 514dd6f174b90..2b955d55b076f 100644
--- a/llvm/include/llvm/IR/StructuralHash.h
+++ b/llvm/include/llvm/IR/StructuralHash.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_STRUCTURALHASH_H
#define LLVM_IR_STRUCTURALHASH_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StableHashing.h"
#include "llvm/IR/Instruction.h"
@@ -29,16 +30,16 @@ class Module;
/// \param DetailedHash Whether or not to encode additional information in the
/// hash. The additional information added into the hash when this flag is set
/// to true includes instruction and operand type information.
-stable_hash StructuralHash(const Function &F, bool DetailedHash = false);
+LLVM_ABI stable_hash StructuralHash(const Function &F, bool DetailedHash = false);
/// Returns a hash of the global variable \p G.
-stable_hash StructuralHash(const GlobalVariable &G);
+LLVM_ABI stable_hash StructuralHash(const GlobalVariable &G);
/// Returns a hash of the module \p M by hashing all functions and global
/// variables contained within. \param M The module to hash. \param DetailedHash
/// Whether or not to encode additional information in the function hashes that
/// composed the module hash.
-stable_hash StructuralHash(const Module &M, bool DetailedHash = false);
+LLVM_ABI stable_hash StructuralHash(const Module &M, bool DetailedHash = false);
/// The pair of an instruction index and a operand index.
using IndexPair = std::pair<unsigned, unsigned>;
@@ -80,7 +81,7 @@ struct FunctionHashInfo {
/// \param IgnoreOp A callable that takes an instruction and an operand index,
/// and returns true if the operand should be ignored in the hash computation.
/// \return A FunctionHashInfo structure
-FunctionHashInfo StructuralHashWithDifferences(const Function &F,
+LLVM_ABI FunctionHashInfo StructuralHashWithDifferences(const Function &F,
IgnoreOperandFunc IgnoreOp);
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 37f6b2ed8ee68..3d2d2906e6be3 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -119,10 +119,10 @@ class Type {
/// When \p NoDetails is true, we only print %st.
/// Put differently, \p NoDetails prints the type as if
/// inlined with the operands when printing an instruction.
- void print(raw_ostream &O, bool IsForDebug = false,
+ LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false,
bool NoDetails = false) const;
- void dump() const;
+ LLVM_ABI void dump() const;
/// Return the LLVMContext in which this type was uniqued.
LLVMContext &getContext() const { return Context; }
@@ -194,7 +194,7 @@ class Type {
return getTypeID() == PPC_FP128TyID;
}
- const fltSemantics &getFltSemantics() const;
+ LLVM_ABI const fltSemantics &getFltSemantics() const;
/// Return true if this is X86 AMX.
bool isX86_AMXTy() const { return getTypeID() == X86_AMXTyID; }
@@ -203,23 +203,23 @@ class Type {
bool isTargetExtTy() const { return getTypeID() == TargetExtTyID; }
/// Return true if this is a target extension type with a scalable layout.
- bool isScalableTargetExtTy() const;
+ LLVM_ABI bool isScalableTargetExtTy() const;
/// Return true if this is a type whose size is a known multiple of vscale.
- bool isScalableTy(SmallPtrSetImpl<const Type *> &Visited) const;
- bool isScalableTy() const;
+ LLVM_ABI bool isScalableTy(SmallPtrSetImpl<const Type *> &Visited) const;
+ LLVM_ABI bool isScalableTy() const;
/// Return true if this type is or contains a target extension type that
/// disallows being used as a global.
- bool
+ LLVM_ABI bool
containsNonGlobalTargetExtType(SmallPtrSetImpl<const Type *> &Visited) const;
- bool containsNonGlobalTargetExtType() const;
+ LLVM_ABI bool containsNonGlobalTargetExtType() const;
/// Return true if this type is or contains a target extension type that
/// disallows being used as a local.
- bool
+ LLVM_ABI bool
containsNonLocalTargetExtType(SmallPtrSetImpl<const Type *> &Visited) const;
- bool containsNonLocalTargetExtType() const;
+ LLVM_ABI bool containsNonLocalTargetExtType() const;
/// Return true if this is a FP type or a vector of FP.
bool isFPOrFPVectorTy() const { return getScalarType()->isFloatingPointTy(); }
@@ -237,7 +237,7 @@ class Type {
bool isIntegerTy() const { return getTypeID() == IntegerTyID; }
/// Return true if this is an IntegerType of the given width.
- bool isIntegerTy(unsigned Bitwidth) const;
+ LLVM_ABI bool isIntegerTy(unsigned Bitwidth) const;
/// Return true if this is an integer type or a vector of integer types.
bool isIntOrIntVectorTy() const { return getScalarType()->isIntegerTy(); }
@@ -272,21 +272,21 @@ class Type {
}
// True if this is an instance of TargetExtType of RISC-V vector tuple.
- bool isRISCVVectorTupleTy() const;
+ LLVM_ABI bool isRISCVVectorTupleTy() const;
/// Return true if this type could be converted with a lossless BitCast to
/// type 'Ty'. For example, i8* to i32*. BitCasts are valid for types of the
/// same size only where no re-interpretation of the bits is done.
/// Determine if this type could be losslessly bitcast to Ty
- bool canLosslesslyBitCastTo(Type *Ty) const;
+ LLVM_ABI bool canLosslesslyBitCastTo(Type *Ty) const;
/// Return true if this type is empty, that is, it has no elements or all of
/// its elements are empty.
- bool isEmptyTy() const;
+ LLVM_ABI bool isEmptyTy() const;
/// Return true if the type is "first class", meaning it is a valid type for a
/// Value.
- bool isFirstClassType() const;
+ LLVM_ABI bool isFirstClassType() const;
/// Return true if the type is a valid type for a register in codegen. This
/// includes all first-class types except struct and array types.
@@ -332,17 +332,17 @@ class Type {
/// instance of the type is stored to memory. The DataLayout class provides
/// additional query functions to provide this information.
///
- TypeSize getPrimitiveSizeInBits() const LLVM_READONLY;
+ LLVM_ABI TypeSize getPrimitiveSizeInBits() const LLVM_READONLY;
/// If this is a vector type, return the getPrimitiveSizeInBits value for the
/// element type. Otherwise return the getPrimitiveSizeInBits value for this
/// type.
- unsigned getScalarSizeInBits() const LLVM_READONLY;
+ LLVM_ABI unsigned getScalarSizeInBits() const LLVM_READONLY;
/// Return the width of the mantissa of this type. This is only valid on
/// floating-point types. If the FP type does not have a stable mantissa (e.g.
/// ppc long double), this method returns -1.
- int getFPMantissaWidth() const;
+ LLVM_ABI int getFPMantissaWidth() const;
/// If this is a vector type, return the element type, otherwise return
/// 'this'.
@@ -390,40 +390,40 @@ class Type {
// only intended to cover the core methods that are frequently used, helper
// methods should not be added here.
- inline unsigned getIntegerBitWidth() const;
+ LLVM_ABI inline unsigned getIntegerBitWidth() const;
- inline Type *getFunctionParamType(unsigned i) const;
- inline unsigned getFunctionNumParams() const;
- inline bool isFunctionVarArg() const;
+ LLVM_ABI inline Type *getFunctionParamType(unsigned i) const;
+ LLVM_ABI inline unsigned getFunctionNumParams() const;
+ LLVM_ABI inline bool isFunctionVarArg() const;
- inline StringRef getStructName() const;
- inline unsigned getStructNumElements() const;
- inline Type *getStructElementType(unsigned N) const;
+ LLVM_ABI inline StringRef getStructName() const;
+ LLVM_ABI inline unsigned getStructNumElements() const;
+ LLVM_ABI inline Type *getStructElementType(unsigned N) const;
- inline uint64_t getArrayNumElements() const;
+ LLVM_ABI inline uint64_t getArrayNumElements() const;
Type *getArrayElementType() const {
assert(getTypeID() == ArrayTyID);
return ContainedTys[0];
}
- inline StringRef getTargetExtName() const;
+ LLVM_ABI inline StringRef getTargetExtName() const;
/// Given vector type, change the element type,
/// whilst keeping the old number of elements.
/// For non-vectors simply returns \p EltTy.
- inline Type *getWithNewType(Type *EltTy) const;
+ LLVM_ABI inline Type *getWithNewType(Type *EltTy) const;
/// Given an integer or vector type, change the lane bitwidth to NewBitwidth,
/// whilst keeping the old number of lanes.
- inline Type *getWithNewBitWidth(unsigned NewBitWidth) const;
+ LLVM_ABI inline Type *getWithNewBitWidth(unsigned NewBitWidth) const;
/// Given scalar/vector integer type, returns a type with elements twice as
/// wide as in the original type. For vectors, preserves element count.
- inline Type *getExtendedType() const;
+ LLVM_ABI inline Type *getExtendedType() const;
/// Get the address space of this pointer or pointer vector type.
- inline unsigned getPointerAddressSpace() const;
+ LLVM_ABI inline unsigned getPointerAddressSpace() const;
//===--------------------------------------------------------------------===//
// Static members exported by the Type class itself. Useful for getting
@@ -431,30 +431,30 @@ class Type {
//
/// Return a type based on an identifier.
- static Type *getPrimitiveType(LLVMContext &C, TypeID IDNumber);
+ LLVM_ABI static Type *getPrimitiveType(LLVMContext &C, TypeID IDNumber);
//===--------------------------------------------------------------------===//
// These are the builtin types that are always available.
//
- static Type *getVoidTy(LLVMContext &C);
- static Type *getLabelTy(LLVMContext &C);
- static Type *getHalfTy(LLVMContext &C);
- static Type *getBFloatTy(LLVMContext &C);
- static Type *getFloatTy(LLVMContext &C);
- static Type *getDoubleTy(LLVMContext &C);
- static Type *getMetadataTy(LLVMContext &C);
- static Type *getX86_FP80Ty(LLVMContext &C);
- static Type *getFP128Ty(LLVMContext &C);
- static Type *getPPC_FP128Ty(LLVMContext &C);
- static Type *getX86_AMXTy(LLVMContext &C);
- static Type *getTokenTy(LLVMContext &C);
- static IntegerType *getIntNTy(LLVMContext &C, unsigned N);
- static IntegerType *getInt1Ty(LLVMContext &C);
- static IntegerType *getInt8Ty(LLVMContext &C);
- static IntegerType *getInt16Ty(LLVMContext &C);
- static IntegerType *getInt32Ty(LLVMContext &C);
- static IntegerType *getInt64Ty(LLVMContext &C);
- static IntegerType *getInt128Ty(LLVMContext &C);
+ LLVM_ABI static Type *getVoidTy(LLVMContext &C);
+ LLVM_ABI static Type *getLabelTy(LLVMContext &C);
+ LLVM_ABI static Type *getHalfTy(LLVMContext &C);
+ LLVM_ABI static Type *getBFloatTy(LLVMContext &C);
+ LLVM_ABI static Type *getFloatTy(LLVMContext &C);
+ LLVM_ABI static Type *getDoubleTy(LLVMContext &C);
+ LLVM_ABI static Type *getMetadataTy(LLVMContext &C);
+ LLVM_ABI static Type *getX86_FP80Ty(LLVMContext &C);
+ LLVM_ABI static Type *getFP128Ty(LLVMContext &C);
+ LLVM_ABI static Type *getPPC_FP128Ty(LLVMContext &C);
+ LLVM_ABI static Type *getX86_AMXTy(LLVMContext &C);
+ LLVM_ABI static Type *getTokenTy(LLVMContext &C);
+ LLVM_ABI static IntegerType *getIntNTy(LLVMContext &C, unsigned N);
+ LLVM_ABI static IntegerType *getInt1Ty(LLVMContext &C);
+ LLVM_ABI static IntegerType *getInt8Ty(LLVMContext &C);
+ LLVM_ABI static IntegerType *getInt16Ty(LLVMContext &C);
+ LLVM_ABI static IntegerType *getInt32Ty(LLVMContext &C);
+ LLVM_ABI static IntegerType *getInt64Ty(LLVMContext &C);
+ LLVM_ABI static IntegerType *getInt128Ty(LLVMContext &C);
template <typename ScalarTy> static Type *getScalarTy(LLVMContext &C) {
int noOfBits = sizeof(ScalarTy) * CHAR_BIT;
if (std::is_integral<ScalarTy>::value) {
@@ -469,25 +469,25 @@ class Type {
}
llvm_unreachable("Unsupported type in Type::getScalarTy");
}
- static Type *getFloatingPointTy(LLVMContext &C, const fltSemantics &S);
+ LLVM_ABI static Type *getFloatingPointTy(LLVMContext &C, const fltSemantics &S);
//===--------------------------------------------------------------------===//
// Convenience methods for getting pointer types.
//
- static Type *getWasm_ExternrefTy(LLVMContext &C);
- static Type *getWasm_FuncrefTy(LLVMContext &C);
+ LLVM_ABI static Type *getWasm_ExternrefTy(LLVMContext &C);
+ LLVM_ABI static Type *getWasm_FuncrefTy(LLVMContext &C);
/// Return a pointer to the current type. This is equivalent to
/// PointerType::get(Ctx, AddrSpace).
/// TODO: Remove this after opaque pointer transition is complete.
- LLVM_DEPRECATED("Use PointerType::get instead", "PointerType::get")
+ LLVM_ABI LLVM_DEPRECATED("Use PointerType::get instead", "PointerType::get")
PointerType *getPointerTo(unsigned AddrSpace = 0) const;
private:
/// Derived types like structures and arrays are sized iff all of the members
/// of the type are sized as well. Since asking for their size is relatively
/// uncommon, move this operation out-of-line.
- bool isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited = nullptr) const;
+ LLVM_ABI bool isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited = nullptr) const;
};
// Printing of types.
diff --git a/llvm/include/llvm/IR/TypedPointerType.h b/llvm/include/llvm/IR/TypedPointerType.h
index 1bea715a64b69..cecc0f0065acc 100644
--- a/llvm/include/llvm/IR/TypedPointerType.h
+++ b/llvm/include/llvm/IR/TypedPointerType.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IR_TYPEDPOINTERTYPE_H
#define LLVM_IR_TYPEDPOINTERTYPE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/Type.h"
namespace llvm {
@@ -33,10 +34,10 @@ class TypedPointerType : public Type {
/// This constructs a pointer to an object of the specified type in a numbered
/// address space.
- static TypedPointerType *get(Type *ElementType, unsigned AddressSpace);
+ LLVM_ABI static TypedPointerType *get(Type *ElementType, unsigned AddressSpace);
/// Return true if the specified type is valid as a element type.
- static bool isValidElementType(Type *ElemTy);
+ LLVM_ABI static bool isValidElementType(Type *ElemTy);
/// Return the address space of the Pointer type.
unsigned getAddressSpace() const { return getSubclassData(); }
diff --git a/llvm/include/llvm/IR/Use.h b/llvm/include/llvm/IR/Use.h
index 0d5d878e4689f..0894d945391a4 100644
--- a/llvm/include/llvm/IR/Use.h
+++ b/llvm/include/llvm/IR/Use.h
@@ -38,7 +38,7 @@ class Use {
/// Provide a fast substitute to std::swap<Use>
/// that also works with less standard-compliant compilers
- void swap(Use &RHS);
+ LLVM_ABI void swap(Use &RHS);
private:
/// Destructor - Only for zap()
@@ -60,10 +60,10 @@ class Use {
/// instruction.
User *getUser() const { return Parent; };
- inline void set(Value *Val);
+ LLVM_ABI inline void set(Value *Val);
- inline Value *operator=(Value *RHS);
- inline const Use &operator=(const Use &RHS);
+ LLVM_ABI inline Value *operator=(Value *RHS);
+ LLVM_ABI inline const Use &operator=(const Use &RHS);
Value *operator->() { return Val; }
const Value *operator->() const { return Val; }
@@ -71,11 +71,11 @@ class Use {
Use *getNext() const { return Next; }
/// Return the operand # of this use in its User.
- unsigned getOperandNo() const;
+ LLVM_ABI unsigned getOperandNo() const;
/// Destroys Use operands when the number of operands of
/// a User changes.
- static void zap(Use *Start, const Use *Stop, bool del = false);
+ LLVM_ABI static void zap(Use *Start, const Use *Stop, bool del = false);
private:
diff --git a/llvm/include/llvm/IR/User.h b/llvm/include/llvm/IR/User.h
index 25ca8d744a591..fd0dd5a00b09c 100644
--- a/llvm/include/llvm/IR/User.h
+++ b/llvm/include/llvm/IR/User.h
@@ -101,17 +101,17 @@ class User : public Value {
///
/// This is used for subclasses which need to allocate a variable number
/// of operands, ie, 'hung off uses'.
- void *operator new(size_t Size, HungOffOperandsAllocMarker);
+ LLVM_ABI void *operator new(size_t Size, HungOffOperandsAllocMarker);
/// Allocate a User with the operands co-allocated.
///
/// This is used for subclasses which have a fixed number of operands.
- void *operator new(size_t Size, IntrusiveOperandsAllocMarker allocTrait);
+ LLVM_ABI void *operator new(size_t Size, IntrusiveOperandsAllocMarker allocTrait);
/// Allocate a User with the operands co-allocated. If DescBytes is non-zero
/// then allocate an additional DescBytes bytes before the operands. These
/// bytes can be accessed by calling getDescriptor.
- void *operator new(size_t Size,
+ LLVM_ABI void *operator new(size_t Size,
IntrusiveOperandsAndDescriptorAllocMarker allocTrait);
User(Type *ty, unsigned vty, AllocInfo AllocInfo) : Value(ty, vty) {
@@ -132,11 +132,11 @@ class User : public Value {
/// (with bottom bit set) to the User.
/// \param IsPhi identifies callers which are phi nodes and which need
/// N BasicBlock* allocated along with N
- void allocHungoffUses(unsigned N, bool IsPhi = false);
+ LLVM_ABI void allocHungoffUses(unsigned N, bool IsPhi = false);
/// Grow the number of hung off uses. Note that allocHungoffUses
/// should be called if there are no uses.
- void growHungoffUses(unsigned N, bool IsPhi = false);
+ LLVM_ABI void growHungoffUses(unsigned N, bool IsPhi = false);
protected:
~User() = default; // Use deleteValue() to delete a generic Instruction.
@@ -145,7 +145,7 @@ class User : public Value {
User(const User &) = delete;
/// Free memory allocated for User and Use objects.
- void operator delete(void *Usr);
+ LLVM_ABI void operator delete(void *Usr);
/// Placement delete - required by std, called if the ctor throws.
void operator delete(void *Usr, HungOffOperandsAllocMarker) {
// Note: If a subclass manipulates the information which is required to
@@ -252,10 +252,10 @@ class User : public Value {
unsigned getNumOperands() const { return NumUserOperands; }
/// Returns the descriptor co-allocated with this User instance.
- ArrayRef<const uint8_t> getDescriptor() const;
+ LLVM_ABI ArrayRef<const uint8_t> getDescriptor() const;
/// Returns the descriptor co-allocated with this User instance.
- MutableArrayRef<uint8_t> getDescriptor();
+ LLVM_ABI MutableArrayRef<uint8_t> getDescriptor();
/// Subclasses with hung off uses need to manage the operand count
/// themselves. In these instances, the operand count isn't used to find the
@@ -269,7 +269,7 @@ class User : public Value {
/// A droppable user is a user for which uses can be dropped without affecting
/// correctness and should be dropped rather than preventing a transformation
/// from happening.
- bool isDroppable() const;
+ LLVM_ABI bool isDroppable() const;
// ---------------------------------------------------------------------------
// Operand Iterator interface...
@@ -353,7 +353,7 @@ class User : public Value {
///
/// Replaces all references to the "From" definition with references to the
/// "To" definition. Returns whether any uses were replaced.
- bool replaceUsesOfWith(Value *From, Value *To);
+ LLVM_ABI bool replaceUsesOfWith(Value *From, Value *To);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
diff --git a/llvm/include/llvm/IR/VFABIDemangler.h b/llvm/include/llvm/IR/VFABIDemangler.h
index de731cd7051c1..936f52a3671b8 100644
--- a/llvm/include/llvm/IR/VFABIDemangler.h
+++ b/llvm/include/llvm/IR/VFABIDemangler.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_VFABIDEMANGLER_H
#define LLVM_IR_VFABIDEMANGLER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instructions.h"
@@ -117,7 +118,7 @@ struct VFShape {
return {EC, Parameters};
}
/// Validation check on the Parameters in the VFShape.
- bool hasValidParameterList() const;
+ LLVM_ABI bool hasValidParameterList() const;
};
/// Holds the VFShape for a specific scalar to vector function mapping.
@@ -180,11 +181,11 @@ static constexpr char const *_LLVM_Scalarize_ = "_LLVM_Scalarize_";
/// factor for scalable vectors, since the mangled name doesn't encode that;
/// it needs to be derived from the widest element types of vector arguments
/// or return values.
-std::optional<VFInfo> tryDemangleForVFABI(StringRef MangledName,
+LLVM_ABI std::optional<VFInfo> tryDemangleForVFABI(StringRef MangledName,
const FunctionType *FTy);
/// Retrieve the `VFParamKind` from a string token.
-VFParamKind getVFParamKindFromString(const StringRef Token);
+LLVM_ABI VFParamKind getVFParamKindFromString(const StringRef Token);
// Name of the attribute where the variant mappings are stored.
static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
@@ -194,7 +195,7 @@ static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
/// vector-function-abi-variant attribute, we return without populating
/// VariantMappings, i.e. callers of getVectorVariantNames need not check for
/// the presence of the attribute (see InjectTLIMappings).
-void getVectorVariantNames(const CallInst &CI,
+LLVM_ABI void getVectorVariantNames(const CallInst &CI,
SmallVectorImpl<std::string> &VariantMappings);
/// Constructs a FunctionType by applying vector function information to the
@@ -204,12 +205,12 @@ void getVectorVariantNames(const CallInst &CI,
/// \param ScalarFTy gets the Type information of parameters, as it is not
/// stored in \p Info.
/// \returns a pointer to a newly created vector FunctionType
-FunctionType *createFunctionType(const VFInfo &Info,
+LLVM_ABI FunctionType *createFunctionType(const VFInfo &Info,
const FunctionType *ScalarFTy);
/// Overwrite the Vector Function ABI variants attribute with the names provide
/// in \p VariantMappings.
-void setVectorVariantNames(CallInst *CI, ArrayRef<std::string> VariantMappings);
+LLVM_ABI void setVectorVariantNames(CallInst *CI, ArrayRef<std::string> VariantMappings);
} // end namespace VFABI
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index 999eeb3dad874..bc4c4052a9034 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_VALUE_H
#define LLVM_IR_VALUE_H
+#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -212,29 +213,29 @@ class Value {
};
protected:
- Value(Type *Ty, unsigned scid);
+ LLVM_ABI Value(Type *Ty, unsigned scid);
/// Value's destructor should be virtual by design, but that would require
/// that Value and all of its subclasses have a vtable that effectively
/// duplicates the information in the value ID. As a size optimization, the
/// destructor has been protected, and the caller should manually call
/// deleteValue.
- ~Value(); // Use deleteValue() to delete a generic Value.
+ LLVM_ABI ~Value(); // Use deleteValue() to delete a generic Value.
public:
Value(const Value &) = delete;
Value &operator=(const Value &) = delete;
/// Delete a pointer to a generic Value.
- void deleteValue();
+ LLVM_ABI void deleteValue();
/// Support for debugging, callable in GDB: V->dump()
- void dump() const;
+ LLVM_ABI void dump() const;
/// Implement operator<< on Value.
/// @{
- void print(raw_ostream &O, bool IsForDebug = false) const;
- void print(raw_ostream &O, ModuleSlotTracker &MST,
+ LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &O, ModuleSlotTracker &MST,
bool IsForDebug = false) const;
/// @}
@@ -245,9 +246,9 @@ class Value {
/// even constants get pretty-printed; for example, the type of a null
/// pointer is printed symbolically.
/// @{
- void printAsOperand(raw_ostream &O, bool PrintType = true,
+ LLVM_ABI void printAsOperand(raw_ostream &O, bool PrintType = true,
const Module *M = nullptr) const;
- void printAsOperand(raw_ostream &O, bool PrintType,
+ LLVM_ABI void printAsOperand(raw_ostream &O, bool PrintType,
ModuleSlotTracker &MST) const;
/// @}
@@ -255,12 +256,12 @@ class Value {
Type *getType() const { return VTy; }
/// All values hold a context through their type.
- LLVMContext &getContext() const;
+ LLVM_ABI LLVMContext &getContext() const;
// All values can potentially be named.
bool hasName() const { return HasName; }
- ValueName *getValueName() const;
- void setValueName(ValueName *VN);
+ LLVM_ABI ValueName *getValueName() const;
+ LLVM_ABI void setValueName(ValueName *VN);
private:
void destroyValueName();
@@ -274,42 +275,42 @@ class Value {
/// This guaranteed to return the same reference as long as the value is not
/// modified. If the value has a name, this does a hashtable lookup, so it's
/// not free.
- StringRef getName() const;
+ LLVM_ABI StringRef getName() const;
/// Change the name of the value.
///
/// Choose a new unique name if the provided name is taken.
///
/// \param Name The new name; or "" if the value's name should be removed.
- void setName(const Twine &Name);
+ LLVM_ABI void setName(const Twine &Name);
/// Transfer the name from V to this value.
///
/// After taking V's name, sets V's name to empty.
///
/// \note It is an error to call V->takeName(V).
- void takeName(Value *V);
+ LLVM_ABI void takeName(Value *V);
- std::string getNameOrAsOperand() const;
+ LLVM_ABI std::string getNameOrAsOperand() const;
/// Change all uses of this to point to a new Value.
///
/// Go through the uses list for this definition and make each use point to
/// "V" instead of "this". After this completes, 'this's use list is
/// guaranteed to be empty.
- void replaceAllUsesWith(Value *V);
+ LLVM_ABI void replaceAllUsesWith(Value *V);
/// Change non-metadata uses of this to point to a new Value.
///
/// Go through the uses list for this definition and make each use point to
/// "V" instead of "this". This function skips metadata entries in the list.
- void replaceNonMetadataUsesWith(Value *V);
+ LLVM_ABI void replaceNonMetadataUsesWith(Value *V);
/// Go through the uses list for this definition and make each use point
/// to "V" if the callback ShouldReplace returns true for the given Use.
/// Unlike replaceAllUsesWith() this function does not support basic block
/// values.
- void replaceUsesWithIf(Value *New,
+ LLVM_ABI void replaceUsesWithIf(Value *New,
llvm::function_ref<bool(Use &U)> ShouldReplace);
/// replaceUsesOutsideBlock - Go through the uses list for this definition and
@@ -317,7 +318,7 @@ class Value {
/// block. 'This's use list is expected to have at least one element.
/// Unlike replaceAllUsesWith() this function does not support basic block
/// values.
- void replaceUsesOutsideBlock(Value *V, BasicBlock *BB);
+ LLVM_ABI void replaceUsesOutsideBlock(Value *V, BasicBlock *BB);
//----------------------------------------------------------------------
// Methods for handling the chain of uses of this Value.
@@ -329,7 +330,7 @@ class Value {
// when using them since you might not get all uses.
// The methods that don't start with materialized_ assert that modules is
// fully materialized.
- void assertModuleIsMaterializedImpl() const;
+ LLVM_ABI void assertModuleIsMaterializedImpl() const;
// This indirection exists so we can keep assertModuleIsMaterializedImpl()
// around in release builds of Value.cpp to be linked with other code built
// in debug mode. But this avoids calling it in any of the release built code.
@@ -438,12 +439,12 @@ class Value {
bool hasOneUse() const { return UseList && hasSingleElement(uses()); }
/// Return true if this Value has exactly N uses.
- bool hasNUses(unsigned N) const;
+ LLVM_ABI bool hasNUses(unsigned N) const;
/// Return true if this value has N uses or more.
///
/// This is logically equivalent to getNumUses() >= N.
- bool hasNUsesOrMore(unsigned N) const;
+ LLVM_ABI bool hasNUsesOrMore(unsigned N) const;
/// Return true if there is exactly one user of this value.
///
@@ -453,18 +454,18 @@ class Value {
///
/// This check is potentially costly, since it requires traversing,
/// in the worst case, the whole use list of a value.
- bool hasOneUser() const;
+ LLVM_ABI bool hasOneUser() const;
/// Return true if there is exactly one use of this value that cannot be
/// dropped.
- Use *getSingleUndroppableUse();
+ LLVM_ABI Use *getSingleUndroppableUse();
const Use *getSingleUndroppableUse() const {
return const_cast<Value *>(this)->getSingleUndroppableUse();
}
/// Return true if there is exactly one unique user of this value that cannot be
/// dropped (that user can have multiple uses of this value).
- User *getUniqueUndroppableUser();
+ LLVM_ABI User *getUniqueUndroppableUser();
const User *getUniqueUndroppableUser() const {
return const_cast<Value *>(this)->getUniqueUndroppableUser();
}
@@ -473,12 +474,12 @@ class Value {
///
/// This is specialized because it is a common request and does not require
/// traversing the whole use list.
- bool hasNUndroppableUses(unsigned N) const;
+ LLVM_ABI bool hasNUndroppableUses(unsigned N) const;
/// Return true if this value has N uses or more.
///
/// This is logically equivalent to getNumUses() >= N.
- bool hasNUndroppableUsesOrMore(unsigned N) const;
+ LLVM_ABI bool hasNUndroppableUsesOrMore(unsigned N) const;
/// Remove every uses that can safely be removed.
///
@@ -487,25 +488,25 @@ class Value {
/// some Droppable uses pervent it.
/// This function optionally takes a filter to only remove some droppable
/// uses.
- void dropDroppableUses(llvm::function_ref<bool(const Use *)> ShouldDrop =
+ LLVM_ABI void dropDroppableUses(llvm::function_ref<bool(const Use *)> ShouldDrop =
[](const Use *) { return true; });
/// Remove every use of this value in \p User that can safely be removed.
- void dropDroppableUsesIn(User &Usr);
+ LLVM_ABI void dropDroppableUsesIn(User &Usr);
/// Remove the droppable use \p U.
- static void dropDroppableUse(Use &U);
+ LLVM_ABI static void dropDroppableUse(Use &U);
/// Check if this value is used in the specified basic block.
///
/// Not supported for ConstantData.
- bool isUsedInBasicBlock(const BasicBlock *BB) const;
+ LLVM_ABI bool isUsedInBasicBlock(const BasicBlock *BB) const;
/// This method computes the number of uses of this Value.
///
/// This is a linear time operation. Use hasOneUse, hasNUses, or
/// hasNUsesOrMore to check for specific values.
- unsigned getNumUses() const;
+ LLVM_ABI unsigned getNumUses() const;
/// This method should only be used by the Use class.
void addUse(Use &U) {
@@ -576,22 +577,22 @@ class Value {
return nullptr;
return getMetadataImpl(KindID);
}
- MDNode *getMetadata(StringRef Kind) const;
+ LLVM_ABI MDNode *getMetadata(StringRef Kind) const;
/// @}
/// Appends all attachments with the given ID to \c MDs in insertion order.
/// If the Value has no attachments with the given ID, or if ID is invalid,
/// leaves MDs unchanged.
/// @{
- void getMetadata(unsigned KindID, SmallVectorImpl<MDNode *> &MDs) const;
- void getMetadata(StringRef Kind, SmallVectorImpl<MDNode *> &MDs) const;
+ LLVM_ABI void getMetadata(unsigned KindID, SmallVectorImpl<MDNode *> &MDs) const;
+ LLVM_ABI void getMetadata(StringRef Kind, SmallVectorImpl<MDNode *> &MDs) const;
/// @}
/// Appends all metadata attached to this value to \c MDs, sorting by
/// KindID. The first element of each pair returned is the KindID, the second
/// element is the metadata value. Attachments with the same ID appear in
/// insertion order.
- void
+ LLVM_ABI void
getAllMetadata(SmallVectorImpl<std::pair<unsigned, MDNode *>> &MDs) const;
/// Return true if this value has any metadata attached to it.
@@ -612,44 +613,44 @@ class Value {
/// Sets the given attachment to \c MD, erasing it if \c MD is \c nullptr or
/// replacing it if it already exists.
/// @{
- void setMetadata(unsigned KindID, MDNode *Node);
- void setMetadata(StringRef Kind, MDNode *Node);
+ LLVM_ABI void setMetadata(unsigned KindID, MDNode *Node);
+ LLVM_ABI void setMetadata(StringRef Kind, MDNode *Node);
/// @}
/// Add a metadata attachment.
/// @{
- void addMetadata(unsigned KindID, MDNode &MD);
- void addMetadata(StringRef Kind, MDNode &MD);
+ LLVM_ABI void addMetadata(unsigned KindID, MDNode &MD);
+ LLVM_ABI void addMetadata(StringRef Kind, MDNode &MD);
/// @}
/// Erase all metadata attachments with the given kind.
///
/// \returns true if any metadata was removed.
- bool eraseMetadata(unsigned KindID);
+ LLVM_ABI bool eraseMetadata(unsigned KindID);
/// Erase all metadata attachments matching the given predicate.
- void eraseMetadataIf(function_ref<bool(unsigned, MDNode *)> Pred);
+ LLVM_ABI void eraseMetadataIf(function_ref<bool(unsigned, MDNode *)> Pred);
/// Erase all metadata attached to this Value.
- void clearMetadata();
+ LLVM_ABI void clearMetadata();
/// Get metadata for the given kind, if any.
/// This is an internal function that must only be called after
/// checking that `hasMetadata()` returns true.
- MDNode *getMetadataImpl(unsigned KindID) const;
+ LLVM_ABI MDNode *getMetadataImpl(unsigned KindID) const;
public:
/// Return true if this value is a swifterror value.
///
/// swifterror values can be either a function argument or an alloca with a
/// swifterror attribute.
- bool isSwiftError() const;
+ LLVM_ABI bool isSwiftError() const;
/// Strip off pointer casts, all-zero GEPs and address space casts.
///
/// Returns the original uncasted value. If this is called on a non-pointer
/// value, it returns 'this'.
- const Value *stripPointerCasts() const;
+ LLVM_ABI const Value *stripPointerCasts() const;
Value *stripPointerCasts() {
return const_cast<Value *>(
static_cast<const Value *>(this)->stripPointerCasts());
@@ -659,7 +660,7 @@ class Value {
///
/// Returns the original uncasted value. If this is called on a non-pointer
/// value, it returns 'this'.
- const Value *stripPointerCastsAndAliases() const;
+ LLVM_ABI const Value *stripPointerCastsAndAliases() const;
Value *stripPointerCastsAndAliases() {
return const_cast<Value *>(
static_cast<const Value *>(this)->stripPointerCastsAndAliases());
@@ -670,7 +671,7 @@ class Value {
///
/// Returns the original uncasted value with the same representation. If this
/// is called on a non-pointer value, it returns 'this'.
- const Value *stripPointerCastsSameRepresentation() const;
+ LLVM_ABI const Value *stripPointerCastsSameRepresentation() const;
Value *stripPointerCastsSameRepresentation() {
return const_cast<Value *>(static_cast<const Value *>(this)
->stripPointerCastsSameRepresentation());
@@ -682,7 +683,7 @@ class Value {
/// Returns the original uncasted value. If this is called on a non-pointer
/// value, it returns 'this'. This function should be used only in
/// Alias analysis.
- const Value *stripPointerCastsForAliasAnalysis() const;
+ LLVM_ABI const Value *stripPointerCastsForAliasAnalysis() const;
Value *stripPointerCastsForAliasAnalysis() {
return const_cast<Value *>(static_cast<const Value *>(this)
->stripPointerCastsForAliasAnalysis());
@@ -692,7 +693,7 @@ class Value {
///
/// Returns the original pointer value. If this is called on a non-pointer
/// value, it returns 'this'.
- const Value *stripInBoundsConstantOffsets() const;
+ LLVM_ABI const Value *stripInBoundsConstantOffsets() const;
Value *stripInBoundsConstantOffsets() {
return const_cast<Value *>(
static_cast<const Value *>(this)->stripInBoundsConstantOffsets());
@@ -731,7 +732,7 @@ class Value {
/// between the underlying value and the returned one. Thus, if no constant
/// offset was found, the returned value is the underlying one and \p Offset
/// is unchanged.
- const Value *stripAndAccumulateConstantOffsets(
+ LLVM_ABI const Value *stripAndAccumulateConstantOffsets(
const DataLayout &DL, APInt &Offset, bool AllowNonInbounds,
bool AllowInvariantGroup = false,
function_ref<bool(Value &Value, APInt &Offset)> ExternalAnalysis =
@@ -767,7 +768,7 @@ class Value {
///
/// Returns the original pointer value. If this is called on a non-pointer
/// value, it returns 'this'.
- const Value *stripInBoundsOffsets(function_ref<void(const Value *)> Func =
+ LLVM_ABI const Value *stripInBoundsOffsets(function_ref<void(const Value *)> Func =
[](const Value *) {}) const;
inline Value *stripInBoundsOffsets(function_ref<void(const Value *)> Func =
[](const Value *) {}) {
@@ -777,14 +778,14 @@ class Value {
/// If this ptr is provably equal to \p Other plus a constant offset, return
/// that offset in bytes. Essentially `ptr this` subtract `ptr Other`.
- std::optional<int64_t> getPointerOffsetFrom(const Value *Other,
+ LLVM_ABI std::optional<int64_t> getPointerOffsetFrom(const Value *Other,
const DataLayout &DL) const;
/// Return true if the memory object referred to by V can by freed in the
/// scope for which the SSA value defining the allocation is statically
/// defined. E.g. deallocation after the static scope of a value does not
/// count, but a deallocation before that does.
- bool canBeFreed() const;
+ LLVM_ABI bool canBeFreed() const;
/// Returns the number of bytes known to be dereferenceable for the
/// pointer value.
@@ -795,7 +796,7 @@ class Value {
/// IF CanBeFreed is true, the pointer is known to be dereferenceable at
/// point of definition only. Caller must prove that allocation is not
/// deallocated between point of definition and use.
- uint64_t getPointerDereferenceableBytes(const DataLayout &DL,
+ LLVM_ABI uint64_t getPointerDereferenceableBytes(const DataLayout &DL,
bool &CanBeNull,
bool &CanBeFreed) const;
@@ -803,7 +804,7 @@ class Value {
///
/// Returns an alignment which is either specified explicitly, e.g. via
/// align attribute of a function argument, or guaranteed by DataLayout.
- Align getPointerAlignment(const DataLayout &DL) const;
+ LLVM_ABI Align getPointerAlignment(const DataLayout &DL) const;
/// Translate PHI node to its predecessor from the given basic block.
///
@@ -811,7 +812,7 @@ class Value {
/// the PHI node corresponding to PredBB. If not, return ourself. This is
/// useful if you want to know the value something has in a predecessor
/// block.
- const Value *DoPHITranslation(const BasicBlock *CurBB,
+ LLVM_ABI const Value *DoPHITranslation(const BasicBlock *CurBB,
const BasicBlock *PredBB) const;
Value *DoPHITranslation(const BasicBlock *CurBB, const BasicBlock *PredBB) {
return const_cast<Value *>(
@@ -842,7 +843,7 @@ class Value {
template <class Compare> void sortUseList(Compare Cmp);
/// Reverse the use-list.
- void reverseUseList();
+ LLVM_ABI void reverseUseList();
private:
/// Merge two lists together.
diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h
index 29560815ea559..4cb27fb29ac18 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_VALUEHANDLE_H
#define LLVM_IR_VALUEHANDLE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/IR/Value.h"
@@ -105,7 +106,7 @@ class ValueHandleBase {
}
/// Remove this ValueHandle from its current use list.
- void RemoveFromUseList();
+ LLVM_ABI void RemoveFromUseList();
/// Clear the underlying pointer without clearing the use list.
///
@@ -115,8 +116,8 @@ class ValueHandleBase {
public:
// Callbacks made from Value.
- static void ValueIsDeleted(Value *V);
- static void ValueIsRAUWd(Value *Old, Value *New);
+ LLVM_ABI static void ValueIsDeleted(Value *V);
+ LLVM_ABI static void ValueIsRAUWd(Value *Old, Value *New);
private:
// Internal implementation details.
@@ -128,13 +129,13 @@ class ValueHandleBase {
///
/// List is the address of either the head of the list or a Next node within
/// the existing use list.
- void AddToExistingUseList(ValueHandleBase **List);
+ LLVM_ABI void AddToExistingUseList(ValueHandleBase **List);
/// Add this ValueHandle to the use list after Node.
void AddToExistingUseListAfter(ValueHandleBase *Node);
/// Add this ValueHandle to the use list for V.
- void AddToUseList();
+ LLVM_ABI void AddToUseList();
};
/// A nullable Value handle that is nullable.
@@ -380,7 +381,7 @@ template <typename ValueTy> class TrackingVH {
/// class can be used as the key of a map, as long as the user takes it out of
/// the map before calling setValPtr() (since the map has to rearrange itself
/// when the pointer changes). Unlike ValueHandleBase, this class has a vtable.
-class CallbackVH : public ValueHandleBase {
+class LLVM_ABI CallbackVH : public ValueHandleBase {
virtual void anchor();
protected:
~CallbackVH() = default;
diff --git a/llvm/include/llvm/IR/ValueSymbolTable.h b/llvm/include/llvm/IR/ValueSymbolTable.h
index cd1dbbe1688a1..fe92ccb42315d 100644
--- a/llvm/include/llvm/IR/ValueSymbolTable.h
+++ b/llvm/include/llvm/IR/ValueSymbolTable.h
@@ -13,6 +13,7 @@
#ifndef LLVM_IR_VALUESYMBOLTABLE_H
#define LLVM_IR_VALUESYMBOLTABLE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Value.h"
@@ -64,7 +65,7 @@ class ValueSymbolTable {
/// @{
ValueSymbolTable(int MaxNameSize = -1) : vmap(0), MaxNameSize(MaxNameSize) {}
- ~ValueSymbolTable();
+ LLVM_ABI ~ValueSymbolTable();
/// @}
/// @name Accessors
@@ -91,7 +92,7 @@ class ValueSymbolTable {
/// This function can be used from the debugger to display the
/// content of the symbol table while debugging.
/// Print out symbol table on stderr
- void dump() const;
+ LLVM_ABI void dump() const;
/// @}
/// @name Iteration
diff --git a/llvm/include/llvm/IR/VectorBuilder.h b/llvm/include/llvm/IR/VectorBuilder.h
index d526d52b433b9..efe12a3159e29 100644
--- a/llvm/include/llvm/IR/VectorBuilder.h
+++ b/llvm/include/llvm/IR/VectorBuilder.h
@@ -15,6 +15,7 @@
#ifndef LLVM_IR_VECTORBUILDER_H
#define LLVM_IR_VECTORBUILDER_H
+#include "llvm/Support/Compiler.h"
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/InstrTypes.h>
#include <llvm/IR/Instruction.h>
@@ -50,7 +51,7 @@ class VectorBuilder {
Value &requestMask();
Value &requestEVL();
- void handleError(const char *ErrorMsg) const;
+ LLVM_ABI void handleError(const char *ErrorMsg) const;
template <typename RetType>
RetType returnWithError(const char *ErrorMsg) const {
handleError(ErrorMsg);
@@ -69,11 +70,11 @@ class VectorBuilder {
ExplicitVectorLength(nullptr),
StaticVectorLength(ElementCount::getFixed(0)) {}
- Module &getModule() const;
+ LLVM_ABI Module &getModule() const;
LLVMContext &getContext() const { return Builder.getContext(); }
// All-true mask for the currently configured explicit vector length.
- Value *getAllTrueMask();
+ LLVM_ABI Value *getAllTrueMask();
VectorBuilder &setMask(Value *NewMask) {
Mask = NewMask;
@@ -100,7 +101,7 @@ class VectorBuilder {
// \p Opcode The functional instruction opcode of the emitted intrinsic.
// \p ReturnTy The return type of the operation.
// \p VecOpArray The operand list.
- Value *createVectorInstruction(unsigned Opcode, Type *ReturnTy,
+ LLVM_ABI Value *createVectorInstruction(unsigned Opcode, Type *ReturnTy,
ArrayRef<Value *> VecOpArray,
const Twine &Name = Twine());
@@ -109,7 +110,7 @@ class VectorBuilder {
/// \param ValTy The type of operand which the reduction operation is
/// performed.
/// \param VecOpArray The operand list.
- Value *createSimpleReduction(Intrinsic::ID RdxID, Type *ValTy,
+ LLVM_ABI Value *createSimpleReduction(Intrinsic::ID RdxID, Type *ValTy,
ArrayRef<Value *> VecOpArray,
const Twine &Name = Twine());
};
diff --git a/llvm/include/llvm/IR/VectorTypeUtils.h b/llvm/include/llvm/IR/VectorTypeUtils.h
index dd9b182682008..eb2271f9e2dad 100644
--- a/llvm/include/llvm/IR/VectorTypeUtils.h
+++ b/llvm/include/llvm/IR/VectorTypeUtils.h
@@ -9,6 +9,7 @@
#ifndef LLVM_IR_VECTORTYPEUTILS_H
#define LLVM_IR_VECTORTYPEUTILS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/DerivedTypes.h"
namespace llvm {
@@ -30,19 +31,19 @@ inline Type *toVectorTy(Type *Scalar, unsigned VF) {
/// Note:
/// - If \p EC is scalar, \p StructTy is returned unchanged
/// - Only unpacked literal struct types are supported
-Type *toVectorizedStructTy(StructType *StructTy, ElementCount EC);
+LLVM_ABI Type *toVectorizedStructTy(StructType *StructTy, ElementCount EC);
/// A helper for converting structs of vector types to structs of scalar types.
/// Note: Only unpacked literal struct types are supported.
-Type *toScalarizedStructTy(StructType *StructTy);
+LLVM_ABI Type *toScalarizedStructTy(StructType *StructTy);
/// Returns true if `StructTy` is an unpacked literal struct where all elements
/// are vectors of matching element count. This does not include empty structs.
-bool isVectorizedStructTy(StructType *StructTy);
+LLVM_ABI bool isVectorizedStructTy(StructType *StructTy);
/// Returns true if `StructTy` is an unpacked literal struct where all elements
/// are scalars that can be used as vector element types.
-bool canVectorizeStructTy(StructType *StructTy);
+LLVM_ABI bool canVectorizeStructTy(StructType *StructTy);
/// A helper for converting to vectorized types. For scalar types, this is
/// equivalent to calling `toVectorTy`. For struct types, this returns a new
diff --git a/llvm/include/llvm/IR/Verifier.h b/llvm/include/llvm/IR/Verifier.h
index b25f8eb77ee38..4640d40f8d302 100644
--- a/llvm/include/llvm/IR/Verifier.h
+++ b/llvm/include/llvm/IR/Verifier.h
@@ -20,6 +20,7 @@
#ifndef LLVM_IR_VERIFIER_H
#define LLVM_IR_VERIFIER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/PassManager.h"
#include <utility>
@@ -76,7 +77,7 @@ class TBAAVerifier {
: Diagnostic(Diagnostic) {}
/// Visit an instruction and return true if it is valid, return false if an
/// invalid TBAA is attached.
- bool visitTBAAMetadata(Instruction &I, const MDNode *MD);
+ LLVM_ABI bool visitTBAAMetadata(Instruction &I, const MDNode *MD);
};
/// Check a function for errors, useful for use when debugging a
@@ -85,7 +86,7 @@ class TBAAVerifier {
/// If there are no errors, the function returns false. If an error is found,
/// a message describing the error is written to OS (if non-null) and true is
/// returned.
-bool verifyFunction(const Function &F, raw_ostream *OS = nullptr);
+LLVM_ABI bool verifyFunction(const Function &F, raw_ostream *OS = nullptr);
/// Check a module for errors.
///
@@ -97,10 +98,10 @@ bool verifyFunction(const Function &F, raw_ostream *OS = nullptr);
/// supplied, DebugInfo verification failures won't be considered as
/// error and instead *BrokenDebugInfo will be set to true. Debug
/// info errors can be "recovered" from by stripping the debug info.
-bool verifyModule(const Module &M, raw_ostream *OS = nullptr,
+LLVM_ABI bool verifyModule(const Module &M, raw_ostream *OS = nullptr,
bool *BrokenDebugInfo = nullptr);
-FunctionPass *createVerifierPass(bool FatalErrors = true);
+LLVM_ABI FunctionPass *createVerifierPass(bool FatalErrors = true);
/// Check a module for errors, and report separate error states for IR
/// and debug info errors.
@@ -114,8 +115,8 @@ class VerifierAnalysis : public AnalysisInfoMixin<VerifierAnalysis> {
bool IRBroken, DebugInfoBroken;
};
- Result run(Module &M, ModuleAnalysisManager &);
- Result run(Function &F, FunctionAnalysisManager &);
+ LLVM_ABI Result run(Module &M, ModuleAnalysisManager &);
+ LLVM_ABI Result run(Function &F, FunctionAnalysisManager &);
static bool isRequired() { return true; }
};
@@ -135,8 +136,8 @@ class VerifierPass : public PassInfoMixin<VerifierPass> {
public:
explicit VerifierPass(bool FatalErrors = true) : FatalErrors(FatalErrors) {}
- PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
- PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+ LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
static bool isRequired() { return true; }
};
diff --git a/llvm/include/llvm/IRPrinter/IRPrintingPasses.h b/llvm/include/llvm/IRPrinter/IRPrintingPasses.h
index 4be1f3c967e24..a1168ecc3e23e 100644
--- a/llvm/include/llvm/IRPrinter/IRPrintingPasses.h
+++ b/llvm/include/llvm/IRPrinter/IRPrintingPasses.h
@@ -18,6 +18,7 @@
#ifndef LLVM_IRPRINTER_IRPRINTINGPASSES_H
#define LLVM_IRPRINTER_IRPRINTINGPASSES_H
+#include "llvm/Support/Compiler.h"
#include "llvm/IR/PassManager.h"
#include <string>
@@ -36,12 +37,12 @@ class PrintModulePass : public PassInfoMixin<PrintModulePass> {
bool EmitSummaryIndex;
public:
- PrintModulePass();
- PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
+ LLVM_ABI PrintModulePass();
+ LLVM_ABI PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
bool ShouldPreserveUseListOrder = false,
bool EmitSummaryIndex = false);
- PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
+ LLVM_ABI PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
static bool isRequired() { return true; }
};
@@ -52,10 +53,10 @@ class PrintFunctionPass : public PassInfoMixin<PrintFunctionPass> {
std::string Banner;
public:
- PrintFunctionPass();
- PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
+ LLVM_ABI PrintFunctionPass();
+ LLVM_ABI PrintFunctionPass(raw_ostream &OS, const std::string &Banner = "");
- PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
+ LLVM_ABI PreservedAnalyses run(Function &F, AnalysisManager<Function> &);
static bool isRequired() { return true; }
};
diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h
index 099b958efb0c6..e5f704d4bfe9a 100644
--- a/llvm/include/llvm/IRReader/IRReader.h
+++ b/llvm/include/llvm/IRReader/IRReader.h
@@ -14,6 +14,7 @@
#ifndef LLVM_IRREADER_IRREADER_H
#define LLVM_IRREADER_IRREADER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include <memory>
@@ -32,7 +33,7 @@ class LLVMContext;
/// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode
/// reader to optionally enable lazy metadata loading. This takes ownership
/// of \p Buffer.
-std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer,
+LLVM_ABI std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer,
SMDiagnostic &Err, LLVMContext &Context,
bool ShouldLazyLoadMetadata = false);
@@ -41,7 +42,7 @@ std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer,
/// attempt to parse it as LLVM Assembly and return a fully populated
/// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode
/// reader to optionally enable lazy metadata loading.
-std::unique_ptr<Module>
+LLVM_ABI std::unique_ptr<Module>
getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
bool ShouldLazyLoadMetadata = false);
@@ -49,7 +50,7 @@ getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
/// for it. Otherwise, attempt to parse it as LLVM Assembly and return
/// a Module for it.
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
-std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
+LLVM_ABI std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
LLVMContext &Context,
ParserCallbacks Callbacks = {});
@@ -57,7 +58,7 @@ std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
/// Otherwise, attempt to parse it as LLVM Assembly and return a Module
/// for it.
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
-std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
+LLVM_ABI std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
LLVMContext &Context,
ParserCallbacks Callbacks = {});
}
>From 816e33052cbb91043290a39d1175eab92b56d85b Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Tue, 27 May 2025 10:11:04 -0700
Subject: [PATCH 2/3] [llvm] manual fix-ups to IDS codemod of IR library
---
llvm/include/llvm/IR/Analysis.h | 4 +-
.../llvm/IR/AssemblyAnnotationWriter.h | 2 +
llvm/include/llvm/IR/Attributes.h | 44 +++++++++----------
llvm/include/llvm/IR/BuiltinGCs.h | 2 +
.../include/llvm/IR/DebugProgramInstruction.h | 4 ++
llvm/include/llvm/IR/DerivedTypes.h | 4 +-
llvm/include/llvm/IR/Dominators.h | 30 ++++++-------
llvm/include/llvm/IR/FMF.h | 2 +
llvm/include/llvm/IR/Function.h | 4 +-
.../IR/GenericFloatingPointPredicateUtils.h | 7 +--
llvm/include/llvm/IR/Metadata.h | 6 +--
llvm/include/llvm/IR/PassInstrumentation.h | 2 +-
llvm/include/llvm/IR/PassManager.h | 12 ++---
llvm/include/llvm/IR/ReplaceConstant.h | 2 +
llvm/include/llvm/IR/SymbolTableListTraits.h | 11 ++---
llvm/include/llvm/IR/Verifier.h | 2 +-
llvm/lib/IR/BasicBlock.cpp | 3 +-
llvm/lib/IR/DebugInfoMetadata.cpp | 3 +-
llvm/lib/IR/DebugProgramInstruction.cpp | 7 +--
llvm/lib/IR/Dominators.cpp | 29 ++++++------
llvm/lib/IR/Function.cpp | 4 +-
llvm/lib/IR/IRPrintingPasses.cpp | 3 +-
llvm/lib/IR/Instruction.cpp | 3 +-
llvm/lib/IR/Instructions.cpp | 9 ++--
llvm/lib/IR/LegacyPassManager.cpp | 3 +-
llvm/lib/IR/Module.cpp | 11 ++---
llvm/lib/IR/PassManager.cpp | 17 +++----
llvm/lib/IRPrinter/IRPrintingPasses.cpp | 3 +-
llvm/unittests/IR/DebugInfoTest.cpp | 3 +-
llvm/unittests/IR/InstructionsTest.cpp | 3 +-
llvm/unittests/IR/MetadataTest.cpp | 3 +-
llvm/unittests/IR/ValueTest.cpp | 3 +-
32 files changed, 137 insertions(+), 108 deletions(-)
diff --git a/llvm/include/llvm/IR/Analysis.h b/llvm/include/llvm/IR/Analysis.h
index b67c6566c5051..eb46cebaa9566 100644
--- a/llvm/include/llvm/IR/Analysis.h
+++ b/llvm/include/llvm/IR/Analysis.h
@@ -57,8 +57,8 @@ template <typename IRUnitT> class AllAnalysesOn {
template <typename IRUnitT> AnalysisSetKey AllAnalysesOn<IRUnitT>::SetKey;
-extern template class AllAnalysesOn<Module>;
-extern template class AllAnalysesOn<Function>;
+extern template class LLVM_TEMPLATE_ABI AllAnalysesOn<Module>;
+extern template class LLVM_TEMPLATE_ABI AllAnalysesOn<Function>;
/// Represents analyses that only rely on functions' control flow.
///
diff --git a/llvm/include/llvm/IR/AssemblyAnnotationWriter.h b/llvm/include/llvm/IR/AssemblyAnnotationWriter.h
index 4c5812062d3f1..d68bcbf85b2b7 100644
--- a/llvm/include/llvm/IR/AssemblyAnnotationWriter.h
+++ b/llvm/include/llvm/IR/AssemblyAnnotationWriter.h
@@ -16,6 +16,8 @@
#ifndef LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
#define LLVM_IR_ASSEMBLYANNOTATIONWRITER_H
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
class Function;
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 0978408ca175c..55b92381e4526 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -373,38 +373,38 @@ class AttributeSet {
/// Add an argument attribute. Returns a new set because attribute sets are
/// immutable.
- LLVM_ABI [[nodiscard]] AttributeSet addAttribute(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeSet addAttribute(LLVMContext &C,
Attribute::AttrKind Kind) const;
/// Add a target-dependent attribute. Returns a new set because attribute sets
/// are immutable.
- LLVM_ABI [[nodiscard]] AttributeSet addAttribute(LLVMContext &C, StringRef Kind,
+ [[nodiscard]] LLVM_ABI AttributeSet addAttribute(LLVMContext &C, StringRef Kind,
StringRef Value = StringRef()) const;
/// Add attributes to the attribute set. Returns a new set because attribute
/// sets are immutable.
- LLVM_ABI [[nodiscard]] AttributeSet addAttributes(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeSet addAttributes(LLVMContext &C,
AttributeSet AS) const;
/// Remove the specified attribute from this set. Returns a new set because
/// attribute sets are immutable.
- LLVM_ABI [[nodiscard]] AttributeSet removeAttribute(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeSet removeAttribute(LLVMContext &C,
Attribute::AttrKind Kind) const;
/// Remove the specified attribute from this set. Returns a new set because
/// attribute sets are immutable.
- LLVM_ABI [[nodiscard]] AttributeSet removeAttribute(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeSet removeAttribute(LLVMContext &C,
StringRef Kind) const;
/// Remove the specified attributes from this set. Returns a new set because
/// attribute sets are immutable.
- LLVM_ABI [[nodiscard]] AttributeSet
+ [[nodiscard]] LLVM_ABI AttributeSet
removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const;
/// Try to intersect this AttributeSet with Other. Returns std::nullopt if
/// the two lists are inherently incompatible (imply different behavior, not
/// just analysis).
- LLVM_ABI [[nodiscard]] std::optional<AttributeSet>
+ [[nodiscard]] LLVM_ABI std::optional<AttributeSet>
intersectWith(LLVMContext &C, AttributeSet Other) const;
/// Return the number of attributes in this set.
@@ -554,24 +554,24 @@ class AttributeList {
// TODO: remove non-AtIndex versions of these methods.
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
addAttributeAtIndex(LLVMContext &C, unsigned Index,
Attribute::AttrKind Kind) const;
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
addAttributeAtIndex(LLVMContext &C, unsigned Index, StringRef Kind,
StringRef Value = StringRef()) const;
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute A) const;
/// Add attributes to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList addAttributesAtIndex(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeList addAttributesAtIndex(LLVMContext &C,
unsigned Index,
const AttrBuilder &B) const;
@@ -643,7 +643,7 @@ class AttributeList {
/// Add an attribute to the attribute list at the given arg indices. Returns a
/// new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList addParamAttribute(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeList addParamAttribute(LLVMContext &C,
ArrayRef<unsigned> ArgNos,
Attribute A) const;
@@ -656,13 +656,13 @@ class AttributeList {
/// Remove the specified attribute at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
removeAttributeAtIndex(LLVMContext &C, unsigned Index,
Attribute::AttrKind Kind) const;
/// Remove the specified attribute at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
removeAttributeAtIndex(LLVMContext &C, unsigned Index, StringRef Kind) const;
[[nodiscard]] AttributeList removeAttribute(LLVMContext &C, unsigned Index,
StringRef Kind) const {
@@ -671,13 +671,13 @@ class AttributeList {
/// Remove the specified attributes at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
removeAttributesAtIndex(LLVMContext &C, unsigned Index,
const AttributeMask &AttrsToRemove) const;
/// Remove all attributes at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList removeAttributesAtIndex(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeList removeAttributesAtIndex(LLVMContext &C,
unsigned Index) const;
/// Remove the specified attribute at the function index from this
@@ -773,37 +773,37 @@ class AttributeList {
/// \brief Add the dereferenceable attribute to the attribute set at the given
/// index. Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList addDereferenceableRetAttr(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeList addDereferenceableRetAttr(LLVMContext &C,
uint64_t Bytes) const;
/// \brief Add the dereferenceable attribute to the attribute set at the given
/// arg index. Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList addDereferenceableParamAttr(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeList addDereferenceableParamAttr(LLVMContext &C,
unsigned ArgNo,
uint64_t Bytes) const;
/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given arg index. Returns a new list because attribute lists are
/// immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo,
uint64_t Bytes) const;
/// Add the range attribute to the attribute set at the return value index.
/// Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList addRangeRetAttr(LLVMContext &C,
+ [[nodiscard]] LLVM_ABI AttributeList addRangeRetAttr(LLVMContext &C,
const ConstantRange &CR) const;
/// Add the allocsize attribute to the attribute set at the given arg index.
/// Returns a new list because attribute lists are immutable.
- LLVM_ABI [[nodiscard]] AttributeList
+ [[nodiscard]] LLVM_ABI AttributeList
addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
const std::optional<unsigned> &NumElemsArg) const;
/// Try to intersect this AttributeList with Other. Returns std::nullopt if
/// the two lists are inherently incompatible (imply different behavior, not
/// just analysis).
- LLVM_ABI [[nodiscard]] std::optional<AttributeList>
+ [[nodiscard]] LLVM_ABI std::optional<AttributeList>
intersectWith(LLVMContext &C, AttributeList Other) const;
//===--------------------------------------------------------------------===//
diff --git a/llvm/include/llvm/IR/BuiltinGCs.h b/llvm/include/llvm/IR/BuiltinGCs.h
index 18930fa28da5a..aeb16efda96e1 100644
--- a/llvm/include/llvm/IR/BuiltinGCs.h
+++ b/llvm/include/llvm/IR/BuiltinGCs.h
@@ -14,6 +14,8 @@
#ifndef LLVM_IR_BUILTINGCS_H
#define LLVM_IR_BUILTINGCS_H
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
/// FIXME: Collector instances are not useful on their own. These no longer
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index d37420a77083c..6b09fd64f1bb0 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -118,6 +118,10 @@ template <typename T> class DbgRecordParamRef {
}
};
+extern template class LLVM_TEMPLATE_ABI DbgRecordParamRef<DIExpression>;
+extern template class LLVM_TEMPLATE_ABI DbgRecordParamRef<DILabel>;
+extern template class LLVM_TEMPLATE_ABI DbgRecordParamRef<DILocalVariable>;
+
/// Base class for non-instruction debug metadata records that have positions
/// within IR. Features various methods copied across from the Instruction
/// class to aid ease-of-use. DbgRecords should always be linked into a
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 0f45ec047bb10..0265db8f9b503 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -702,9 +702,9 @@ class PointerType : public Type {
/// This constructs a pointer to an object of the specified type in a numbered
/// address space.
- LLVM_ABI [[deprecated("PointerType::get with pointee type is pending removal. Use "
+ [[deprecated("PointerType::get with pointee type is pending removal. Use "
"Context overload.")]]
- static PointerType *get(Type *ElementType, unsigned AddressSpace);
+ LLVM_ABI static PointerType *get(Type *ElementType, unsigned AddressSpace);
/// This constructs an opaque pointer to an object in a numbered address
/// space.
LLVM_ABI static PointerType *get(LLVMContext &C, unsigned AddressSpace);
diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h
index 1ef84efe52781..514ef3f6c3123 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -44,9 +44,9 @@ class Value;
class raw_ostream;
template <class GraphType> struct GraphTraits;
-extern template class DomTreeNodeBase<BasicBlock>;
-extern template class DominatorTreeBase<BasicBlock, false>; // DomTree
-extern template class DominatorTreeBase<BasicBlock, true>; // PostDomTree
+extern template class LLVM_TEMPLATE_ABI DomTreeNodeBase<BasicBlock>;
+extern template class LLVM_TEMPLATE_ABI DominatorTreeBase<BasicBlock, false>; // DomTree
+extern template class LLVM_TEMPLATE_ABI DominatorTreeBase<BasicBlock, true>; // PostDomTree
extern template class cfg::Update<BasicBlock *>;
@@ -59,34 +59,34 @@ using BBUpdates = ArrayRef<llvm::cfg::Update<BasicBlock *>>;
using BBDomTreeGraphDiff = GraphDiff<BasicBlock *, false>;
using BBPostDomTreeGraphDiff = GraphDiff<BasicBlock *, true>;
-extern template void Calculate<BBDomTree>(BBDomTree &DT);
-extern template void CalculateWithUpdates<BBDomTree>(BBDomTree &DT,
+extern template LLVM_TEMPLATE_ABI void Calculate<BBDomTree>(BBDomTree &DT);
+extern template LLVM_TEMPLATE_ABI void CalculateWithUpdates<BBDomTree>(BBDomTree &DT,
BBUpdates U);
-extern template void Calculate<BBPostDomTree>(BBPostDomTree &DT);
+extern template LLVM_TEMPLATE_ABI void Calculate<BBPostDomTree>(BBPostDomTree &DT);
-extern template void InsertEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
+extern template LLVM_TEMPLATE_ABI void InsertEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
BasicBlock *To);
-extern template void InsertEdge<BBPostDomTree>(BBPostDomTree &DT,
+extern template LLVM_TEMPLATE_ABI void InsertEdge<BBPostDomTree>(BBPostDomTree &DT,
BasicBlock *From,
BasicBlock *To);
-extern template void DeleteEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
+extern template LLVM_TEMPLATE_ABI void DeleteEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
BasicBlock *To);
-extern template void DeleteEdge<BBPostDomTree>(BBPostDomTree &DT,
+extern template LLVM_TEMPLATE_ABI void DeleteEdge<BBPostDomTree>(BBPostDomTree &DT,
BasicBlock *From,
BasicBlock *To);
-extern template void ApplyUpdates<BBDomTree>(BBDomTree &DT,
+extern template LLVM_TEMPLATE_ABI void ApplyUpdates<BBDomTree>(BBDomTree &DT,
BBDomTreeGraphDiff &,
BBDomTreeGraphDiff *);
-extern template void ApplyUpdates<BBPostDomTree>(BBPostDomTree &DT,
+extern template LLVM_TEMPLATE_ABI void ApplyUpdates<BBPostDomTree>(BBPostDomTree &DT,
BBPostDomTreeGraphDiff &,
BBPostDomTreeGraphDiff *);
-extern template bool Verify<BBDomTree>(const BBDomTree &DT,
+extern template LLVM_TEMPLATE_ABI bool Verify<BBDomTree>(const BBDomTree &DT,
BBDomTree::VerificationLevel VL);
-extern template bool Verify<BBPostDomTree>(const BBPostDomTree &DT,
+extern template LLVM_TEMPLATE_ABI bool Verify<BBPostDomTree>(const BBPostDomTree &DT,
BBPostDomTree::VerificationLevel VL);
} // namespace DomTreeBuilder
@@ -279,7 +279,7 @@ template <> struct GraphTraits<DominatorTree*>
/// Analysis pass which computes a \c DominatorTree.
class DominatorTreeAnalysis : public AnalysisInfoMixin<DominatorTreeAnalysis> {
friend AnalysisInfoMixin<DominatorTreeAnalysis>;
- static AnalysisKey Key;
+ LLVM_ABI static AnalysisKey Key;
public:
/// Provide the result typedef for this analysis pass.
diff --git a/llvm/include/llvm/IR/FMF.h b/llvm/include/llvm/IR/FMF.h
index 416eeb13f9382..8bd591250a38a 100644
--- a/llvm/include/llvm/IR/FMF.h
+++ b/llvm/include/llvm/IR/FMF.h
@@ -13,6 +13,8 @@
#ifndef LLVM_IR_FMF_H
#define LLVM_IR_FMF_H
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
class raw_ostream;
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index e5e509c14963e..5580d226a80c6 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -792,8 +792,8 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {
private:
// These need access to the underlying BB list.
- friend void BasicBlock::removeFromParent();
- friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
+ LLVM_ABI_FRIEND friend void BasicBlock::removeFromParent();
+ LLVM_ABI_FRIEND friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
template <class BB_t, class BB_i_t, class BI_t, class II_t>
friend class InstIterator;
friend class llvm::SymbolTableListTraits<llvm::BasicBlock>;
diff --git a/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h b/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h
index 49c5fe0aed6e1..da38e3a36763d 100644
--- a/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h
+++ b/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h
@@ -15,6 +15,7 @@
#ifndef LLVM_ADT_GENERICFLOATINGPOINTPREDICATEUTILS_H
#define LLVM_ADT_GENERICFLOATINGPOINTPREDICATEUTILS_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/IR/Instructions.h"
@@ -29,12 +30,12 @@ template <typename ContextT> class GenericFloatingPointPredicateUtils {
constexpr static ValueRefT Invalid = {};
private:
- static DenormalMode queryDenormalMode(const FunctionT &F, ValueRefT Val);
+ LLVM_ABI static DenormalMode queryDenormalMode(const FunctionT &F, ValueRefT Val);
- static bool lookThroughFAbs(const FunctionT &F, ValueRefT LHS,
+ LLVM_ABI static bool lookThroughFAbs(const FunctionT &F, ValueRefT LHS,
ValueRefT &Src);
- static std::optional<APFloat> matchConstantFloat(const FunctionT &F,
+ LLVM_ABI static std::optional<APFloat> matchConstantFloat(const FunctionT &F,
ValueRefT Val);
/// Return the return value for fcmpImpliesClass for a compare that produces
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index 393abc6d9599d..ca950593dceba 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -1336,9 +1336,9 @@ class MDNode : public Metadata {
/// @}
private:
- MDNode *replaceWithPermanentImpl();
- MDNode *replaceWithUniquedImpl();
- MDNode *replaceWithDistinctImpl();
+ LLVM_ABI MDNode *replaceWithPermanentImpl();
+ LLVM_ABI MDNode *replaceWithUniquedImpl();
+ LLVM_ABI MDNode *replaceWithDistinctImpl();
protected:
/// Set an operand.
diff --git a/llvm/include/llvm/IR/PassInstrumentation.h b/llvm/include/llvm/IR/PassInstrumentation.h
index de7ffd6de77f9..356ddcd1a64a7 100644
--- a/llvm/include/llvm/IR/PassInstrumentation.h
+++ b/llvm/include/llvm/IR/PassInstrumentation.h
@@ -351,7 +351,7 @@ LLVM_ABI bool isSpecialPass(StringRef PassID, const std::vector<StringRef> &Spec
class PassInstrumentationAnalysis
: public AnalysisInfoMixin<PassInstrumentationAnalysis> {
friend AnalysisInfoMixin<PassInstrumentationAnalysis>;
- static AnalysisKey Key;
+ LLVM_ABI static AnalysisKey Key;
PassInstrumentationCallbacks *Callbacks;
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index 960991513526a..ed71ecb458b37 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -232,7 +232,7 @@ void printIRUnitNameForStackTrace(raw_ostream &OS, const IRUnitT &IR);
template <>
LLVM_ABI void printIRUnitNameForStackTrace<Module>(raw_ostream &OS, const Module &IR);
-extern template class PassManager<Module>;
+extern template class LLVM_TEMPLATE_ABI PassManager<Module>;
/// Convenience typedef for a pass manager over modules.
using ModulePassManager = PassManager<Module>;
@@ -241,7 +241,7 @@ template <>
LLVM_ABI void printIRUnitNameForStackTrace<Function>(raw_ostream &OS,
const Function &IR);
-extern template class PassManager<Function>;
+extern template class LLVM_TEMPLATE_ABI PassManager<Function>;
/// Convenience typedef for a pass manager over functions.
using FunctionPassManager = PassManager<Function>;
@@ -536,12 +536,12 @@ template <typename IRUnitT, typename... ExtraArgTs> class AnalysisManager {
AnalysisResultMapT AnalysisResults;
};
-extern template class AnalysisManager<Module>;
+extern template class LLVM_TEMPLATE_ABI AnalysisManager<Module>;
/// Convenience typedef for the Module analysis manager.
using ModuleAnalysisManager = AnalysisManager<Module>;
-extern template class AnalysisManager<Function>;
+extern template class LLVM_TEMPLATE_ABI AnalysisManager<Function>;
/// Convenience typedef for the Function analysis manager.
using FunctionAnalysisManager = AnalysisManager<Function>;
@@ -563,7 +563,7 @@ using FunctionAnalysisManager = AnalysisManager<Function>;
/// Note that the proxy's result is a move-only RAII object. The validity of
/// the analyses in the inner analysis manager is tied to its lifetime.
template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
-class InnerAnalysisManagerProxy
+class LLVM_TEMPLATE_ABI InnerAnalysisManagerProxy
: public AnalysisInfoMixin<
InnerAnalysisManagerProxy<AnalysisManagerT, IRUnitT>> {
public:
@@ -796,7 +796,7 @@ template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
AnalysisKey
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>::Key;
-extern template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
+extern template class LLVM_TEMPLATE_ABI OuterAnalysisManagerProxy<ModuleAnalysisManager,
Function>;
/// Provide the \c ModuleAnalysisManager to \c Function proxy.
using ModuleAnalysisManagerFunctionProxy =
diff --git a/llvm/include/llvm/IR/ReplaceConstant.h b/llvm/include/llvm/IR/ReplaceConstant.h
index 5820d44d9668f..7b40dbde27d0f 100644
--- a/llvm/include/llvm/IR/ReplaceConstant.h
+++ b/llvm/include/llvm/IR/ReplaceConstant.h
@@ -14,6 +14,8 @@
#ifndef LLVM_IR_REPLACECONSTANT_H
#define LLVM_IR_REPLACECONSTANT_H
+#include "llvm/Support/Compiler.h"
+
namespace llvm {
template <typename T> class ArrayRef;
diff --git a/llvm/include/llvm/IR/SymbolTableListTraits.h b/llvm/include/llvm/IR/SymbolTableListTraits.h
index fcf6f0fb15280..e8fcab89005bb 100644
--- a/llvm/include/llvm/IR/SymbolTableListTraits.h
+++ b/llvm/include/llvm/IR/SymbolTableListTraits.h
@@ -26,6 +26,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/simple_ilist.h"
+#include "llvm/Support/Compiler.h"
#include <cstddef>
namespace llvm {
@@ -109,11 +110,11 @@ class SymbolTableListTraits : public ilist_alloc_traits<ValueSubClass> {
// The SymbolTableListTraits template is explicitly instantiated for the
// following data types, so add extern template statements to prevent implicit
// instantiation.
-extern template class SymbolTableListTraits<BasicBlock>;
-extern template class SymbolTableListTraits<Function>;
-extern template class SymbolTableListTraits<GlobalAlias>;
-extern template class SymbolTableListTraits<GlobalIFunc>;
-extern template class SymbolTableListTraits<GlobalVariable>;
+extern template class LLVM_TEMPLATE_ABI SymbolTableListTraits<BasicBlock>;
+extern template class LLVM_TEMPLATE_ABI SymbolTableListTraits<Function>;
+extern template class LLVM_TEMPLATE_ABI SymbolTableListTraits<GlobalAlias>;
+extern template class LLVM_TEMPLATE_ABI SymbolTableListTraits<GlobalIFunc>;
+extern template class LLVM_TEMPLATE_ABI SymbolTableListTraits<GlobalVariable>;
/// List that automatically updates parent links and symbol tables.
///
diff --git a/llvm/include/llvm/IR/Verifier.h b/llvm/include/llvm/IR/Verifier.h
index 4640d40f8d302..a3c95a9d04b14 100644
--- a/llvm/include/llvm/IR/Verifier.h
+++ b/llvm/include/llvm/IR/Verifier.h
@@ -108,7 +108,7 @@ LLVM_ABI FunctionPass *createVerifierPass(bool FatalErrors = true);
class VerifierAnalysis : public AnalysisInfoMixin<VerifierAnalysis> {
friend AnalysisInfoMixin<VerifierAnalysis>;
- static AnalysisKey Key;
+ LLVM_ABI static AnalysisKey Key;
public:
struct Result {
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index d56f4d399ea52..e91078acbc9e8 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -22,6 +22,7 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "LLVMContextImpl.h"
@@ -41,7 +42,7 @@ STATISTIC(NumInstrRenumberings, "Number of renumberings across all blocks");
// that might be needed to remove debug intrinsics.
//
// https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578
-cl::opt<bool> UseNewDbgInfoFormat(
+LLVM_ABI cl::opt<bool> UseNewDbgInfoFormat(
"dont-pass-this-flag-please-experimental-debuginfo", cl::Hidden,
cl::init(true));
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 6735bf7dc52db..473114b99225b 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -22,6 +22,7 @@
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include <numeric>
#include <optional>
@@ -36,7 +37,7 @@ cl::opt<bool> EnableFSDiscriminator(
// When true, preserves line and column number by picking one of the merged
// location info in a deterministic manner to assist sample based PGO.
-cl::opt<bool> PickMergedSourceLocations(
+LLVM_ABI cl::opt<bool> PickMergedSourceLocations(
"pick-merged-source-locations", cl::init(false), cl::Hidden,
cl::desc("Preserve line and column number when merging locations."));
} // namespace llvm
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index 92023d6ab80fd..6f9425bb51a64 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -10,6 +10,7 @@
#include "llvm/IR/DebugProgramInstruction.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/IntrinsicInst.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -24,9 +25,9 @@ template <typename T> T *DbgRecordParamRef<T>::get() const {
return cast<T>(Ref);
}
-template class DbgRecordParamRef<DIExpression>;
-template class DbgRecordParamRef<DILabel>;
-template class DbgRecordParamRef<DILocalVariable>;
+template class LLVM_EXPORT_TEMPLATE DbgRecordParamRef<DIExpression>;
+template class LLVM_EXPORT_TEMPLATE DbgRecordParamRef<DILabel>;
+template class LLVM_EXPORT_TEMPLATE DbgRecordParamRef<DILocalVariable>;
DbgVariableRecord::DbgVariableRecord(const DbgVariableIntrinsic *DVI)
: DbgRecord(ValueKind, DVI->getDebugLoc()),
diff --git a/llvm/lib/IR/Dominators.cpp b/llvm/lib/IR/Dominators.cpp
index cc51b4905a628..7b3c6901357e6 100644
--- a/llvm/lib/IR/Dominators.cpp
+++ b/llvm/lib/IR/Dominators.cpp
@@ -25,6 +25,7 @@
#include "llvm/PassRegistry.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/GenericDomTreeConstruction.h"
#include "llvm/Support/raw_ostream.h"
@@ -70,43 +71,43 @@ bool BasicBlockEdge::isSingleEdge() const {
//
//===----------------------------------------------------------------------===//
-template class llvm::DomTreeNodeBase<BasicBlock>;
-template class llvm::DominatorTreeBase<BasicBlock, false>; // DomTreeBase
-template class llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
+template class LLVM_EXPORT_TEMPLATE llvm::DomTreeNodeBase<BasicBlock>;
+template class LLVM_EXPORT_TEMPLATE llvm::DominatorTreeBase<BasicBlock, false>; // DomTreeBase
+template class LLVM_EXPORT_TEMPLATE llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
template class llvm::cfg::Update<BasicBlock *>;
-template void llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT);
-template void
+template LLVM_EXPORT_TEMPLATE void
llvm::DomTreeBuilder::CalculateWithUpdates<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, BBUpdates U);
-template void llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT);
// No CalculateWithUpdates<PostDomTree> instantiation, unless a usecase arises.
-template void llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, BasicBlock *From, BasicBlock *To);
-template void llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT, BasicBlock *From, BasicBlock *To);
-template void llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, BasicBlock *From, BasicBlock *To);
-template void llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT, BasicBlock *From, BasicBlock *To);
-template void llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, DomTreeBuilder::BBDomTreeGraphDiff &,
DomTreeBuilder::BBDomTreeGraphDiff *);
-template void llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT, DomTreeBuilder::BBPostDomTreeGraphDiff &,
DomTreeBuilder::BBPostDomTreeGraphDiff *);
-template bool llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE bool llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBDomTree>(
const DomTreeBuilder::BBDomTree &DT,
DomTreeBuilder::BBDomTree::VerificationLevel VL);
-template bool llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE bool llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBPostDomTree>(
const DomTreeBuilder::BBPostDomTree &DT,
DomTreeBuilder::BBPostDomTree::VerificationLevel VL);
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 85c28b0205691..dfffbbfcf5d2a 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -59,13 +59,13 @@ using ProfileCount = Function::ProfileCount;
// Explicit instantiations of SymbolTableListTraits since some of the methods
// are not in the public header file...
-template class llvm::SymbolTableListTraits<BasicBlock>;
+template class LLVM_EXPORT_TEMPLATE llvm::SymbolTableListTraits<BasicBlock>;
static cl::opt<int> NonGlobalValueMaxNameSize(
"non-global-value-max-name-size", cl::Hidden, cl::init(1024),
cl::desc("Maximum size for the name of non-global values."));
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
void Function::renumberBlocks() {
validateBlockNumbers();
diff --git a/llvm/lib/IR/IRPrintingPasses.cpp b/llvm/lib/IR/IRPrintingPasses.cpp
index 96396d06ebba3..a26bb0f5af012 100644
--- a/llvm/lib/IR/IRPrintingPasses.cpp
+++ b/llvm/lib/IR/IRPrintingPasses.cpp
@@ -18,12 +18,13 @@
#include "llvm/IR/PrintPasses.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
namespace {
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 54e5e6d53e791..997f3849d4c1b 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -26,6 +26,7 @@
#include "llvm/IR/Operator.h"
#include "llvm/IR/ProfDataUtils.h"
#include "llvm/IR/Type.h"
+#include "llvm/Support/Compiler.h"
using namespace llvm;
InsertPosition::InsertPosition(Instruction *InsertBefore)
@@ -129,7 +130,7 @@ BasicBlock::iterator Instruction::insertInto(BasicBlock *ParentBB,
return getIterator();
}
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
void Instruction::insertBefore(BasicBlock &BB,
InstListType::iterator InsertPos) {
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index f404e11b9c0f0..35555c74fd5bd 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -39,6 +39,7 @@
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CheckedArithmetic.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Support/MathExtras.h"
@@ -485,9 +486,9 @@ Attribute CallBase::getFnAttrOnCalledFunction(AK Kind) const {
return Attribute();
}
-template Attribute
+template LLVM_ABI Attribute
CallBase::getFnAttrOnCalledFunction(Attribute::AttrKind Kind) const;
-template Attribute CallBase::getFnAttrOnCalledFunction(StringRef Kind) const;
+template LLVM_ABI Attribute CallBase::getFnAttrOnCalledFunction(StringRef Kind) const;
template <typename AK>
Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
@@ -499,10 +500,10 @@ Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
return Attribute();
}
-template Attribute
+template LLVM_ABI Attribute
CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
Attribute::AttrKind Kind) const;
-template Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
+template LLVM_ABI Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
StringRef Kind) const;
void CallBase::getOperandBundlesAsDefs(
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index 9ac6e9c1e97e1..110636b2e9032 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -21,6 +21,7 @@
#include "llvm/IR/PrintPasses.h"
#include "llvm/Support/Chrono.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
@@ -31,7 +32,7 @@
using namespace llvm;
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
// See PassManagers.h for Pass Manager infrastructure overview.
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index eb635dc29aeeb..9741bfef01674 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -38,6 +38,7 @@
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -53,7 +54,7 @@
using namespace llvm;
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
//===----------------------------------------------------------------------===//
// Methods to implement the globals and functions lists.
@@ -61,10 +62,10 @@ extern cl::opt<bool> UseNewDbgInfoFormat;
// Explicit instantiations of SymbolTableListTraits since some of the methods
// are not in the public header file.
-template class llvm::SymbolTableListTraits<Function>;
-template class llvm::SymbolTableListTraits<GlobalVariable>;
-template class llvm::SymbolTableListTraits<GlobalAlias>;
-template class llvm::SymbolTableListTraits<GlobalIFunc>;
+template class LLVM_EXPORT_TEMPLATE llvm::SymbolTableListTraits<Function>;
+template class LLVM_EXPORT_TEMPLATE llvm::SymbolTableListTraits<GlobalVariable>;
+template class LLVM_EXPORT_TEMPLATE llvm::SymbolTableListTraits<GlobalAlias>;
+template class LLVM_EXPORT_TEMPLATE llvm::SymbolTableListTraits<GlobalIFunc>;
//===----------------------------------------------------------------------===//
// Primitive Module methods.
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index bf8f7906d3368..ef1c744724c77 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/lib/IR/PassManager.cpp
@@ -9,6 +9,7 @@
#include "llvm/IR/PassManager.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManagerImpl.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
using namespace llvm;
@@ -16,14 +17,14 @@ using namespace llvm;
namespace llvm {
// Explicit template instantiations and specialization defininitions for core
// template typedefs.
-template class AllAnalysesOn<Module>;
-template class AllAnalysesOn<Function>;
-template class PassManager<Module>;
-template class PassManager<Function>;
-template class AnalysisManager<Module>;
-template class AnalysisManager<Function>;
-template class InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>;
-template class OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
+template class LLVM_EXPORT_TEMPLATE AllAnalysesOn<Module>;
+template class LLVM_EXPORT_TEMPLATE AllAnalysesOn<Function>;
+template class LLVM_EXPORT_TEMPLATE PassManager<Module>;
+template class LLVM_EXPORT_TEMPLATE PassManager<Function>;
+template class LLVM_EXPORT_TEMPLATE AnalysisManager<Module>;
+template class LLVM_EXPORT_TEMPLATE AnalysisManager<Function>;
+template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>;
+template class LLVM_EXPORT_TEMPLATE OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
template <>
bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
diff --git a/llvm/lib/IRPrinter/IRPrintingPasses.cpp b/llvm/lib/IRPrinter/IRPrintingPasses.cpp
index b1750a5ca3091..d6bd6c32002da 100644
--- a/llvm/lib/IRPrinter/IRPrintingPasses.cpp
+++ b/llvm/lib/IRPrinter/IRPrintingPasses.cpp
@@ -17,12 +17,13 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/PrintPasses.h"
#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
PrintModulePass::PrintModulePass() : OS(dbgs()) {}
PrintModulePass::PrintModulePass(raw_ostream &OS, const std::string &Banner,
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp
index 8748371ae4b47..c3a0f665d423a 100644
--- a/llvm/unittests/IR/DebugInfoTest.cpp
+++ b/llvm/unittests/IR/DebugInfoTest.cpp
@@ -19,6 +19,7 @@
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Transforms/Utils/Local.h"
@@ -26,7 +27,7 @@
using namespace llvm;
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
static std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) {
SMDiagnostic Err;
diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index 386a60702d0da..e9227f6d8c4ac 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -26,13 +26,14 @@
#include "llvm/IR/NoFolder.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm-c/Core.h"
#include "gmock/gmock-matchers.h"
#include "gtest/gtest.h"
#include <memory>
-extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
namespace llvm {
namespace {
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 56367e07b9d09..df415602cef59 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -21,13 +21,14 @@
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Verifier.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
#include "gtest/gtest.h"
#include <optional>
using namespace llvm;
namespace llvm {
-extern cl::opt<bool> PickMergedSourceLocations;
+LLVM_ABI extern cl::opt<bool> PickMergedSourceLocations;
} // namespace llvm
namespace {
diff --git a/llvm/unittests/IR/ValueTest.cpp b/llvm/unittests/IR/ValueTest.cpp
index ca45e9abcf225..888595efdb66e 100644
--- a/llvm/unittests/IR/ValueTest.cpp
+++ b/llvm/unittests/IR/ValueTest.cpp
@@ -15,11 +15,12 @@
#include "llvm/IR/Module.h"
#include "llvm/IR/ModuleSlotTracker.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/SourceMgr.h"
#include "gtest/gtest.h"
using namespace llvm;
-extern cl::opt<bool> UseNewDbgInfoFormat;
+LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
namespace {
>From 7f3ea160b77503512ceaba8ebdcc506af841b7e4 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Tue, 27 May 2025 10:12:05 -0700
Subject: [PATCH 3/3] [llvm] clang-format changes to IR library
---
llvm/include/llvm/IR/AbstractCallSite.h | 7 +-
llvm/include/llvm/IR/Analysis.h | 2 +-
llvm/include/llvm/IR/Argument.h | 10 +-
llvm/include/llvm/IR/Assumptions.h | 12 +-
llvm/include/llvm/IR/Attributes.h | 196 ++++++-----
llvm/include/llvm/IR/AutoUpgrade.h | 17 +-
llvm/include/llvm/IR/BasicBlock.h | 58 ++--
llvm/include/llvm/IR/CmpPredicate.h | 4 +-
llvm/include/llvm/IR/Comdat.h | 2 +-
llvm/include/llvm/IR/Constant.h | 9 +-
llvm/include/llvm/IR/ConstantFPRange.h | 20 +-
llvm/include/llvm/IR/ConstantFold.h | 52 +--
llvm/include/llvm/IR/ConstantFolder.h | 2 +-
llvm/include/llvm/IR/ConstantRange.h | 81 +++--
llvm/include/llvm/IR/ConstantRangeList.h | 2 +-
llvm/include/llvm/IR/Constants.h | 79 +++--
llvm/include/llvm/IR/DIBuilder.h | 316 +++++++++---------
llvm/include/llvm/IR/DataLayout.h | 18 +-
llvm/include/llvm/IR/DebugInfo.h | 38 ++-
llvm/include/llvm/IR/DebugInfoMetadata.h | 301 +++++++++--------
llvm/include/llvm/IR/DebugLoc.h | 8 +-
.../include/llvm/IR/DebugProgramInstruction.h | 63 ++--
llvm/include/llvm/IR/DerivedTypes.h | 37 +-
llvm/include/llvm/IR/DiagnosticHandler.h | 2 +-
llvm/include/llvm/IR/DiagnosticInfo.h | 35 +-
llvm/include/llvm/IR/Dominators.h | 74 ++--
llvm/include/llvm/IR/DroppedVariableStats.h | 18 +-
llvm/include/llvm/IR/DroppedVariableStatsIR.h | 2 +-
llvm/include/llvm/IR/EHPersonalities.h | 2 +-
llvm/include/llvm/IR/FPEnv.h | 8 +-
llvm/include/llvm/IR/Function.h | 8 +-
.../IR/GenericFloatingPointPredicateUtils.h | 9 +-
llvm/include/llvm/IR/GlobalAlias.h | 16 +-
llvm/include/llvm/IR/GlobalIFunc.h | 9 +-
llvm/include/llvm/IR/GlobalObject.h | 2 +-
llvm/include/llvm/IR/GlobalValue.h | 10 +-
llvm/include/llvm/IR/GlobalVariable.h | 26 +-
llvm/include/llvm/IR/IRBuilder.h | 222 ++++++------
llvm/include/llvm/IR/IRBuilderFolder.h | 2 +-
llvm/include/llvm/IR/IRPrintingPasses.h | 8 +-
llvm/include/llvm/IR/InlineAsm.h | 12 +-
llvm/include/llvm/IR/InstrTypes.h | 130 +++----
llvm/include/llvm/IR/Instruction.h | 46 +--
llvm/include/llvm/IR/Instructions.h | 264 ++++++++-------
llvm/include/llvm/IR/IntrinsicInst.h | 29 +-
llvm/include/llvm/IR/Intrinsics.h | 32 +-
llvm/include/llvm/IR/LLVMContext.h | 21 +-
llvm/include/llvm/IR/LLVMRemarkStreamer.h | 11 +-
llvm/include/llvm/IR/LegacyPassManager.h | 2 +-
llvm/include/llvm/IR/LegacyPassManagers.h | 3 +-
llvm/include/llvm/IR/LegacyPassNameParser.h | 4 +-
llvm/include/llvm/IR/MDBuilder.h | 47 +--
llvm/include/llvm/IR/Mangler.h | 27 +-
.../IR/MemoryModelRelaxationAnnotations.h | 6 +-
llvm/include/llvm/IR/Metadata.h | 41 ++-
llvm/include/llvm/IR/Module.h | 8 +-
llvm/include/llvm/IR/ModuleSummaryIndex.h | 20 +-
llvm/include/llvm/IR/NoFolder.h | 2 +-
llvm/include/llvm/IR/Operator.h | 9 +-
llvm/include/llvm/IR/OptBisect.h | 2 +-
llvm/include/llvm/IR/PassInstrumentation.h | 3 +-
llvm/include/llvm/IR/PassManager.h | 16 +-
llvm/include/llvm/IR/PassManagerImpl.h | 2 +-
llvm/include/llvm/IR/PassTimingInfo.h | 2 +-
llvm/include/llvm/IR/ProfDataUtils.h | 20 +-
llvm/include/llvm/IR/ProfileSummary.h | 2 +-
llvm/include/llvm/IR/ReplaceConstant.h | 7 +-
llvm/include/llvm/IR/RuntimeLibcalls.h | 2 +-
llvm/include/llvm/IR/StructuralHash.h | 9 +-
llvm/include/llvm/IR/Type.h | 10 +-
llvm/include/llvm/IR/TypedPointerType.h | 5 +-
llvm/include/llvm/IR/User.h | 8 +-
llvm/include/llvm/IR/VFABIDemangler.h | 14 +-
llvm/include/llvm/IR/Value.h | 37 +-
llvm/include/llvm/IR/ValueHandle.h | 2 +-
llvm/include/llvm/IR/ValueSymbolTable.h | 8 +-
llvm/include/llvm/IR/VectorBuilder.h | 8 +-
llvm/include/llvm/IR/VectorTypeUtils.h | 2 +-
llvm/include/llvm/IR/Verifier.h | 4 +-
.../include/llvm/IRPrinter/IRPrintingPasses.h | 6 +-
llvm/include/llvm/IRReader/IRReader.h | 22 +-
llvm/lib/IR/BasicBlock.cpp | 6 +-
llvm/lib/IR/DebugProgramInstruction.cpp | 2 +-
llvm/lib/IR/Dominators.cpp | 36 +-
llvm/lib/IR/Instructions.cpp | 10 +-
llvm/lib/IR/Module.cpp | 2 +-
llvm/lib/IR/PassManager.cpp | 6 +-
llvm/unittests/IR/InstructionsTest.cpp | 2 +-
88 files changed, 1512 insertions(+), 1244 deletions(-)
diff --git a/llvm/include/llvm/IR/AbstractCallSite.h b/llvm/include/llvm/IR/AbstractCallSite.h
index 9006b7356242b..9e24ae7d1b431 100644
--- a/llvm/include/llvm/IR/AbstractCallSite.h
+++ b/llvm/include/llvm/IR/AbstractCallSite.h
@@ -14,11 +14,11 @@
#ifndef LLVM_IR_ABSTRACTCALLSITE_H
#define LLVM_IR_ABSTRACTCALLSITE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
namespace llvm {
@@ -103,8 +103,9 @@ class AbstractCallSite {
///
/// All uses added to \p CallbackUses can be used to create abstract call
/// sites for which AbstractCallSite::isCallbackCall() will return true.
- LLVM_ABI static void getCallbackUses(const CallBase &CB,
- SmallVectorImpl<const Use *> &CallbackUses);
+ LLVM_ABI static void
+ getCallbackUses(const CallBase &CB,
+ SmallVectorImpl<const Use *> &CallbackUses);
/// Conversion operator to conveniently check for a valid/initialized ACS.
explicit operator bool() const { return CB != nullptr; }
diff --git a/llvm/include/llvm/IR/Analysis.h b/llvm/include/llvm/IR/Analysis.h
index eb46cebaa9566..8ab70dd9ed594 100644
--- a/llvm/include/llvm/IR/Analysis.h
+++ b/llvm/include/llvm/IR/Analysis.h
@@ -12,8 +12,8 @@
#ifndef LLVM_IR_ANALYSIS_H
#define LLVM_IR_ANALYSIS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/Argument.h b/llvm/include/llvm/IR/Argument.h
index ba2dee67b7013..60854b17094bf 100644
--- a/llvm/include/llvm/IR/Argument.h
+++ b/llvm/include/llvm/IR/Argument.h
@@ -13,10 +13,10 @@
#ifndef LLVM_IR_ARGUMENT_H
#define LLVM_IR_ARGUMENT_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -38,8 +38,8 @@ class Argument final : public Value {
public:
/// Argument constructor.
- LLVM_ABI explicit Argument(Type *Ty, const Twine &Name = "", Function *F = nullptr,
- unsigned ArgNo = 0);
+ LLVM_ABI explicit Argument(Type *Ty, const Twine &Name = "",
+ Function *F = nullptr, unsigned ArgNo = 0);
inline const Function *getParent() const { return Parent; }
inline Function *getParent() { return Parent; }
@@ -108,8 +108,8 @@ class Argument final : public Value {
/// If this is a byval or inalloca argument, return its alignment.
/// FIXME: Remove this function once transition to Align is over.
/// Use getParamAlign() instead.
- LLVM_ABI LLVM_DEPRECATED("Use getParamAlign() instead", "getParamAlign")
- uint64_t getParamAlignment() const;
+ LLVM_ABI LLVM_DEPRECATED("Use getParamAlign() instead",
+ "getParamAlign") uint64_t getParamAlignment() const;
/// If this is a byval or inalloca argument, return its alignment.
LLVM_ABI MaybeAlign getParamAlign() const;
diff --git a/llvm/include/llvm/IR/Assumptions.h b/llvm/include/llvm/IR/Assumptions.h
index ca1bf67ca7377..f1663f3d6d2bd 100644
--- a/llvm/include/llvm/IR/Assumptions.h
+++ b/llvm/include/llvm/IR/Assumptions.h
@@ -15,10 +15,10 @@
#ifndef LLVM_IR_ASSUMPTIONS_H
#define LLVM_IR_ASSUMPTIONS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -51,12 +51,12 @@ struct KnownAssumptionString {
/// Return true if \p F has the assumption \p AssumptionStr attached.
LLVM_ABI bool hasAssumption(const Function &F,
- const KnownAssumptionString &AssumptionStr);
+ const KnownAssumptionString &AssumptionStr);
/// Return true if \p CB or the callee has the assumption \p AssumptionStr
/// attached.
LLVM_ABI bool hasAssumption(const CallBase &CB,
- const KnownAssumptionString &AssumptionStr);
+ const KnownAssumptionString &AssumptionStr);
/// Return the set of all assumptions for the function \p F.
LLVM_ABI DenseSet<StringRef> getAssumptions(const Function &F);
@@ -65,10 +65,12 @@ LLVM_ABI DenseSet<StringRef> getAssumptions(const Function &F);
LLVM_ABI DenseSet<StringRef> getAssumptions(const CallBase &CB);
/// Appends the set of assumptions \p Assumptions to \F.
-LLVM_ABI bool addAssumptions(Function &F, const DenseSet<StringRef> &Assumptions);
+LLVM_ABI bool addAssumptions(Function &F,
+ const DenseSet<StringRef> &Assumptions);
/// Appends the set of assumptions \p Assumptions to \CB.
-LLVM_ABI bool addAssumptions(CallBase &CB, const DenseSet<StringRef> &Assumptions);
+LLVM_ABI bool addAssumptions(CallBase &CB,
+ const DenseSet<StringRef> &Assumptions);
} // namespace llvm
diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 55b92381e4526..c648170e708f5 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -15,7 +15,6 @@
#ifndef LLVM_IR_ATTRIBUTES_H
#define LLVM_IR_ATTRIBUTES_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
@@ -23,6 +22,7 @@
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/CodeGen.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ModRef.h"
#include "llvm/Support/PointerLikeTypeTraits.h"
#include <cassert>
@@ -137,37 +137,47 @@ class Attribute {
//===--------------------------------------------------------------------===//
/// Return a uniquified Attribute object.
- LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
+ LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind,
+ uint64_t Val = 0);
LLVM_ABI static Attribute get(LLVMContext &Context, StringRef Kind,
- StringRef Val = StringRef());
+ StringRef Val = StringRef());
LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind, Type *Ty);
LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind,
- const ConstantRange &CR);
+ const ConstantRange &CR);
LLVM_ABI static Attribute get(LLVMContext &Context, AttrKind Kind,
- ArrayRef<ConstantRange> Val);
+ ArrayRef<ConstantRange> Val);
/// Return a uniquified Attribute object that has the specific
/// alignment set.
- LLVM_ABI static Attribute getWithAlignment(LLVMContext &Context, Align Alignment);
- LLVM_ABI static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment);
+ LLVM_ABI static Attribute getWithAlignment(LLVMContext &Context,
+ Align Alignment);
+ LLVM_ABI static Attribute getWithStackAlignment(LLVMContext &Context,
+ Align Alignment);
LLVM_ABI static Attribute getWithDereferenceableBytes(LLVMContext &Context,
- uint64_t Bytes);
- LLVM_ABI static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context,
- uint64_t Bytes);
- LLVM_ABI static Attribute getWithAllocSizeArgs(
- LLVMContext &Context, unsigned ElemSizeArg,
- const std::optional<unsigned> &NumElemsArg);
+ uint64_t Bytes);
+ LLVM_ABI static Attribute
+ getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes);
+ LLVM_ABI static Attribute
+ getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg,
+ const std::optional<unsigned> &NumElemsArg);
LLVM_ABI static Attribute getWithVScaleRangeArgs(LLVMContext &Context,
- unsigned MinValue, unsigned MaxValue);
+ unsigned MinValue,
+ unsigned MaxValue);
LLVM_ABI static Attribute getWithByValType(LLVMContext &Context, Type *Ty);
- LLVM_ABI static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithStructRetType(LLVMContext &Context,
+ Type *Ty);
LLVM_ABI static Attribute getWithByRefType(LLVMContext &Context, Type *Ty);
- LLVM_ABI static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty);
+ LLVM_ABI static Attribute getWithPreallocatedType(LLVMContext &Context,
+ Type *Ty);
LLVM_ABI static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty);
- LLVM_ABI static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind);
- LLVM_ABI static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME);
- LLVM_ABI static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask);
- LLVM_ABI static Attribute getWithCaptureInfo(LLVMContext &Context, CaptureInfo CI);
+ LLVM_ABI static Attribute getWithUWTableKind(LLVMContext &Context,
+ UWTableKind Kind);
+ LLVM_ABI static Attribute getWithMemoryEffects(LLVMContext &Context,
+ MemoryEffects ME);
+ LLVM_ABI static Attribute getWithNoFPClass(LLVMContext &Context,
+ FPClassTest Mask);
+ LLVM_ABI static Attribute getWithCaptureInfo(LLVMContext &Context,
+ CaptureInfo CI);
/// For a typed attribute, return the equivalent attribute with the type
/// changed to \p ReplacementTy.
@@ -269,7 +279,8 @@ class Attribute {
LLVM_ABI uint64_t getDereferenceableOrNullBytes() const;
/// Returns the argument numbers for the allocsize attribute.
- LLVM_ABI std::pair<unsigned, std::optional<unsigned>> getAllocSizeArgs() const;
+ LLVM_ABI std::pair<unsigned, std::optional<unsigned>>
+ getAllocSizeArgs() const;
/// Returns the minimum value for the vscale_range attribute.
LLVM_ABI unsigned getVScaleRangeMin() const;
@@ -373,28 +384,28 @@ class AttributeSet {
/// Add an argument attribute. Returns a new set because attribute sets are
/// immutable.
- [[nodiscard]] LLVM_ABI AttributeSet addAttribute(LLVMContext &C,
- Attribute::AttrKind Kind) const;
+ [[nodiscard]] LLVM_ABI AttributeSet
+ addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const;
/// Add a target-dependent attribute. Returns a new set because attribute sets
/// are immutable.
- [[nodiscard]] LLVM_ABI AttributeSet addAttribute(LLVMContext &C, StringRef Kind,
- StringRef Value = StringRef()) const;
+ [[nodiscard]] LLVM_ABI AttributeSet addAttribute(
+ LLVMContext &C, StringRef Kind, StringRef Value = StringRef()) const;
/// Add attributes to the attribute set. Returns a new set because attribute
/// sets are immutable.
[[nodiscard]] LLVM_ABI AttributeSet addAttributes(LLVMContext &C,
- AttributeSet AS) const;
+ AttributeSet AS) const;
/// Remove the specified attribute from this set. Returns a new set because
/// attribute sets are immutable.
- [[nodiscard]] LLVM_ABI AttributeSet removeAttribute(LLVMContext &C,
- Attribute::AttrKind Kind) const;
+ [[nodiscard]] LLVM_ABI AttributeSet
+ removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const;
/// Remove the specified attribute from this set. Returns a new set because
/// attribute sets are immutable.
[[nodiscard]] LLVM_ABI AttributeSet removeAttribute(LLVMContext &C,
- StringRef Kind) const;
+ StringRef Kind) const;
/// Remove the specified attributes from this set. Returns a new set because
/// attribute sets are immutable.
@@ -435,8 +446,8 @@ class AttributeSet {
LLVM_ABI Type *getPreallocatedType() const;
LLVM_ABI Type *getInAllocaType() const;
LLVM_ABI Type *getElementType() const;
- LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
- const;
+ LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>>
+ getAllocSizeArgs() const;
LLVM_ABI unsigned getVScaleRangeMin() const;
LLVM_ABI std::optional<unsigned> getVScaleRangeMax() const;
LLVM_ABI UWTableKind getUWTableKind() const;
@@ -511,16 +522,16 @@ class AttributeList {
public:
/// Create an AttributeList with the specified parameters in it.
- LLVM_ABI static AttributeList get(LLVMContext &C,
- ArrayRef<std::pair<unsigned, Attribute>> Attrs);
- LLVM_ABI static AttributeList get(LLVMContext &C,
- ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);
+ LLVM_ABI static AttributeList
+ get(LLVMContext &C, ArrayRef<std::pair<unsigned, Attribute>> Attrs);
+ LLVM_ABI static AttributeList
+ get(LLVMContext &C, ArrayRef<std::pair<unsigned, AttributeSet>> Attrs);
/// Create an AttributeList from attribute sets for a function, its
/// return value, and all of its arguments.
LLVM_ABI static AttributeList get(LLVMContext &C, AttributeSet FnAttrs,
- AttributeSet RetAttrs,
- ArrayRef<AttributeSet> ArgAttrs);
+ AttributeSet RetAttrs,
+ ArrayRef<AttributeSet> ArgAttrs);
private:
explicit AttributeList(AttributeListImpl *LI) : pImpl(LI) {}
@@ -538,25 +549,25 @@ class AttributeList {
//===--------------------------------------------------------------------===//
/// Return an AttributeList with the specified parameters in it.
- LLVM_ABI static AttributeList get(LLVMContext &C, ArrayRef<AttributeList> Attrs);
+ LLVM_ABI static AttributeList get(LLVMContext &C,
+ ArrayRef<AttributeList> Attrs);
LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
- ArrayRef<Attribute::AttrKind> Kinds);
+ ArrayRef<Attribute::AttrKind> Kinds);
LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
- ArrayRef<Attribute::AttrKind> Kinds,
- ArrayRef<uint64_t> Values);
+ ArrayRef<Attribute::AttrKind> Kinds,
+ ArrayRef<uint64_t> Values);
LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
- ArrayRef<StringRef> Kind);
+ ArrayRef<StringRef> Kind);
LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
- AttributeSet Attrs);
+ AttributeSet Attrs);
LLVM_ABI static AttributeList get(LLVMContext &C, unsigned Index,
- const AttrBuilder &B);
+ const AttrBuilder &B);
// TODO: remove non-AtIndex versions of these methods.
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList
- addAttributeAtIndex(LLVMContext &C, unsigned Index,
- Attribute::AttrKind Kind) const;
+ [[nodiscard]] LLVM_ABI AttributeList addAttributeAtIndex(
+ LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const;
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
@@ -566,14 +577,14 @@ class AttributeList {
/// Add an attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList
- addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute A) const;
+ [[nodiscard]] LLVM_ABI AttributeList addAttributeAtIndex(LLVMContext &C,
+ unsigned Index,
+ Attribute A) const;
/// Add attributes to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList addAttributesAtIndex(LLVMContext &C,
- unsigned Index,
- const AttrBuilder &B) const;
+ [[nodiscard]] LLVM_ABI AttributeList addAttributesAtIndex(
+ LLVMContext &C, unsigned Index, const AttrBuilder &B) const;
/// Add a function attribute to the list. Returns a new list because
/// attribute lists are immutable.
@@ -643,9 +654,8 @@ class AttributeList {
/// Add an attribute to the attribute list at the given arg indices. Returns a
/// new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList addParamAttribute(LLVMContext &C,
- ArrayRef<unsigned> ArgNos,
- Attribute A) const;
+ [[nodiscard]] LLVM_ABI AttributeList addParamAttribute(
+ LLVMContext &C, ArrayRef<unsigned> ArgNos, Attribute A) const;
/// Add an argument attribute to the list. Returns a new list because
/// attribute lists are immutable.
@@ -656,9 +666,8 @@ class AttributeList {
/// Remove the specified attribute at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList
- removeAttributeAtIndex(LLVMContext &C, unsigned Index,
- Attribute::AttrKind Kind) const;
+ [[nodiscard]] LLVM_ABI AttributeList removeAttributeAtIndex(
+ LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const;
/// Remove the specified attribute at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
@@ -671,14 +680,13 @@ class AttributeList {
/// Remove the specified attributes at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList
- removeAttributesAtIndex(LLVMContext &C, unsigned Index,
- const AttributeMask &AttrsToRemove) const;
+ [[nodiscard]] LLVM_ABI AttributeList removeAttributesAtIndex(
+ LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const;
/// Remove all attributes at the specified index from this
/// attribute list. Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList removeAttributesAtIndex(LLVMContext &C,
- unsigned Index) const;
+ [[nodiscard]] LLVM_ABI AttributeList
+ removeAttributesAtIndex(LLVMContext &C, unsigned Index) const;
/// Remove the specified attribute at the function index from this
/// attribute list. Returns a new list because attribute lists are immutable.
@@ -773,26 +781,24 @@ class AttributeList {
/// \brief Add the dereferenceable attribute to the attribute set at the given
/// index. Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList addDereferenceableRetAttr(LLVMContext &C,
- uint64_t Bytes) const;
+ [[nodiscard]] LLVM_ABI AttributeList
+ addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const;
/// \brief Add the dereferenceable attribute to the attribute set at the given
/// arg index. Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList addDereferenceableParamAttr(LLVMContext &C,
- unsigned ArgNo,
- uint64_t Bytes) const;
+ [[nodiscard]] LLVM_ABI AttributeList addDereferenceableParamAttr(
+ LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const;
/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given arg index. Returns a new list because attribute lists are
/// immutable.
- [[nodiscard]] LLVM_ABI AttributeList
- addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo,
- uint64_t Bytes) const;
+ [[nodiscard]] LLVM_ABI AttributeList addDereferenceableOrNullParamAttr(
+ LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const;
/// Add the range attribute to the attribute set at the return value index.
/// Returns a new list because attribute lists are immutable.
- [[nodiscard]] LLVM_ABI AttributeList addRangeRetAttr(LLVMContext &C,
- const ConstantRange &CR) const;
+ [[nodiscard]] LLVM_ABI AttributeList
+ addRangeRetAttr(LLVMContext &C, const ConstantRange &CR) const;
/// Add the allocsize attribute to the attribute set at the given arg index.
/// Returns a new list because attribute lists are immutable.
@@ -824,7 +830,8 @@ class AttributeList {
LLVM_ABI AttributeSet getFnAttrs() const;
/// Return true if the attribute exists at the given index.
- LLVM_ABI bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
+ LLVM_ABI bool hasAttributeAtIndex(unsigned Index,
+ Attribute::AttrKind Kind) const;
/// Return true if the attribute exists at the given index.
LLVM_ABI bool hasAttributeAtIndex(unsigned Index, StringRef Kind) const;
@@ -873,10 +880,11 @@ class AttributeList {
/// parameter or for the return value. If Index is not nullptr, the index
/// of a parameter with the specified attribute is provided.
LLVM_ABI bool hasAttrSomewhere(Attribute::AttrKind Kind,
- unsigned *Index = nullptr) const;
+ unsigned *Index = nullptr) const;
/// Return the attribute object that exists at the given index.
- LLVM_ABI Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const;
+ LLVM_ABI Attribute getAttributeAtIndex(unsigned Index,
+ Attribute::AttrKind Kind) const;
/// Return the attribute object that exists at the given index.
LLVM_ABI Attribute getAttributeAtIndex(unsigned Index, StringRef Kind) const;
@@ -972,7 +980,8 @@ class AttributeList {
LLVM_ABI MemoryEffects getMemoryEffects() const;
/// Return the attributes at the index as a string.
- LLVM_ABI std::string getAsString(unsigned Index, bool InAttrGrp = false) const;
+ LLVM_ABI std::string getAsString(unsigned Index,
+ bool InAttrGrp = false) const;
/// Return true if this attribute list belongs to the LLVMContext.
LLVM_ABI bool hasParentContext(LLVMContext &C) const;
@@ -1139,7 +1148,8 @@ class AttrBuilder {
/// Return raw (possibly packed/encoded) value of integer attribute or
/// std::nullopt if not set.
- LLVM_ABI std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
+ LLVM_ABI std::optional<uint64_t>
+ getRawIntAttr(Attribute::AttrKind Kind) const;
/// Retrieve the alignment attribute, if it exists.
MaybeAlign getAlignment() const {
@@ -1192,8 +1202,8 @@ class AttrBuilder {
/// Retrieve the allocsize args, or std::nullopt if the attribute does not
/// exist.
- LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
- const;
+ LLVM_ABI std::optional<std::pair<unsigned, std::optional<unsigned>>>
+ getAllocSizeArgs() const;
/// Add integer attribute with raw value (packed/encoded if necessary).
LLVM_ABI AttrBuilder &addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value);
@@ -1231,12 +1241,13 @@ class AttrBuilder {
LLVM_ABI AttrBuilder &addDereferenceableOrNullAttr(uint64_t Bytes);
/// This turns one (or two) ints into the form used internally in Attribute.
- LLVM_ABI AttrBuilder &addAllocSizeAttr(unsigned ElemSizeArg,
- const std::optional<unsigned> &NumElemsArg);
+ LLVM_ABI AttrBuilder &
+ addAllocSizeAttr(unsigned ElemSizeArg,
+ const std::optional<unsigned> &NumElemsArg);
/// This turns two ints into the form used internally in Attribute.
LLVM_ABI AttrBuilder &addVScaleRangeAttr(unsigned MinValue,
- std::optional<unsigned> MaxValue);
+ std::optional<unsigned> MaxValue);
/// Add a type attribute with the given type.
LLVM_ABI AttrBuilder &addTypeAttr(Attribute::AttrKind Kind, Type *Ty);
@@ -1262,7 +1273,8 @@ class AttrBuilder {
/// Add a vscale_range attribute, using the representation returned by
/// Attribute.getIntValue().
- LLVM_ABI AttrBuilder &addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr);
+ LLVM_ABI AttrBuilder &
+ addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr);
/// This turns the unwind table kind into the form used internally in
/// Attribute.
@@ -1282,14 +1294,14 @@ class AttrBuilder {
/// Add a ConstantRange attribute with the given range.
LLVM_ABI AttrBuilder &addConstantRangeAttr(Attribute::AttrKind Kind,
- const ConstantRange &CR);
+ const ConstantRange &CR);
/// Add range attribute.
LLVM_ABI AttrBuilder &addRangeAttr(const ConstantRange &CR);
/// Add a ConstantRangeList attribute with the given ranges.
LLVM_ABI AttrBuilder &addConstantRangeListAttr(Attribute::AttrKind Kind,
- ArrayRef<ConstantRange> Val);
+ ArrayRef<ConstantRange> Val);
/// Add initializes attribute.
LLVM_ABI AttrBuilder &addInitializesAttr(const ConstantRangeList &CRL);
@@ -1327,7 +1339,7 @@ LLVM_ABI bool isNoFPClassCompatibleType(Type *Ty);
/// the mask; only attributes that might be unsafe to drop (e.g.,
/// ABI-related attributes) are in the mask; or both.
LLVM_ABI AttributeMask typeIncompatible(Type *Ty, AttributeSet AS,
- AttributeSafetyKind ASK = ASK_ALL);
+ AttributeSafetyKind ASK = ASK_ALL);
/// Get param/return attributes which imply immediate undefined behavior if an
/// invalid value is passed. For example, this includes noundef (where undef
@@ -1338,8 +1350,8 @@ LLVM_ABI AttributeMask getUBImplyingAttributes();
/// \returns Return true if the two functions have compatible target-independent
/// attributes for inlining purposes.
-LLVM_ABI bool areInlineCompatible(const Function &Caller, const Function &Callee);
-
+LLVM_ABI bool areInlineCompatible(const Function &Caller,
+ const Function &Callee);
/// Checks if there are any incompatible function attributes between
/// \p A and \p B.
@@ -1350,13 +1362,15 @@ LLVM_ABI bool areInlineCompatible(const Function &Caller, const Function &Callee
LLVM_ABI bool areOutlineCompatible(const Function &A, const Function &B);
/// Merge caller's and callee's attributes.
-LLVM_ABI void mergeAttributesForInlining(Function &Caller, const Function &Callee);
+LLVM_ABI void mergeAttributesForInlining(Function &Caller,
+ const Function &Callee);
/// Merges the functions attributes from \p ToMerge into function \p Base.
///
/// \param [in,out] Base - The function being merged into.
/// \param [in] ToMerge - The function to merge attributes from.
-LLVM_ABI void mergeAttributesForOutlining(Function &Base, const Function &ToMerge);
+LLVM_ABI void mergeAttributesForOutlining(Function &Base,
+ const Function &ToMerge);
/// Update min-legal-vector-width if it is in Attribute and less than Width.
LLVM_ABI void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width);
diff --git a/llvm/include/llvm/IR/AutoUpgrade.h b/llvm/include/llvm/IR/AutoUpgrade.h
index 23384e746fdf2..31096e86c5180 100644
--- a/llvm/include/llvm/IR/AutoUpgrade.h
+++ b/llvm/include/llvm/IR/AutoUpgrade.h
@@ -13,8 +13,8 @@
#ifndef LLVM_IR_AUTOUPGRADE_H
#define LLVM_IR_AUTOUPGRADE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <vector>
namespace llvm {
@@ -37,8 +37,9 @@ namespace llvm {
/// for upgrading, and returns true if it requires upgrading. It may return
/// null in NewFn if the all calls to the original intrinsic function
/// should be transformed to non-function-call instructions.
- LLVM_ABI bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn,
- bool CanUpgradeDebugIntrinsicsToRecords = true);
+ LLVM_ABI bool
+ UpgradeIntrinsicFunction(Function *F, Function *&NewFn,
+ bool CanUpgradeDebugIntrinsicsToRecords = true);
/// This is the complement to the above, replacing a specific call to an
/// intrinsic function with a call to the specified new function.
@@ -52,7 +53,7 @@ namespace llvm {
/// which need to have both the function updated as well as all calls updated
/// to the new function. This should only be run in a post-processing fashion
/// so that it can update all calls to the old function.
- LLVM_ABI void UpgradeCallsToIntrinsic(Function* F);
+ LLVM_ABI void UpgradeCallsToIntrinsic(Function *F);
/// This checks for global variables which should be upgraded. If it requires
/// upgrading, returns a pointer to the upgraded variable.
@@ -83,12 +84,13 @@ namespace llvm {
/// This is an auto-upgrade for bitcast between pointers with different
/// address spaces: the instruction is replaced by a pair ptrtoint+inttoptr.
LLVM_ABI Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
- Instruction *&Temp);
+ Instruction *&Temp);
/// This is an auto-upgrade for bitcast constant expression between pointers
/// with different address spaces: the instruction is replaced by a pair
/// ptrtoint+inttoptr.
- LLVM_ABI Constant *UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy);
+ LLVM_ABI Constant *UpgradeBitCastExpr(unsigned Opc, Constant *C,
+ Type *DestTy);
/// Check the debug info version number, if it is out-dated, drop the debug
/// info. Return true if module is modified.
@@ -110,7 +112,8 @@ namespace llvm {
LLVM_ABI void UpgradeAttributes(AttrBuilder &B);
/// Upgrade operand bundles (without knowing about their user instruction).
- LLVM_ABI void UpgradeOperandBundles(std::vector<OperandBundleDef> &OperandBundles);
+ LLVM_ABI void
+ UpgradeOperandBundles(std::vector<OperandBundleDef> &OperandBundles);
} // End llvm namespace
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 64622f45baf8e..1480458e9ec19 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -13,7 +13,6 @@
#ifndef LLVM_IR_BASICBLOCK_H
#define LLVM_IR_BASICBLOCK_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Twine.h"
@@ -25,6 +24,7 @@
#include "llvm/IR/Instruction.h"
#include "llvm/IR/SymbolTableListTraits.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstddef>
#include <iterator>
@@ -138,7 +138,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
LLVM_ABI void insertDbgRecordAfter(DbgRecord *DR, Instruction *I);
/// Insert a DbgRecord into a block at the position given by \p Here.
- LLVM_ABI void insertDbgRecordBefore(DbgRecord *DR, InstListType::iterator Here);
+ LLVM_ABI void insertDbgRecordBefore(DbgRecord *DR,
+ InstListType::iterator Here);
/// Eject any debug-info trailing at the end of a block. DbgRecords can
/// transiently be located "off the end" of a block if the blocks terminator
@@ -151,8 +152,9 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// happens in RemoveDIs debug-info mode, some special patching-up needs to
/// occur: inserting into the middle of a sequence of dbg.value intrinsics
/// does not have an equivalent with DbgRecords.
- LLVM_ABI void reinsertInstInDbgRecords(Instruction *I,
- std::optional<DbgRecord::self_iterator> Pos);
+ LLVM_ABI void
+ reinsertInstInDbgRecords(Instruction *I,
+ std::optional<DbgRecord::self_iterator> Pos);
private:
void setParent(Function *parent);
@@ -163,8 +165,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// inserted at either the end of the function (if InsertBefore is null), or
/// before the specified basic block.
LLVM_ABI explicit BasicBlock(LLVMContext &C, const Twine &Name = "",
- Function *Parent = nullptr,
- BasicBlock *InsertBefore = nullptr);
+ Function *Parent = nullptr,
+ BasicBlock *InsertBefore = nullptr);
public:
BasicBlock(const BasicBlock &) = delete;
@@ -228,7 +230,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
LLVM_ABI const Module *getModule() const;
Module *getModule() {
return const_cast<Module *>(
- static_cast<const BasicBlock *>(this)->getModule());
+ static_cast<const BasicBlock *>(this)->getModule());
}
/// Get the data layout of the module this basic block belongs to.
@@ -236,8 +238,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Requires the basic block to have a parent module.
LLVM_ABI const DataLayout &getDataLayout() const;
- /// Returns the terminator instruction if the block is well formed or null
- /// if the block is not well formed.
+ /// Returns the terminator instruction if the block is well formed or
+ /// null if the block is not well formed.
const Instruction *getTerminator() const LLVM_READONLY {
if (InstList.empty() || !InstList.back().isTerminator())
return nullptr;
@@ -284,11 +286,11 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
///
/// Deprecated in favour of getFirstNonPHIIt, which returns an iterator that
/// preserves some debugging information.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "getFirstNonPHIIt")
- const Instruction *getFirstNonPHI() const;
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
+ "getFirstNonPHIIt") const
+ Instruction *getFirstNonPHI() const;
LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions instead",
- "getFirstNonPHIIt")
- Instruction *getFirstNonPHI();
+ "getFirstNonPHIIt") Instruction *getFirstNonPHI();
/// Returns an iterator to the first instruction in this block that is not a
/// PHINode instruction.
@@ -352,7 +354,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Returns the first potential AsynchEH faulty instruction
/// currently it checks for loads/stores (which may dereference a null
/// pointer) and calls/invokes (which may propagate exceptions)
- LLVM_ABI const Instruction* getFirstMayFaultInst() const;
+ LLVM_ABI const Instruction *getFirstMayFaultInst() const;
Instruction* getFirstMayFaultInst() {
return const_cast<Instruction*>(
static_cast<const BasicBlock*>(this)->getFirstMayFaultInst());
@@ -361,7 +363,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Return a const iterator range over the instructions in the block, skipping
/// any debug instructions. Skip any pseudo operations as well if \c
/// SkipPseudoOp is true.
- LLVM_ABI iterator_range<filter_iterator<BasicBlock::const_iterator,
+ LLVM_ABI
+ iterator_range<filter_iterator<BasicBlock::const_iterator,
std::function<bool(const Instruction &)>>>
instructionsWithoutDebug(bool SkipPseudoOp = true) const;
@@ -373,7 +376,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
instructionsWithoutDebug(bool SkipPseudoOp = true);
/// Return the size of the basic block ignoring debug instructions
- LLVM_ABI filter_iterator<BasicBlock::const_iterator,
+ LLVM_ABI
+ filter_iterator<BasicBlock::const_iterator,
std::function<bool(const Instruction &)>>::difference_type
sizeWithoutDebug() const;
@@ -402,7 +406,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// provided, inserts before that basic block, otherwise inserts at the end.
///
/// \pre \a getParent() is \c nullptr.
- LLVM_ABI void insertInto(Function *Parent, BasicBlock *InsertBefore = nullptr);
+ LLVM_ABI void insertInto(Function *Parent,
+ BasicBlock *InsertBefore = nullptr);
/// Return the predecessor of this block if it has a single predecessor
/// block. Otherwise return a null pointer.
@@ -453,8 +458,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Print the basic block to an output stream with an optional
/// AssemblyAnnotationWriter.
LLVM_ABI void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr,
- bool ShouldPreserveUseListOrder = false,
- bool IsForDebug = false) const;
+ bool ShouldPreserveUseListOrder = false,
+ bool IsForDebug = false) const;
//===--------------------------------------------------------------------===//
/// Instruction iterator methods
@@ -608,7 +613,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// If \p KeepOneInputPHIs is true then don't remove PHIs that are left with
/// zero or one incoming values, and don't simplify PHIs with all incoming
/// values the same.
- LLVM_ABI void removePredecessor(BasicBlock *Pred, bool KeepOneInputPHIs = false);
+ LLVM_ABI void removePredecessor(BasicBlock *Pred,
+ bool KeepOneInputPHIs = false);
LLVM_ABI bool canSplitPredecessors() const;
@@ -631,7 +637,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Also note that this doesn't preserve any passes. To split blocks while
/// keeping loop information consistent, use the SplitBlock utility function.
LLVM_ABI BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "",
- bool Before = false);
+ bool Before = false);
BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "",
bool Before = false) {
return splitBasicBlock(I->getIterator(), BBName, Before);
@@ -654,7 +660,8 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Also note that this doesn't preserve any passes. To split blocks while
/// keeping loop information consistent, use the SplitBlockBefore utility
/// function.
- LLVM_ABI BasicBlock *splitBasicBlockBefore(iterator I, const Twine &BBName = "");
+ LLVM_ABI BasicBlock *splitBasicBlockBefore(iterator I,
+ const Twine &BBName = "");
BasicBlock *splitBasicBlockBefore(Instruction *I, const Twine &BBName = "") {
return splitBasicBlockBefore(I->getIterator(), BBName);
}
@@ -678,12 +685,13 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
/// Transfer a range of instructions that belong to \p FromBB from \p
/// FromBeginIt to \p FromEndIt, to this basic block at \p ToIt.
LLVM_ABI void splice(BasicBlock::iterator ToIt, BasicBlock *FromBB,
- BasicBlock::iterator FromBeginIt,
- BasicBlock::iterator FromEndIt);
+ BasicBlock::iterator FromBeginIt,
+ BasicBlock::iterator FromEndIt);
/// Erases a range of instructions from \p FromIt to (not including) \p ToIt.
/// \Returns \p ToIt.
- LLVM_ABI BasicBlock::iterator erase(BasicBlock::iterator FromIt, BasicBlock::iterator ToIt);
+ LLVM_ABI BasicBlock::iterator erase(BasicBlock::iterator FromIt,
+ BasicBlock::iterator ToIt);
/// Returns true if there are any uses of this basic block other than
/// direct branches, switches, etc. to it.
diff --git a/llvm/include/llvm/IR/CmpPredicate.h b/llvm/include/llvm/IR/CmpPredicate.h
index 893dd12636ede..96b85426a4add 100644
--- a/llvm/include/llvm/IR/CmpPredicate.h
+++ b/llvm/include/llvm/IR/CmpPredicate.h
@@ -13,8 +13,8 @@
#ifndef LLVM_IR_CMPPREDICATE_H
#define LLVM_IR_CMPPREDICATE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/InstrTypes.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
/// An abstraction over a floating-point predicate, and a pack of an integer
@@ -56,7 +56,7 @@ class CmpPredicate {
/// ult + ult -> ult
/// ult + slt -> std::nullopt
LLVM_ABI static std::optional<CmpPredicate> getMatching(CmpPredicate A,
- CmpPredicate B);
+ CmpPredicate B);
/// Attempts to return a signed CmpInst::Predicate from the CmpPredicate. If
/// the CmpPredicate has samesign, return ICmpInst::getSignedPredicate,
diff --git a/llvm/include/llvm/IR/Comdat.h b/llvm/include/llvm/IR/Comdat.h
index 1fc2356c0cbde..3865d0cc82b04 100644
--- a/llvm/include/llvm/IR/Comdat.h
+++ b/llvm/include/llvm/IR/Comdat.h
@@ -15,10 +15,10 @@
#ifndef LLVM_IR_COMDAT_H
#define LLVM_IR_COMDAT_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/Constant.h b/llvm/include/llvm/IR/Constant.h
index 04384b250dc10..0be1fc172ebd4 100644
--- a/llvm/include/llvm/IR/Constant.h
+++ b/llvm/include/llvm/IR/Constant.h
@@ -13,10 +13,10 @@
#ifndef LLVM_IR_CONSTANT_H
#define LLVM_IR_CONSTANT_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -187,12 +187,12 @@ class Constant : public User {
///
LLVM_ABI void handleOperandChange(Value *, Value *);
- LLVM_ABI static Constant *getNullValue(Type* Ty);
+ LLVM_ABI static Constant *getNullValue(Type *Ty);
/// @returns the value for an integer or vector of integer constant of the
/// given type that has all its bits set to true.
/// Get the all ones value
- LLVM_ABI static Constant *getAllOnesValue(Type* Ty);
+ LLVM_ABI static Constant *getAllOnesValue(Type *Ty);
/// Return the value for an integer or pointer constant, or a vector thereof,
/// with the given scalar value.
@@ -227,7 +227,8 @@ class Constant : public User {
/// Try to replace undefined constant C or undefined elements in C with
/// Replacement. If no changes are made, the constant C is returned.
- LLVM_ABI static Constant *replaceUndefsWith(Constant *C, Constant *Replacement);
+ LLVM_ABI static Constant *replaceUndefsWith(Constant *C,
+ Constant *Replacement);
/// Merges undefs of a Constant with another Constant, along with the
/// undefs already present. Other doesn't have to be the same type as C, but
diff --git a/llvm/include/llvm/IR/ConstantFPRange.h b/llvm/include/llvm/IR/ConstantFPRange.h
index ef4de41a3025d..930c6f98c033f 100644
--- a/llvm/include/llvm/IR/ConstantFPRange.h
+++ b/llvm/include/llvm/IR/ConstantFPRange.h
@@ -23,9 +23,9 @@
#ifndef LLVM_IR_CONSTANTFPRANGE_H
#define LLVM_IR_CONSTANTFPRANGE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -63,7 +63,7 @@ class [[nodiscard]] ConstantFPRange {
/// Note: If \p LowerVal is greater than \p UpperVal, please use the canonical
/// form [Inf, -Inf].
LLVM_ABI ConstantFPRange(APFloat LowerVal, APFloat UpperVal, bool MayBeQNaN,
- bool MayBeSNaN);
+ bool MayBeSNaN);
/// Create empty constant range with the given semantics.
static ConstantFPRange getEmpty(const fltSemantics &Sem) {
@@ -94,8 +94,8 @@ class [[nodiscard]] ConstantFPRange {
}
/// Create a range which only contains NaNs.
- LLVM_ABI static ConstantFPRange getNaNOnly(const fltSemantics &Sem, bool MayBeQNaN,
- bool MayBeSNaN);
+ LLVM_ABI static ConstantFPRange getNaNOnly(const fltSemantics &Sem,
+ bool MayBeQNaN, bool MayBeSNaN);
/// Produce the smallest range such that all values that may satisfy the given
/// predicate with any value contained within Other is contained in the
@@ -105,8 +105,8 @@ class [[nodiscard]] ConstantFPRange {
/// a proper superset of the above.
///
/// Example: Pred = ole and Other = float [2, 5] returns Result = [-inf, 5]
- LLVM_ABI static ConstantFPRange makeAllowedFCmpRegion(FCmpInst::Predicate Pred,
- const ConstantFPRange &Other);
+ LLVM_ABI static ConstantFPRange
+ makeAllowedFCmpRegion(FCmpInst::Predicate Pred, const ConstantFPRange &Other);
/// Produce the largest range such that all values in the returned range
/// satisfy the given predicate with all values contained within Other.
@@ -116,8 +116,9 @@ class [[nodiscard]] ConstantFPRange {
/// will be a proper subset of the above.
///
/// Example: Pred = ole and Other = float [2, 5] returns [-inf, 2]
- LLVM_ABI static ConstantFPRange makeSatisfyingFCmpRegion(FCmpInst::Predicate Pred,
- const ConstantFPRange &Other);
+ LLVM_ABI static ConstantFPRange
+ makeSatisfyingFCmpRegion(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other);
/// Produce the exact range such that all values in the returned range satisfy
/// the given predicate with any value contained within Other. Formally, this
@@ -131,7 +132,8 @@ class [[nodiscard]] ConstantFPRange {
/// Does the predicate \p Pred hold between ranges this and \p Other?
/// NOTE: false does not mean that inverse predicate holds!
- LLVM_ABI bool fcmp(FCmpInst::Predicate Pred, const ConstantFPRange &Other) const;
+ LLVM_ABI bool fcmp(FCmpInst::Predicate Pred,
+ const ConstantFPRange &Other) const;
/// Return the lower value for this range.
const APFloat &getLower() const { return Lower; }
diff --git a/llvm/include/llvm/IR/ConstantFold.h b/llvm/include/llvm/IR/ConstantFold.h
index 8e29744981474..f9f2b3516a4ca 100644
--- a/llvm/include/llvm/IR/ConstantFold.h
+++ b/llvm/include/llvm/IR/ConstantFold.h
@@ -21,8 +21,8 @@
#ifndef LLVM_IR_CONSTANTFOLD_H
#define LLVM_IR_CONSTANTFOLD_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/InstrTypes.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -32,30 +32,36 @@ namespace llvm {
class Type;
// Constant fold various types of instruction...
- LLVM_ABI Constant *ConstantFoldCastInstruction(
- unsigned opcode, ///< The opcode of the cast
- Constant *V, ///< The source constant
- Type *DestTy ///< The destination type
+ LLVM_ABI Constant *
+ ConstantFoldCastInstruction(unsigned opcode, ///< The opcode of the cast
+ Constant *V, ///< The source constant
+ Type *DestTy ///< The destination type
);
- LLVM_ABI Constant *ConstantFoldSelectInstruction(Constant *Cond,
- Constant *V1, Constant *V2);
- LLVM_ABI Constant *ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx);
- LLVM_ABI Constant *ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt,
- Constant *Idx);
- LLVM_ABI Constant *ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
- ArrayRef<int> Mask);
- LLVM_ABI Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
- ArrayRef<unsigned> Idxs);
- LLVM_ABI Constant *ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val,
- ArrayRef<unsigned> Idxs);
+ LLVM_ABI Constant *ConstantFoldSelectInstruction(Constant *Cond, Constant *V1,
+ Constant *V2);
+ LLVM_ABI Constant *ConstantFoldExtractElementInstruction(Constant *Val,
+ Constant *Idx);
+ LLVM_ABI Constant *ConstantFoldInsertElementInstruction(Constant *Val,
+ Constant *Elt,
+ Constant *Idx);
+ LLVM_ABI Constant *ConstantFoldShuffleVectorInstruction(Constant *V1,
+ Constant *V2,
+ ArrayRef<int> Mask);
+ LLVM_ABI Constant *
+ ConstantFoldExtractValueInstruction(Constant *Agg, ArrayRef<unsigned> Idxs);
+ LLVM_ABI Constant *
+ ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val,
+ ArrayRef<unsigned> Idxs);
LLVM_ABI Constant *ConstantFoldUnaryInstruction(unsigned Opcode, Constant *V);
- LLVM_ABI Constant *ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1,
- Constant *V2);
- LLVM_ABI Constant *ConstantFoldCompareInstruction(CmpInst::Predicate Predicate,
- Constant *C1, Constant *C2);
- LLVM_ABI Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C,
- std::optional<ConstantRange> InRange,
- ArrayRef<Value *> Idxs);
+ LLVM_ABI Constant *ConstantFoldBinaryInstruction(unsigned Opcode,
+ Constant *V1, Constant *V2);
+ LLVM_ABI Constant *
+ ConstantFoldCompareInstruction(CmpInst::Predicate Predicate, Constant *C1,
+ Constant *C2);
+ LLVM_ABI Constant *
+ ConstantFoldGetElementPtr(Type *Ty, Constant *C,
+ std::optional<ConstantRange> InRange,
+ ArrayRef<Value *> Idxs);
} // End llvm namespace
#endif
diff --git a/llvm/include/llvm/IR/ConstantFolder.h b/llvm/include/llvm/IR/ConstantFolder.h
index 51108c07b5c48..26b7242abc4d9 100644
--- a/llvm/include/llvm/IR/ConstantFolder.h
+++ b/llvm/include/llvm/IR/ConstantFolder.h
@@ -16,7 +16,6 @@
#ifndef LLVM_IR_CONSTANTFOLDER_H
#define LLVM_IR_CONSTANTFOLDER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/ConstantFold.h"
@@ -24,6 +23,7 @@
#include "llvm/IR/IRBuilderFolder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Operator.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/ConstantRange.h b/llvm/include/llvm/IR/ConstantRange.h
index f46cf2cdfea3e..9a6a9db65688a 100644
--- a/llvm/include/llvm/IR/ConstantRange.h
+++ b/llvm/include/llvm/IR/ConstantRange.h
@@ -90,7 +90,8 @@ class [[nodiscard]] ConstantRange {
/// Initialize a range based on a known bits constraint. The IsSigned flag
/// indicates whether the constant range should not wrap in the signed or
/// unsigned domain.
- LLVM_ABI static ConstantRange fromKnownBits(const KnownBits &Known, bool IsSigned);
+ LLVM_ABI static ConstantRange fromKnownBits(const KnownBits &Known,
+ bool IsSigned);
/// Split the ConstantRange into positive and negative components, ignoring
/// zero values.
@@ -104,8 +105,8 @@ class [[nodiscard]] ConstantRange {
/// proper superset of the above.
///
/// Example: Pred = ult and Other = i8 [2, 5) returns Result = [0, 4)
- LLVM_ABI static ConstantRange makeAllowedICmpRegion(CmpInst::Predicate Pred,
- const ConstantRange &Other);
+ LLVM_ABI static ConstantRange
+ makeAllowedICmpRegion(CmpInst::Predicate Pred, const ConstantRange &Other);
/// Produce the largest range such that all values in the returned range
/// satisfy the given predicate with all values contained within Other.
@@ -115,8 +116,8 @@ class [[nodiscard]] ConstantRange {
/// will be a proper subset of the above.
///
/// Example: Pred = ult and Other = i8 [2, 5) returns [0, 2)
- LLVM_ABI static ConstantRange makeSatisfyingICmpRegion(CmpInst::Predicate Pred,
- const ConstantRange &Other);
+ LLVM_ABI static ConstantRange
+ makeSatisfyingICmpRegion(CmpInst::Predicate Pred, const ConstantRange &Other);
/// Produce the exact range such that all values in the returned range satisfy
/// the given predicate with any value contained within Other. Formally, this
@@ -126,7 +127,7 @@ class [[nodiscard]] ConstantRange {
///
/// Example: Pred = ult and Other = i8 3 returns [0, 3)
LLVM_ABI static ConstantRange makeExactICmpRegion(CmpInst::Predicate Pred,
- const APInt &Other);
+ const APInt &Other);
/// Does the predicate \p Pred hold between ranges this and \p Other?
/// NOTE: false does not mean that inverse predicate holds!
@@ -170,20 +171,21 @@ class [[nodiscard]] ConstantRange {
/// MGNR(Add, [i8 -1, 6), OBO::NoSignedWrap) == [INT_MIN+1, INT_MAX-4)
/// MGNR(Sub, [i8 1, 2), OBO::NoSignedWrap) == [-127, 128)
/// MGNR(Sub, [i8 1, 2), OBO::NoUnsignedWrap) == [1, 0)
- LLVM_ABI static ConstantRange makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
- const ConstantRange &Other,
- unsigned NoWrapKind);
+ LLVM_ABI static ConstantRange
+ makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
+ const ConstantRange &Other, unsigned NoWrapKind);
/// Produce the range that contains X if and only if "X BinOp Other" does
/// not wrap.
- LLVM_ABI static ConstantRange makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
- const APInt &Other,
- unsigned NoWrapKind);
+ LLVM_ABI static ConstantRange
+ makeExactNoWrapRegion(Instruction::BinaryOps BinOp, const APInt &Other,
+ unsigned NoWrapKind);
/// Initialize a range containing all values X that satisfy `(X & Mask)
/// != C`. Note that the range returned may contain values where `(X & Mask)
/// == C` holds, making it less precise, but still conservative.
- LLVM_ABI static ConstantRange makeMaskNotEqualRange(const APInt &Mask, const APInt &C);
+ LLVM_ABI static ConstantRange makeMaskNotEqualRange(const APInt &Mask,
+ const APInt &C);
/// Returns true if ConstantRange calculations are supported for intrinsic
/// with \p IntrinsicID.
@@ -191,7 +193,7 @@ class [[nodiscard]] ConstantRange {
/// Compute range of intrinsic result for the given operand ranges.
LLVM_ABI static ConstantRange intrinsic(Intrinsic::ID IntrinsicID,
- ArrayRef<ConstantRange> Ops);
+ ArrayRef<ConstantRange> Ops);
/// Set up \p Pred and \p RHS such that
/// ConstantRange::makeExactICmpRegion(Pred, RHS) == *this. Return true if
@@ -200,8 +202,8 @@ class [[nodiscard]] ConstantRange {
/// Set up \p Pred, \p RHS and \p Offset such that (V + Offset) Pred RHS
/// is true iff V is in the range. Prefers using Offset == 0 if possible.
- LLVM_ABI void
- getEquivalentICmp(CmpInst::Predicate &Pred, APInt &RHS, APInt &Offset) const;
+ LLVM_ABI void getEquivalentICmp(CmpInst::Predicate &Pred, APInt &RHS,
+ APInt &Offset) const;
/// Return the lower value for this range.
const APInt &getLower() const { return Lower; }
@@ -333,8 +335,8 @@ class [[nodiscard]] ConstantRange {
/// Return the range that results from the intersection of this range with
/// another range. If the intersection is disjoint, such that two results
/// are possible, the preferred range is determined by the PreferredRangeType.
- LLVM_ABI ConstantRange intersectWith(const ConstantRange &CR,
- PreferredRangeType Type = Smallest) const;
+ LLVM_ABI ConstantRange intersectWith(
+ const ConstantRange &CR, PreferredRangeType Type = Smallest) const;
/// Return the range that results from the union of this range
/// with another range. The resultant range is guaranteed to include the
@@ -342,7 +344,7 @@ class [[nodiscard]] ConstantRange {
/// [12,15) is [3, 15), which includes 9, 10, and 11, which were not included
/// in either set before.
LLVM_ABI ConstantRange unionWith(const ConstantRange &CR,
- PreferredRangeType Type = Smallest) const;
+ PreferredRangeType Type = Smallest) const;
/// Intersect the two ranges and return the result if it can be represented
/// exactly, otherwise return std::nullopt.
@@ -351,7 +353,8 @@ class [[nodiscard]] ConstantRange {
/// Union the two ranges and return the result if it can be represented
/// exactly, otherwise return std::nullopt.
- LLVM_ABI std::optional<ConstantRange> exactUnionWith(const ConstantRange &CR) const;
+ LLVM_ABI std::optional<ConstantRange>
+ exactUnionWith(const ConstantRange &CR) const;
/// Return a new range representing the possible values resulting
/// from an application of the specified cast operator to this range. \p
@@ -360,7 +363,7 @@ class [[nodiscard]] ConstantRange {
/// which do change bitwidth, the bitwidth must be consistent with the
/// requested cast and source bitwidth.
LLVM_ABI ConstantRange castOp(Instruction::CastOps CastOp,
- uint32_t BitWidth) const;
+ uint32_t BitWidth) const;
/// Return a new range in the specified integer type, which must
/// be strictly larger than the current type. The returned range will
@@ -392,15 +395,15 @@ class [[nodiscard]] ConstantRange {
/// from an application of the specified binary operator to an left hand side
/// of this range and a right hand side of \p Other.
LLVM_ABI ConstantRange binaryOp(Instruction::BinaryOps BinOp,
- const ConstantRange &Other) const;
+ const ConstantRange &Other) const;
/// Return a new range representing the possible values resulting
/// from an application of the specified overflowing binary operator to a
/// left hand side of this range and a right hand side of \p Other given
/// the provided knowledge about lack of wrapping \p NoWrapKind.
LLVM_ABI ConstantRange overflowingBinaryOp(Instruction::BinaryOps BinOp,
- const ConstantRange &Other,
- unsigned NoWrapKind) const;
+ const ConstantRange &Other,
+ unsigned NoWrapKind) const;
/// Return a new range representing the possible values resulting
/// from an addition of a value in this range and a value in \p Other.
@@ -411,8 +414,9 @@ class [[nodiscard]] ConstantRange {
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- LLVM_ABI ConstantRange addWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
- PreferredRangeType RangeType = Smallest) const;
+ LLVM_ABI ConstantRange
+ addWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
+ PreferredRangeType RangeType = Smallest) const;
/// Return a new range representing the possible values resulting
/// from a subtraction of a value in this range and a value in \p Other.
@@ -423,8 +427,9 @@ class [[nodiscard]] ConstantRange {
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- LLVM_ABI ConstantRange subWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
- PreferredRangeType RangeType = Smallest) const;
+ LLVM_ABI ConstantRange
+ subWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
+ PreferredRangeType RangeType = Smallest) const;
/// Return a new range representing the possible values resulting
/// from a multiplication of a value in this range and a value in \p Other,
@@ -510,8 +515,9 @@ class [[nodiscard]] ConstantRange {
/// range and a value in \p Other.
/// If the result range is disjoint, the preferred range is determined by the
/// \p PreferredRangeType.
- LLVM_ABI ConstantRange shlWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
- PreferredRangeType RangeType = Smallest) const;
+ LLVM_ABI ConstantRange
+ shlWithNoWrap(const ConstantRange &Other, unsigned NoWrapKind,
+ PreferredRangeType RangeType = Smallest) const;
/// Return a new range representing the possible values resulting from a
/// logical right shift of a value in this range and a value in \p Other.
@@ -580,19 +586,24 @@ class [[nodiscard]] ConstantRange {
};
/// Return whether unsigned add of the two ranges always/never overflows.
- LLVM_ABI OverflowResult unsignedAddMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult
+ unsignedAddMayOverflow(const ConstantRange &Other) const;
/// Return whether signed add of the two ranges always/never overflows.
- LLVM_ABI OverflowResult signedAddMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult
+ signedAddMayOverflow(const ConstantRange &Other) const;
/// Return whether unsigned sub of the two ranges always/never overflows.
- LLVM_ABI OverflowResult unsignedSubMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult
+ unsignedSubMayOverflow(const ConstantRange &Other) const;
/// Return whether signed sub of the two ranges always/never overflows.
- LLVM_ABI OverflowResult signedSubMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult
+ signedSubMayOverflow(const ConstantRange &Other) const;
/// Return whether unsigned mul of the two ranges always/never overflows.
- LLVM_ABI OverflowResult unsignedMulMayOverflow(const ConstantRange &Other) const;
+ LLVM_ABI OverflowResult
+ unsignedMulMayOverflow(const ConstantRange &Other) const;
/// Return known bits for values in this range.
LLVM_ABI KnownBits toKnownBits() const;
diff --git a/llvm/include/llvm/IR/ConstantRangeList.h b/llvm/include/llvm/IR/ConstantRangeList.h
index 2a02c19077b94..104018bc73153 100644
--- a/llvm/include/llvm/IR/ConstantRangeList.h
+++ b/llvm/include/llvm/IR/ConstantRangeList.h
@@ -16,9 +16,9 @@
#ifndef LLVM_IR_CONSTANTRANGELIST_H
#define LLVM_IR_CONSTANTRANGELIST_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APInt.h"
#include "llvm/IR/ConstantRange.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include <cstddef>
#include <cstdint>
diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index 642469047c41d..9c9fc8892bdbf 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -120,7 +120,8 @@ class ConstantInt final : public ConstantData {
/// be interpreted as a 64-bit signed integer and sign-extended to fit
/// the type.
/// Get a ConstantInt for a specific value.
- LLVM_ABI static ConstantInt *get(IntegerType *Ty, uint64_t V, bool IsSigned = false);
+ LLVM_ABI static ConstantInt *get(IntegerType *Ty, uint64_t V,
+ bool IsSigned = false);
/// Return a ConstantInt with the specified value for the specified type. The
/// value V will be canonicalized to a an unsigned APInt. Accessing it with
@@ -140,7 +141,8 @@ class ConstantInt final : public ConstantData {
/// Return a ConstantInt constructed from the string strStart with the given
/// radix.
- LLVM_ABI static ConstantInt *get(IntegerType *Ty, StringRef Str, uint8_t Radix);
+ LLVM_ABI static ConstantInt *get(IntegerType *Ty, StringRef Str,
+ uint8_t Radix);
/// If Ty is a vector type, return a Constant with a splat of the given
/// value. Otherwise return a ConstantInt for the given value.
@@ -304,11 +306,11 @@ class ConstantFP final : public ConstantData {
LLVM_ABI static Constant *get(Type *Ty, StringRef Str);
LLVM_ABI static ConstantFP *get(LLVMContext &Context, const APFloat &V);
LLVM_ABI static Constant *getNaN(Type *Ty, bool Negative = false,
- uint64_t Payload = 0);
+ uint64_t Payload = 0);
LLVM_ABI static Constant *getQNaN(Type *Ty, bool Negative = false,
- APInt *Payload = nullptr);
+ APInt *Payload = nullptr);
LLVM_ABI static Constant *getSNaN(Type *Ty, bool Negative = false,
- APInt *Payload = nullptr);
+ APInt *Payload = nullptr);
LLVM_ABI static Constant *getZero(Type *Ty, bool Negative = false);
static Constant *getNegativeZero(Type *Ty) { return getZero(Ty, true); }
LLVM_ABI static Constant *getInfinity(Type *Ty, bool Negative = false);
@@ -406,7 +408,7 @@ class ConstantAggregateZero final : public ConstantData {
class ConstantAggregate : public Constant {
protected:
LLVM_ABI ConstantAggregate(Type *T, ValueTy VT, ArrayRef<Constant *> V,
- AllocInfo AllocInfo);
+ AllocInfo AllocInfo);
public:
/// Transparently provide more efficient getOperand methods.
@@ -492,11 +494,11 @@ class ConstantStruct final : public ConstantAggregate {
/// Return an anonymous struct type to use for a constant with the specified
/// set of elements. The list must not be empty.
LLVM_ABI static StructType *getTypeForElements(ArrayRef<Constant *> V,
- bool Packed = false);
+ bool Packed = false);
/// This version of the method allows an empty list.
LLVM_ABI static StructType *getTypeForElements(LLVMContext &Ctx,
- ArrayRef<Constant *> V,
- bool Packed = false);
+ ArrayRef<Constant *> V,
+ bool Packed = false);
/// Specialization - reduce amount of casting.
inline StructType *getType() const {
@@ -750,8 +752,8 @@ class ConstantDataArray final : public ConstantDataSequential {
/// be placed at the end of the array (increasing the length of the string by
/// one more than the StringRef would normally indicate. Pass AddNull=false
/// to disable this behavior.
- LLVM_ABI static Constant *getString(LLVMContext &Context, StringRef Initializer,
- bool AddNull = true);
+ LLVM_ABI static Constant *
+ getString(LLVMContext &Context, StringRef Initializer, bool AddNull = true);
/// Specialize the getType() method to always return an ArrayType,
/// which reduces the amount of casting needed in parts of the compiler.
@@ -1044,7 +1046,7 @@ class ConstantPtrAuth final : public Constant {
public:
/// Return a pointer signed with the specified parameters.
LLVM_ABI static ConstantPtrAuth *get(Constant *Ptr, ConstantInt *Key,
- ConstantInt *Disc, Constant *AddrDisc);
+ ConstantInt *Disc, Constant *AddrDisc);
/// Produce a new ptrauth expression signing the given value using
/// the same schema as is stored in one.
@@ -1092,8 +1094,9 @@ class ConstantPtrAuth final : public Constant {
/// Check whether an authentication operation with key \p Key and (possibly
/// blended) discriminator \p Discriminator is known to be compatible with
/// this ptrauth signed pointer.
- LLVM_ABI bool isKnownCompatibleWith(const Value *Key, const Value *Discriminator,
- const DataLayout &DL) const;
+ LLVM_ABI bool isKnownCompatibleWith(const Value *Key,
+ const Value *Discriminator,
+ const DataLayout &DL) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Value *V) {
@@ -1148,20 +1151,21 @@ class ConstantExpr : public Constant {
LLVM_ABI static Constant *getNeg(Constant *C, bool HasNSW = false);
LLVM_ABI static Constant *getNot(Constant *C);
- LLVM_ABI static Constant *getAdd(Constant *C1, Constant *C2, bool HasNUW = false,
- bool HasNSW = false);
- LLVM_ABI static Constant *getSub(Constant *C1, Constant *C2, bool HasNUW = false,
- bool HasNSW = false);
+ LLVM_ABI static Constant *getAdd(Constant *C1, Constant *C2,
+ bool HasNUW = false, bool HasNSW = false);
+ LLVM_ABI static Constant *getSub(Constant *C1, Constant *C2,
+ bool HasNUW = false, bool HasNSW = false);
LLVM_ABI static Constant *getXor(Constant *C1, Constant *C2);
- LLVM_ABI static Constant *getTrunc(Constant *C, Type *Ty, bool OnlyIfReduced = false);
+ LLVM_ABI static Constant *getTrunc(Constant *C, Type *Ty,
+ bool OnlyIfReduced = false);
LLVM_ABI static Constant *getPtrToInt(Constant *C, Type *Ty,
- bool OnlyIfReduced = false);
+ bool OnlyIfReduced = false);
LLVM_ABI static Constant *getIntToPtr(Constant *C, Type *Ty,
- bool OnlyIfReduced = false);
+ bool OnlyIfReduced = false);
LLVM_ABI static Constant *getBitCast(Constant *C, Type *Ty,
- bool OnlyIfReduced = false);
+ bool OnlyIfReduced = false);
LLVM_ABI static Constant *getAddrSpaceCast(Constant *C, Type *Ty,
- bool OnlyIfReduced = false);
+ bool OnlyIfReduced = false);
static Constant *getNSWNeg(Constant *C) { return getNeg(C, /*HasNSW=*/true); }
@@ -1195,8 +1199,8 @@ class ConstantExpr : public Constant {
/// setting NSZ to true returns the identity +0.0 instead of -0.0. Return
/// nullptr if the operator does not have an identity constant.
LLVM_ABI static Constant *getBinOpIdentity(unsigned Opcode, Type *Ty,
- bool AllowRHSConstant = false,
- bool NSZ = false);
+ bool AllowRHSConstant = false,
+ bool NSZ = false);
LLVM_ABI static Constant *getIntrinsicIdentity(Intrinsic::ID, Type *Ty);
@@ -1204,7 +1208,8 @@ class ConstantExpr : public Constant {
/// The identity constant C is defined as X op C = X and C op X = X where C
/// and X are the first two operands, and the operation is commutative.
LLVM_ABI static Constant *getIdentity(Instruction *I, Type *Ty,
- bool AllowRHSConstant = false, bool NSZ = false);
+ bool AllowRHSConstant = false,
+ bool NSZ = false);
/// Return the absorbing element for the given binary
/// operation, i.e. a constant C such that X op C = C and C op X = C for
@@ -1213,7 +1218,7 @@ class ConstantExpr : public Constant {
/// defined as C op X = C. It returns null if the operator doesn't have
/// an absorbing element.
LLVM_ABI static Constant *getBinOpAbsorber(unsigned Opcode, Type *Ty,
- bool AllowLHSConstant = false);
+ bool AllowLHSConstant = false);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@@ -1225,7 +1230,7 @@ class ConstantExpr : public Constant {
/// \param Ty The type to which the constant is converted
/// \param OnlyIfReduced see \a getWithOperands() docs.
LLVM_ABI static Constant *getCast(unsigned ops, Constant *C, Type *Ty,
- bool OnlyIfReduced = false);
+ bool OnlyIfReduced = false);
// Create a Trunc or BitCast cast constant expression
LLVM_ABI static Constant *
@@ -1255,7 +1260,8 @@ class ConstantExpr : public Constant {
///
/// \param OnlyIfReducedTy see \a getWithOperands() docs.
LLVM_ABI static Constant *get(unsigned Opcode, Constant *C1, Constant *C2,
- unsigned Flags = 0, Type *OnlyIfReducedTy = nullptr);
+ unsigned Flags = 0,
+ Type *OnlyIfReducedTy = nullptr);
/// Getelementptr form. Value* is only accepted for convenience;
/// all elements must be Constants.
@@ -1307,12 +1313,13 @@ class ConstantExpr : public Constant {
}
LLVM_ABI static Constant *getExtractElement(Constant *Vec, Constant *Idx,
- Type *OnlyIfReducedTy = nullptr);
- LLVM_ABI static Constant *getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx,
- Type *OnlyIfReducedTy = nullptr);
+ Type *OnlyIfReducedTy = nullptr);
+ LLVM_ABI static Constant *getInsertElement(Constant *Vec, Constant *Elt,
+ Constant *Idx,
+ Type *OnlyIfReducedTy = nullptr);
LLVM_ABI static Constant *getShuffleVector(Constant *V1, Constant *V2,
- ArrayRef<int> Mask,
- Type *OnlyIfReducedTy = nullptr);
+ ArrayRef<int> Mask,
+ Type *OnlyIfReducedTy = nullptr);
/// Return the opcode at the root of this constant expression
unsigned getOpcode() const { return getSubclassDataFromValue(); }
@@ -1347,8 +1354,8 @@ class ConstantExpr : public Constant {
/// gets constant-folded, the type changes, or the expression is otherwise
/// canonicalized. This parameter should almost always be \c false.
LLVM_ABI Constant *getWithOperands(ArrayRef<Constant *> Ops, Type *Ty,
- bool OnlyIfReduced = false,
- Type *SrcTy = nullptr) const;
+ bool OnlyIfReduced = false,
+ Type *SrcTy = nullptr) const;
/// Returns an Instruction which implements the same operation as this
/// ConstantExpr. It is not inserted into any basic block.
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index e7aab7732bbd5..ebfe41dd59afb 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_DIBUILDER_H
#define LLVM_IR_DIBUILDER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
@@ -25,6 +24,7 @@
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/TrackingMDRef.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <cstdint>
#include <optional>
@@ -111,7 +111,7 @@ namespace llvm {
///
/// If \p CU is given a value other than nullptr, then set \p CUNode to CU.
LLVM_ABI explicit DIBuilder(Module &M, bool AllowUnresolved = true,
- DICompileUnit *CU = nullptr);
+ DICompileUnit *CU = nullptr);
DIBuilder(const DIBuilder &) = delete;
DIBuilder &operator=(const DIBuilder &) = delete;
@@ -179,8 +179,9 @@ namespace llvm {
/// \param MacroType DW_MACINFO_define or DW_MACINFO_undef.
/// \param Name Macro name.
/// \param Value Macro value.
- LLVM_ABI DIMacro *createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType,
- StringRef Name, StringRef Value = StringRef());
+ LLVM_ABI DIMacro *createMacro(DIMacroFile *Parent, unsigned Line,
+ unsigned MacroType, StringRef Name,
+ StringRef Value = StringRef());
/// Create debugging information temporary entry for a macro file.
/// List of macro node direct children will be calculated by DIBuilder,
@@ -188,13 +189,14 @@ namespace llvm {
/// \param Parent Macro file parent (could be nullptr).
/// \param Line Source line number where the macro file is included.
/// \param File File descriptor containing the name of the macro file.
- LLVM_ABI DIMacroFile *createTempMacroFile(DIMacroFile *Parent, unsigned Line,
- DIFile *File);
+ LLVM_ABI DIMacroFile *createTempMacroFile(DIMacroFile *Parent,
+ unsigned Line, DIFile *File);
/// Create a single enumerator value.
- LLVM_ABI DIEnumerator *createEnumerator(StringRef Name, const APSInt &Value);
+ LLVM_ABI DIEnumerator *createEnumerator(StringRef Name,
+ const APSInt &Value);
LLVM_ABI DIEnumerator *createEnumerator(StringRef Name, uint64_t Val,
- bool IsUnsigned = false);
+ bool IsUnsigned = false);
/// Create a DWARF unspecified type.
LLVM_ABI DIBasicType *createUnspecifiedType(StringRef Name);
@@ -211,10 +213,10 @@ namespace llvm {
/// \param NumExtraInhabitants The number of extra inhabitants of the type.
/// An extra inhabitant is a bit pattern that does not represent a valid
/// value for instances of a given type. This is used by the Swift language.
- LLVM_ABI DIBasicType *createBasicType(StringRef Name, uint64_t SizeInBits,
- unsigned Encoding,
- DINode::DIFlags Flags = DINode::FlagZero,
- uint32_t NumExtraInhabitants = 0);
+ LLVM_ABI DIBasicType *
+ createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding,
+ DINode::DIFlags Flags = DINode::FlagZero,
+ uint32_t NumExtraInhabitants = 0);
/// Create debugging information entry for a binary fixed-point type.
/// \param Name Type name.
@@ -256,24 +258,26 @@ namespace llvm {
/// type.
/// \param Name Type name.
/// \param SizeInBits Size of the type.
- LLVM_ABI DIStringType *createStringType(StringRef Name, uint64_t SizeInBits);
+ LLVM_ABI DIStringType *createStringType(StringRef Name,
+ uint64_t SizeInBits);
/// Create debugging information entry for Fortran
/// assumed length string type.
/// \param Name Type name.
/// \param StringLength String length expressed as DIVariable *.
/// \param StrLocationExp Optional memory location of the string.
- LLVM_ABI DIStringType *createStringType(StringRef Name, DIVariable *StringLength,
- DIExpression *StrLocationExp = nullptr);
+ LLVM_ABI DIStringType *
+ createStringType(StringRef Name, DIVariable *StringLength,
+ DIExpression *StrLocationExp = nullptr);
/// Create debugging information entry for Fortran
/// assumed length string type.
/// \param Name Type name.
/// \param StringLengthExp String length expressed in DIExpression form.
/// \param StrLocationExp Optional memory location of the string.
- LLVM_ABI DIStringType *createStringType(StringRef Name,
- DIExpression *StringLengthExp,
- DIExpression *StrLocationExp = nullptr);
+ LLVM_ABI DIStringType *
+ createStringType(StringRef Name, DIExpression *StringLengthExp,
+ DIExpression *StrLocationExp = nullptr);
/// Create debugging information entry for a qualified
/// type, e.g. 'const int'.
@@ -295,11 +299,11 @@ namespace llvm {
StringRef Name = "", DINodeArray Annotations = nullptr);
/// Create a __ptrauth qualifier.
- LLVM_ABI DIDerivedType *createPtrAuthQualifiedType(DIType *FromTy, unsigned Key,
- bool IsAddressDiscriminated,
- unsigned ExtraDiscriminator,
- bool IsaPointer,
- bool authenticatesNullValues);
+ LLVM_ABI DIDerivedType *
+ createPtrAuthQualifiedType(DIType *FromTy, unsigned Key,
+ bool IsAddressDiscriminated,
+ unsigned ExtraDiscriminator, bool IsaPointer,
+ bool authenticatesNullValues);
/// Create debugging information entry for a pointer to member.
/// \param PointeeTy Type pointed to by this pointer.
@@ -327,11 +331,11 @@ namespace llvm {
/// \param AlignInBits Alignment. (optional)
/// \param Flags Flags to describe inheritance attribute, e.g. private
/// \param Annotations Annotations. (optional)
- LLVM_ABI DIDerivedType *createTypedef(DIType *Ty, StringRef Name, DIFile *File,
- unsigned LineNo, DIScope *Context,
- uint32_t AlignInBits = 0,
- DINode::DIFlags Flags = DINode::FlagZero,
- DINodeArray Annotations = nullptr);
+ LLVM_ABI DIDerivedType *
+ createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo,
+ DIScope *Context, uint32_t AlignInBits = 0,
+ DINode::DIFlags Flags = DINode::FlagZero,
+ DINodeArray Annotations = nullptr);
/// Create debugging information entry for a template alias.
/// \param Ty Original type.
@@ -344,12 +348,12 @@ namespace llvm {
/// \param Flags Flags to describe inheritance attribute (optional),
/// e.g. private.
/// \param Annotations Annotations. (optional)
- LLVM_ABI DIDerivedType *createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File,
- unsigned LineNo, DIScope *Context,
- DINodeArray TParams,
- uint32_t AlignInBits = 0,
- DINode::DIFlags Flags = DINode::FlagZero,
- DINodeArray Annotations = nullptr);
+ LLVM_ABI DIDerivedType *
+ createTemplateAlias(DIType *Ty, StringRef Name, DIFile *File,
+ unsigned LineNo, DIScope *Context, DINodeArray TParams,
+ uint32_t AlignInBits = 0,
+ DINode::DIFlags Flags = DINode::FlagZero,
+ DINodeArray Annotations = nullptr);
/// Create debugging information entry for a 'friend'.
LLVM_ABI DIDerivedType *createFriend(DIType *Ty, DIType *FriendTy);
@@ -363,8 +367,9 @@ namespace llvm {
/// \param Flags Flags to describe inheritance attribute,
/// e.g. private
LLVM_ABI DIDerivedType *createInheritance(DIType *Ty, DIType *BaseTy,
- uint64_t BaseOffset, uint32_t VBPtrOffset,
- DINode::DIFlags Flags);
+ uint64_t BaseOffset,
+ uint32_t VBPtrOffset,
+ DINode::DIFlags Flags);
/// Create debugging information entry for a member.
/// \param Scope Member scope.
@@ -377,12 +382,11 @@ namespace llvm {
/// \param Flags Flags to encode member attribute, e.g. private
/// \param Ty Parent type.
/// \param Annotations Member annotations.
- LLVM_ABI DIDerivedType *createMemberType(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNo,
- uint64_t SizeInBits, uint32_t AlignInBits,
- uint64_t OffsetInBits,
- DINode::DIFlags Flags, DIType *Ty,
- DINodeArray Annotations = nullptr);
+ LLVM_ABI DIDerivedType *
+ createMemberType(DIScope *Scope, StringRef Name, DIFile *File,
+ unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits,
+ uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty,
+ DINodeArray Annotations = nullptr);
/// Create debugging information entry for a variant. A variant
/// normally should be a member of a variant part.
@@ -399,13 +403,10 @@ namespace llvm {
/// ConstantDataArray if the variant applies
/// for multiple discriminants.
/// \param Ty Parent type.
- LLVM_ABI DIDerivedType *createVariantMemberType(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNo,
- uint64_t SizeInBits,
- uint32_t AlignInBits,
- uint64_t OffsetInBits,
- Constant *Discriminant,
- DINode::DIFlags Flags, DIType *Ty);
+ LLVM_ABI DIDerivedType *createVariantMemberType(
+ DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
+ uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits,
+ Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty);
/// Create debugging information entry for a variant. A variant
/// created this way "inlines" multiple members into the enclosing
@@ -417,8 +418,10 @@ namespace llvm {
/// ConstantDataArray if the variant applies
/// for multiple discriminants.
/// \param Ty Parent type.
- LLVM_ABI DIDerivedType *createVariantMemberType(DIScope *Scope, DINodeArray Elements,
- Constant *Discriminant, DIType *Ty);
+ LLVM_ABI DIDerivedType *createVariantMemberType(DIScope *Scope,
+ DINodeArray Elements,
+ Constant *Discriminant,
+ DIType *Ty);
/// Create debugging information entry for a bit field member.
/// \param Scope Member scope.
@@ -431,13 +434,11 @@ namespace llvm {
/// \param Flags Flags to encode member attribute.
/// \param Ty Parent type.
/// \param Annotations Member annotations.
- LLVM_ABI DIDerivedType *createBitFieldMemberType(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNo,
- uint64_t SizeInBits,
- uint64_t OffsetInBits,
- uint64_t StorageOffsetInBits,
- DINode::DIFlags Flags, DIType *Ty,
- DINodeArray Annotations = nullptr);
+ LLVM_ABI DIDerivedType *createBitFieldMemberType(
+ DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
+ uint64_t SizeInBits, uint64_t OffsetInBits,
+ uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty,
+ DINodeArray Annotations = nullptr);
/// Create debugging information entry for a
/// C++ static data member.
@@ -450,11 +451,12 @@ namespace llvm {
/// \param Val Const initializer of the member.
/// \param Tag DWARF tag of the static member.
/// \param AlignInBits Member alignment.
- LLVM_ABI DIDerivedType *createStaticMemberType(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNo,
- DIType *Ty, DINode::DIFlags Flags,
- Constant *Val, unsigned Tag,
- uint32_t AlignInBits = 0);
+ LLVM_ABI DIDerivedType *createStaticMemberType(DIScope *Scope,
+ StringRef Name, DIFile *File,
+ unsigned LineNo, DIType *Ty,
+ DINode::DIFlags Flags,
+ Constant *Val, unsigned Tag,
+ uint32_t AlignInBits = 0);
/// Create debugging information entry for Objective-C
/// instance variable.
@@ -467,10 +469,12 @@ namespace llvm {
/// \param Flags Flags to encode member attribute, e.g. private
/// \param Ty Parent type.
/// \param PropertyNode Property associated with this ivar.
- LLVM_ABI DIDerivedType *createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo,
- uint64_t SizeInBits, uint32_t AlignInBits,
- uint64_t OffsetInBits, DINode::DIFlags Flags,
- DIType *Ty, MDNode *PropertyNode);
+ LLVM_ABI DIDerivedType *createObjCIVar(StringRef Name, DIFile *File,
+ unsigned LineNo, uint64_t SizeInBits,
+ uint32_t AlignInBits,
+ uint64_t OffsetInBits,
+ DINode::DIFlags Flags, DIType *Ty,
+ MDNode *PropertyNode);
/// Create debugging information entry for Objective-C
/// property.
@@ -481,11 +485,10 @@ namespace llvm {
/// \param SetterName Name of the Objective C property setter selector.
/// \param PropertyAttributes Objective C property attributes.
/// \param Ty Type.
- LLVM_ABI DIObjCProperty *createObjCProperty(StringRef Name, DIFile *File,
- unsigned LineNumber,
- StringRef GetterName,
- StringRef SetterName,
- unsigned PropertyAttributes, DIType *Ty);
+ LLVM_ABI DIObjCProperty *
+ createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber,
+ StringRef GetterName, StringRef SetterName,
+ unsigned PropertyAttributes, DIType *Ty);
/// Create debugging information entry for a class.
/// \param Scope Scope in which this class is defined.
@@ -545,13 +548,12 @@ namespace llvm {
/// \param Elements Union elements.
/// \param RunTimeLang Optional parameter, Objective-C runtime version.
/// \param UniqueIdentifier A unique identifier for the union.
- LLVM_ABI DICompositeType *createUnionType(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNumber,
- uint64_t SizeInBits, uint32_t AlignInBits,
- DINode::DIFlags Flags,
- DINodeArray Elements,
- unsigned RunTimeLang = 0,
- StringRef UniqueIdentifier = "");
+ LLVM_ABI DICompositeType *
+ createUnionType(DIScope *Scope, StringRef Name, DIFile *File,
+ unsigned LineNumber, uint64_t SizeInBits,
+ uint32_t AlignInBits, DINode::DIFlags Flags,
+ DINodeArray Elements, unsigned RunTimeLang = 0,
+ StringRef UniqueIdentifier = "");
/// Create debugging information entry for a variant part. A
/// variant part normally has a discriminator (though this is not
@@ -566,13 +568,12 @@ namespace llvm {
/// \param Discriminator Discriminant member
/// \param Elements Variant elements.
/// \param UniqueIdentifier A unique identifier for the union.
- LLVM_ABI DICompositeType *createVariantPart(DIScope *Scope, StringRef Name,
- DIFile *File, unsigned LineNumber,
- uint64_t SizeInBits, uint32_t AlignInBits,
- DINode::DIFlags Flags,
- DIDerivedType *Discriminator,
- DINodeArray Elements,
- StringRef UniqueIdentifier = "");
+ LLVM_ABI DICompositeType *
+ createVariantPart(DIScope *Scope, StringRef Name, DIFile *File,
+ unsigned LineNumber, uint64_t SizeInBits,
+ uint32_t AlignInBits, DINode::DIFlags Flags,
+ DIDerivedType *Discriminator, DINodeArray Elements,
+ StringRef UniqueIdentifier = "");
/// Create debugging information for template
/// type parameter.
@@ -580,10 +581,9 @@ namespace llvm {
/// \param Name Type parameter name.
/// \param Ty Parameter type.
/// \param IsDefault Parameter is default or not
- LLVM_ABI DITemplateTypeParameter *createTemplateTypeParameter(DIScope *Scope,
- StringRef Name,
- DIType *Ty,
- bool IsDefault);
+ LLVM_ABI DITemplateTypeParameter *
+ createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty,
+ bool IsDefault);
/// Create debugging information for template
/// value parameter.
@@ -611,10 +611,9 @@ namespace llvm {
/// \param Name Value parameter name.
/// \param Ty Parameter type.
/// \param Val An array of types in the pack.
- LLVM_ABI DITemplateValueParameter *createTemplateParameterPack(DIScope *Scope,
- StringRef Name,
- DIType *Ty,
- DINodeArray Val);
+ LLVM_ABI DITemplateValueParameter *
+ createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty,
+ DINodeArray Val);
/// Create debugging information entry for an array.
/// \param Size Array size.
@@ -676,8 +675,9 @@ namespace llvm {
/// \param AlignInBits Alignment.
/// \param Ty Element type.
/// \param Subscripts Subscripts.
- LLVM_ABI DICompositeType *createVectorType(uint64_t Size, uint32_t AlignInBits,
- DIType *Ty, DINodeArray Subscripts);
+ LLVM_ABI DICompositeType *createVectorType(uint64_t Size,
+ uint32_t AlignInBits, DIType *Ty,
+ DINodeArray Subscripts);
/// Create debugging information entry for an
/// enumeration.
@@ -707,9 +707,10 @@ namespace llvm {
/// \param SizeInBits Set size.
/// \param AlignInBits Set alignment.
/// \param Ty Base type of the set.
- LLVM_ABI DIDerivedType *createSetType(DIScope *Scope, StringRef Name, DIFile *File,
- unsigned LineNo, uint64_t SizeInBits,
- uint32_t AlignInBits, DIType *Ty);
+ LLVM_ABI DIDerivedType *createSetType(DIScope *Scope, StringRef Name,
+ DIFile *File, unsigned LineNo,
+ uint64_t SizeInBits,
+ uint32_t AlignInBits, DIType *Ty);
/// Create subroutine type.
/// \param ParameterTypes An array of subroutine parameter types. This
@@ -780,7 +781,8 @@ namespace llvm {
LLVM_ABI DINodeArray getOrCreateArray(ArrayRef<Metadata *> Elements);
/// Get a DIMacroNodeArray, create one if required.
- LLVM_ABI DIMacroNodeArray getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
+ LLVM_ABI DIMacroNodeArray
+ getOrCreateMacroArray(ArrayRef<Metadata *> Elements);
/// Get a DITypeRefArray, create one if required.
LLVM_ABI DITypeRefArray getOrCreateTypeArray(ArrayRef<Metadata *> Elements);
@@ -789,8 +791,10 @@ namespace llvm {
/// implicitly uniques the values returned.
LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, int64_t Count);
LLVM_ABI DISubrange *getOrCreateSubrange(int64_t Lo, Metadata *CountNode);
- LLVM_ABI DISubrange *getOrCreateSubrange(Metadata *Count, Metadata *LowerBound,
- Metadata *UpperBound, Metadata *Stride);
+ LLVM_ABI DISubrange *getOrCreateSubrange(Metadata *Count,
+ Metadata *LowerBound,
+ Metadata *UpperBound,
+ Metadata *Stride);
LLVM_ABI DIGenericSubrange *
getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count,
@@ -844,9 +848,8 @@ namespace llvm {
///
/// \c Scope must be a \a DILocalScope, and thus its scope chain eventually
/// leads to a \a DISubprogram.
- LLVM_ABI DILabel *
- createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo,
- bool AlwaysPreserve = false);
+ LLVM_ABI DILabel *createLabel(DIScope *Scope, StringRef Name, DIFile *File,
+ unsigned LineNo, bool AlwaysPreserve = false);
/// Create a new descriptor for a parameter variable.
///
@@ -895,16 +898,14 @@ namespace llvm {
/// \param Annotations Attribute Annotations.
/// \param TargetFuncName The name of the target function if this is
/// a trampoline.
- LLVM_ABI DISubprogram *
- createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName,
- DIFile *File, unsigned LineNo, DISubroutineType *Ty,
- unsigned ScopeLine, DINode::DIFlags Flags = DINode::FlagZero,
- DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
- DITemplateParameterArray TParams = nullptr,
- DISubprogram *Decl = nullptr,
- DITypeArray ThrownTypes = nullptr,
- DINodeArray Annotations = nullptr,
- StringRef TargetFuncName = "");
+ LLVM_ABI DISubprogram *createFunction(
+ DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File,
+ unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine,
+ DINode::DIFlags Flags = DINode::FlagZero,
+ DISubprogram::DISPFlags SPFlags = DISubprogram::SPFlagZero,
+ DITemplateParameterArray TParams = nullptr,
+ DISubprogram *Decl = nullptr, DITypeArray ThrownTypes = nullptr,
+ DINodeArray Annotations = nullptr, StringRef TargetFuncName = "");
/// Identical to createFunction,
/// except that the resulting DbgNode is meant to be RAUWed.
@@ -951,9 +952,10 @@ namespace llvm {
/// \param Name The name of this common block.
/// \param File The file this common block is defined.
/// \param LineNo Line number.
- LLVM_ABI DICommonBlock *createCommonBlock(DIScope *Scope, DIGlobalVariable *decl,
- StringRef Name, DIFile *File,
- unsigned LineNo);
+ LLVM_ABI DICommonBlock *createCommonBlock(DIScope *Scope,
+ DIGlobalVariable *decl,
+ StringRef Name, DIFile *File,
+ unsigned LineNo);
/// This creates new descriptor for a namespace with the specified
/// parent scope.
@@ -961,7 +963,7 @@ namespace llvm {
/// \param Name Name of this namespace
/// \param ExportSymbols True for C++ inline namespaces.
LLVM_ABI DINamespace *createNameSpace(DIScope *Scope, StringRef Name,
- bool ExportSymbols);
+ bool ExportSymbols);
/// This creates new descriptor for a module with the specified
/// parent scope.
@@ -981,9 +983,11 @@ namespace llvm {
/// as this entry is just a hint for the debugger to find
/// the corresponding definition in the global scope.
LLVM_ABI DIModule *createModule(DIScope *Scope, StringRef Name,
- StringRef ConfigurationMacros, StringRef IncludePath,
- StringRef APINotesFile = {}, DIFile *File = nullptr,
- unsigned LineNo = 0, bool IsDecl = false);
+ StringRef ConfigurationMacros,
+ StringRef IncludePath,
+ StringRef APINotesFile = {},
+ DIFile *File = nullptr, unsigned LineNo = 0,
+ bool IsDecl = false);
/// This creates a descriptor for a lexical block with a new file
/// attached. This merely extends the existing
@@ -991,8 +995,9 @@ namespace llvm {
/// \param Scope Lexical block.
/// \param File Source file.
/// \param Discriminator DWARF path discriminator value.
- LLVM_ABI DILexicalBlockFile *createLexicalBlockFile(DIScope *Scope, DIFile *File,
- unsigned Discriminator = 0);
+ LLVM_ABI DILexicalBlockFile *
+ createLexicalBlockFile(DIScope *Scope, DIFile *File,
+ unsigned Discriminator = 0);
/// This creates a descriptor for a lexical block with the
/// specified parent context.
@@ -1001,7 +1006,7 @@ namespace llvm {
/// \param Line Line number.
/// \param Col Column number.
LLVM_ABI DILexicalBlock *createLexicalBlock(DIScope *Scope, DIFile *File,
- unsigned Line, unsigned Col);
+ unsigned Line, unsigned Col);
/// Create a descriptor for an imported module.
/// \param Context The scope this module is imported into
@@ -1009,9 +1014,9 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- LLVM_ABI DIImportedEntity *createImportedModule(DIScope *Context, DINamespace *NS,
- DIFile *File, unsigned Line,
- DINodeArray Elements = nullptr);
+ LLVM_ABI DIImportedEntity *
+ createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File,
+ unsigned Line, DINodeArray Elements = nullptr);
/// Create a descriptor for an imported module.
/// \param Context The scope this module is imported into.
@@ -1019,10 +1024,9 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- LLVM_ABI DIImportedEntity *createImportedModule(DIScope *Context,
- DIImportedEntity *NS, DIFile *File,
- unsigned Line,
- DINodeArray Elements = nullptr);
+ LLVM_ABI DIImportedEntity *
+ createImportedModule(DIScope *Context, DIImportedEntity *NS, DIFile *File,
+ unsigned Line, DINodeArray Elements = nullptr);
/// Create a descriptor for an imported module.
/// \param Context The scope this module is imported into.
@@ -1030,9 +1034,9 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- LLVM_ABI DIImportedEntity *createImportedModule(DIScope *Context, DIModule *M,
- DIFile *File, unsigned Line,
- DINodeArray Elements = nullptr);
+ LLVM_ABI DIImportedEntity *
+ createImportedModule(DIScope *Context, DIModule *M, DIFile *File,
+ unsigned Line, DINodeArray Elements = nullptr);
/// Create a descriptor for an imported function.
/// \param Context The scope this module is imported into.
@@ -1041,10 +1045,10 @@ namespace llvm {
/// \param File File where the declaration is located.
/// \param Line Line number of the declaration.
/// \param Elements Renamed elements.
- LLVM_ABI DIImportedEntity *createImportedDeclaration(DIScope *Context, DINode *Decl,
- DIFile *File, unsigned Line,
- StringRef Name = "",
- DINodeArray Elements = nullptr);
+ LLVM_ABI DIImportedEntity *
+ createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File,
+ unsigned Line, StringRef Name = "",
+ DINodeArray Elements = nullptr);
/// Insert a new llvm.dbg.declare intrinsic call.
/// \param Storage llvm::Value of the variable
@@ -1052,9 +1056,10 @@ namespace llvm {
/// \param Expr A complex location expression.
/// \param DL Debug info location.
/// \param InsertAtEnd Location for the new intrinsic.
- LLVM_ABI DbgInstPtr insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
- DIExpression *Expr, const DILocation *DL,
- BasicBlock *InsertAtEnd);
+ LLVM_ABI DbgInstPtr insertDeclare(llvm::Value *Storage,
+ DILocalVariable *VarInfo,
+ DIExpression *Expr, const DILocation *DL,
+ BasicBlock *InsertAtEnd);
/// Insert a new llvm.dbg.assign intrinsic call.
/// \param LinkedInstr Instruction with a DIAssignID to link with the new
@@ -1071,9 +1076,10 @@ namespace llvm {
/// column: 0, scope: var-decl-scope). See
/// getDebugValueLoc.
LLVM_ABI DbgInstPtr insertDbgAssign(Instruction *LinkedInstr, Value *Val,
- DILocalVariable *SrcVar, DIExpression *ValExpr,
- Value *Addr, DIExpression *AddrExpr,
- const DILocation *DL);
+ DILocalVariable *SrcVar,
+ DIExpression *ValExpr, Value *Addr,
+ DIExpression *AddrExpr,
+ const DILocation *DL);
/// Insert a new llvm.dbg.declare intrinsic call.
/// \param Storage llvm::Value of the variable
@@ -1081,16 +1087,17 @@ namespace llvm {
/// \param Expr A complex location expression.
/// \param DL Debug info location.
/// \param InsertPt Location for the new intrinsic.
- LLVM_ABI DbgInstPtr insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
- DIExpression *Expr, const DILocation *DL,
- InsertPosition InsertPt);
+ LLVM_ABI DbgInstPtr insertDeclare(llvm::Value *Storage,
+ DILocalVariable *VarInfo,
+ DIExpression *Expr, const DILocation *DL,
+ InsertPosition InsertPt);
/// Insert a new llvm.dbg.label intrinsic call.
/// \param LabelInfo Label's debug info descriptor.
/// \param DL Debug info location.
/// \param InsertBefore Location for the new intrinsic.
LLVM_ABI DbgInstPtr insertLabel(DILabel *LabelInfo, const DILocation *DL,
- InsertPosition InsertPt);
+ InsertPosition InsertPt);
/// Insert a new llvm.dbg.value intrinsic call.
/// \param Val llvm::Value of the variable
@@ -1099,16 +1106,17 @@ namespace llvm {
/// \param DL Debug info location.
/// \param InsertPt Location for the new intrinsic.
LLVM_ABI DbgInstPtr insertDbgValueIntrinsic(llvm::Value *Val,
- DILocalVariable *VarInfo,
- DIExpression *Expr, const DILocation *DL,
- InsertPosition InsertPt);
+ DILocalVariable *VarInfo,
+ DIExpression *Expr,
+ const DILocation *DL,
+ InsertPosition InsertPt);
/// Replace the vtable holder in the given type.
///
/// If this creates a self reference, it may orphan some unresolved cycles
/// in the operands of \c T, so \a DIBuilder needs to track that.
LLVM_ABI void replaceVTableHolder(DICompositeType *&T,
- DIType *VTableHolder);
+ DIType *VTableHolder);
/// Replace arrays on a composite type.
///
@@ -1116,7 +1124,7 @@ namespace llvm {
/// has a self-reference -- \a DIBuilder needs to track the array to
/// resolve cycles.
LLVM_ABI void replaceArrays(DICompositeType *&T, DINodeArray Elements,
- DINodeArray TParams = DINodeArray());
+ DINodeArray TParams = DINodeArray());
/// Replace a temporary node.
///
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index c086caef1ad8b..2992484c47d06 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -542,7 +542,8 @@ class DataLayout {
/// Returns an integer type with size at least as big as that of a
/// pointer in the given address space.
- LLVM_ABI IntegerType *getIntPtrType(LLVMContext &C, unsigned AddressSpace = 0) const;
+ LLVM_ABI IntegerType *getIntPtrType(LLVMContext &C,
+ unsigned AddressSpace = 0) const;
/// Returns an integer (vector of integer) type with size at least as
/// big as that of a pointer of the given pointer (vector of pointer) type.
@@ -550,7 +551,8 @@ class DataLayout {
/// Returns the smallest integer type with size at least as big as
/// Width bits.
- LLVM_ABI Type *getSmallestLegalIntType(LLVMContext &C, unsigned Width = 0) const;
+ LLVM_ABI Type *getSmallestLegalIntType(LLVMContext &C,
+ unsigned Width = 0) const;
/// Returns the largest legal integer type, or null if none are set.
Type *getLargestLegalIntType(LLVMContext &C) const {
@@ -565,7 +567,8 @@ class DataLayout {
/// Returns the type of a GEP index in \p AddressSpace.
/// If it was not specified explicitly, it will be the integer type of the
/// pointer width - IntPtrType.
- LLVM_ABI IntegerType *getIndexType(LLVMContext &C, unsigned AddressSpace) const;
+ LLVM_ABI IntegerType *getIndexType(LLVMContext &C,
+ unsigned AddressSpace) const;
/// Returns the type of an address in \p AddressSpace
IntegerType *getAddressType(LLVMContext &C, unsigned AddressSpace) const {
return getIndexType(C, AddressSpace);
@@ -583,17 +586,20 @@ class DataLayout {
///
/// Note that this takes the element type, not the pointer type.
/// This is used to implement getelementptr.
- LLVM_ABI int64_t getIndexedOffsetInType(Type *ElemTy, ArrayRef<Value *> Indices) const;
+ LLVM_ABI int64_t getIndexedOffsetInType(Type *ElemTy,
+ ArrayRef<Value *> Indices) const;
/// Get GEP indices to access Offset inside ElemTy. ElemTy is updated to be
/// the result element type and Offset to be the residual offset.
- LLVM_ABI SmallVector<APInt> getGEPIndicesForOffset(Type *&ElemTy, APInt &Offset) const;
+ LLVM_ABI SmallVector<APInt> getGEPIndicesForOffset(Type *&ElemTy,
+ APInt &Offset) const;
/// Get single GEP index to access Offset inside ElemTy. Returns std::nullopt
/// if index cannot be computed, e.g. because the type is not an aggregate.
/// ElemTy is updated to be the result element type and Offset to be the
/// residual offset.
- LLVM_ABI std::optional<APInt> getGEPIndexForOffset(Type *&ElemTy, APInt &Offset) const;
+ LLVM_ABI std::optional<APInt> getGEPIndexForOffset(Type *&ElemTy,
+ APInt &Offset) const;
/// Returns a StructLayout object, indicating the alignment of the
/// struct, its size, and the offsets of its fields.
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index 8e4ea005a1116..77cee875f16e7 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -16,7 +16,6 @@
#ifndef LLVM_IR_DEBUGINFO_H
#define LLVM_IR_DEBUGINFO_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
@@ -28,6 +27,7 @@
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -89,8 +89,9 @@ LLVM_ABI bool stripNonLineTableDebugInfo(Module &M);
/// to the instruction \p I, if one exists. \p Updater is applied to Metadata
/// operand in the MD_loop metadata: the returned value is included in the
/// updated loop metadata node if it is non-null.
-LLVM_ABI void updateLoopMetadataDebugLocations(
- Instruction &I, function_ref<Metadata *(Metadata *)> Updater);
+LLVM_ABI void
+updateLoopMetadataDebugLocations(Instruction &I,
+ function_ref<Metadata *(Metadata *)> Updater);
/// Return Debug Info Metadata Version by checking module flags.
LLVM_ABI unsigned getDebugMetadataVersionFromModule(const Module &M);
@@ -263,18 +264,21 @@ LLVM_ABI void deleteAll(Function *F);
/// variable size) in DAI.
///
/// Result contains a zero-sized fragment if there's no intersect.
-LLVM_ABI bool calculateFragmentIntersect(
- const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
- uint64_t SliceSizeInBits, const DbgAssignIntrinsic *DbgAssign,
- std::optional<DIExpression::FragmentInfo> &Result);
-LLVM_ABI bool calculateFragmentIntersect(
- const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
- uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign,
- std::optional<DIExpression::FragmentInfo> &Result);
+LLVM_ABI bool
+calculateFragmentIntersect(const DataLayout &DL, const Value *Dest,
+ uint64_t SliceOffsetInBits, uint64_t SliceSizeInBits,
+ const DbgAssignIntrinsic *DbgAssign,
+ std::optional<DIExpression::FragmentInfo> &Result);
+LLVM_ABI bool
+calculateFragmentIntersect(const DataLayout &DL, const Value *Dest,
+ uint64_t SliceOffsetInBits, uint64_t SliceSizeInBits,
+ const DbgVariableRecord *DVRAssign,
+ std::optional<DIExpression::FragmentInfo> &Result);
/// Replace DIAssignID uses and attachments with IDs from \p Map.
/// If an ID is unmapped a new ID is generated and added to \p Map.
-LLVM_ABI void remapAssignID(DenseMap<DIAssignID *, DIAssignID *> &Map, Instruction &I);
+LLVM_ABI void remapAssignID(DenseMap<DIAssignID *, DIAssignID *> &Map,
+ Instruction &I);
/// Helper struct for trackAssignments, below. We don't use the similar
/// DebugVariable class because trackAssignments doesn't (yet?) understand
@@ -332,8 +336,8 @@ using StorageToVarsMap =
/// Track assignments to \p Vars between \p Start and \p End.
LLVM_ABI void trackAssignments(Function::iterator Start, Function::iterator End,
- const StorageToVarsMap &Vars, const DataLayout &DL,
- bool DebugPrints = false);
+ const StorageToVarsMap &Vars,
+ const DataLayout &DL, bool DebugPrints = false);
/// Describes properties of a store that has a static size and offset into a
/// some base storage. Used by the getAssignmentInfo functions.
@@ -352,11 +356,11 @@ struct AssignmentInfo {
};
LLVM_ABI std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
- const MemIntrinsic *I);
+ const MemIntrinsic *I);
LLVM_ABI std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
- const StoreInst *SI);
+ const StoreInst *SI);
LLVM_ABI std::optional<AssignmentInfo> getAssignmentInfo(const DataLayout &DL,
- const AllocaInst *AI);
+ const AllocaInst *AI);
} // end namespace at
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index f92fa77167e38..12ee52098d891 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -13,7 +13,6 @@
#ifndef LLVM_IR_DEBUGINFOMETADATA_H
#define LLVM_IR_DEBUGINFOMETADATA_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/PointerUnion.h"
@@ -27,6 +26,7 @@
#include "llvm/IR/PseudoProbe.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Discriminator.h"
#include <cassert>
#include <climits>
@@ -190,7 +190,7 @@ class DINode : public MDNode {
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
/// any remaining (unrecognized) bits.
LLVM_ABI static DIFlags splitFlags(DIFlags Flags,
- SmallVectorImpl<DIFlags> &SplitFlags);
+ SmallVectorImpl<DIFlags> &SplitFlags);
static bool classof(const Metadata *MD) {
switch (MD->getMetadataID()) {
@@ -259,8 +259,10 @@ class GenericDINode : public DINode {
}
LLVM_ABI static GenericDINode *getImpl(LLVMContext &Context, unsigned Tag,
- MDString *Header, ArrayRef<Metadata *> DwarfOps,
- StorageType Storage, bool ShouldCreate = true);
+ MDString *Header,
+ ArrayRef<Metadata *> DwarfOps,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempGenericDINode cloneImpl() const {
return getTemporary(getContext(), getTag(), getHeader(),
@@ -319,7 +321,7 @@ class DIAssignID : public MDNode {
~DIAssignID() { dropAllReferences(); }
LLVM_ABI static DIAssignID *getImpl(LLVMContext &Context, StorageType Storage,
- bool ShouldCreate = true);
+ bool ShouldCreate = true);
TempDIAssignID cloneImpl() const { return getTemporary(getContext()); }
@@ -354,17 +356,18 @@ class DISubrange : public DINode {
~DISubrange() = default;
LLVM_ABI static DISubrange *getImpl(LLVMContext &Context, int64_t Count,
- int64_t LowerBound, StorageType Storage,
- bool ShouldCreate = true);
+ int64_t LowerBound, StorageType Storage,
+ bool ShouldCreate = true);
LLVM_ABI static DISubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
- int64_t LowerBound, StorageType Storage,
- bool ShouldCreate = true);
+ int64_t LowerBound, StorageType Storage,
+ bool ShouldCreate = true);
LLVM_ABI static DISubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
- Metadata *LowerBound, Metadata *UpperBound,
- Metadata *Stride, StorageType Storage,
- bool ShouldCreate = true);
+ Metadata *LowerBound,
+ Metadata *UpperBound, Metadata *Stride,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDISubrange cloneImpl() const {
return getTemporary(getContext(), getRawCountNode(), getRawLowerBound(),
@@ -417,10 +420,10 @@ class DIGenericSubrange : public DINode {
~DIGenericSubrange() = default;
- LLVM_ABI static DIGenericSubrange *getImpl(LLVMContext &Context, Metadata *CountNode,
- Metadata *LowerBound, Metadata *UpperBound,
- Metadata *Stride, StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DIGenericSubrange *
+ getImpl(LLVMContext &Context, Metadata *CountNode, Metadata *LowerBound,
+ Metadata *UpperBound, Metadata *Stride, StorageType Storage,
+ bool ShouldCreate = true);
TempDIGenericSubrange cloneImpl() const {
return getTemporary(getContext(), getRawCountNode(), getRawLowerBound(),
@@ -462,7 +465,7 @@ class DIEnumerator : public DINode {
APInt Value;
LLVM_ABI DIEnumerator(LLVMContext &C, StorageType Storage, const APInt &Value,
- bool IsUnsigned, ArrayRef<Metadata *> Ops);
+ bool IsUnsigned, ArrayRef<Metadata *> Ops);
DIEnumerator(LLVMContext &C, StorageType Storage, int64_t Value,
bool IsUnsigned, ArrayRef<Metadata *> Ops)
: DIEnumerator(C, Storage, APInt(64, Value, !IsUnsigned), IsUnsigned,
@@ -475,9 +478,10 @@ class DIEnumerator : public DINode {
return getImpl(Context, Value, IsUnsigned,
getCanonicalMDString(Context, Name), Storage, ShouldCreate);
}
- LLVM_ABI static DIEnumerator *getImpl(LLVMContext &Context, const APInt &Value,
- bool IsUnsigned, MDString *Name,
- StorageType Storage, bool ShouldCreate = true);
+ LLVM_ABI static DIEnumerator *getImpl(LLVMContext &Context,
+ const APInt &Value, bool IsUnsigned,
+ MDString *Name, StorageType Storage,
+ bool ShouldCreate = true);
TempDIEnumerator cloneImpl() const {
return getTemporary(getContext(), getValue(), isUnsigned(), getName());
@@ -632,10 +636,10 @@ class DIFile : public DIScope {
ShouldCreate);
}
LLVM_ABI static DIFile *getImpl(LLVMContext &Context, MDString *Filename,
- MDString *Directory,
- std::optional<ChecksumInfo<MDString *>> CS,
- MDString *Source, StorageType Storage,
- bool ShouldCreate = true);
+ MDString *Directory,
+ std::optional<ChecksumInfo<MDString *>> CS,
+ MDString *Source, StorageType Storage,
+ bool ShouldCreate = true);
TempDIFile cloneImpl() const {
return getTemporary(getContext(), getFilename(), getDirectory(),
@@ -677,7 +681,8 @@ class DIFile : public DIScope {
MDString *getRawSource() const { return Source; }
LLVM_ABI static StringRef getChecksumKindAsString(ChecksumKind CSKind);
- LLVM_ABI static std::optional<ChecksumKind> getChecksumKind(StringRef CSKindStr);
+ LLVM_ABI static std::optional<ChecksumKind>
+ getChecksumKind(StringRef CSKindStr);
static bool classof(const Metadata *MD) {
return MD->getMetadataID() == DIFileKind;
@@ -857,10 +862,11 @@ class DIBasicType : public DIType {
Flags, Storage, ShouldCreate);
}
LLVM_ABI static DIBasicType *getImpl(LLVMContext &Context, unsigned Tag,
- MDString *Name, uint64_t SizeInBits,
- uint32_t AlignInBits, unsigned Encoding,
- uint32_t NumExtraInhabitants, DIFlags Flags,
- StorageType Storage, bool ShouldCreate = true);
+ MDString *Name, uint64_t SizeInBits,
+ uint32_t AlignInBits, unsigned Encoding,
+ uint32_t NumExtraInhabitants,
+ DIFlags Flags, StorageType Storage,
+ bool ShouldCreate = true);
TempDIBasicType cloneImpl() const {
return getTemporary(getContext(), getTag(), getName(), getSizeInBits(),
@@ -987,7 +993,8 @@ class DIFixedPointType : public DIBasicType {
LastFixedPointKind = FixedPointRational,
};
- LLVM_ABI static std::optional<FixedPointKind> getFixedPointKind(StringRef Str);
+ LLVM_ABI static std::optional<FixedPointKind>
+ getFixedPointKind(StringRef Str);
LLVM_ABI static const char *fixedPointKindString(FixedPointKind);
DEFINE_MDNODE_GET(DIFixedPointType,
@@ -1063,12 +1070,11 @@ class DIStringType : public DIType {
StringLength, StrLenExp, StrLocationExp, SizeInBits,
AlignInBits, Encoding, Storage, ShouldCreate);
}
- LLVM_ABI static DIStringType *getImpl(LLVMContext &Context, unsigned Tag,
- MDString *Name, Metadata *StringLength,
- Metadata *StrLenExp, Metadata *StrLocationExp,
- uint64_t SizeInBits, uint32_t AlignInBits,
- unsigned Encoding, StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DIStringType *
+ getImpl(LLVMContext &Context, unsigned Tag, MDString *Name,
+ Metadata *StringLength, Metadata *StrLenExp, Metadata *StrLocationExp,
+ uint64_t SizeInBits, uint32_t AlignInBits, unsigned Encoding,
+ StorageType Storage, bool ShouldCreate = true);
TempDIStringType cloneImpl() const {
return getTemporary(getContext(), getTag(), getRawName(),
@@ -1331,13 +1337,12 @@ class DISubrangeType : public DIType {
UpperBound, Stride, Bias, Storage, ShouldCreate);
}
- LLVM_ABI static DISubrangeType *getImpl(LLVMContext &Context, MDString *Name,
- Metadata *File, unsigned Line, Metadata *Scope,
- uint64_t SizeInBits, uint32_t AlignInBits,
- DIFlags Flags, Metadata *BaseType,
- Metadata *LowerBound, Metadata *UpperBound,
- Metadata *Stride, Metadata *Bias,
- StorageType Storage, bool ShouldCreate = true);
+ LLVM_ABI static DISubrangeType *
+ getImpl(LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
+ Metadata *Scope, uint64_t SizeInBits, uint32_t AlignInBits,
+ DIFlags Flags, Metadata *BaseType, Metadata *LowerBound,
+ Metadata *UpperBound, Metadata *Stride, Metadata *Bias,
+ StorageType Storage, bool ShouldCreate = true);
TempDISubrangeType cloneImpl() const {
return getTemporary(getContext(), getName(), getFile(), getLine(),
@@ -1531,7 +1536,7 @@ class DICompositeType : public DIType {
Metadata *Associated, Metadata *Allocated, Metadata *Rank,
Metadata *Annotations, Metadata *BitStride);
LLVM_ABI static DICompositeType *getODRTypeIfExists(LLVMContext &Context,
- MDString &Identifier);
+ MDString &Identifier);
/// Build a DICompositeType with the given ODR identifier.
///
@@ -1676,9 +1681,9 @@ class DISubroutineType : public DIType {
return getImpl(Context, Flags, CC, TypeArray.get(), Storage, ShouldCreate);
}
LLVM_ABI static DISubroutineType *getImpl(LLVMContext &Context, DIFlags Flags,
- uint8_t CC, Metadata *TypeArray,
- StorageType Storage,
- bool ShouldCreate = true);
+ uint8_t CC, Metadata *TypeArray,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDISubroutineType cloneImpl() const {
return getTemporary(getContext(), getFlags(), getCC(), getTypeArray());
@@ -1735,9 +1740,11 @@ class DICompileUnit : public DIScope {
LastDebugNameTableKind = Apple
};
- LLVM_ABI static std::optional<DebugEmissionKind> getEmissionKind(StringRef Str);
+ LLVM_ABI static std::optional<DebugEmissionKind>
+ getEmissionKind(StringRef Str);
LLVM_ABI static const char *emissionKindString(DebugEmissionKind EK);
- LLVM_ABI static std::optional<DebugNameTableKind> getNameTableKind(StringRef Str);
+ LLVM_ABI static std::optional<DebugNameTableKind>
+ getNameTableKind(StringRef Str);
LLVM_ABI static const char *nameTableKindString(DebugNameTableKind PK);
private:
@@ -1987,13 +1994,13 @@ class DISubprogram : public DILocalScope {
/// Split \c Flags into \c SplitFlags, a vector of its components. Returns
/// any remaining (unrecognized) bits.
LLVM_ABI static DISPFlags splitFlags(DISPFlags Flags,
- SmallVectorImpl<DISPFlags> &SplitFlags);
+ SmallVectorImpl<DISPFlags> &SplitFlags);
// Helper for converting old bitfields to new flags word.
LLVM_ABI static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition,
- bool IsOptimized,
- unsigned Virtuality = SPFlagNonvirtual,
- bool IsMainSubprogram = false);
+ bool IsOptimized,
+ unsigned Virtuality = SPFlagNonvirtual,
+ bool IsMainSubprogram = false);
private:
DIFlags Flags;
@@ -2246,11 +2253,10 @@ class DILocation : public MDNode {
ArrayRef<Metadata *> MDs, bool ImplicitCode);
~DILocation() { dropAllReferences(); }
- LLVM_ABI static DILocation *getImpl(LLVMContext &Context, unsigned Line,
- unsigned Column, Metadata *Scope,
- Metadata *InlinedAt, bool ImplicitCode,
- uint64_t AtomGroup, uint8_t AtomRank,
- StorageType Storage, bool ShouldCreate = true);
+ LLVM_ABI static DILocation *
+ getImpl(LLVMContext &Context, unsigned Line, unsigned Column, Metadata *Scope,
+ Metadata *InlinedAt, bool ImplicitCode, uint64_t AtomGroup,
+ uint8_t AtomRank, StorageType Storage, bool ShouldCreate = true);
static DILocation *getImpl(LLVMContext &Context, unsigned Line,
unsigned Column, DILocalScope *Scope,
DILocation *InlinedAt, bool ImplicitCode,
@@ -2444,7 +2450,8 @@ class DILocation : public MDNode {
/// use the scope of any location.
///
/// \p LocA \p LocB: The locations to be merged.
- LLVM_ABI static DILocation *getMergedLocation(DILocation *LocA, DILocation *LocB);
+ LLVM_ABI static DILocation *getMergedLocation(DILocation *LocA,
+ DILocation *LocB);
/// Try to combine the vector of locations passed as input in a single one.
/// This function applies getMergedLocation() repeatedly left-to-right.
@@ -2499,12 +2506,12 @@ class DILocation : public MDNode {
/// The return is std::nullopt if the values cannot be encoded in 32 bits -
/// for example, values for BD or DF larger than 12 bits. Otherwise, the
/// return is the encoded value.
- LLVM_ABI static std::optional<unsigned> encodeDiscriminator(unsigned BD, unsigned DF,
- unsigned CI);
+ LLVM_ABI static std::optional<unsigned>
+ encodeDiscriminator(unsigned BD, unsigned DF, unsigned CI);
/// Raw decoder for values in an encoded discriminator D.
- LLVM_ABI static void decodeDiscriminator(unsigned D, unsigned &BD, unsigned &DF,
- unsigned &CI);
+ LLVM_ABI static void decodeDiscriminator(unsigned D, unsigned &BD,
+ unsigned &DF, unsigned &CI);
/// Returns the duplication factor for a given encoded discriminator \p D, or
/// 1 if no value or 0 is encoded.
@@ -2539,7 +2546,7 @@ class DILocation : public MDNode {
class DILexicalBlockBase : public DILocalScope {
protected:
LLVM_ABI DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage,
- ArrayRef<Metadata *> Ops);
+ ArrayRef<Metadata *> Ops);
~DILexicalBlockBase() = default;
public:
@@ -2586,8 +2593,9 @@ class DILexicalBlock : public DILexicalBlockBase {
}
LLVM_ABI static DILexicalBlock *getImpl(LLVMContext &Context, Metadata *Scope,
- Metadata *File, unsigned Line, unsigned Column,
- StorageType Storage, bool ShouldCreate = true);
+ Metadata *File, unsigned Line,
+ unsigned Column, StorageType Storage,
+ bool ShouldCreate = true);
TempDILexicalBlock cloneImpl() const {
return getTemporary(getContext(), getScope(), getFile(), getLine(),
@@ -2634,10 +2642,11 @@ class DILexicalBlockFile : public DILexicalBlockBase {
ShouldCreate);
}
- LLVM_ABI static DILexicalBlockFile *getImpl(LLVMContext &Context, Metadata *Scope,
- Metadata *File, unsigned Discriminator,
- StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DILexicalBlockFile *getImpl(LLVMContext &Context,
+ Metadata *Scope, Metadata *File,
+ unsigned Discriminator,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDILexicalBlockFile cloneImpl() const {
return getTemporary(getContext(), getScope(), getFile(),
@@ -2756,8 +2765,9 @@ class DINamespace : public DIScope {
ExportSymbols, Storage, ShouldCreate);
}
LLVM_ABI static DINamespace *getImpl(LLVMContext &Context, Metadata *Scope,
- MDString *Name, bool ExportSymbols,
- StorageType Storage, bool ShouldCreate = true);
+ MDString *Name, bool ExportSymbols,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDINamespace cloneImpl() const {
return getTemporary(getContext(), getScope(), getName(),
@@ -2809,11 +2819,11 @@ class DIModule : public DIScope {
getCanonicalMDString(Context, APINotesFile), LineNo, IsDecl,
Storage, ShouldCreate);
}
- LLVM_ABI static DIModule *getImpl(LLVMContext &Context, Metadata *File,
- Metadata *Scope, MDString *Name,
- MDString *ConfigurationMacros, MDString *IncludePath,
- MDString *APINotesFile, unsigned LineNo, bool IsDecl,
- StorageType Storage, bool ShouldCreate = true);
+ LLVM_ABI static DIModule *
+ getImpl(LLVMContext &Context, Metadata *File, Metadata *Scope, MDString *Name,
+ MDString *ConfigurationMacros, MDString *IncludePath,
+ MDString *APINotesFile, unsigned LineNo, bool IsDecl,
+ StorageType Storage, bool ShouldCreate = true);
TempDIModule cloneImpl() const {
return getTemporary(getContext(), getFile(), getScope(), getName(),
@@ -2901,10 +2911,9 @@ class DITemplateTypeParameter : public DITemplateParameter {
return getImpl(Context, getCanonicalMDString(Context, Name), Type,
IsDefault, Storage, ShouldCreate);
}
- LLVM_ABI static DITemplateTypeParameter *getImpl(LLVMContext &Context, MDString *Name,
- Metadata *Type, bool IsDefault,
- StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DITemplateTypeParameter *
+ getImpl(LLVMContext &Context, MDString *Name, Metadata *Type, bool IsDefault,
+ StorageType Storage, bool ShouldCreate = true);
TempDITemplateTypeParameter cloneImpl() const {
return getTemporary(getContext(), getName(), getType(), isDefault());
@@ -2944,11 +2953,10 @@ class DITemplateValueParameter : public DITemplateParameter {
return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
IsDefault, Value, Storage, ShouldCreate);
}
- LLVM_ABI static DITemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
- MDString *Name, Metadata *Type,
- bool IsDefault, Metadata *Value,
- StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DITemplateValueParameter *
+ getImpl(LLVMContext &Context, unsigned Tag, MDString *Name, Metadata *Type,
+ bool IsDefault, Metadata *Value, StorageType Storage,
+ bool ShouldCreate = true);
TempDITemplateValueParameter cloneImpl() const {
return getTemporary(getContext(), getTag(), getName(), getType(),
@@ -2981,8 +2989,9 @@ class DIVariable : public DINode {
unsigned Line;
protected:
- LLVM_ABI DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, signed Line,
- ArrayRef<Metadata *> Ops, uint32_t AlignInBits = 0);
+ LLVM_ABI DIVariable(LLVMContext &C, unsigned ID, StorageType Storage,
+ signed Line, ArrayRef<Metadata *> Ops,
+ uint32_t AlignInBits = 0);
~DIVariable() = default;
public:
@@ -3054,8 +3063,9 @@ class DIExpression : public MDNode {
~DIExpression() = default;
LLVM_ABI static DIExpression *getImpl(LLVMContext &Context,
- ArrayRef<uint64_t> Elements, StorageType Storage,
- bool ShouldCreate = true);
+ ArrayRef<uint64_t> Elements,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDIExpression cloneImpl() const {
return getTemporary(getContext(), getElements());
@@ -3215,8 +3225,8 @@ class DIExpression : public MDNode {
LLVM_ABI std::optional<uint64_t> getActiveBits(DIVariable *Var);
/// Retrieve the details of this fragment expression.
- LLVM_ABI static std::optional<FragmentInfo> getFragmentInfo(expr_op_iterator Start,
- expr_op_iterator End);
+ LLVM_ABI static std::optional<FragmentInfo>
+ getFragmentInfo(expr_op_iterator Start, expr_op_iterator End);
/// Retrieve the details of this fragment expression.
std::optional<FragmentInfo> getFragmentInfo() const {
@@ -3243,7 +3253,8 @@ class DIExpression : public MDNode {
/// Similar to `convertToNonVariadicExpression`, but faster and cheaper - it
/// does not check whether the expression is a single-location expression, and
/// it returns elements rather than creating a new DIExpression.
- LLVM_ABI std::optional<ArrayRef<uint64_t>> getSingleLocationExpressionElements() const;
+ LLVM_ABI std::optional<ArrayRef<uint64_t>>
+ getSingleLocationExpressionElements() const;
/// Removes all elements from \p Expr that do not apply to an undef debug
/// value, which includes every operator that computes the value/location on
@@ -3251,7 +3262,8 @@ class DIExpression : public MDNode {
/// of this function always a single-location expression) while leaving
/// everything that defines what the computed value applies to, i.e. the
/// fragment information.
- LLVM_ABI static const DIExpression *convertToUndefExpression(const DIExpression *Expr);
+ LLVM_ABI static const DIExpression *
+ convertToUndefExpression(const DIExpression *Expr);
/// If \p Expr is a non-variadic expression (i.e. one that does not contain
/// DW_OP_LLVM_arg), returns \p Expr converted to variadic form by adding a
@@ -3275,8 +3287,8 @@ class DIExpression : public MDNode {
/// allows us to check equivalence between expressions with differing
/// directness or variadicness.
LLVM_ABI static void canonicalizeExpressionOps(SmallVectorImpl<uint64_t> &Ops,
- const DIExpression *Expr,
- bool IsIndirect);
+ const DIExpression *Expr,
+ bool IsIndirect);
/// Determines whether two debug values should produce equivalent DWARF
/// expressions, using their DIExpressions and directness, ignoring the
@@ -3290,12 +3302,13 @@ class DIExpression : public MDNode {
/// \p SecondExpr and \p SecondIndirect have the same meaning as the prior
/// arguments, but apply to the second debug value.
LLVM_ABI static bool isEqualExpression(const DIExpression *FirstExpr,
- bool FirstIndirect,
- const DIExpression *SecondExpr,
- bool SecondIndirect);
+ bool FirstIndirect,
+ const DIExpression *SecondExpr,
+ bool SecondIndirect);
/// Append \p Ops with operations to apply the \p Offset.
- LLVM_ABI static void appendOffset(SmallVectorImpl<uint64_t> &Ops, int64_t Offset);
+ LLVM_ABI static void appendOffset(SmallVectorImpl<uint64_t> &Ops,
+ int64_t Offset);
/// If this is a constant offset, extract it. If there is no expression,
/// return true with an offset of zero.
@@ -3308,8 +3321,9 @@ class DIExpression : public MDNode {
///
/// We don't try very hard to interpret the expression because we assume that
/// foldConstantMath has canonicalized the expression.
- LLVM_ABI bool extractLeadingOffset(int64_t &OffsetInBytes,
- SmallVectorImpl<uint64_t> &RemainingOps) const;
+ LLVM_ABI bool
+ extractLeadingOffset(int64_t &OffsetInBytes,
+ SmallVectorImpl<uint64_t> &RemainingOps) const;
/// Returns true iff this DIExpression contains at least one instance of
/// `DW_OP_LLVM_arg, n` for all n in [0, N).
@@ -3318,8 +3332,8 @@ class DIExpression : public MDNode {
/// Checks if the last 4 elements of the expression are DW_OP_constu <DWARF
/// Address Space> DW_OP_swap DW_OP_xderef and extracts the <DWARF Address
/// Space>.
- LLVM_ABI static const DIExpression *extractAddressClass(const DIExpression *Expr,
- unsigned &AddrClass);
+ LLVM_ABI static const DIExpression *
+ extractAddressClass(const DIExpression *Expr, unsigned &AddrClass);
/// Used for DIExpression::prepend.
enum PrependOps : uint8_t {
@@ -3333,35 +3347,37 @@ class DIExpression : public MDNode {
/// Prepend \p DIExpr with a deref and offset operation and optionally turn it
/// into a stack value or/and an entry value.
LLVM_ABI static DIExpression *prepend(const DIExpression *Expr, uint8_t Flags,
- int64_t Offset = 0);
+ int64_t Offset = 0);
/// Prepend \p DIExpr with the given opcodes and optionally turn it into a
/// stack value.
LLVM_ABI static DIExpression *prependOpcodes(const DIExpression *Expr,
- SmallVectorImpl<uint64_t> &Ops,
- bool StackValue = false,
- bool EntryValue = false);
+ SmallVectorImpl<uint64_t> &Ops,
+ bool StackValue = false,
+ bool EntryValue = false);
/// Append the opcodes \p Ops to \p DIExpr. Unlike \ref appendToStack, the
/// returned expression is a stack value only if \p DIExpr is a stack value.
/// If \p DIExpr describes a fragment, the returned expression will describe
/// the same fragment.
- LLVM_ABI static DIExpression *append(const DIExpression *Expr, ArrayRef<uint64_t> Ops);
+ LLVM_ABI static DIExpression *append(const DIExpression *Expr,
+ ArrayRef<uint64_t> Ops);
/// Convert \p DIExpr into a stack value if it isn't one already by appending
/// DW_OP_deref if needed, and appending \p Ops to the resulting expression.
/// If \p DIExpr describes a fragment, the returned expression will describe
/// the same fragment.
LLVM_ABI static DIExpression *appendToStack(const DIExpression *Expr,
- ArrayRef<uint64_t> Ops);
+ ArrayRef<uint64_t> Ops);
/// Create a copy of \p Expr by appending the given list of \p Ops to each
/// instance of the operand `DW_OP_LLVM_arg, \p ArgNo`. This is used to
/// modify a specific location used by \p Expr, such as when salvaging that
/// location.
LLVM_ABI static DIExpression *appendOpsToArg(const DIExpression *Expr,
- ArrayRef<uint64_t> Ops, unsigned ArgNo,
- bool StackValue = false);
+ ArrayRef<uint64_t> Ops,
+ unsigned ArgNo,
+ bool StackValue = false);
/// Create a copy of \p Expr with each instance of
/// `DW_OP_LLVM_arg, \p OldArg` replaced with `DW_OP_LLVM_arg, \p NewArg`,
@@ -3369,8 +3385,8 @@ class DIExpression : public MDNode {
/// for all Arg > \p OldArg.
/// This is used when replacing one of the operands of a debug value list
/// with another operand in the same list and deleting the old operand.
- LLVM_ABI static DIExpression *replaceArg(const DIExpression *Expr, uint64_t OldArg,
- uint64_t NewArg);
+ LLVM_ABI static DIExpression *replaceArg(const DIExpression *Expr,
+ uint64_t OldArg, uint64_t NewArg);
/// Create a DIExpression to describe one part of an aggregate variable that
/// is fragmented across multiple Values. The DW_OP_LLVM_fragment operation
@@ -3443,12 +3459,14 @@ class DIExpression : public MDNode {
using ExtOps = std::array<uint64_t, 6>;
/// Returns the ops for a zero- or sign-extension in a DIExpression.
- LLVM_ABI static ExtOps getExtOps(unsigned FromSize, unsigned ToSize, bool Signed);
+ LLVM_ABI static ExtOps getExtOps(unsigned FromSize, unsigned ToSize,
+ bool Signed);
/// Append a zero- or sign-extension to \p Expr. Converts the expression to a
/// stack value if it isn't one already.
- LLVM_ABI static DIExpression *appendExt(const DIExpression *Expr, unsigned FromSize,
- unsigned ToSize, bool Signed);
+ LLVM_ABI static DIExpression *appendExt(const DIExpression *Expr,
+ unsigned FromSize, unsigned ToSize,
+ bool Signed);
/// Check if fragments overlap between a pair of FragmentInfos.
static bool fragmentsOverlap(const FragmentInfo &A, const FragmentInfo &B) {
@@ -3697,9 +3715,10 @@ class DICommonBlock : public DIScope {
File, LineNo, Storage, ShouldCreate);
}
LLVM_ABI static DICommonBlock *getImpl(LLVMContext &Context, Metadata *Scope,
- Metadata *Decl, MDString *Name, Metadata *File,
- unsigned LineNo, StorageType Storage,
- bool ShouldCreate = true);
+ Metadata *Decl, MDString *Name,
+ Metadata *File, unsigned LineNo,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempDICommonBlock cloneImpl() const {
return getTemporary(getContext(), getScope(), getDecl(), getName(),
@@ -3765,12 +3784,11 @@ class DILocalVariable : public DIVariable {
Line, Type, Arg, Flags, AlignInBits, Annotations.get(),
Storage, ShouldCreate);
}
- LLVM_ABI static DILocalVariable *getImpl(LLVMContext &Context, Metadata *Scope,
- MDString *Name, Metadata *File, unsigned Line,
- Metadata *Type, unsigned Arg, DIFlags Flags,
- uint32_t AlignInBits, Metadata *Annotations,
- StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DILocalVariable *
+ getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name, Metadata *File,
+ unsigned Line, Metadata *Type, unsigned Arg, DIFlags Flags,
+ uint32_t AlignInBits, Metadata *Annotations, StorageType Storage,
+ bool ShouldCreate = true);
TempDILocalVariable cloneImpl() const {
return getTemporary(getContext(), getScope(), getName(), getFile(),
@@ -3844,9 +3862,10 @@ class DILabel : public DINode {
return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
Line, Storage, ShouldCreate);
}
- LLVM_ABI static DILabel *getImpl(LLVMContext &Context, Metadata *Scope, MDString *Name,
- Metadata *File, unsigned Line, StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DILabel *getImpl(LLVMContext &Context, Metadata *Scope,
+ MDString *Name, Metadata *File,
+ unsigned Line, StorageType Storage,
+ bool ShouldCreate = true);
TempDILabel cloneImpl() const {
return getTemporary(getContext(), getScope(), getName(), getFile(),
@@ -3913,11 +3932,10 @@ class DIObjCProperty : public DINode {
getCanonicalMDString(Context, SetterName), Attributes, Type,
Storage, ShouldCreate);
}
- LLVM_ABI static DIObjCProperty *getImpl(LLVMContext &Context, MDString *Name,
- Metadata *File, unsigned Line,
- MDString *GetterName, MDString *SetterName,
- unsigned Attributes, Metadata *Type,
- StorageType Storage, bool ShouldCreate = true);
+ LLVM_ABI static DIObjCProperty *
+ getImpl(LLVMContext &Context, MDString *Name, Metadata *File, unsigned Line,
+ MDString *GetterName, MDString *SetterName, unsigned Attributes,
+ Metadata *Type, StorageType Storage, bool ShouldCreate = true);
TempDIObjCProperty cloneImpl() const {
return getTemporary(getContext(), getName(), getFile(), getLine(),
@@ -4152,9 +4170,10 @@ class DIMacro : public DIMacroNode {
return getImpl(Context, MIType, Line, getCanonicalMDString(Context, Name),
getCanonicalMDString(Context, Value), Storage, ShouldCreate);
}
- LLVM_ABI static DIMacro *getImpl(LLVMContext &Context, unsigned MIType, unsigned Line,
- MDString *Name, MDString *Value, StorageType Storage,
- bool ShouldCreate = true);
+ LLVM_ABI static DIMacro *getImpl(LLVMContext &Context, unsigned MIType,
+ unsigned Line, MDString *Name,
+ MDString *Value, StorageType Storage,
+ bool ShouldCreate = true);
TempDIMacro cloneImpl() const {
return getTemporary(getContext(), getMacinfoType(), getLine(), getName(),
@@ -4209,8 +4228,9 @@ class DIMacroFile : public DIMacroNode {
}
LLVM_ABI static DIMacroFile *getImpl(LLVMContext &Context, unsigned MIType,
- unsigned Line, Metadata *File, Metadata *Elements,
- StorageType Storage, bool ShouldCreate = true);
+ unsigned Line, Metadata *File,
+ Metadata *Elements, StorageType Storage,
+ bool ShouldCreate = true);
TempDIMacroFile cloneImpl() const {
return getTemporary(getContext(), getMacinfoType(), getLine(), getFile(),
@@ -4274,7 +4294,8 @@ class DIArgList : public Metadata, ReplaceableMetadataImpl {
void dropAllReferences(bool Untrack);
public:
- LLVM_ABI static DIArgList *get(LLVMContext &Context, ArrayRef<ValueAsMetadata *> Args);
+ LLVM_ABI static DIArgList *get(LLVMContext &Context,
+ ArrayRef<ValueAsMetadata *> Args);
ArrayRef<ValueAsMetadata *> getArgs() const { return Args; }
diff --git a/llvm/include/llvm/IR/DebugLoc.h b/llvm/include/llvm/IR/DebugLoc.h
index 02bcc9bfae222..c3d0fb80354a4 100644
--- a/llvm/include/llvm/IR/DebugLoc.h
+++ b/llvm/include/llvm/IR/DebugLoc.h
@@ -14,9 +14,9 @@
#ifndef LLVM_IR_DEBUGLOC_H
#define LLVM_IR_DEBUGLOC_H
-#include "llvm/Support/Compiler.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/TrackingMDRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
namespace llvm {
@@ -167,9 +167,9 @@ namespace llvm {
/// Rebuild the entire inlined-at chain for this instruction so that the top of
/// the chain now is inlined-at the new call site.
/// \param InlinedAt The new outermost inlined-at in the chain.
- LLVM_ABI static DebugLoc appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt,
- LLVMContext &Ctx,
- DenseMap<const MDNode *, MDNode *> &Cache);
+ LLVM_ABI static DebugLoc
+ appendInlinedAt(const DebugLoc &DL, DILocation *InlinedAt, LLVMContext &Ctx,
+ DenseMap<const MDNode *, MDNode *> &Cache);
/// Return true if the source locations match, ignoring isImplicitCode and
/// source atom info.
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 6b09fd64f1bb0..1436677e5a085 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -47,7 +47,6 @@
#ifndef LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
#define LLVM_IR_DEBUGPROGRAMINSTRUCTION_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/iterator.h"
@@ -56,6 +55,7 @@
#include "llvm/IR/Instruction.h"
#include "llvm/IR/SymbolTableListTraits.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -157,13 +157,14 @@ class DbgRecord : public ilist_node<DbgRecord> {
LLVM_ABI void deleteRecord();
LLVM_ABI DbgRecord *clone() const;
LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
- LLVM_ABI void print(raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI void print(raw_ostream &O, ModuleSlotTracker &MST,
+ bool IsForDebug) const;
LLVM_ABI bool isIdenticalToWhenDefined(const DbgRecord &R) const;
/// Convert this DbgRecord back into an appropriate llvm.dbg.* intrinsic.
/// \p InsertBefore Optional position to insert this intrinsic.
/// \returns A new llvm.dbg.* intrinsic representiung this DbgRecord.
- LLVM_ABI DbgInfoIntrinsic *createDebugIntrinsic(Module *M,
- Instruction *InsertBefore) const;
+ LLVM_ABI DbgInfoIntrinsic *
+ createDebugIntrinsic(Module *M, Instruction *InsertBefore) const;
///@}
/// Same as isIdenticalToWhenDefined but checks DebugLoc too.
@@ -249,13 +250,14 @@ class DbgLabelRecord : public DbgRecord {
/// they are resolved, or if they resolve to the wrong type, will result in a
/// crash.
LLVM_ABI static DbgLabelRecord *createUnresolvedDbgLabelRecord(MDNode *Label,
- MDNode *DL);
+ MDNode *DL);
LLVM_ABI DbgLabelRecord *clone() const;
LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
- LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ bool IsForDebug) const;
LLVM_ABI DbgLabelInst *createDebugIntrinsic(Module *M,
- Instruction *InsertBefore) const;
+ Instruction *InsertBefore) const;
void setLabel(DILabel *NewLabel) { Label = NewLabel; }
DILabel *getLabel() const { return Label.get(); }
@@ -305,13 +307,13 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
LLVM_ABI DbgVariableRecord(const DbgVariableRecord &DVR);
/// Directly construct a new DbgVariableRecord representing a dbg.value
/// intrinsic assigning \p Location to the DV / Expr / DI variable.
- LLVM_ABI DbgVariableRecord(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
- const DILocation *DI,
- LocationType Type = LocationType::Value);
+ LLVM_ABI DbgVariableRecord(Metadata *Location, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ LocationType Type = LocationType::Value);
LLVM_ABI DbgVariableRecord(Metadata *Value, DILocalVariable *Variable,
- DIExpression *Expression, DIAssignID *AssignID,
- Metadata *Address, DIExpression *AddressExpression,
- const DILocation *DI);
+ DIExpression *Expression, DIAssignID *AssignID,
+ Metadata *Address, DIExpression *AddressExpression,
+ const DILocation *DI);
private:
/// Private constructor for creating new instances during parsing only. Only
@@ -347,18 +349,17 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
Value *Address, DIExpression *AddressExpression,
const DILocation *DI);
- LLVM_ABI static DbgVariableRecord *createDbgVariableRecord(Value *Location,
- DILocalVariable *DV,
- DIExpression *Expr,
- const DILocation *DI);
+ LLVM_ABI static DbgVariableRecord *
+ createDbgVariableRecord(Value *Location, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI);
LLVM_ABI static DbgVariableRecord *
createDbgVariableRecord(Value *Location, DILocalVariable *DV,
DIExpression *Expr, const DILocation *DI,
DbgVariableRecord &InsertBefore);
LLVM_ABI static DbgVariableRecord *createDVRDeclare(Value *Address,
- DILocalVariable *DV,
- DIExpression *Expr,
- const DILocation *DI);
+ DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI);
LLVM_ABI static DbgVariableRecord *
createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr,
const DILocation *DI, DbgVariableRecord &InsertBefore);
@@ -422,13 +423,13 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
LLVM_ABI void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
- bool AllowEmpty = false);
+ bool AllowEmpty = false);
LLVM_ABI void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
/// Adding a new location operand will always result in this intrinsic using
/// an ArgList, and must always be accompanied by a new expression that uses
/// the new operand.
LLVM_ABI void addVariableLocationOps(ArrayRef<Value *> NewValues,
- DIExpression *NewExpr);
+ DIExpression *NewExpr);
LLVM_ABI unsigned getNumVariableLocationOps() const;
@@ -539,15 +540,16 @@ class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
/// Convert this DbgVariableRecord back into a dbg.value intrinsic.
/// \p InsertBefore Optional position to insert this intrinsic.
/// \returns A new dbg.value intrinsic representiung this DbgVariableRecord.
- LLVM_ABI DbgVariableIntrinsic *createDebugIntrinsic(Module *M,
- Instruction *InsertBefore) const;
+ LLVM_ABI DbgVariableIntrinsic *
+ createDebugIntrinsic(Module *M, Instruction *InsertBefore) const;
/// Handle changes to the location of the Value(s) that we refer to happening
/// "under our feet".
LLVM_ABI void handleChangedLocation(Metadata *NewLocation);
LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
- LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ bool IsForDebug) const;
/// Support type inquiry through isa, cast, and dyn_cast.
static bool classof(const DbgRecord *E) {
@@ -613,10 +615,12 @@ class DbgMarker {
/// Implement operator<< on DbgMarker.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
- LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const;
+ LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ bool IsForDebug) const;
/// Produce a range over all the DbgRecords in this Marker.
- LLVM_ABI iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange();
+ LLVM_ABI iterator_range<simple_ilist<DbgRecord>::iterator>
+ getDbgRecordRange();
LLVM_ABI iterator_range<simple_ilist<DbgRecord>::const_iterator>
getDbgRecordRange() const;
/// Transfer any DbgRecords from \p Src into this DbgMarker. If \p
@@ -626,8 +630,9 @@ class DbgMarker {
/// Transfer the DbgRecords in \p Range from \p Src into this DbgMarker. If
/// \p InsertAtHead is true, place them before existing DbgRecords, otherwise
// afterwards.
- LLVM_ABI void absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
- DbgMarker &Src, bool InsertAtHead);
+ LLVM_ABI void
+ absorbDebugValues(iterator_range<DbgRecord::self_iterator> Range,
+ DbgMarker &Src, bool InsertAtHead);
/// Insert a DbgRecord into this DbgMarker, at the end of the list. If
/// \p InsertAtHead is true, at the start.
LLVM_ABI void insertDbgRecord(DbgRecord *New, bool InsertAtHead);
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 0265db8f9b503..4d6bb1cfe3069 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -110,8 +110,8 @@ class FunctionType : public Type {
FunctionType &operator=(const FunctionType &) = delete;
/// This static method is the primary way of constructing a FunctionType.
- LLVM_ABI static FunctionType *get(Type *Result,
- ArrayRef<Type*> Params, bool isVarArg);
+ LLVM_ABI static FunctionType *get(Type *Result, ArrayRef<Type *> Params,
+ bool isVarArg);
/// Create a FunctionType taking no parameters.
LLVM_ABI static FunctionType *get(Type *Result, bool isVarArg);
@@ -247,11 +247,13 @@ class StructType : public Type {
LLVM_ABI static StructType *create(LLVMContext &Context);
LLVM_ABI static StructType *create(ArrayRef<Type *> Elements, StringRef Name,
- bool isPacked = false);
+ bool isPacked = false);
LLVM_ABI static StructType *create(ArrayRef<Type *> Elements);
- LLVM_ABI static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements,
- StringRef Name, bool isPacked = false);
- LLVM_ABI static StructType *create(LLVMContext &Context, ArrayRef<Type *> Elements);
+ LLVM_ABI static StructType *create(LLVMContext &Context,
+ ArrayRef<Type *> Elements, StringRef Name,
+ bool isPacked = false);
+ LLVM_ABI static StructType *create(LLVMContext &Context,
+ ArrayRef<Type *> Elements);
template <class... Tys>
static std::enable_if_t<are_base_of<Type, Tys...>::value, StructType *>
create(StringRef Name, Type *elt1, Tys *... elts) {
@@ -260,8 +262,8 @@ class StructType : public Type {
}
/// This static method is the primary way to create a literal StructType.
- LLVM_ABI static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
- bool isPacked = false);
+ LLVM_ABI static StructType *
+ get(LLVMContext &Context, ArrayRef<Type *> Elements, bool isPacked = false);
/// Create an empty structure type.
LLVM_ABI static StructType *get(LLVMContext &Context, bool isPacked = false);
@@ -336,11 +338,12 @@ class StructType : public Type {
/// Specify a body for an opaque identified type, which must not make the type
/// recursive.
- LLVM_ABI void setBody(ArrayRef<Type*> Elements, bool isPacked = false);
+ LLVM_ABI void setBody(ArrayRef<Type *> Elements, bool isPacked = false);
/// Specify a body for an opaque identified type or return an error if it
/// would make the type recursive.
- LLVM_ABI Error setBodyOrError(ArrayRef<Type *> Elements, bool isPacked = false);
+ LLVM_ABI Error setBodyOrError(ArrayRef<Type *> Elements,
+ bool isPacked = false);
/// Return an error if the body for an opaque identified type would make it
/// recursive.
@@ -639,7 +642,8 @@ class ScalableVectorType : public VectorType {
: VectorType(ElTy, MinNumElts, ScalableVectorTyID) {}
public:
- LLVM_ABI static ScalableVectorType *get(Type *ElementType, unsigned MinNumElts);
+ LLVM_ABI static ScalableVectorType *get(Type *ElementType,
+ unsigned MinNumElts);
static ScalableVectorType *get(Type *ElementType,
const ScalableVectorType *SVTy) {
@@ -789,16 +793,15 @@ class TargetExtType : public Type {
/// Return a target extension type having the specified name and optional
/// type and integer parameters.
LLVM_ABI static TargetExtType *get(LLVMContext &Context, StringRef Name,
- ArrayRef<Type *> Types = {},
- ArrayRef<unsigned> Ints = {});
+ ArrayRef<Type *> Types = {},
+ ArrayRef<unsigned> Ints = {});
/// Return a target extension type having the specified name and optional
/// type and integer parameters, or an appropriate Error if it fails the
/// parameters check.
- LLVM_ABI static Expected<TargetExtType *> getOrError(LLVMContext &Context,
- StringRef Name,
- ArrayRef<Type *> Types = {},
- ArrayRef<unsigned> Ints = {});
+ LLVM_ABI static Expected<TargetExtType *>
+ getOrError(LLVMContext &Context, StringRef Name, ArrayRef<Type *> Types = {},
+ ArrayRef<unsigned> Ints = {});
/// Check that a newly created target extension type has the expected number
/// of type parameters and integer parameters, returning the type itself if OK
diff --git a/llvm/include/llvm/IR/DiagnosticHandler.h b/llvm/include/llvm/IR/DiagnosticHandler.h
index cfd70ce978fdc..54880d8e62733 100644
--- a/llvm/include/llvm/IR/DiagnosticHandler.h
+++ b/llvm/include/llvm/IR/DiagnosticHandler.h
@@ -12,8 +12,8 @@
#ifndef LLVM_IR_DIAGNOSTICHANDLER_H
#define LLVM_IR_DIAGNOSTICHANDLER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
class DiagnosticInfo;
diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h
index 9509a3715b76b..da72286fc89d4 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_DIAGNOSTICINFO_H
#define LLVM_IR_DIAGNOSTICINFO_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
@@ -22,6 +21,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TypeSize.h"
@@ -234,7 +234,8 @@ class LLVM_ABI DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
};
/// Diagnostic information for stripping invalid debug metadata.
-class LLVM_ABI DiagnosticInfoIgnoringInvalidDebugMetadata : public DiagnosticInfo {
+class LLVM_ABI DiagnosticInfoIgnoringInvalidDebugMetadata
+ : public DiagnosticInfo {
private:
/// The module that is concerned by this debug metadata version diagnostic.
const Module &M;
@@ -377,7 +378,8 @@ class LLVM_ABI DiagnosticInfoWithLocationBase : public DiagnosticInfo {
DiagnosticLocation Loc;
};
-class LLVM_ABI DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoGenericWithLoc
+ : public DiagnosticInfoWithLocationBase {
private:
/// Message to be reported.
const Twine &MsgStr;
@@ -402,7 +404,8 @@ class LLVM_ABI DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationB
}
};
-class LLVM_ABI DiagnosticInfoRegAllocFailure : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoRegAllocFailure
+ : public DiagnosticInfoWithLocationBase {
private:
/// Message to be reported.
const Twine &MsgStr;
@@ -430,7 +433,8 @@ class LLVM_ABI DiagnosticInfoRegAllocFailure : public DiagnosticInfoWithLocation
/// Diagnostic information for stack size etc. reporting.
/// This is basically a function and a size.
-class LLVM_ABI DiagnosticInfoResourceLimit : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoResourceLimit
+ : public DiagnosticInfoWithLocationBase {
private:
/// The function that is concerned by this resource limit diagnostic.
const Function &Fn;
@@ -485,7 +489,8 @@ class LLVM_ABI DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit {
/// Common features for diagnostics dealing with optimization remarks
/// that are used by both IR and MIR passes.
-class LLVM_ABI DiagnosticInfoOptimizationBase : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoOptimizationBase
+ : public DiagnosticInfoWithLocationBase {
public:
/// Used to set IsVerbose via the stream interface.
struct setIsVerbose {};
@@ -659,7 +664,8 @@ operator<<(RemarkT &&R,
/// Common features for diagnostics dealing with optimization remarks
/// that are used by IR passes.
-class LLVM_ABI DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
+class LLVM_ABI DiagnosticInfoIROptimization
+ : public DiagnosticInfoOptimizationBase {
void anchor() override;
public:
/// \p PassName is the name of the pass emitting this diagnostic. \p
@@ -817,7 +823,8 @@ class LLVM_ABI OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
};
/// Diagnostic information for optimization analysis remarks.
-class LLVM_ABI OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
+class LLVM_ABI OptimizationRemarkAnalysis
+ : public DiagnosticInfoIROptimization {
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
/// matches the regular expression given in -Rpass-analysis=, then the
@@ -890,7 +897,8 @@ class LLVM_ABI OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization
/// Diagnostic information for optimization analysis remarks related to
/// floating-point non-commutativity.
-class LLVM_ABI OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
+class LLVM_ABI OptimizationRemarkAnalysisFPCommute
+ : public OptimizationRemarkAnalysis {
void anchor() override;
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
@@ -932,7 +940,8 @@ class LLVM_ABI OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAn
/// Diagnostic information for optimization analysis remarks related to
/// pointer aliasing.
-class LLVM_ABI OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
+class LLVM_ABI OptimizationRemarkAnalysisAliasing
+ : public OptimizationRemarkAnalysis {
void anchor() override;
public:
/// \p PassName is the name of the pass emitting this diagnostic. If this name
@@ -1029,7 +1038,8 @@ class LLVM_ABI DiagnosticInfoISelFallback : public DiagnosticInfo {
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)
/// Diagnostic information for optimization failures.
-class LLVM_ABI DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
+class LLVM_ABI DiagnosticInfoOptimizationFailure
+ : public DiagnosticInfoIROptimization {
public:
/// \p Fn is the function where the diagnostic is being emitted. \p Loc is
/// the location information to use in the diagnostic. If line table
@@ -1061,7 +1071,8 @@ class LLVM_ABI DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimi
};
/// Diagnostic information for unsupported feature in backend.
-class LLVM_ABI DiagnosticInfoUnsupported : public DiagnosticInfoWithLocationBase {
+class LLVM_ABI DiagnosticInfoUnsupported
+ : public DiagnosticInfoWithLocationBase {
private:
Twine Msg;
diff --git a/llvm/include/llvm/IR/Dominators.h b/llvm/include/llvm/IR/Dominators.h
index 514ef3f6c3123..bf128a3936cbd 100644
--- a/llvm/include/llvm/IR/Dominators.h
+++ b/llvm/include/llvm/IR/Dominators.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_DOMINATORS_H
#define LLVM_IR_DOMINATORS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMapInfo.h"
@@ -31,6 +30,7 @@
#include "llvm/Pass.h"
#include "llvm/Support/CFGDiff.h"
#include "llvm/Support/CFGUpdate.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/GenericDomTree.h"
#include <algorithm>
#include <utility>
@@ -45,8 +45,10 @@ class raw_ostream;
template <class GraphType> struct GraphTraits;
extern template class LLVM_TEMPLATE_ABI DomTreeNodeBase<BasicBlock>;
-extern template class LLVM_TEMPLATE_ABI DominatorTreeBase<BasicBlock, false>; // DomTree
-extern template class LLVM_TEMPLATE_ABI DominatorTreeBase<BasicBlock, true>; // PostDomTree
+extern template class LLVM_TEMPLATE_ABI
+ DominatorTreeBase<BasicBlock, false>; // DomTree
+extern template class LLVM_TEMPLATE_ABI
+ DominatorTreeBase<BasicBlock, true>; // PostDomTree
extern template class cfg::Update<BasicBlock *>;
@@ -60,34 +62,34 @@ using BBDomTreeGraphDiff = GraphDiff<BasicBlock *, false>;
using BBPostDomTreeGraphDiff = GraphDiff<BasicBlock *, true>;
extern template LLVM_TEMPLATE_ABI void Calculate<BBDomTree>(BBDomTree &DT);
-extern template LLVM_TEMPLATE_ABI void CalculateWithUpdates<BBDomTree>(BBDomTree &DT,
- BBUpdates U);
-
-extern template LLVM_TEMPLATE_ABI void Calculate<BBPostDomTree>(BBPostDomTree &DT);
-
-extern template LLVM_TEMPLATE_ABI void InsertEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
- BasicBlock *To);
-extern template LLVM_TEMPLATE_ABI void InsertEdge<BBPostDomTree>(BBPostDomTree &DT,
- BasicBlock *From,
- BasicBlock *To);
-
-extern template LLVM_TEMPLATE_ABI void DeleteEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
- BasicBlock *To);
-extern template LLVM_TEMPLATE_ABI void DeleteEdge<BBPostDomTree>(BBPostDomTree &DT,
- BasicBlock *From,
- BasicBlock *To);
-
-extern template LLVM_TEMPLATE_ABI void ApplyUpdates<BBDomTree>(BBDomTree &DT,
- BBDomTreeGraphDiff &,
- BBDomTreeGraphDiff *);
-extern template LLVM_TEMPLATE_ABI void ApplyUpdates<BBPostDomTree>(BBPostDomTree &DT,
- BBPostDomTreeGraphDiff &,
- BBPostDomTreeGraphDiff *);
-
-extern template LLVM_TEMPLATE_ABI bool Verify<BBDomTree>(const BBDomTree &DT,
- BBDomTree::VerificationLevel VL);
-extern template LLVM_TEMPLATE_ABI bool Verify<BBPostDomTree>(const BBPostDomTree &DT,
- BBPostDomTree::VerificationLevel VL);
+extern template LLVM_TEMPLATE_ABI void
+CalculateWithUpdates<BBDomTree>(BBDomTree &DT, BBUpdates U);
+
+extern template LLVM_TEMPLATE_ABI void
+Calculate<BBPostDomTree>(BBPostDomTree &DT);
+
+extern template LLVM_TEMPLATE_ABI void
+InsertEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From, BasicBlock *To);
+extern template LLVM_TEMPLATE_ABI void
+InsertEdge<BBPostDomTree>(BBPostDomTree &DT, BasicBlock *From, BasicBlock *To);
+
+extern template LLVM_TEMPLATE_ABI void
+DeleteEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From, BasicBlock *To);
+extern template LLVM_TEMPLATE_ABI void
+DeleteEdge<BBPostDomTree>(BBPostDomTree &DT, BasicBlock *From, BasicBlock *To);
+
+extern template LLVM_TEMPLATE_ABI void
+ApplyUpdates<BBDomTree>(BBDomTree &DT, BBDomTreeGraphDiff &,
+ BBDomTreeGraphDiff *);
+extern template LLVM_TEMPLATE_ABI void
+ApplyUpdates<BBPostDomTree>(BBPostDomTree &DT, BBPostDomTreeGraphDiff &,
+ BBPostDomTreeGraphDiff *);
+
+extern template LLVM_TEMPLATE_ABI bool
+Verify<BBDomTree>(const BBDomTree &DT, BBDomTree::VerificationLevel VL);
+extern template LLVM_TEMPLATE_ABI bool
+Verify<BBPostDomTree>(const BBPostDomTree &DT,
+ BBPostDomTree::VerificationLevel VL);
} // namespace DomTreeBuilder
using DomTreeNode = DomTreeNodeBase<BasicBlock>;
@@ -172,7 +174,7 @@ class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
/// Handle invalidation explicitly.
LLVM_ABI bool invalidate(Function &F, const PreservedAnalyses &PA,
- FunctionAnalysisManager::Invalidator &);
+ FunctionAnalysisManager::Invalidator &);
// Ensure base-class overloads are visible.
using Base::dominates;
@@ -210,9 +212,11 @@ class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
/// If BBE is not a unique edge between start and end of the edge, it can
/// never dominate the use.
LLVM_ABI bool dominates(const BasicBlockEdge &BBE, const Use &U) const;
- LLVM_ABI bool dominates(const BasicBlockEdge &BBE, const BasicBlock *BB) const;
+ LLVM_ABI bool dominates(const BasicBlockEdge &BBE,
+ const BasicBlock *BB) const;
/// Returns true if edge \p BBE1 dominates edge \p BBE2.
- LLVM_ABI bool dominates(const BasicBlockEdge &BBE1, const BasicBlockEdge &BBE2) const;
+ LLVM_ABI bool dominates(const BasicBlockEdge &BBE1,
+ const BasicBlockEdge &BBE2) const;
// Ensure base class overloads are visible.
using Base::isReachableFromEntry;
@@ -226,7 +230,7 @@ class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
/// Find the nearest instruction I that dominates both I1 and I2, in the sense
/// that a result produced before I will be available at both I1 and I2.
LLVM_ABI Instruction *findNearestCommonDominator(Instruction *I1,
- Instruction *I2) const;
+ Instruction *I2) const;
// Pop up a GraphViz/gv window with the Dominator Tree rendered using `dot`.
LLVM_ABI void viewGraph(const Twine &Name, const Twine &Title);
diff --git a/llvm/include/llvm/IR/DroppedVariableStats.h b/llvm/include/llvm/IR/DroppedVariableStats.h
index a01dd75c221eb..42e86dd966751 100644
--- a/llvm/include/llvm/IR/DroppedVariableStats.h
+++ b/llvm/include/llvm/IR/DroppedVariableStats.h
@@ -14,9 +14,9 @@
#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATS_H
#define LLVM_CODEGEN_DROPPEDVARIABLESTATS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
#include <tuple>
namespace llvm {
@@ -76,21 +76,21 @@ class DroppedVariableStats {
SmallVector<DenseMap<StringRef, DenseMap<VarID, DILocation *>>> InlinedAts;
/// Calculate the number of dropped variables in an llvm::Function or
/// llvm::MachineFunction and print the relevant information to stdout.
- LLVM_ABI void calculateDroppedStatsAndPrint(DebugVariables &DbgVariables,
- StringRef FuncName, StringRef PassID,
- StringRef FuncOrModName,
- StringRef PassLevel, const Function *Func);
+ LLVM_ABI void calculateDroppedStatsAndPrint(
+ DebugVariables &DbgVariables, StringRef FuncName, StringRef PassID,
+ StringRef FuncOrModName, StringRef PassLevel, const Function *Func);
/// Check if a \p Var has been dropped or is a false positive. Also update the
/// \p DroppedCount if a debug variable is dropped.
LLVM_ABI bool updateDroppedCount(DILocation *DbgLoc, const DIScope *Scope,
- const DIScope *DbgValScope,
- DenseMap<VarID, DILocation *> &InlinedAtsMap,
- VarID Var, unsigned &DroppedCount);
+ const DIScope *DbgValScope,
+ DenseMap<VarID, DILocation *> &InlinedAtsMap,
+ VarID Var, unsigned &DroppedCount);
/// Run code to populate relevant data structures over an llvm::Function or
/// llvm::MachineFunction.
- LLVM_ABI void run(DebugVariables &DbgVariables, StringRef FuncName, bool Before);
+ LLVM_ABI void run(DebugVariables &DbgVariables, StringRef FuncName,
+ bool Before);
/// Populate the VarIDSet and InlinedAtMap with the relevant information
/// needed for before and after pass analysis to determine dropped variable
diff --git a/llvm/include/llvm/IR/DroppedVariableStatsIR.h b/llvm/include/llvm/IR/DroppedVariableStatsIR.h
index 454cd1afaaffb..3e182566f8cc0 100644
--- a/llvm/include/llvm/IR/DroppedVariableStatsIR.h
+++ b/llvm/include/llvm/IR/DroppedVariableStatsIR.h
@@ -14,8 +14,8 @@
#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
#define LLVM_CODEGEN_DROPPEDVARIABLESTATSIR_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/DroppedVariableStats.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/EHPersonalities.h b/llvm/include/llvm/IR/EHPersonalities.h
index d21b68dff095b..39f6817b3dc38 100644
--- a/llvm/include/llvm/IR/EHPersonalities.h
+++ b/llvm/include/llvm/IR/EHPersonalities.h
@@ -9,9 +9,9 @@
#ifndef LLVM_IR_EHPERSONALITIES_H
#define LLVM_IR_EHPERSONALITIES_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/TinyPtrVector.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
class BasicBlock;
diff --git a/llvm/include/llvm/IR/FPEnv.h b/llvm/include/llvm/IR/FPEnv.h
index 053588243a366..38395b15c8c09 100644
--- a/llvm/include/llvm/IR/FPEnv.h
+++ b/llvm/include/llvm/IR/FPEnv.h
@@ -15,9 +15,9 @@
#ifndef LLVM_IR_FPENV_H
#define LLVM_IR_FPENV_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/IR/FMF.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -55,11 +55,13 @@ LLVM_ABI std::optional<StringRef> convertRoundingModeToStr(RoundingMode);
/// Returns a valid ExceptionBehavior enumerator when given a string
/// valid as input in constrained intrinsic exception behavior metadata.
-LLVM_ABI std::optional<fp::ExceptionBehavior> convertStrToExceptionBehavior(StringRef);
+LLVM_ABI std::optional<fp::ExceptionBehavior>
+ convertStrToExceptionBehavior(StringRef);
/// For any ExceptionBehavior enumerator, returns a string valid as
/// input in constrained intrinsic exception behavior metadata.
-LLVM_ABI std::optional<StringRef> convertExceptionBehaviorToStr(fp::ExceptionBehavior);
+LLVM_ABI std::optional<StringRef>
+ convertExceptionBehaviorToStr(fp::ExceptionBehavior);
/// Returns true if the exception handling behavior and rounding mode
/// match what is used in the default floating point environment.
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 5580d226a80c6..b37c6c6f94a07 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -17,7 +17,6 @@
#ifndef LLVM_IR_FUNCTION_H
#define LLVM_IR_FUNCTION_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
@@ -33,6 +32,7 @@
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/SymbolTableListTraits.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
@@ -793,7 +793,8 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {
private:
// These need access to the underlying BB list.
LLVM_ABI_FRIEND friend void BasicBlock::removeFromParent();
- LLVM_ABI_FRIEND friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
+ LLVM_ABI_FRIEND friend iplist<BasicBlock>::iterator
+ BasicBlock::eraseFromParent();
template <class BB_t, class BB_i_t, class BI_t, class II_t>
friend class InstIterator;
friend class llvm::SymbolTableListTraits<llvm::BasicBlock>;
@@ -1053,8 +1054,7 @@ namespace CallingConv {
// TODO: Need similar function for support of argument in position. General
// version on FunctionType + Attributes + CallingConv::ID?
-LLVM_ABI LLVM_READNONE
-bool supportsNonVoidReturnType(CallingConv::ID CC);
+LLVM_ABI LLVM_READNONE bool supportsNonVoidReturnType(CallingConv::ID CC);
} // namespace CallingConv
/// Check whether null pointer dereferencing is considered undefined behavior
diff --git a/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h b/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h
index da38e3a36763d..8aac9d5b49dbb 100644
--- a/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h
+++ b/llvm/include/llvm/IR/GenericFloatingPointPredicateUtils.h
@@ -15,10 +15,10 @@
#ifndef LLVM_ADT_GENERICFLOATINGPOINTPREDICATEUTILS_H
#define LLVM_ADT_GENERICFLOATINGPOINTPREDICATEUTILS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/Support/Compiler.h"
#include <optional>
namespace llvm {
@@ -30,13 +30,14 @@ template <typename ContextT> class GenericFloatingPointPredicateUtils {
constexpr static ValueRefT Invalid = {};
private:
- LLVM_ABI static DenormalMode queryDenormalMode(const FunctionT &F, ValueRefT Val);
+ LLVM_ABI static DenormalMode queryDenormalMode(const FunctionT &F,
+ ValueRefT Val);
LLVM_ABI static bool lookThroughFAbs(const FunctionT &F, ValueRefT LHS,
- ValueRefT &Src);
+ ValueRefT &Src);
LLVM_ABI static std::optional<APFloat> matchConstantFloat(const FunctionT &F,
- ValueRefT Val);
+ ValueRefT Val);
/// Return the return value for fcmpImpliesClass for a compare that produces
/// an exact class test.
diff --git a/llvm/include/llvm/IR/GlobalAlias.h b/llvm/include/llvm/IR/GlobalAlias.h
index 991d03dcd08c4..12b9f053abb17 100644
--- a/llvm/include/llvm/IR/GlobalAlias.h
+++ b/llvm/include/llvm/IR/GlobalAlias.h
@@ -14,11 +14,11 @@
#ifndef LLVM_IR_GLOBALALIAS_H
#define LLVM_IR_GLOBALALIAS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -41,22 +41,22 @@ class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
/// If a parent module is specified, the alias is automatically inserted into
/// the end of the specified module's alias list.
LLVM_ABI static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
- LinkageTypes Linkage, const Twine &Name,
- Constant *Aliasee, Module *Parent);
+ LinkageTypes Linkage, const Twine &Name,
+ Constant *Aliasee, Module *Parent);
// Without the Aliasee.
LLVM_ABI static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
- LinkageTypes Linkage, const Twine &Name,
- Module *Parent);
+ LinkageTypes Linkage, const Twine &Name,
+ Module *Parent);
// The module is taken from the Aliasee.
LLVM_ABI static GlobalAlias *create(Type *Ty, unsigned AddressSpace,
- LinkageTypes Linkage, const Twine &Name,
- GlobalValue *Aliasee);
+ LinkageTypes Linkage, const Twine &Name,
+ GlobalValue *Aliasee);
// Type, Parent and AddressSpace taken from the Aliasee.
LLVM_ABI static GlobalAlias *create(LinkageTypes Linkage, const Twine &Name,
- GlobalValue *Aliasee);
+ GlobalValue *Aliasee);
// Linkage, Type, Parent and AddressSpace taken from the Aliasee.
LLVM_ABI static GlobalAlias *create(const Twine &Name, GlobalValue *Aliasee);
diff --git a/llvm/include/llvm/IR/GlobalIFunc.h b/llvm/include/llvm/IR/GlobalIFunc.h
index f8694a26fb5f6..d93146aa016be 100644
--- a/llvm/include/llvm/IR/GlobalIFunc.h
+++ b/llvm/include/llvm/IR/GlobalIFunc.h
@@ -17,12 +17,12 @@
#ifndef LLVM_IR_GLOBALIFUNC_H
#define LLVM_IR_GLOBALIFUNC_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -47,8 +47,8 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
/// If a parent module is specified, the ifunc is automatically inserted into
/// the end of the specified module's ifunc list.
LLVM_ABI static GlobalIFunc *create(Type *Ty, unsigned AddressSpace,
- LinkageTypes Linkage, const Twine &Name,
- Constant *Resolver, Module *Parent);
+ LinkageTypes Linkage, const Twine &Name,
+ Constant *Resolver, Module *Parent);
// allocate space for exactly one operand
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -97,7 +97,8 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
// is already a global object, then apply the operation to it directly. If
// target is a GlobalExpr or a GlobalAlias, evaluate it to its base object and
// apply the operation for the base object and all aliases along the path.
- LLVM_ABI void applyAlongResolverPath(function_ref<void(const GlobalValue &)> Op) const;
+ LLVM_ABI void
+ applyAlongResolverPath(function_ref<void(const GlobalValue &)> Op) const;
};
template <>
diff --git a/llvm/include/llvm/IR/GlobalObject.h b/llvm/include/llvm/IR/GlobalObject.h
index fa9cd27026b5c..557add940f452 100644
--- a/llvm/include/llvm/IR/GlobalObject.h
+++ b/llvm/include/llvm/IR/GlobalObject.h
@@ -14,11 +14,11 @@
#ifndef LLVM_IR_GLOBALOBJECT_H
#define LLVM_IR_GLOBALOBJECT_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/GlobalValue.h b/llvm/include/llvm/IR/GlobalValue.h
index ae5320901dd85..83e695cdd27d9 100644
--- a/llvm/include/llvm/IR/GlobalValue.h
+++ b/llvm/include/llvm/IR/GlobalValue.h
@@ -17,13 +17,13 @@
#ifndef LLVM_IR_GLOBALVALUE_H
#define LLVM_IR_GLOBALVALUE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstdint>
@@ -580,9 +580,9 @@ class GlobalValue : public Constant {
/// used as the key for a global lookup (e.g. profile or ThinLTO).
/// The value's original name is \c Name and has linkage of type
/// \c Linkage. The value is defined in module \c FileName.
- LLVM_ABI static std::string getGlobalIdentifier(StringRef Name,
- GlobalValue::LinkageTypes Linkage,
- StringRef FileName);
+ LLVM_ABI static std::string
+ getGlobalIdentifier(StringRef Name, GlobalValue::LinkageTypes Linkage,
+ StringRef FileName);
private:
/// Return the modified name for this global value suitable to be
@@ -616,7 +616,7 @@ class GlobalValue : public Constant {
/// Make sure this GlobalValue is fully read.
LLVM_ABI Error materialize();
-/// @}
+ /// @}
/// Return true if the primary definition of this global value is outside of
/// the current translation unit.
diff --git a/llvm/include/llvm/IR/GlobalVariable.h b/llvm/include/llvm/IR/GlobalVariable.h
index 29aee6aa7b516..a411897f5490e 100644
--- a/llvm/include/llvm/IR/GlobalVariable.h
+++ b/llvm/include/llvm/IR/GlobalVariable.h
@@ -19,13 +19,13 @@
#ifndef LLVM_IR_GLOBALVARIABLE_H
#define LLVM_IR_GLOBALVARIABLE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/GlobalObject.h"
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstddef>
@@ -59,17 +59,20 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
/// GlobalVariable ctor - If a parent module is specified, the global is
/// automatically inserted into the end of the specified modules global list.
LLVM_ABI GlobalVariable(Type *Ty, bool isConstant, LinkageTypes Linkage,
- Constant *Initializer = nullptr, const Twine &Name = "",
- ThreadLocalMode = NotThreadLocal, unsigned AddressSpace = 0,
- bool isExternallyInitialized = false);
+ Constant *Initializer = nullptr,
+ const Twine &Name = "",
+ ThreadLocalMode = NotThreadLocal,
+ unsigned AddressSpace = 0,
+ bool isExternallyInitialized = false);
/// GlobalVariable ctor - This creates a global and inserts it before the
/// specified other global.
- LLVM_ABI GlobalVariable(Module &M, Type *Ty, bool isConstant, LinkageTypes Linkage,
- Constant *Initializer, const Twine &Name = "",
- GlobalVariable *InsertBefore = nullptr,
- ThreadLocalMode = NotThreadLocal,
- std::optional<unsigned> AddressSpace = std::nullopt,
- bool isExternallyInitialized = false);
+ LLVM_ABI GlobalVariable(Module &M, Type *Ty, bool isConstant,
+ LinkageTypes Linkage, Constant *Initializer,
+ const Twine &Name = "",
+ GlobalVariable *InsertBefore = nullptr,
+ ThreadLocalMode = NotThreadLocal,
+ std::optional<unsigned> AddressSpace = std::nullopt,
+ bool isExternallyInitialized = false);
GlobalVariable(const GlobalVariable &) = delete;
GlobalVariable &operator=(const GlobalVariable &) = delete;
@@ -203,7 +206,8 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
LLVM_ABI void addDebugInfo(DIGlobalVariableExpression *GV);
/// Fill the vector with all debug info attachements.
- LLVM_ABI void getDebugInfo(SmallVectorImpl<DIGlobalVariableExpression *> &GVs) const;
+ LLVM_ABI void
+ getDebugInfo(SmallVectorImpl<DIGlobalVariableExpression *> &GVs) const;
/// Add attribute to this global.
void addAttribute(Attribute::AttrKind Kind) {
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index f805679578c50..0db5179c7a3e4 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_IRBUILDER_H
#define LLVM_IR_IRBUILDER_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
@@ -42,6 +41,7 @@
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <cstdint>
#include <functional>
@@ -473,9 +473,11 @@ class IRBuilderBase {
///
/// If no module is given via \p M, it is take from the insertion point basic
/// block.
- LLVM_ABI GlobalVariable *CreateGlobalString(StringRef Str, const Twine &Name = "",
- unsigned AddressSpace = 0,
- Module *M = nullptr, bool AddNull = true);
+ LLVM_ABI GlobalVariable *CreateGlobalString(StringRef Str,
+ const Twine &Name = "",
+ unsigned AddressSpace = 0,
+ Module *M = nullptr,
+ bool AddNull = true);
/// Get a constant value representing either true or false.
ConstantInt *getInt1(bool V) {
@@ -617,13 +619,14 @@ class IRBuilderBase {
return CreateMemSet(Ptr, Val, getInt64(Size), Align, isVolatile, AAInfo);
}
- LLVM_ABI CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, MaybeAlign Align,
- bool isVolatile = false,
- const AAMDNodes &AAInfo = AAMDNodes());
+ LLVM_ABI CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size,
+ MaybeAlign Align, bool isVolatile = false,
+ const AAMDNodes &AAInfo = AAMDNodes());
- LLVM_ABI CallInst *CreateMemSetInline(Value *Dst, MaybeAlign DstAlign, Value *Val,
- Value *Size, bool IsVolatile = false,
- const AAMDNodes &AAInfo = AAMDNodes());
+ LLVM_ABI CallInst *CreateMemSetInline(Value *Dst, MaybeAlign DstAlign,
+ Value *Val, Value *Size,
+ bool IsVolatile = false,
+ const AAMDNodes &AAInfo = AAMDNodes());
/// Create and insert an element unordered-atomic memset of the region of
/// memory starting at the given pointer to the given value.
@@ -638,20 +641,24 @@ class IRBuilderBase {
Ptr, Val, getInt64(Size), Align(Alignment), ElementSize, AAInfo);
}
- LLVM_ABI CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize,
- Value *ArraySize, ArrayRef<OperandBundleDef> OpB,
- Function *MallocF = nullptr, const Twine &Name = "");
+ LLVM_ABI CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy,
+ Value *AllocSize, Value *ArraySize,
+ ArrayRef<OperandBundleDef> OpB,
+ Function *MallocF = nullptr,
+ const Twine &Name = "");
/// CreateMalloc - Generate the IR for a call to malloc:
/// 1. Compute the malloc call's argument as the specified type's size,
/// possibly multiplied by the array size if the array size is not
/// constant 1.
/// 2. Call malloc with that argument.
- LLVM_ABI CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy, Value *AllocSize,
- Value *ArraySize, Function *MallocF = nullptr,
- const Twine &Name = "");
+ LLVM_ABI CallInst *CreateMalloc(Type *IntPtrTy, Type *AllocTy,
+ Value *AllocSize, Value *ArraySize,
+ Function *MallocF = nullptr,
+ const Twine &Name = "");
/// Generate the IR for a call to the builtin free function.
- LLVM_ABI CallInst *CreateFree(Value *Source, ArrayRef<OperandBundleDef> Bundles = {});
+ LLVM_ABI CallInst *CreateFree(Value *Source,
+ ArrayRef<OperandBundleDef> Bundles = {});
LLVM_ABI CallInst *
CreateElementUnorderedAtomicMemSet(Value *Ptr, Value *Val, Value *Size,
@@ -671,11 +678,11 @@ class IRBuilderBase {
isVolatile, AAInfo);
}
- LLVM_ABI CallInst *CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst,
- MaybeAlign DstAlign, Value *Src,
- MaybeAlign SrcAlign, Value *Size,
- bool isVolatile = false,
- const AAMDNodes &AAInfo = AAMDNodes());
+ LLVM_ABI CallInst *
+ CreateMemTransferInst(Intrinsic::ID IntrID, Value *Dst, MaybeAlign DstAlign,
+ Value *Src, MaybeAlign SrcAlign, Value *Size,
+ bool isVolatile = false,
+ const AAMDNodes &AAInfo = AAMDNodes());
CallInst *CreateMemCpy(Value *Dst, MaybeAlign DstAlign, Value *Src,
MaybeAlign SrcAlign, Value *Size,
@@ -793,7 +800,8 @@ class IRBuilderBase {
/// Create a lifetime.start intrinsic.
///
/// If the pointer isn't i8* it will be converted.
- LLVM_ABI CallInst *CreateLifetimeStart(Value *Ptr, ConstantInt *Size = nullptr);
+ LLVM_ABI CallInst *CreateLifetimeStart(Value *Ptr,
+ ConstantInt *Size = nullptr);
/// Create a lifetime.end intrinsic.
///
@@ -803,37 +811,43 @@ class IRBuilderBase {
/// Create a call to invariant.start intrinsic.
///
/// If the pointer isn't i8* it will be converted.
- LLVM_ABI CallInst *CreateInvariantStart(Value *Ptr, ConstantInt *Size = nullptr);
+ LLVM_ABI CallInst *CreateInvariantStart(Value *Ptr,
+ ConstantInt *Size = nullptr);
/// Create a call to llvm.threadlocal.address intrinsic.
LLVM_ABI CallInst *CreateThreadLocalAddress(Value *Ptr);
/// Create a call to Masked Load intrinsic
- LLVM_ABI CallInst *CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment, Value *Mask,
- Value *PassThru = nullptr, const Twine &Name = "");
+ LLVM_ABI CallInst *CreateMaskedLoad(Type *Ty, Value *Ptr, Align Alignment,
+ Value *Mask, Value *PassThru = nullptr,
+ const Twine &Name = "");
/// Create a call to Masked Store intrinsic
LLVM_ABI CallInst *CreateMaskedStore(Value *Val, Value *Ptr, Align Alignment,
- Value *Mask);
+ Value *Mask);
/// Create a call to Masked Gather intrinsic
LLVM_ABI CallInst *CreateMaskedGather(Type *Ty, Value *Ptrs, Align Alignment,
- Value *Mask = nullptr, Value *PassThru = nullptr,
- const Twine &Name = "");
+ Value *Mask = nullptr,
+ Value *PassThru = nullptr,
+ const Twine &Name = "");
/// Create a call to Masked Scatter intrinsic
- LLVM_ABI CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs, Align Alignment,
- Value *Mask = nullptr);
+ LLVM_ABI CallInst *CreateMaskedScatter(Value *Val, Value *Ptrs,
+ Align Alignment,
+ Value *Mask = nullptr);
/// Create a call to Masked Expand Load intrinsic
- LLVM_ABI CallInst *CreateMaskedExpandLoad(Type *Ty, Value *Ptr, MaybeAlign Align,
- Value *Mask = nullptr,
- Value *PassThru = nullptr,
- const Twine &Name = "");
+ LLVM_ABI CallInst *CreateMaskedExpandLoad(Type *Ty, Value *Ptr,
+ MaybeAlign Align,
+ Value *Mask = nullptr,
+ Value *PassThru = nullptr,
+ const Twine &Name = "");
/// Create a call to Masked Compress Store intrinsic
- LLVM_ABI CallInst *CreateMaskedCompressStore(Value *Val, Value *Ptr, MaybeAlign Align,
- Value *Mask = nullptr);
+ LLVM_ABI CallInst *CreateMaskedCompressStore(Value *Val, Value *Ptr,
+ MaybeAlign Align,
+ Value *Mask = nullptr);
/// Return an all true boolean vector (mask) with \p NumElts lanes.
Value *getAllOnesMask(ElementCount NumElts) {
@@ -846,8 +860,8 @@ class IRBuilderBase {
///
/// The optional argument \p OpBundles specifies operand bundles that are
/// added to the call instruction.
- LLVM_ABI CallInst *CreateAssumption(Value *Cond,
- ArrayRef<OperandBundleDef> OpBundles = {});
+ LLVM_ABI CallInst *
+ CreateAssumption(Value *Cond, ArrayRef<OperandBundleDef> OpBundles = {});
/// Create a llvm.experimental.noalias.scope.decl intrinsic call.
LLVM_ABI Instruction *CreateNoAliasScopeDeclaration(Value *Scope);
@@ -858,32 +872,29 @@ class IRBuilderBase {
/// Create a call to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- LLVM_ABI CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
- FunctionCallee ActualCallee,
- ArrayRef<Value *> CallArgs,
- std::optional<ArrayRef<Value *>> DeoptArgs,
- ArrayRef<Value *> GCArgs,
- const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCStatepointCall(
+ uint64_t ID, uint32_t NumPatchBytes, FunctionCallee ActualCallee,
+ ArrayRef<Value *> CallArgs, std::optional<ArrayRef<Value *>> DeoptArgs,
+ ArrayRef<Value *> GCArgs, const Twine &Name = "");
/// Create a call to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
- LLVM_ABI CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
- FunctionCallee ActualCallee, uint32_t Flags,
- ArrayRef<Value *> CallArgs,
- std::optional<ArrayRef<Use>> TransitionArgs,
- std::optional<ArrayRef<Use>> DeoptArgs,
- ArrayRef<Value *> GCArgs,
- const Twine &Name = "");
+ LLVM_ABI CallInst *
+ CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ FunctionCallee ActualCallee, uint32_t Flags,
+ ArrayRef<Value *> CallArgs,
+ std::optional<ArrayRef<Use>> TransitionArgs,
+ std::optional<ArrayRef<Use>> DeoptArgs,
+ ArrayRef<Value *> GCArgs, const Twine &Name = "");
/// Conveninence function for the common case when CallArgs are filled
/// in using ArrayRef(CS.arg_begin(), CS.arg_end()); Use needs to be
/// .get()'ed to get the Value pointer.
- LLVM_ABI CallInst *CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
- FunctionCallee ActualCallee,
- ArrayRef<Use> CallArgs,
- std::optional<ArrayRef<Value *>> DeoptArgs,
- ArrayRef<Value *> GCArgs,
- const Twine &Name = "");
+ LLVM_ABI CallInst *
+ CreateGCStatepointCall(uint64_t ID, uint32_t NumPatchBytes,
+ FunctionCallee ActualCallee, ArrayRef<Use> CallArgs,
+ std::optional<ArrayRef<Value *>> DeoptArgs,
+ ArrayRef<Value *> GCArgs, const Twine &Name = "");
/// Create an invoke to the experimental.gc.statepoint intrinsic to
/// start a new statepoint sequence.
@@ -915,25 +926,24 @@ class IRBuilderBase {
/// Create a call to the experimental.gc.result intrinsic to extract
/// the result from a call wrapped in a statepoint.
- LLVM_ABI CallInst *CreateGCResult(Instruction *Statepoint,
- Type *ResultType,
- const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCResult(Instruction *Statepoint, Type *ResultType,
+ const Twine &Name = "");
/// Create a call to the experimental.gc.relocate intrinsics to
/// project the relocated value of one pointer from the statepoint.
- LLVM_ABI CallInst *CreateGCRelocate(Instruction *Statepoint,
- int BaseOffset,
- int DerivedOffset,
- Type *ResultType,
- const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCRelocate(Instruction *Statepoint, int BaseOffset,
+ int DerivedOffset, Type *ResultType,
+ const Twine &Name = "");
/// Create a call to the experimental.gc.pointer.base intrinsic to get the
/// base pointer for the specified derived pointer.
- LLVM_ABI CallInst *CreateGCGetPointerBase(Value *DerivedPtr, const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCGetPointerBase(Value *DerivedPtr,
+ const Twine &Name = "");
/// Create a call to the experimental.gc.get.pointer.offset intrinsic to get
/// the offset of the specified derived pointer from its base.
- LLVM_ABI CallInst *CreateGCGetPointerOffset(Value *DerivedPtr, const Twine &Name = "");
+ LLVM_ABI CallInst *CreateGCGetPointerOffset(Value *DerivedPtr,
+ const Twine &Name = "");
/// Create a call to llvm.vscale, multiplied by \p Scaling. The type of VScale
/// will be the same type as that of \p Scaling.
@@ -953,28 +963,30 @@ class IRBuilderBase {
/// Create a call to intrinsic \p ID with 1 operand which is mangled on its
/// type.
LLVM_ABI CallInst *CreateUnaryIntrinsic(Intrinsic::ID ID, Value *V,
- FMFSource FMFSource = {},
- const Twine &Name = "");
+ FMFSource FMFSource = {},
+ const Twine &Name = "");
/// Create a call to intrinsic \p ID with 2 operands which is mangled on the
/// first type.
- LLVM_ABI Value *CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS,
- FMFSource FMFSource = {},
- const Twine &Name = "");
+ LLVM_ABI Value *CreateBinaryIntrinsic(Intrinsic::ID ID, Value *LHS,
+ Value *RHS, FMFSource FMFSource = {},
+ const Twine &Name = "");
/// Create a call to intrinsic \p ID with \p Args, mangled using \p Types. If
/// \p FMFSource is provided, copy fast-math-flags from that instruction to
/// the intrinsic.
LLVM_ABI CallInst *CreateIntrinsic(Intrinsic::ID ID, ArrayRef<Type *> Types,
- ArrayRef<Value *> Args, FMFSource FMFSource = {},
- const Twine &Name = "");
+ ArrayRef<Value *> Args,
+ FMFSource FMFSource = {},
+ const Twine &Name = "");
/// Create a call to intrinsic \p ID with \p RetTy and \p Args. If
/// \p FMFSource is provided, copy fast-math-flags from that instruction to
/// the intrinsic.
LLVM_ABI CallInst *CreateIntrinsic(Type *RetTy, Intrinsic::ID ID,
- ArrayRef<Value *> Args, FMFSource FMFSource = {},
- const Twine &Name = "");
+ ArrayRef<Value *> Args,
+ FMFSource FMFSource = {},
+ const Twine &Name = "");
/// Create a call to non-overloaded intrinsic \p ID with \p Args. If
/// \p FMFSource is provided, copy fast-math-flags from that instruction to
@@ -1792,7 +1804,8 @@ class IRBuilderBase {
/// Create either a UnaryOperator or BinaryOperator depending on \p Opc.
/// Correct number of operands must be passed accordingly.
LLVM_ABI Value *CreateNAryOp(unsigned Opc, ArrayRef<Value *> Ops,
- const Twine &Name = "", MDNode *FPMathTag = nullptr);
+ const Twine &Name = "",
+ MDNode *FPMathTag = nullptr);
//===--------------------------------------------------------------------===//
// Instruction creation methods: Memory Instructions
@@ -2446,8 +2459,8 @@ class IRBuilderBase {
private:
// Helper routine to create either a signaling or a quiet FP comparison.
LLVM_ABI Value *CreateFCmpHelper(CmpInst::Predicate P, Value *LHS, Value *RHS,
- const Twine &Name, MDNode *FPMathTag,
- FMFSource FMFSource, bool IsSignaling);
+ const Twine &Name, MDNode *FPMathTag,
+ FMFSource FMFSource, bool IsSignaling);
public:
LLVM_ABI CallInst *CreateConstrainedFPCmp(
@@ -2514,10 +2527,11 @@ class IRBuilderBase {
std::optional<fp::ExceptionBehavior> Except = std::nullopt);
LLVM_ABI Value *CreateSelect(Value *C, Value *True, Value *False,
- const Twine &Name = "", Instruction *MDFrom = nullptr);
+ const Twine &Name = "",
+ Instruction *MDFrom = nullptr);
LLVM_ABI Value *CreateSelectFMF(Value *C, Value *True, Value *False,
- FMFSource FMFSource, const Twine &Name = "",
- Instruction *MDFrom = nullptr);
+ FMFSource FMFSource, const Twine &Name = "",
+ Instruction *MDFrom = nullptr);
VAArgInst *CreateVAArg(Value *List, Type *Ty, const Twine &Name = "") {
return Insert(new VAArgInst(List, Ty), Name);
@@ -2634,7 +2648,7 @@ class IRBuilderBase {
/// pointers must be appropriately aligned for their element types and
/// pointing into the same object.
LLVM_ABI Value *CreatePtrDiff(Type *ElemTy, Value *LHS, Value *RHS,
- const Twine &Name = "");
+ const Twine &Name = "");
/// Create a launder.invariant.group intrinsic call. If Ptr type is
/// different from pointer to i8, it's casted to pointer to i8 in the same
@@ -2657,26 +2671,31 @@ class IRBuilderBase {
/// -VL <= Imm < VL (where VL is the runtime vector length of the
/// source/result vector)
LLVM_ABI Value *CreateVectorSplice(Value *V1, Value *V2, int64_t Imm,
- const Twine &Name = "");
+ const Twine &Name = "");
/// Return a vector value that contains \arg V broadcasted to \p
/// NumElts elements.
- LLVM_ABI Value *CreateVectorSplat(unsigned NumElts, Value *V, const Twine &Name = "");
+ LLVM_ABI Value *CreateVectorSplat(unsigned NumElts, Value *V,
+ const Twine &Name = "");
/// Return a vector value that contains \arg V broadcasted to \p
/// EC elements.
- LLVM_ABI Value *CreateVectorSplat(ElementCount EC, Value *V, const Twine &Name = "");
+ LLVM_ABI Value *CreateVectorSplat(ElementCount EC, Value *V,
+ const Twine &Name = "");
LLVM_ABI Value *CreatePreserveArrayAccessIndex(Type *ElTy, Value *Base,
- unsigned Dimension, unsigned LastIndex,
- MDNode *DbgInfo);
+ unsigned Dimension,
+ unsigned LastIndex,
+ MDNode *DbgInfo);
- LLVM_ABI Value *CreatePreserveUnionAccessIndex(Value *Base, unsigned FieldIndex,
- MDNode *DbgInfo);
+ LLVM_ABI Value *CreatePreserveUnionAccessIndex(Value *Base,
+ unsigned FieldIndex,
+ MDNode *DbgInfo);
LLVM_ABI Value *CreatePreserveStructAccessIndex(Type *ElTy, Value *Base,
- unsigned Index, unsigned FieldIndex,
- MDNode *DbgInfo);
+ unsigned Index,
+ unsigned FieldIndex,
+ MDNode *DbgInfo);
LLVM_ABI Value *createIsFPClass(Value *FPNum, unsigned Test);
@@ -2695,9 +2714,10 @@ class IRBuilderBase {
/// An optional offset can be provided, and if it is provided, the offset
/// must be subtracted from the provided pointer to get the pointer with the
/// specified alignment.
- LLVM_ABI CallInst *CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue,
- unsigned Alignment,
- Value *OffsetValue = nullptr);
+ LLVM_ABI CallInst *CreateAlignmentAssumption(const DataLayout &DL,
+ Value *PtrValue,
+ unsigned Alignment,
+ Value *OffsetValue = nullptr);
/// Create an assume intrinsic call that represents an alignment
/// assumption on the provided pointer.
@@ -2708,13 +2728,15 @@ class IRBuilderBase {
///
/// This overload handles the condition where the Alignment is dependent
/// on an existing value rather than a static value.
- LLVM_ABI CallInst *CreateAlignmentAssumption(const DataLayout &DL, Value *PtrValue,
- Value *Alignment,
- Value *OffsetValue = nullptr);
+ LLVM_ABI CallInst *CreateAlignmentAssumption(const DataLayout &DL,
+ Value *PtrValue,
+ Value *Alignment,
+ Value *OffsetValue = nullptr);
/// Create an assume intrinsic call that represents an dereferencable
/// assumption on the provided pointer.
- LLVM_ABI CallInst *CreateDereferenceableAssumption(Value *PtrValue, Value *SizeValue);
+ LLVM_ABI CallInst *CreateDereferenceableAssumption(Value *PtrValue,
+ Value *SizeValue);
};
/// This provides a uniform API for creating instructions and inserting
diff --git a/llvm/include/llvm/IR/IRBuilderFolder.h b/llvm/include/llvm/IR/IRBuilderFolder.h
index b81ea3d087c6e..db4ab5af2433a 100644
--- a/llvm/include/llvm/IR/IRBuilderFolder.h
+++ b/llvm/include/llvm/IR/IRBuilderFolder.h
@@ -14,11 +14,11 @@
#ifndef LLVM_IR_IRBUILDERFOLDER_H
#define LLVM_IR_IRBUILDERFOLDER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/GEPNoWrapFlags.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/IRPrintingPasses.h b/llvm/include/llvm/IR/IRPrintingPasses.h
index 23c81063035a1..1b2d38d6190e9 100644
--- a/llvm/include/llvm/IR/IRPrintingPasses.h
+++ b/llvm/include/llvm/IR/IRPrintingPasses.h
@@ -27,14 +27,14 @@ class Pass;
/// Create and return a pass that writes the module to the specified
/// \c raw_ostream.
-LLVM_ABI ModulePass *createPrintModulePass(raw_ostream &OS,
- const std::string &Banner = "",
- bool ShouldPreserveUseListOrder = false);
+LLVM_ABI ModulePass *
+createPrintModulePass(raw_ostream &OS, const std::string &Banner = "",
+ bool ShouldPreserveUseListOrder = false);
/// Create and return a pass that prints functions to the specified
/// \c raw_ostream as they are processed.
LLVM_ABI FunctionPass *createPrintFunctionPass(raw_ostream &OS,
- const std::string &Banner = "");
+ const std::string &Banner = "");
/// Print out a name of an LLVM value without any prefixes.
///
diff --git a/llvm/include/llvm/IR/InlineAsm.h b/llvm/include/llvm/IR/InlineAsm.h
index c05b7578f6748..96887d129a69f 100644
--- a/llvm/include/llvm/IR/InlineAsm.h
+++ b/llvm/include/llvm/IR/InlineAsm.h
@@ -15,11 +15,11 @@
#ifndef LLVM_IR_INLINEASM_H
#define LLVM_IR_INLINEASM_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <string>
@@ -65,9 +65,10 @@ class InlineAsm final : public Value {
/// InlineAsm::get - Return the specified uniqued inline asm string.
///
LLVM_ABI static InlineAsm *get(FunctionType *Ty, StringRef AsmString,
- StringRef Constraints, bool hasSideEffects,
- bool isAlignStack = false,
- AsmDialect asmDialect = AD_ATT, bool canThrow = false);
+ StringRef Constraints, bool hasSideEffects,
+ bool isAlignStack = false,
+ AsmDialect asmDialect = AD_ATT,
+ bool canThrow = false);
bool hasSideEffects() const { return HasSideEffects; }
bool isAlignStack() const { return IsAlignStack; }
@@ -185,7 +186,8 @@ class InlineAsm final : public Value {
/// ParseConstraints - Split up the constraint string into the specific
/// constraints and their prefixes. If this returns an empty vector, and if
/// the constraint string itself isn't empty, there was an error parsing.
- LLVM_ABI static ConstraintInfoVector ParseConstraints(StringRef ConstraintString);
+ LLVM_ABI static ConstraintInfoVector
+ ParseConstraints(StringRef ConstraintString);
/// ParseConstraints - Parse the constraints of this inlineasm object,
/// returning them the same way that ParseConstraints(str) does.
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index 17f5cc7b18fbc..11aaa938f451f 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -15,7 +15,6 @@
#ifndef LLVM_IR_INSTRTYPES_H
#define LLVM_IR_INSTRTYPES_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
@@ -31,6 +30,7 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/OperandTraits.h"
#include "llvm/IR/User.h"
+#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
@@ -103,7 +103,7 @@ class UnaryOperator : public UnaryInstruction {
protected:
LLVM_ABI UnaryOperator(UnaryOps iType, Value *S, Type *Ty, const Twine &Name,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
@@ -117,8 +117,8 @@ class UnaryOperator : public UnaryInstruction {
/// Instruction is allowed to be a dereferenced end iterator.
///
LLVM_ABI static UnaryOperator *Create(UnaryOps Op, Value *S,
- const Twine &Name = Twine(),
- InsertPosition InsertBefore = nullptr);
+ const Twine &Name = Twine(),
+ InsertPosition InsertBefore = nullptr);
/// These methods just forward to Create, and are useful when you
/// statically know what type of instruction you're going to create. These
@@ -175,7 +175,7 @@ class BinaryOperator : public Instruction {
protected:
LLVM_ABI BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
- const Twine &Name, InsertPosition InsertBefore);
+ const Twine &Name, InsertPosition InsertBefore);
// Note: Instruction needs to be a friend here to call cloneImpl.
friend class Instruction;
@@ -196,8 +196,8 @@ class BinaryOperator : public Instruction {
/// Instruction is allowed to be a dereferenced end iterator.
///
LLVM_ABI static BinaryOperator *Create(BinaryOps Op, Value *S1, Value *S2,
- const Twine &Name = Twine(),
- InsertPosition InsertBefore = nullptr);
+ const Twine &Name = Twine(),
+ InsertPosition InsertBefore = nullptr);
/// These methods just forward to Create, and are useful when you
/// statically know what type of instruction you're going to create. These
@@ -361,12 +361,15 @@ class BinaryOperator : public Instruction {
///
/// Create the NEG and NOT instructions out of SUB and XOR instructions.
///
- LLVM_ABI static BinaryOperator *CreateNeg(Value *Op, const Twine &Name = "",
- InsertPosition InsertBefore = nullptr);
- LLVM_ABI static BinaryOperator *CreateNSWNeg(Value *Op, const Twine &Name = "",
- InsertPosition InsertBefore = nullptr);
- LLVM_ABI static BinaryOperator *CreateNot(Value *Op, const Twine &Name = "",
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static BinaryOperator *
+ CreateNeg(Value *Op, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static BinaryOperator *
+ CreateNSWNeg(Value *Op, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static BinaryOperator *
+ CreateNot(Value *Op, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr);
BinaryOps getOpcode() const {
return static_cast<BinaryOps>(Instruction::getOpcode());
@@ -537,9 +540,9 @@ class CastInst : public UnaryInstruction {
);
/// Check whether a bitcast between these types is valid
- LLVM_ABI static bool isBitCastable(
- Type *SrcTy, ///< The Type from which the value should be cast.
- Type *DestTy ///< The Type to which the value should be cast.
+ LLVM_ABI static bool
+ isBitCastable(Type *SrcTy, ///< The Type from which the value should be cast.
+ Type *DestTy ///< The Type to which the value should be cast.
);
/// Check whether a bitcast, inttoptr, or ptrtoint cast between these
@@ -555,11 +558,11 @@ class CastInst : public UnaryInstruction {
/// Returns the opcode necessary to cast Val into Ty using usual casting
/// rules.
/// Infer the opcode for cast operand and type
- LLVM_ABI static Instruction::CastOps getCastOpcode(
- const Value *Val, ///< The value to cast
- bool SrcIsSigned, ///< Whether to treat the source as signed
- Type *Ty, ///< The Type to which the value should be casted
- bool DstIsSigned ///< Whether to treate the dest. as signed
+ LLVM_ABI static Instruction::CastOps
+ getCastOpcode(const Value *Val, ///< The value to cast
+ bool SrcIsSigned, ///< Whether to treat the source as signed
+ Type *Ty, ///< The Type to which the value should be casted
+ bool DstIsSigned ///< Whether to treate the dest. as signed
);
/// There are several places where we need to know if a cast instruction
@@ -576,11 +579,11 @@ class CastInst : public UnaryInstruction {
/// is the same size as the pointer. However, pointer size varies with
/// platform. Note that a precondition of this method is that the cast is
/// legal - i.e. the instruction formed with these operands would verify.
- LLVM_ABI static bool isNoopCast(
- Instruction::CastOps Opcode, ///< Opcode of cast
- Type *SrcTy, ///< SrcTy of cast
- Type *DstTy, ///< DstTy of cast
- const DataLayout &DL ///< DataLayout to get the Int Ptr type from.
+ LLVM_ABI static bool
+ isNoopCast(Instruction::CastOps Opcode, ///< Opcode of cast
+ Type *SrcTy, ///< SrcTy of cast
+ Type *DstTy, ///< DstTy of cast
+ const DataLayout &DL ///< DataLayout to get the Int Ptr type from.
);
/// Determine if this cast is a no-op cast.
@@ -595,14 +598,14 @@ class CastInst : public UnaryInstruction {
/// the pair, casting SrcTy to DstTy.
/// Determine if a cast pair is eliminable
LLVM_ABI static unsigned isEliminableCastPair(
- Instruction::CastOps firstOpcode, ///< Opcode of first cast
- Instruction::CastOps secondOpcode, ///< Opcode of second cast
- Type *SrcTy, ///< SrcTy of 1st cast
- Type *MidTy, ///< DstTy of 1st cast & SrcTy of 2nd cast
- Type *DstTy, ///< DstTy of 2nd cast
- Type *SrcIntPtrTy, ///< Integer type corresponding to Ptr SrcTy, or null
- Type *MidIntPtrTy, ///< Integer type corresponding to Ptr MidTy, or null
- Type *DstIntPtrTy ///< Integer type corresponding to Ptr DstTy, or null
+ Instruction::CastOps firstOpcode, ///< Opcode of first cast
+ Instruction::CastOps secondOpcode, ///< Opcode of second cast
+ Type *SrcTy, ///< SrcTy of 1st cast
+ Type *MidTy, ///< DstTy of 1st cast & SrcTy of 2nd cast
+ Type *DstTy, ///< DstTy of 2nd cast
+ Type *SrcIntPtrTy, ///< Integer type corresponding to Ptr SrcTy, or null
+ Type *MidIntPtrTy, ///< Integer type corresponding to Ptr MidTy, or null
+ Type *DstIntPtrTy ///< Integer type corresponding to Ptr DstTy, or null
);
/// Return the opcode of this CastInst
@@ -619,7 +622,8 @@ class CastInst : public UnaryInstruction {
/// Opcode op is valid or not.
/// @returns true iff the proposed cast is valid.
/// Determine if a cast is valid without creating one.
- LLVM_ABI static bool castIsValid(Instruction::CastOps op, Type *SrcTy, Type *DstTy);
+ LLVM_ABI static bool castIsValid(Instruction::CastOps op, Type *SrcTy,
+ Type *DstTy);
static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy) {
return castIsValid(op, S->getType(), DstTy);
}
@@ -724,10 +728,10 @@ class CmpInst : public Instruction {
}
protected:
- LLVM_ABI CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred, Value *LHS,
- Value *RHS, const Twine &Name = "",
- InsertPosition InsertBefore = nullptr,
- Instruction *FlagsSource = nullptr);
+ LLVM_ABI CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
+ Value *LHS, Value *RHS, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr,
+ Instruction *FlagsSource = nullptr);
public:
// allocate space for exactly two operands
@@ -739,9 +743,9 @@ class CmpInst : public Instruction {
/// instruction into a BasicBlock right before the specified instruction.
/// The specified Instruction is allowed to be a dereferenced end iterator.
/// Create a CmpInst
- LLVM_ABI static CmpInst *Create(OtherOps Op, Predicate Pred, Value *S1, Value *S2,
- const Twine &Name = "",
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static CmpInst *Create(OtherOps Op, Predicate Pred, Value *S1,
+ Value *S2, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr);
/// Construct a compare instruction, given the opcode, the predicate,
/// the two operands and the instruction to copy the flags from. Optionally
@@ -749,11 +753,10 @@ class CmpInst : public Instruction {
/// right before the specified instruction. The specified Instruction is
/// allowed to be a dereferenced end iterator.
/// Create a CmpInst
- LLVM_ABI static CmpInst *CreateWithCopiedFlags(OtherOps Op, Predicate Pred, Value *S1,
- Value *S2,
- const Instruction *FlagsSource,
- const Twine &Name = "",
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static CmpInst *
+ CreateWithCopiedFlags(OtherOps Op, Predicate Pred, Value *S1, Value *S2,
+ const Instruction *FlagsSource, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr);
/// Get the opcode casted to the right type
OtherOps getOpcode() const {
@@ -1160,8 +1163,9 @@ class CallBase : public Instruction {
/// The returned call instruction is identical \p CB in every way except that
/// the operand bundles for the new instruction are set to the operand bundles
/// in \p Bundles.
- LLVM_ABI static CallBase *Create(CallBase *CB, ArrayRef<OperandBundleDef> Bundles,
- InsertPosition InsertPt = nullptr);
+ LLVM_ABI static CallBase *Create(CallBase *CB,
+ ArrayRef<OperandBundleDef> Bundles,
+ InsertPosition InsertPt = nullptr);
/// Create a clone of \p CB with the operand bundle with the tag matching
/// \p Bundle's tag replaced with Bundle, and insert it before \p InsertPt.
@@ -1169,16 +1173,17 @@ class CallBase : public Instruction {
/// The returned call instruction is identical \p CI in every way except that
/// the specified operand bundle has been replaced.
LLVM_ABI static CallBase *Create(CallBase *CB, OperandBundleDef Bundle,
- InsertPosition InsertPt = nullptr);
+ InsertPosition InsertPt = nullptr);
/// Create a clone of \p CB with operand bundle \p OB added.
LLVM_ABI static CallBase *addOperandBundle(CallBase *CB, uint32_t ID,
- OperandBundleDef OB,
- InsertPosition InsertPt = nullptr);
+ OperandBundleDef OB,
+ InsertPosition InsertPt = nullptr);
/// Create a clone of \p CB with operand bundle \p ID removed.
- LLVM_ABI static CallBase *removeOperandBundle(CallBase *CB, uint32_t ID,
- InsertPosition InsertPt = nullptr);
+ LLVM_ABI static CallBase *
+ removeOperandBundle(CallBase *CB, uint32_t ID,
+ InsertPosition InsertPt = nullptr);
/// Return the convergence control token for this call, if it exists.
Value *getConvergenceControlToken() const {
@@ -1609,7 +1614,8 @@ class CallBase : public Instruction {
/// addrspace(0). If \p AllowUndefOrPoison is true, respect the semantics of
/// nonnull attribute and return true even if the argument can be undef or
/// poison.
- LLVM_ABI bool paramHasNonNullAttr(unsigned ArgNo, bool AllowUndefOrPoison) const;
+ LLVM_ABI bool paramHasNonNullAttr(unsigned ArgNo,
+ bool AllowUndefOrPoison) const;
/// Get the attribute of a given kind at a position.
Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const {
@@ -2108,7 +2114,8 @@ class CallBase : public Instruction {
/// OperandBundleUser to a vector of OperandBundleDefs. Note:
/// OperandBundeUses and OperandBundleDefs are non-trivially *different*
/// representations of operand bundles (see documentation above).
- LLVM_ABI void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const;
+ LLVM_ABI void
+ getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const;
/// Return the operand bundle for the operand at index OpIdx.
///
@@ -2282,8 +2289,8 @@ class CallBase : public Instruction {
///
/// Each \p OperandBundleDef instance is tracked by a OperandBundleInfo
/// instance allocated in this User's descriptor.
- LLVM_ABI op_iterator populateBundleOperandInfos(ArrayRef<OperandBundleDef> Bundles,
- const unsigned BeginIndex);
+ LLVM_ABI op_iterator populateBundleOperandInfos(
+ ArrayRef<OperandBundleDef> Bundles, const unsigned BeginIndex);
/// Return true if the call has deopt state bundle.
bool hasDeoptState() const {
@@ -2351,9 +2358,10 @@ class FuncletPadInst : public Instruction {
private:
FuncletPadInst(const FuncletPadInst &CPI, AllocInfo AllocInfo);
- LLVM_ABI explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
- ArrayRef<Value *> Args, AllocInfo AllocInfo,
- const Twine &NameStr, InsertPosition InsertBefore);
+ LLVM_ABI explicit FuncletPadInst(Instruction::FuncletPadOps Op,
+ Value *ParentPad, ArrayRef<Value *> Args,
+ AllocInfo AllocInfo, const Twine &NameStr,
+ InsertPosition InsertBefore);
void init(Value *ParentPad, ArrayRef<Value *> Args, const Twine &NameStr);
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index 9c71e64cc2a3d..10fc9c1298607 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_INSTRUCTION_H
#define LLVM_IR_INSTRUCTION_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/StringRef.h"
@@ -24,6 +23,7 @@
#include "llvm/IR/User.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <utility>
@@ -54,8 +54,8 @@ class InsertPosition {
public:
InsertPosition(std::nullptr_t) : InsertAt() {}
LLVM_ABI LLVM_DEPRECATED("Use BasicBlock::iterators for insertion instead",
- "BasicBlock::iterator")
- InsertPosition(Instruction *InsertBefore);
+ "BasicBlock::iterator")
+ InsertPosition(Instruction *InsertBefore);
LLVM_ABI InsertPosition(BasicBlock *InsertAtEnd);
InsertPosition(InstListType::iterator InsertAt) : InsertAt(InsertAt) {}
operator InstListType::iterator() const { return InsertAt; }
@@ -109,7 +109,8 @@ class Instruction : public User,
/// Return an iterator to the position of the "Next" DbgRecord after this
/// instruction, or std::nullopt. This is the position to pass to
/// BasicBlock::reinsertInstInDbgRecords when re-inserting an instruction.
- LLVM_ABI std::optional<simple_ilist<DbgRecord>::iterator> getDbgReinsertionPosition();
+ LLVM_ABI std::optional<simple_ilist<DbgRecord>::iterator>
+ getDbgReinsertionPosition();
/// Returns true if any DbgRecords are attached to this instruction.
LLVM_ABI bool hasDbgRecords() const;
@@ -118,7 +119,7 @@ class Instruction : public User,
/// by simply adopting the sequence of DbgRecords (which is efficient) if
/// possible, by merging two sequences otherwise.
LLVM_ABI void adoptDbgRecords(BasicBlock *BB, InstListType::iterator It,
- bool InsertAtHead);
+ bool InsertAtHead);
/// Erase any DbgRecords attached to this instruction.
LLVM_ABI void dropDbgRecords();
@@ -212,8 +213,8 @@ class Instruction : public User,
/// start of a block such as BasicBlock::getFirstNonPHIIt must be passed into
/// insertBefore without unwrapping/rewrapping. For all other positions, call
/// getIterator to fetch the instruction iterator.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "")
- void insertBefore(Instruction *InsertPos);
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
+ "") void insertBefore(Instruction *InsertPos);
/// Insert an unlinked instruction into a basic block immediately before
/// the specified position.
@@ -230,7 +231,7 @@ class Instruction : public User,
/// Inserts an unlinked instruction into \p ParentBB at position \p It and
/// returns the iterator of the inserted instruction.
LLVM_ABI InstListType::iterator insertInto(BasicBlock *ParentBB,
- InstListType::iterator It);
+ InstListType::iterator It);
LLVM_ABI void insertBefore(BasicBlock &BB, InstListType::iterator InsertPos);
@@ -241,8 +242,8 @@ class Instruction : public User,
/// start of a block such as BasicBlock::getFirstNonPHIIt must be passed into
/// moveBefore without unwrapping/rewrapping. For all other positions, call
/// getIterator to fetch the instruction iterator.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "")
- void moveBefore(Instruction *MovePos);
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
+ "") void moveBefore(Instruction *MovePos);
/// Unlink this instruction from its current basic block and insert it into
/// the basic block that MovePos lives in, right before MovePos.
@@ -264,8 +265,8 @@ class Instruction : public User,
///
/// Deprecated in favour of the iterator-accepting flavour of
/// moveBeforePreserving, as all insertions should be at iterator positions.
- LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions", "")
- void moveBeforePreserving(Instruction *MovePos);
+ LLVM_ABI LLVM_DEPRECATED("Use iterators as instruction positions",
+ "") void moveBeforePreserving(Instruction *MovePos);
private:
/// RemoveDIs project: all other moves implemented with this method,
@@ -463,7 +464,7 @@ class Instruction : public User,
/// specifies the list of meta data that needs to be copied. If \p WL is
/// empty, all meta data will be copied.
LLVM_ABI void copyMetadata(const Instruction &SrcInst,
- ArrayRef<unsigned> WL = ArrayRef<unsigned>());
+ ArrayRef<unsigned> WL = ArrayRef<unsigned>());
/// Erase all metadata that matches the predicate.
LLVM_ABI void eraseMetadataIf(function_ref<bool(unsigned, MDNode *)> Pred);
@@ -579,7 +580,8 @@ class Instruction : public User,
/// dropUnknownNonDebugMetadata). For calls, it also drops parameter and
/// return attributes that can cause undefined behaviour. Both of these should
/// be done by passes which move instructions in IR.
- LLVM_ABI void dropUBImplyingAttrsAndUnknownMetadata(ArrayRef<unsigned> KnownIDs = {});
+ LLVM_ABI void
+ dropUBImplyingAttrsAndUnknownMetadata(ArrayRef<unsigned> KnownIDs = {});
/// Drop any attributes or metadata that can cause immediate undefined
/// behavior. Retain other attributes/metadata on a best-effort basis.
@@ -721,7 +723,8 @@ class Instruction : public User,
/// SourceInstructions does then the merged one will be attached to
/// it. However, instructions without attachments in \p SourceInstructions
/// are not modified.
- LLVM_ABI void mergeDIAssignID(ArrayRef<const Instruction *> SourceInstructions);
+ LLVM_ABI void
+ mergeDIAssignID(ArrayRef<const Instruction *> SourceInstructions);
private:
// These are all implemented in Metadata.cpp.
@@ -826,7 +829,8 @@ class Instruction : public User,
/// If IncludePhaseOneUnwind is set, this will also include cases where
/// phase one unwinding may unwind past this frame due to skipping of
/// cleanup landingpads.
- LLVM_ABI bool mayThrow(bool IncludePhaseOneUnwind = false) const LLVM_READONLY;
+ LLVM_ABI bool
+ mayThrow(bool IncludePhaseOneUnwind = false) const LLVM_READONLY;
/// Return true if this instruction behaves like a memory fence: it can load
/// or store to memory location without being given a memory location.
@@ -955,7 +959,8 @@ class Instruction : public User,
/// @returns true if the specified instruction is the same operation as
/// the current one.
/// Determine if one instruction is the same operation as another.
- LLVM_ABI bool isSameOperationAs(const Instruction *I, unsigned flags = 0) const LLVM_READONLY;
+ LLVM_ABI bool isSameOperationAs(const Instruction *I,
+ unsigned flags = 0) const LLVM_READONLY;
/// This function determines if the speficied instruction has the same
/// "special" characteristics as the current one. This means that opcode
@@ -965,8 +970,9 @@ class Instruction : public User,
/// @returns true if the specific instruction has the same opcde specific
/// characteristics as the current one. Determine if one instruction has the
/// same state as another.
- LLVM_ABI bool hasSameSpecialState(const Instruction *I2, bool IgnoreAlignment = false,
- bool IntersectAttrs = false) const LLVM_READONLY;
+ LLVM_ABI bool
+ hasSameSpecialState(const Instruction *I2, bool IgnoreAlignment = false,
+ bool IntersectAttrs = false) const LLVM_READONLY;
/// Return true if there are any uses of this instruction in blocks other than
/// the specified block. Note that PHI nodes are considered to evaluate their
@@ -1085,7 +1091,7 @@ class Instruction : public User,
}
LLVM_ABI Instruction(Type *Ty, unsigned iType, AllocInfo AllocInfo,
- InsertPosition InsertBefore = nullptr);
+ InsertPosition InsertBefore = nullptr);
private:
/// Create a copy of this instruction.
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 82607262214df..6f69b68f628fc 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -15,7 +15,6 @@
#ifndef LLVM_IR_INSTRUCTIONS_H
#define LLVM_IR_INSTRUCTIONS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Bitfields.h"
#include "llvm/ADT/MapVector.h"
@@ -36,6 +35,7 @@
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstddef>
@@ -79,13 +79,14 @@ class AllocaInst : public UnaryInstruction {
public:
LLVM_ABI explicit AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
- const Twine &Name, InsertPosition InsertBefore);
+ const Twine &Name, InsertPosition InsertBefore);
LLVM_ABI AllocaInst(Type *Ty, unsigned AddrSpace, const Twine &Name,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
- LLVM_ABI AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize, Align Align,
- const Twine &Name = "", InsertPosition InsertBefore = nullptr);
+ LLVM_ABI AllocaInst(Type *Ty, unsigned AddrSpace, Value *ArraySize,
+ Align Align, const Twine &Name = "",
+ InsertPosition InsertBefore = nullptr);
/// Return true if there is an allocation size parameter to the allocation
/// instruction that is not 1.
@@ -108,11 +109,13 @@ class AllocaInst : public UnaryInstruction {
/// Get allocation size in bytes. Returns std::nullopt if size can't be
/// determined, e.g. in case of a VLA.
- LLVM_ABI std::optional<TypeSize> getAllocationSize(const DataLayout &DL) const;
+ LLVM_ABI std::optional<TypeSize>
+ getAllocationSize(const DataLayout &DL) const;
/// Get allocation size in bits. Returns std::nullopt if size can't be
/// determined, e.g. in case of a VLA.
- LLVM_ABI std::optional<TypeSize> getAllocationSizeInBits(const DataLayout &DL) const;
+ LLVM_ABI std::optional<TypeSize>
+ getAllocationSizeInBits(const DataLayout &DL) const;
/// Return the type that is being allocated by the instruction.
Type *getAllocatedType() const { return AllocatedType; }
@@ -192,15 +195,15 @@ class LoadInst : public UnaryInstruction {
public:
LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, InsertPosition InsertBefore = nullptr);
+ Align Align, InsertPosition InsertBefore = nullptr);
LLVM_ABI LoadInst(Type *Ty, Value *Ptr, const Twine &NameStr, bool isVolatile,
- Align Align, AtomicOrdering Order,
- SyncScope::ID SSID = SyncScope::System,
- InsertPosition InsertBefore = nullptr);
+ Align Align, AtomicOrdering Order,
+ SyncScope::ID SSID = SyncScope::System,
+ InsertPosition InsertBefore = nullptr);
/// Return true if this is a load from a volatile memory location.
bool isVolatile() const { return getSubclassData<VolatileField>(); }
@@ -311,12 +314,13 @@ class StoreInst : public Instruction {
public:
LLVM_ABI StoreInst(Value *Val, Value *Ptr, InsertPosition InsertBefore);
LLVM_ABI StoreInst(Value *Val, Value *Ptr, bool isVolatile,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
LLVM_ABI StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- InsertPosition InsertBefore = nullptr);
+ InsertPosition InsertBefore = nullptr);
LLVM_ABI StoreInst(Value *Val, Value *Ptr, bool isVolatile, Align Align,
- AtomicOrdering Order, SyncScope::ID SSID = SyncScope::System,
- InsertPosition InsertBefore = nullptr);
+ AtomicOrdering Order,
+ SyncScope::ID SSID = SyncScope::System,
+ InsertPosition InsertBefore = nullptr);
// allocate space for exactly two operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -439,8 +443,8 @@ class FenceInst : public Instruction {
// Ordering may only be Acquire, Release, AcquireRelease, or
// SequentiallyConsistent.
LLVM_ABI FenceInst(LLVMContext &C, AtomicOrdering Ordering,
- SyncScope::ID SSID = SyncScope::System,
- InsertPosition InsertBefore = nullptr);
+ SyncScope::ID SSID = SyncScope::System,
+ InsertPosition InsertBefore = nullptr);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -518,10 +522,10 @@ class AtomicCmpXchgInst : public Instruction {
LLVM_ABI AtomicCmpXchgInst *cloneImpl() const;
public:
- LLVM_ABI AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal, Align Alignment,
- AtomicOrdering SuccessOrdering,
- AtomicOrdering FailureOrdering, SyncScope::ID SSID,
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI AtomicCmpXchgInst(Value *Ptr, Value *Cmp, Value *NewVal,
+ Align Alignment, AtomicOrdering SuccessOrdering,
+ AtomicOrdering FailureOrdering, SyncScope::ID SSID,
+ InsertPosition InsertBefore = nullptr);
// allocate space for exactly three operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -794,9 +798,10 @@ class AtomicRMWInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};
public:
- LLVM_ABI AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val, Align Alignment,
- AtomicOrdering Ordering, SyncScope::ID SSID,
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI AtomicRMWInst(BinOp Operation, Value *Ptr, Value *Val,
+ Align Alignment, AtomicOrdering Ordering,
+ SyncScope::ID SSID,
+ InsertPosition InsertBefore = nullptr);
// allocate space for exactly two operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -955,7 +960,8 @@ class GetElementPtrInst : public Instruction {
ArrayRef<Value *> IdxList, AllocInfo AllocInfo,
const Twine &NameStr, InsertPosition InsertBefore);
- LLVM_ABI void init(Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr);
+ LLVM_ABI void init(Value *Ptr, ArrayRef<Value *> IdxList,
+ const Twine &NameStr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -1128,10 +1134,12 @@ class GetElementPtrInst : public Instruction {
/// undefined (it is *not* preserved!). The APInt passed into this routine
/// must be at least as wide as the IntPtr type for the address space of
/// the base GEP pointer.
- LLVM_ABI bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const;
- LLVM_ABI bool collectOffset(const DataLayout &DL, unsigned BitWidth,
- SmallMapVector<Value *, APInt, 4> &VariableOffsets,
- APInt &ConstantOffset) const;
+ LLVM_ABI bool accumulateConstantOffset(const DataLayout &DL,
+ APInt &Offset) const;
+ LLVM_ABI bool
+ collectOffset(const DataLayout &DL, unsigned BitWidth,
+ SmallMapVector<Value *, APInt, 4> &VariableOffsets,
+ APInt &ConstantOffset) const;
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
return (I->getOpcode() == Instruction::GetElementPtr);
@@ -1291,8 +1299,8 @@ class ICmpInst: public CmpInst {
/// Determine if Pred1 implies Pred2 is true, false, or if nothing can be
/// inferred about the implication, when two compares have matching operands.
- LLVM_ABI static std::optional<bool> isImpliedByMatchingCmp(CmpPredicate Pred1,
- CmpPredicate Pred2);
+ LLVM_ABI static std::optional<bool>
+ isImpliedByMatchingCmp(CmpPredicate Pred1, CmpPredicate Pred2);
void setSameSign(bool B = true) {
SubclassOptionalData = (SubclassOptionalData & ~SameSign) | (B * SameSign);
@@ -1375,12 +1383,12 @@ class ICmpInst: public CmpInst {
/// Return result of `LHS Pred RHS` comparison.
LLVM_ABI static bool compare(const APInt &LHS, const APInt &RHS,
- ICmpInst::Predicate Pred);
+ ICmpInst::Predicate Pred);
/// Return result of `LHS Pred RHS`, if it can be determined from the
/// KnownBits. Otherwise return nullopt.
- LLVM_ABI static std::optional<bool> compare(const KnownBits &LHS, const KnownBits &RHS,
- ICmpInst::Predicate Pred);
+ LLVM_ABI static std::optional<bool>
+ compare(const KnownBits &LHS, const KnownBits &RHS, ICmpInst::Predicate Pred);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
@@ -1482,7 +1490,7 @@ class FCmpInst: public CmpInst {
/// Return result of `LHS Pred RHS` comparison.
LLVM_ABI static bool compare(const APFloat &LHS, const APFloat &RHS,
- FCmpInst::Predicate Pred);
+ FCmpInst::Predicate Pred);
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
@@ -1513,10 +1521,10 @@ class CallInst : public CallBase {
: CallInst(Ty, Func, Args, {}, NameStr, AllocInfo, InsertBefore) {}
LLVM_ABI explicit CallInst(FunctionType *Ty, Value *F, const Twine &NameStr,
- AllocInfo AllocInfo, InsertPosition InsertBefore);
+ AllocInfo AllocInfo, InsertPosition InsertBefore);
LLVM_ABI void init(FunctionType *FTy, Value *Func, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
+ ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
void init(FunctionType *FTy, Value *Func, const Twine &NameStr);
/// Compute the number of operands to allocate.
@@ -1588,8 +1596,9 @@ class CallInst : public CallBase {
/// The returned call instruction is identical \p CI in every way except that
/// the operand bundles for the new instruction are set to the operand bundles
/// in \p Bundles.
- LLVM_ABI static CallInst *Create(CallInst *CI, ArrayRef<OperandBundleDef> Bundles,
- InsertPosition InsertPt = nullptr);
+ LLVM_ABI static CallInst *Create(CallInst *CI,
+ ArrayRef<OperandBundleDef> Bundles,
+ InsertPosition InsertPt = nullptr);
// Note that 'musttail' implies 'tail'.
enum TailCallKind : unsigned {
@@ -1730,7 +1739,8 @@ class SelectInst : public Instruction {
/// Return a string if the specified operands are invalid
/// for a select operation, otherwise return null.
- LLVM_ABI static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
+ LLVM_ABI static const char *areInvalidOperands(Value *Cond, Value *True,
+ Value *False);
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -1799,7 +1809,7 @@ class ExtractElementInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};
LLVM_ABI ExtractElementInst(Value *Vec, Value *Idx, const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ InsertPosition InsertBefore = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -1858,8 +1868,8 @@ class InsertElementInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{3};
LLVM_ABI InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
- const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ const Twine &NameStr = "",
+ InsertPosition InsertBefore = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -1878,7 +1888,7 @@ class InsertElementInst : public Instruction {
/// Return true if an insertelement instruction can be
/// formed with the specified operands.
LLVM_ABI static bool isValidOperands(const Value *Vec, const Value *NewElt,
- const Value *Idx);
+ const Value *Idx);
/// Overload to return most specific vector type.
///
@@ -1935,15 +1945,16 @@ class ShuffleVectorInst : public Instruction {
public:
LLVM_ABI ShuffleVectorInst(Value *V1, Value *Mask, const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
- LLVM_ABI ShuffleVectorInst(Value *V1, ArrayRef<int> Mask, const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ InsertPosition InsertBefore = nullptr);
+ LLVM_ABI ShuffleVectorInst(Value *V1, ArrayRef<int> Mask,
+ const Twine &NameStr = "",
+ InsertPosition InsertBefore = nullptr);
LLVM_ABI ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
- const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ const Twine &NameStr = "",
+ InsertPosition InsertBefore = nullptr);
LLVM_ABI ShuffleVectorInst(Value *V1, Value *V2, ArrayRef<int> Mask,
- const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ const Twine &NameStr = "",
+ InsertPosition InsertBefore = nullptr);
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
void operator delete(void *Ptr) { return User::operator delete(Ptr); }
@@ -1955,9 +1966,9 @@ class ShuffleVectorInst : public Instruction {
/// Return true if a shufflevector instruction can be
/// formed with the specified operands.
LLVM_ABI static bool isValidOperands(const Value *V1, const Value *V2,
- const Value *Mask);
+ const Value *Mask);
LLVM_ABI static bool isValidOperands(const Value *V1, const Value *V2,
- ArrayRef<int> Mask);
+ ArrayRef<int> Mask);
/// Overload to return most specific vector type.
///
@@ -1975,7 +1986,7 @@ class ShuffleVectorInst : public Instruction {
/// Convert the input shuffle mask operand to a vector of integers. Undefined
/// elements of the mask are returned as PoisonMaskElem.
LLVM_ABI static void getShuffleMask(const Constant *Mask,
- SmallVectorImpl<int> &Result);
+ SmallVectorImpl<int> &Result);
/// Return the mask for this instruction as a vector of integers. Undefined
/// elements of the mask are returned as PoisonMaskElem.
@@ -1990,7 +2001,7 @@ class ShuffleVectorInst : public Instruction {
Constant *getShuffleMaskForBitcode() const { return ShuffleMaskForBitcode; }
LLVM_ABI static Constant *convertShuffleMaskForBitcode(ArrayRef<int> Mask,
- Type *ResultTy);
+ Type *ResultTy);
LLVM_ABI void setShuffleMask(ArrayRef<int> Mask);
@@ -2214,7 +2225,8 @@ class ShuffleVectorInst : public Instruction {
/// Example: shufflevector <4 x n> A, <4 x n> B, <1,2,3,4>
/// This assumes that vector operands (of length \p NumSrcElts) are the same
/// length as the mask.
- LLVM_ABI static bool isSpliceMask(ArrayRef<int> Mask, int NumSrcElts, int &Index);
+ LLVM_ABI static bool isSpliceMask(ArrayRef<int> Mask, int NumSrcElts,
+ int &Index);
static bool isSpliceMask(const Constant *Mask, int NumSrcElts, int &Index) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
SmallVector<int, 16> MaskAsInts;
@@ -2234,8 +2246,8 @@ class ShuffleVectorInst : public Instruction {
/// Return true if this shuffle mask is an extract subvector mask.
/// A valid extract subvector mask returns a smaller vector from a single
/// source operand. The base extraction index is returned as well.
- LLVM_ABI static bool isExtractSubvectorMask(ArrayRef<int> Mask, int NumSrcElts,
- int &Index);
+ LLVM_ABI static bool isExtractSubvectorMask(ArrayRef<int> Mask,
+ int NumSrcElts, int &Index);
static bool isExtractSubvectorMask(const Constant *Mask, int NumSrcElts,
int &Index) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
@@ -2265,7 +2277,7 @@ class ShuffleVectorInst : public Instruction {
/// source operand into an in-place first source operand.
/// Both the sub vector width and the insertion index is returned.
LLVM_ABI static bool isInsertSubvectorMask(ArrayRef<int> Mask, int NumSrcElts,
- int &NumSubElts, int &Index);
+ int &NumSubElts, int &Index);
static bool isInsertSubvectorMask(const Constant *Mask, int NumSrcElts,
int &NumSubElts, int &Index) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
@@ -2294,8 +2306,8 @@ class ShuffleVectorInst : public Instruction {
/// in a vector \p ReplicationFactor times.
/// For example, the mask for \p ReplicationFactor=3 and \p VF=4 is:
/// <0,0,0,1,1,1,2,2,2,3,3,3>
- LLVM_ABI static bool isReplicationMask(ArrayRef<int> Mask, int &ReplicationFactor,
- int &VF);
+ LLVM_ABI static bool isReplicationMask(ArrayRef<int> Mask,
+ int &ReplicationFactor, int &VF);
static bool isReplicationMask(const Constant *Mask, int &ReplicationFactor,
int &VF) {
assert(Mask->getType()->isVectorTy() && "Shuffle needs vector constant.");
@@ -2361,9 +2373,9 @@ class ShuffleVectorInst : public Instruction {
/// Note that this does not check if the input vectors are consecutive:
/// It will return true for masks such as
/// <0, 4, 6, 1, 5, 7> (Factor=3, LaneLen=2)
- LLVM_ABI static bool isInterleaveMask(ArrayRef<int> Mask, unsigned Factor,
- unsigned NumInputElts,
- SmallVectorImpl<unsigned> &StartIndexes);
+ LLVM_ABI static bool
+ isInterleaveMask(ArrayRef<int> Mask, unsigned Factor, unsigned NumInputElts,
+ SmallVectorImpl<unsigned> &StartIndexes);
static bool isInterleaveMask(ArrayRef<int> Mask, unsigned Factor,
unsigned NumInputElts) {
SmallVector<unsigned, 8> StartIndexes;
@@ -2373,8 +2385,9 @@ class ShuffleVectorInst : public Instruction {
/// Check if the mask is a DE-interleave mask of the given factor
/// \p Factor like:
/// <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>
- LLVM_ABI static bool isDeInterleaveMaskOfFactor(ArrayRef<int> Mask, unsigned Factor,
- unsigned &Index);
+ LLVM_ABI static bool isDeInterleaveMaskOfFactor(ArrayRef<int> Mask,
+ unsigned Factor,
+ unsigned &Index);
static bool isDeInterleaveMaskOfFactor(ArrayRef<int> Mask, unsigned Factor) {
unsigned Unused;
return isDeInterleaveMaskOfFactor(Mask, Factor, Unused);
@@ -2391,9 +2404,11 @@ class ShuffleVectorInst : public Instruction {
///
/// If it can be expressed as a rotation, returns the number of subelements to
/// group by in NumSubElts and the number of bits to rotate left in RotateAmt.
- LLVM_ABI static bool isBitRotateMask(ArrayRef<int> Mask, unsigned EltSizeInBits,
- unsigned MinSubElts, unsigned MaxSubElts,
- unsigned &NumSubElts, unsigned &RotateAmt);
+ LLVM_ABI static bool isBitRotateMask(ArrayRef<int> Mask,
+ unsigned EltSizeInBits,
+ unsigned MinSubElts, unsigned MaxSubElts,
+ unsigned &NumSubElts,
+ unsigned &RotateAmt);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const Instruction *I) {
@@ -2526,7 +2541,7 @@ class InsertValueInst : public Instruction {
InsertPosition InsertBefore = nullptr);
LLVM_ABI void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
- const Twine &NameStr);
+ const Twine &NameStr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -2772,7 +2787,8 @@ class PHINode : public Instruction {
/// dummy values. The only time there should be zero incoming values to a PHI
/// node is when the block is dead, so this strategy is sound.
///
- LLVM_ABI Value *removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty = true);
+ LLVM_ABI Value *removeIncomingValue(unsigned Idx,
+ bool DeletePHIIfEmpty = true);
Value *removeIncomingValue(const BasicBlock *BB, bool DeletePHIIfEmpty=true) {
int Idx = getBasicBlockIndex(BB);
@@ -2783,7 +2799,7 @@ class PHINode : public Instruction {
/// Remove all incoming values for which the predicate returns true.
/// The predicate accepts the incoming value index.
LLVM_ABI void removeIncomingValueIf(function_ref<bool(unsigned)> Predicate,
- bool DeletePHIIfEmpty = true);
+ bool DeletePHIIfEmpty = true);
/// Return the first index of the specified basic
/// block in the value list for this PHI. Returns -1 if no instance.
@@ -2895,9 +2911,10 @@ class LandingPadInst : public Instruction {
/// Constructors - NumReservedClauses is a hint for the number of incoming
/// clauses that this landingpad will have (use 0 if you really have no idea).
- LLVM_ABI static LandingPadInst *Create(Type *RetTy, unsigned NumReservedClauses,
- const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static LandingPadInst *Create(Type *RetTy,
+ unsigned NumReservedClauses,
+ const Twine &NameStr = "",
+ InsertPosition InsertBefore = nullptr);
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
@@ -2975,8 +2992,9 @@ class ReturnInst : public Instruction {
//
// NOTE: If the Value* passed is of type void then the constructor behaves as
// if it was passed NULL.
- LLVM_ABI explicit ReturnInst(LLVMContext &C, Value *retVal, AllocInfo AllocInfo,
- InsertPosition InsertBefore);
+ LLVM_ABI explicit ReturnInst(LLVMContext &C, Value *retVal,
+ AllocInfo AllocInfo,
+ InsertPosition InsertBefore);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -3052,9 +3070,9 @@ class BranchInst : public Instruction {
// BranchInst(BB* B, BB *I) - 'br B' insert at end
// BranchInst(BB* T, BB *F, Value *C, BB *I) - 'br C, T, F', insert at end
LLVM_ABI explicit BranchInst(BasicBlock *IfTrue, AllocInfo AllocInfo,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
LLVM_ABI BranchInst(BasicBlock *IfTrue, BasicBlock *IfFalse, Value *Cond,
- AllocInfo AllocInfo, InsertPosition InsertBefore);
+ AllocInfo AllocInfo, InsertPosition InsertBefore);
void AssertOK();
@@ -3190,7 +3208,7 @@ class SwitchInst : public Instruction {
/// to make memory allocation more efficient. This constructor can also
/// auto-insert before another instruction.
LLVM_ABI SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -3550,7 +3568,8 @@ class SwitchInstProfUpdateWrapper {
LLVM_ABI void setSuccessorWeight(unsigned idx, CaseWeightOpt W);
LLVM_ABI CaseWeightOpt getSuccessorWeight(unsigned idx);
- LLVM_ABI static CaseWeightOpt getSuccessorWeight(const SwitchInst &SI, unsigned idx);
+ LLVM_ABI static CaseWeightOpt getSuccessorWeight(const SwitchInst &SI,
+ unsigned idx);
};
template <> struct OperandTraits<SwitchInst> : public HungoffOperandTraits {};
@@ -3578,7 +3597,7 @@ class IndirectBrInst : public Instruction {
/// here to make memory allocation more efficient. This constructor can also
/// autoinsert before another instruction.
LLVM_ABI IndirectBrInst(Value *Address, unsigned NumDests,
- InsertPosition InsertBefore);
+ InsertPosition InsertBefore);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -3712,8 +3731,8 @@ class InvokeInst : public CallBase {
const Twine &NameStr, InsertPosition InsertBefore);
LLVM_ABI void init(FunctionType *Ty, Value *Func, BasicBlock *IfNormal,
- BasicBlock *IfException, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
+ BasicBlock *IfException, ArrayRef<Value *> Args,
+ ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
/// Compute the number of operands to allocate.
static unsigned ComputeNumOperands(unsigned NumArgs,
@@ -3777,8 +3796,9 @@ class InvokeInst : public CallBase {
/// The returned invoke instruction is identical to \p II in every way except
/// that the operand bundles for the new instruction are set to the operand
/// bundles in \p Bundles.
- LLVM_ABI static InvokeInst *Create(InvokeInst *II, ArrayRef<OperandBundleDef> Bundles,
- InsertPosition InsertPt = nullptr);
+ LLVM_ABI static InvokeInst *Create(InvokeInst *II,
+ ArrayRef<OperandBundleDef> Bundles,
+ InsertPosition InsertPt = nullptr);
// get*Dest - Return the destination basic blocks...
BasicBlock *getNormalDest() const {
@@ -3866,8 +3886,9 @@ class CallBrInst : public CallBase {
InsertPosition InsertBefore);
LLVM_ABI void init(FunctionType *FTy, Value *Func, BasicBlock *DefaultDest,
- ArrayRef<BasicBlock *> IndirectDests, ArrayRef<Value *> Args,
- ArrayRef<OperandBundleDef> Bundles, const Twine &NameStr);
+ ArrayRef<BasicBlock *> IndirectDests,
+ ArrayRef<Value *> Args, ArrayRef<OperandBundleDef> Bundles,
+ const Twine &NameStr);
/// Compute the number of operands to allocate.
static unsigned ComputeNumOperands(int NumArgs, int NumIndirectDests,
@@ -3935,8 +3956,9 @@ class CallBrInst : public CallBase {
/// The returned callbr instruction is identical to \p CBI in every way
/// except that the operand bundles for the new instruction are set to the
/// operand bundles in \p Bundles.
- LLVM_ABI static CallBrInst *Create(CallBrInst *CBI, ArrayRef<OperandBundleDef> Bundles,
- InsertPosition InsertBefore = nullptr);
+ LLVM_ABI static CallBrInst *Create(CallBrInst *CBI,
+ ArrayRef<OperandBundleDef> Bundles,
+ InsertPosition InsertBefore = nullptr);
/// Return the number of callbr indirect dest labels.
///
@@ -4027,7 +4049,8 @@ class ResumeInst : public Instruction {
ResumeInst(const ResumeInst &RI);
- LLVM_ABI explicit ResumeInst(Value *Exn, InsertPosition InsertBefore = nullptr);
+ LLVM_ABI explicit ResumeInst(Value *Exn,
+ InsertPosition InsertBefore = nullptr);
protected:
// Note: Instruction needs to be a friend here to call cloneImpl.
@@ -4095,8 +4118,8 @@ class CatchSwitchInst : public Instruction {
/// here to make memory allocation more efficient.
/// This constructor can also autoinsert before another instruction.
LLVM_ABI CatchSwitchInst(Value *ParentPad, BasicBlock *UnwindDest,
- unsigned NumHandlers, const Twine &NameStr,
- InsertPosition InsertBefore);
+ unsigned NumHandlers, const Twine &NameStr,
+ InsertPosition InsertBefore);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -4313,7 +4336,8 @@ class CatchReturnInst : public Instruction {
constexpr static IntrusiveOperandsAllocMarker AllocMarker{2};
CatchReturnInst(const CatchReturnInst &RI);
- LLVM_ABI CatchReturnInst(Value *CatchPad, BasicBlock *BB, InsertPosition InsertBefore);
+ LLVM_ABI CatchReturnInst(Value *CatchPad, BasicBlock *BB,
+ InsertPosition InsertBefore);
void init(Value *CatchPad, BasicBlock *BB);
@@ -4390,7 +4414,8 @@ class CleanupReturnInst : public Instruction {
private:
CleanupReturnInst(const CleanupReturnInst &RI, AllocInfo AllocInfo);
LLVM_ABI CleanupReturnInst(Value *CleanupPad, BasicBlock *UnwindBB,
- AllocInfo AllocInfo, InsertPosition InsertBefore = nullptr);
+ AllocInfo AllocInfo,
+ InsertPosition InsertBefore = nullptr);
void init(Value *CleanupPad, BasicBlock *UnwindBB);
@@ -4492,7 +4517,7 @@ class UnreachableInst : public Instruction {
public:
LLVM_ABI explicit UnreachableInst(LLVMContext &C,
- InsertPosition InsertBefore = nullptr);
+ InsertPosition InsertBefore = nullptr);
// allocate space for exactly zero operands
void *operator new(size_t S) { return User::operator new(S, AllocMarker); }
@@ -4509,7 +4534,8 @@ class UnreachableInst : public Instruction {
}
// Whether to do target lowering in SelectionDAG.
- LLVM_ABI bool shouldLowerToTrap(bool TrapUnreachable, bool NoTrapAfterNoreturn) const;
+ LLVM_ABI bool shouldLowerToTrap(bool TrapUnreachable,
+ bool NoTrapAfterNoreturn) const;
private:
BasicBlock *getSuccessor(unsigned idx) const {
@@ -4538,7 +4564,8 @@ class TruncInst : public CastInst {
enum { AnyWrap = 0, NoUnsignedWrap = (1 << 0), NoSignedWrap = (1 << 1) };
/// Constructor with insert-before-instruction semantics
- LLVM_ABI TruncInst(Value *S, ///< The value to be truncated
+ LLVM_ABI
+ TruncInst(Value *S, ///< The value to be truncated
Type *Ty, ///< The (smaller) type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4602,7 +4629,8 @@ class ZExtInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI ZExtInst(Value *S, ///< The value to be zero extended
+ LLVM_ABI
+ ZExtInst(Value *S, ///< The value to be zero extended
Type *Ty, ///< The type to zero extend to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4633,7 +4661,8 @@ class SExtInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI SExtInst(Value *S, ///< The value to be sign extended
+ LLVM_ABI
+ SExtInst(Value *S, ///< The value to be sign extended
Type *Ty, ///< The type to sign extend to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4663,8 +4692,9 @@ class FPTruncInst : public CastInst {
LLVM_ABI FPTruncInst *cloneImpl() const;
public: /// Constructor with insert-before-instruction semantics
- LLVM_ABI FPTruncInst(Value *S, ///< The value to be truncated
- Type *Ty, ///< The type to truncate to
+ LLVM_ABI
+ FPTruncInst(Value *S, ///< The value to be truncated
+ Type *Ty, ///< The type to truncate to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
nullptr ///< Where to insert the new instruction
@@ -4694,7 +4724,8 @@ class FPExtInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI FPExtInst(Value *S, ///< The value to be extended
+ LLVM_ABI
+ FPExtInst(Value *S, ///< The value to be extended
Type *Ty, ///< The type to extend to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4725,7 +4756,8 @@ class UIToFPInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI UIToFPInst(Value *S, ///< The value to be converted
+ LLVM_ABI
+ UIToFPInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4756,7 +4788,8 @@ class SIToFPInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI SIToFPInst(Value *S, ///< The value to be converted
+ LLVM_ABI
+ SIToFPInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4787,7 +4820,8 @@ class FPToUIInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI FPToUIInst(Value *S, ///< The value to be converted
+ LLVM_ABI
+ FPToUIInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4818,7 +4852,8 @@ class FPToSIInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI FPToSIInst(Value *S, ///< The value to be converted
+ LLVM_ABI
+ FPToSIInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4845,7 +4880,8 @@ class IntToPtrInst : public CastInst {
friend class Instruction;
/// Constructor with insert-before-instruction semantics
- LLVM_ABI IntToPtrInst(Value *S, ///< The value to be converted
+ LLVM_ABI
+ IntToPtrInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4884,7 +4920,8 @@ class PtrToIntInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI PtrToIntInst(Value *S, ///< The value to be converted
+ LLVM_ABI
+ PtrToIntInst(Value *S, ///< The value to be converted
Type *Ty, ///< The type to convert to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -4927,7 +4964,8 @@ class BitCastInst : public CastInst {
public:
/// Constructor with insert-before-instruction semantics
- LLVM_ABI BitCastInst(Value *S, ///< The value to be casted
+ LLVM_ABI
+ BitCastInst(Value *S, ///< The value to be casted
Type *Ty, ///< The type to casted to
const Twine &NameStr = "", ///< A name for the new instruction
InsertPosition InsertBefore =
@@ -5121,7 +5159,7 @@ class FreezeInst : public UnaryInstruction {
public:
LLVM_ABI explicit FreezeInst(Value *S, const Twine &NameStr = "",
- InsertPosition InsertBefore = nullptr);
+ InsertPosition InsertBefore = nullptr);
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Instruction *I) {
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index 7d9e26ded6534..74bd22e70b619 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -23,7 +23,6 @@
#ifndef LLVM_IR_INTRINSICINST_H
#define LLVM_IR_INTRINSICINST_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
@@ -34,6 +33,7 @@
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
@@ -316,13 +316,13 @@ class DbgVariableIntrinsic : public DbgInfoIntrinsic {
LLVM_ABI Value *getVariableLocationOp(unsigned OpIdx) const;
LLVM_ABI void replaceVariableLocationOp(Value *OldValue, Value *NewValue,
- bool AllowEmpty = false);
+ bool AllowEmpty = false);
LLVM_ABI void replaceVariableLocationOp(unsigned OpIdx, Value *NewValue);
/// Adding a new location operand will always result in this intrinsic using
/// an ArgList, and must always be accompanied by a new expression that uses
/// the new operand.
LLVM_ABI void addVariableLocationOps(ArrayRef<Value *> NewValues,
- DIExpression *NewExpr);
+ DIExpression *NewExpr);
void setVariable(DILocalVariable *NewVar) {
setArgOperand(1, MetadataAsValue::get(NewVar->getContext(), NewVar));
@@ -569,13 +569,14 @@ class VPIntrinsic : public IntrinsicInst {
/// \brief Declares a llvm.vp.* intrinsic in \p M that matches the parameters
/// \p Params. Additionally, the load and gather intrinsics require
/// \p ReturnType to be specified.
- LLVM_ABI static Function *getOrInsertDeclarationForParams(Module *M, Intrinsic::ID,
- Type *ReturnType,
- ArrayRef<Value *> Params);
+ LLVM_ABI static Function *
+ getOrInsertDeclarationForParams(Module *M, Intrinsic::ID, Type *ReturnType,
+ ArrayRef<Value *> Params);
- LLVM_ABI static std::optional<unsigned> getMaskParamPos(Intrinsic::ID IntrinsicID);
- LLVM_ABI static std::optional<unsigned> getVectorLengthParamPos(
- Intrinsic::ID IntrinsicID);
+ LLVM_ABI static std::optional<unsigned>
+ getMaskParamPos(Intrinsic::ID IntrinsicID);
+ LLVM_ABI static std::optional<unsigned>
+ getVectorLengthParamPos(Intrinsic::ID IntrinsicID);
/// The llvm.vp.* intrinsics for this instruction Opcode
LLVM_ABI static Intrinsic::ID getForOpcode(unsigned OC);
@@ -609,7 +610,8 @@ class VPIntrinsic : public IntrinsicInst {
/// \return The pointer operand of this load,store, gather or scatter.
LLVM_ABI Value *getMemoryPointerParam() const;
- LLVM_ABI static std::optional<unsigned> getMemoryPointerParamPos(Intrinsic::ID);
+ LLVM_ABI static std::optional<unsigned>
+ getMemoryPointerParamPos(Intrinsic::ID);
/// \return The data (payload) operand of this store or scatter.
LLVM_ABI Value *getMemoryDataParam() const;
@@ -639,7 +641,8 @@ class VPIntrinsic : public IntrinsicInst {
}
// Equivalent non-predicated opcode
- LLVM_ABI static std::optional<unsigned> getFunctionalOpcodeForVP(Intrinsic::ID ID);
+ LLVM_ABI static std::optional<unsigned>
+ getFunctionalOpcodeForVP(Intrinsic::ID ID);
// Equivalent non-predicated intrinsic ID
LLVM_ABI static std::optional<Intrinsic::ID>
@@ -1792,8 +1795,8 @@ class ConvergenceControlInst : public IntrinsicInst {
LLVM_ABI static ConvergenceControlInst *CreateAnchor(BasicBlock &BB);
LLVM_ABI static ConvergenceControlInst *CreateEntry(BasicBlock &BB);
- LLVM_ABI static ConvergenceControlInst *CreateLoop(BasicBlock &BB,
- ConvergenceControlInst *Parent);
+ LLVM_ABI static ConvergenceControlInst *
+ CreateLoop(BasicBlock &BB, ConvergenceControlInst *Parent);
};
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/Intrinsics.h b/llvm/include/llvm/IR/Intrinsics.h
index 3b6e29e0c1bb8..156805293367b 100644
--- a/llvm/include/llvm/IR/Intrinsics.h
+++ b/llvm/include/llvm/IR/Intrinsics.h
@@ -15,8 +15,8 @@
#ifndef LLVM_IR_INTRINSICS_H
#define LLVM_IR_INTRINSICS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/TypeSize.h"
#include <optional>
#include <string>
@@ -67,7 +67,7 @@ namespace Intrinsic {
/// the StringRef version. If one of the types is based on an unnamed type, a
/// function type will be computed. Providing FT will avoid this computation.
LLVM_ABI std::string getName(ID Id, ArrayRef<Type *> Tys, Module *M,
- FunctionType *FT = nullptr);
+ FunctionType *FT = nullptr);
/// Return the LLVM name for an intrinsic. This is a special version only to
/// be used by LLVMIntrinsicCopyOverloadedName. It only supports overloads
@@ -75,7 +75,8 @@ namespace Intrinsic {
LLVM_ABI std::string getNameNoUnnamedTypes(ID Id, ArrayRef<Type *> Tys);
/// Return the function type for an intrinsic.
- LLVM_ABI FunctionType *getType(LLVMContext &Context, ID id, ArrayRef<Type *> Tys = {});
+ LLVM_ABI FunctionType *getType(LLVMContext &Context, ID id,
+ ArrayRef<Type *> Tys = {});
/// Returns true if the intrinsic can be overloaded.
LLVM_ABI bool isOverloaded(ID id);
@@ -100,7 +101,8 @@ namespace Intrinsic {
/// using iAny, fAny, vAny, or pAny). For a declaration of an overloaded
/// intrinsic, Tys must provide exactly one type for each overloaded type in
/// the intrinsic.
- LLVM_ABI Function *getOrInsertDeclaration(Module *M, ID id, ArrayRef<Type *> Tys = {});
+ LLVM_ABI Function *getOrInsertDeclaration(Module *M, ID id,
+ ArrayRef<Type *> Tys = {});
LLVM_DEPRECATED("Use getOrInsertDeclaration instead",
"getOrInsertDeclaration")
@@ -114,14 +116,17 @@ namespace Intrinsic {
LLVM_ABI Function *getDeclarationIfExists(const Module *M, ID id);
/// This version supports overloaded intrinsics.
- LLVM_ABI Function *getDeclarationIfExists(Module *M, ID id, ArrayRef<Type *> Tys,
- FunctionType *FT = nullptr);
+ LLVM_ABI Function *getDeclarationIfExists(Module *M, ID id,
+ ArrayRef<Type *> Tys,
+ FunctionType *FT = nullptr);
/// Map a Clang builtin name to an intrinsic ID.
- LLVM_ABI ID getIntrinsicForClangBuiltin(StringRef TargetPrefix, StringRef BuiltinName);
+ LLVM_ABI ID getIntrinsicForClangBuiltin(StringRef TargetPrefix,
+ StringRef BuiltinName);
/// Map a MS builtin name to an intrinsic ID.
- LLVM_ABI ID getIntrinsicForMSBuiltin(StringRef TargetPrefix, StringRef BuiltinName);
+ LLVM_ABI ID getIntrinsicForMSBuiltin(StringRef TargetPrefix,
+ StringRef BuiltinName);
/// Returns true if the intrinsic ID is for one of the "Constrained
/// Floating-Point Intrinsics".
@@ -233,7 +238,8 @@ namespace Intrinsic {
/// Return the IIT table descriptor for the specified intrinsic into an array
/// of IITDescriptors.
- LLVM_ABI void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl<IITDescriptor> &T);
+ LLVM_ABI void getIntrinsicInfoTableEntries(ID id,
+ SmallVectorImpl<IITDescriptor> &T);
enum MatchIntrinsicTypesResult {
MatchIntrinsicTypes_Match = 0,
@@ -255,7 +261,8 @@ namespace Intrinsic {
/// be called after all the fixed arguments have been matched first.
///
/// This method returns true on error.
- LLVM_ABI bool matchIntrinsicVarArg(bool isVarArg, ArrayRef<IITDescriptor> &Infos);
+ LLVM_ABI bool matchIntrinsicVarArg(bool isVarArg,
+ ArrayRef<IITDescriptor> &Infos);
/// Gets the type arguments of an intrinsic call by matching type contraints
/// specified by the .td file. The overloaded types are pushed into the
@@ -264,10 +271,11 @@ namespace Intrinsic {
/// Returns false if the given ID and function type combination is not a
/// valid intrinsic call.
LLVM_ABI bool getIntrinsicSignature(Intrinsic::ID, FunctionType *FT,
- SmallVectorImpl<Type *> &ArgTys);
+ SmallVectorImpl<Type *> &ArgTys);
/// Same as previous, but accepts a Function instead of ID and FunctionType.
- LLVM_ABI bool getIntrinsicSignature(Function *F, SmallVectorImpl<Type *> &ArgTys);
+ LLVM_ABI bool getIntrinsicSignature(Function *F,
+ SmallVectorImpl<Type *> &ArgTys);
// Checks if the intrinsic name matches with its signature and if not
// returns the declaration with the same signature and remangled name.
diff --git a/llvm/include/llvm/IR/LLVMContext.h b/llvm/include/llvm/IR/LLVMContext.h
index f8056590b7f8f..852a3a4e2f638 100644
--- a/llvm/include/llvm/IR/LLVMContext.h
+++ b/llvm/include/llvm/IR/LLVMContext.h
@@ -14,10 +14,10 @@
#ifndef LLVM_IR_LLVMCONTEXT_H
#define LLVM_IR_LLVMCONTEXT_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/IR/DiagnosticHandler.h"
#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/Compiler.h"
#include <cstdint>
#include <memory>
#include <optional>
@@ -115,7 +115,8 @@ class LLVMContext {
/// getOrInsertBundleTag - Returns the Tag to use for an operand bundle of
/// name TagName.
- LLVM_ABI StringMapEntry<uint32_t> *getOrInsertBundleTag(StringRef TagName) const;
+ LLVM_ABI StringMapEntry<uint32_t> *
+ getOrInsertBundleTag(StringRef TagName) const;
/// getOperandBundleTagID - Maps a bundle tag to an integer ID. Every bundle
/// tag registered with an LLVMContext has an unique ID.
@@ -188,11 +189,12 @@ class LLVMContext {
///
/// Ownership of this pointer is moved to LLVMContextImpl.
LLVM_ABI void setDiagnosticHandler(std::unique_ptr<DiagnosticHandler> &&DH,
- bool RespectFilters = false);
+ bool RespectFilters = false);
/// getDiagnosticHandlerCallBack - Return the diagnostic handler call back set by
/// setDiagnosticHandlerCallBack.
- LLVM_ABI DiagnosticHandler::DiagnosticHandlerTy getDiagnosticHandlerCallBack() const;
+ LLVM_ABI DiagnosticHandler::DiagnosticHandlerTy
+ getDiagnosticHandlerCallBack() const;
/// getDiagnosticContext - Return the diagnostic context set by
/// setDiagnosticContext.
@@ -215,7 +217,8 @@ class LLVMContext {
LLVM_ABI bool getMisExpectWarningRequested() const;
LLVM_ABI void setMisExpectWarningRequested(bool Requested);
- LLVM_ABI void setDiagnosticsMisExpectTolerance(std::optional<uint32_t> Tolerance);
+ LLVM_ABI void
+ setDiagnosticsMisExpectTolerance(std::optional<uint32_t> Tolerance);
LLVM_ABI uint32_t getDiagnosticsMisExpectTolerance() const;
/// Return the minimum hotness value a diagnostic would need in order
@@ -232,7 +235,8 @@ class LLVMContext {
/// Set the minimum hotness value a diagnostic needs in order to be
/// included in optimization diagnostics.
- LLVM_ABI void setDiagnosticsHotnessThreshold(std::optional<uint64_t> Threshold);
+ LLVM_ABI void
+ setDiagnosticsHotnessThreshold(std::optional<uint64_t> Threshold);
/// Return if hotness threshold is requested from PSI.
LLVM_ABI bool isDiagnosticsHotnessThresholdSetFromPSI() const;
@@ -261,7 +265,8 @@ class LLVMContext {
/// Get the prefix that should be printed in front of a diagnostic of
/// the given \p Severity
- LLVM_ABI static const char *getDiagnosticMessagePrefix(DiagnosticSeverity Severity);
+ LLVM_ABI static const char *
+ getDiagnosticMessagePrefix(DiagnosticSeverity Severity);
/// Report a message to the currently installed diagnostic handler.
///
@@ -318,7 +323,7 @@ class LLVMContext {
///
/// The lifetime of the object must be guaranteed to extend as long as the
/// LLVMContext is used by compilation.
- LLVM_ABI void setOptPassGate(OptPassGate&);
+ LLVM_ABI void setOptPassGate(OptPassGate &);
/// Get or set the current "default" target CPU (target-cpu function
/// attribute). The intent is that compiler frontends will set this to a value
diff --git a/llvm/include/llvm/IR/LLVMRemarkStreamer.h b/llvm/include/llvm/IR/LLVMRemarkStreamer.h
index 232e1875fe71a..376acdec49fbb 100644
--- a/llvm/include/llvm/IR/LLVMRemarkStreamer.h
+++ b/llvm/include/llvm/IR/LLVMRemarkStreamer.h
@@ -14,8 +14,8 @@
#ifndef LLVM_IR_LLVMREMARKSTREAMER_H
#define LLVM_IR_LLVMREMARKSTREAMER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/Remarks/Remark.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include <memory>
#include <optional>
@@ -83,11 +83,10 @@ struct LLVMRemarkSetupFormatError
};
/// Setup optimization remarks that output to a file.
-LLVM_ABI Expected<std::unique_ptr<ToolOutputFile>>
-setupLLVMOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
- StringRef RemarksPasses, StringRef RemarksFormat,
- bool RemarksWithHotness,
- std::optional<uint64_t> RemarksHotnessThreshold = 0);
+LLVM_ABI Expected<std::unique_ptr<ToolOutputFile>> setupLLVMOptimizationRemarks(
+ LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses,
+ StringRef RemarksFormat, bool RemarksWithHotness,
+ std::optional<uint64_t> RemarksHotnessThreshold = 0);
/// Setup optimization remarks that output directly to a raw_ostream.
/// \p OS is managed by the caller and should be open for writing as long as \p
diff --git a/llvm/include/llvm/IR/LegacyPassManager.h b/llvm/include/llvm/IR/LegacyPassManager.h
index f553246d3f8d9..770b3d8f6eaa6 100644
--- a/llvm/include/llvm/IR/LegacyPassManager.h
+++ b/llvm/include/llvm/IR/LegacyPassManager.h
@@ -16,8 +16,8 @@
#ifndef LLVM_IR_LEGACYPASSMANAGER_H
#define LLVM_IR_LEGACYPASSMANAGER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/CBindingWrapping.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/LegacyPassManagers.h b/llvm/include/llvm/IR/LegacyPassManagers.h
index 39d38059d706d..1e5b92636d0aa 100644
--- a/llvm/include/llvm/IR/LegacyPassManagers.h
+++ b/llvm/include/llvm/IR/LegacyPassManagers.h
@@ -13,12 +13,12 @@
#ifndef LLVM_IR_LEGACYPASSMANAGERS_H
#define LLVM_IR_LEGACYPASSMANAGERS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Pass.h"
+#include "llvm/Support/Compiler.h"
#include <vector>
//===----------------------------------------------------------------------===//
@@ -509,7 +509,6 @@ class LLVM_ABI FPPassManager : public ModulePass, public PMDataManager {
return PMT_FunctionPassManager;
}
};
-
}
#endif
diff --git a/llvm/include/llvm/IR/LegacyPassNameParser.h b/llvm/include/llvm/IR/LegacyPassNameParser.h
index 65a0c857f2278..3460de0d90223 100644
--- a/llvm/include/llvm/IR/LegacyPassNameParser.h
+++ b/llvm/include/llvm/IR/LegacyPassNameParser.h
@@ -25,10 +25,10 @@
#ifndef LLVM_IR_LEGACYPASSNAMEPARSER_H
#define LLVM_IR_LEGACYPASSNAMEPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cstring>
@@ -40,7 +40,7 @@ namespace llvm {
// automatically add a command line argument to opt for each pass.
//
class LLVM_ABI PassNameParser : public PassRegistrationListener,
- public cl::parser<const PassInfo*> {
+ public cl::parser<const PassInfo *> {
public:
PassNameParser(cl::Option &O);
~PassNameParser() override;
diff --git a/llvm/include/llvm/IR/MDBuilder.h b/llvm/include/llvm/IR/MDBuilder.h
index 745bb673e9387..df1c66cf24fcb 100644
--- a/llvm/include/llvm/IR/MDBuilder.h
+++ b/llvm/include/llvm/IR/MDBuilder.h
@@ -14,11 +14,11 @@
#ifndef LLVM_IR_MDBUILDER_H
#define LLVM_IR_MDBUILDER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/GlobalValue.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include <utility>
@@ -63,8 +63,9 @@ class MDBuilder {
/// @param TrueWeight the weight of the true branch
/// @param FalseWeight the weight of the false branch
/// @param Do these weights come from __builtin_expect*
- LLVM_ABI MDNode *createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight,
- bool IsExpected = false);
+ LLVM_ABI MDNode *createBranchWeights(uint32_t TrueWeight,
+ uint32_t FalseWeight,
+ bool IsExpected = false);
/// Return metadata containing two branch weights, with significant bias
/// towards `true` destination.
@@ -78,7 +79,7 @@ class MDBuilder {
/// @param Weights the weights of all the branches
/// @param Do these weights come from __builtin_expect*
LLVM_ABI MDNode *createBranchWeights(ArrayRef<uint32_t> Weights,
- bool IsExpected = false);
+ bool IsExpected = false);
/// Return metadata specifying that a branch or switch is unpredictable.
LLVM_ABI MDNode *createUnpredictable();
@@ -87,14 +88,16 @@ class MDBuilder {
/// \Synthetic indicating whether the counts were synthetized, and the
/// GUIDs stored in \p Imports that need to be imported for sample PGO, to
/// enable the same inlines as the profiled optimized binary
- LLVM_ABI MDNode *createFunctionEntryCount(uint64_t Count, bool Synthetic,
- const DenseSet<GlobalValue::GUID> *Imports);
+ LLVM_ABI MDNode *
+ createFunctionEntryCount(uint64_t Count, bool Synthetic,
+ const DenseSet<GlobalValue::GUID> *Imports);
/// Return metadata containing the section prefix for a global object.
LLVM_ABI MDNode *createGlobalObjectSectionPrefix(StringRef Prefix);
/// Return metadata containing the pseudo probe descriptor for a function.
- LLVM_ABI MDNode *createPseudoProbeDesc(uint64_t GUID, uint64_t Hash, StringRef FName);
+ LLVM_ABI MDNode *createPseudoProbeDesc(uint64_t GUID, uint64_t Hash,
+ StringRef FName);
/// Return metadata containing llvm statistics.
LLVM_ABI MDNode *
@@ -123,15 +126,18 @@ class MDBuilder {
//===------------------------------------------------------------------===//
/// Return metadata describing a callback (see llvm::AbstractCallSite).
- LLVM_ABI MDNode *createCallbackEncoding(unsigned CalleeArgNo, ArrayRef<int> Arguments,
- bool VarArgsArePassed);
+ LLVM_ABI MDNode *createCallbackEncoding(unsigned CalleeArgNo,
+ ArrayRef<int> Arguments,
+ bool VarArgsArePassed);
/// Merge the new callback encoding \p NewCB into \p ExistingCallbacks.
- LLVM_ABI MDNode *mergeCallbackEncodings(MDNode *ExistingCallbacks, MDNode *NewCB);
+ LLVM_ABI MDNode *mergeCallbackEncodings(MDNode *ExistingCallbacks,
+ MDNode *NewCB);
/// Return metadata feeding to the CodeGen about how to generate a function
/// prologue for the "function" santizier.
- LLVM_ABI MDNode *createRTTIPointerPrologue(Constant *PrologueSig, Constant *RTTI);
+ LLVM_ABI MDNode *createRTTIPointerPrologue(Constant *PrologueSig,
+ Constant *RTTI);
//===------------------------------------------------------------------===//
// PC sections metadata.
@@ -152,7 +158,7 @@ class MDBuilder {
/// Each returned node is distinct from all other metadata and will never
/// be identified (uniqued) with anything else.
LLVM_ABI MDNode *createAnonymousAARoot(StringRef Name = StringRef(),
- MDNode *Extra = nullptr);
+ MDNode *Extra = nullptr);
public:
/// Return metadata appropriate for a TBAA root node. Each returned
@@ -195,7 +201,7 @@ class MDBuilder {
/// Return metadata for a non-root TBAA node with the given name,
/// parent in the TBAA tree, and value for 'pointsToConstantMemory'.
LLVM_ABI MDNode *createTBAANode(StringRef Name, MDNode *Parent,
- bool isConstant = false);
+ bool isConstant = false);
struct TBAAStructField {
uint64_t Offset;
@@ -218,26 +224,27 @@ class MDBuilder {
/// Return metadata for a TBAA scalar type node with the
/// given name, an offset and a parent in the TBAA type DAG.
LLVM_ABI MDNode *createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
- uint64_t Offset = 0);
+ uint64_t Offset = 0);
/// Return metadata for a TBAA tag node with the given
/// base type, access type and offset relative to the base type.
LLVM_ABI MDNode *createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
- uint64_t Offset, bool IsConstant = false);
+ uint64_t Offset,
+ bool IsConstant = false);
/// Return metadata for a TBAA type node in the TBAA type DAG with the
/// given parent type, size in bytes, type identifier and a list of fields.
- LLVM_ABI MDNode *createTBAATypeNode(MDNode *Parent, uint64_t Size, Metadata *Id,
- ArrayRef<TBAAStructField> Fields =
- ArrayRef<TBAAStructField>());
+ LLVM_ABI MDNode *createTBAATypeNode(
+ MDNode *Parent, uint64_t Size, Metadata *Id,
+ ArrayRef<TBAAStructField> Fields = ArrayRef<TBAAStructField>());
/// Return metadata for a TBAA access tag with the given base type,
/// final access type, offset of the access relative to the base type, size of
/// the access and flag indicating whether the accessed object can be
/// considered immutable for the purposes of the TBAA analysis.
LLVM_ABI MDNode *createTBAAAccessTag(MDNode *BaseType, MDNode *AccessType,
- uint64_t Offset, uint64_t Size,
- bool IsImmutable = false);
+ uint64_t Offset, uint64_t Size,
+ bool IsImmutable = false);
/// Return mutable version of the given mutable or immutable TBAA
/// access tag.
diff --git a/llvm/include/llvm/IR/Mangler.h b/llvm/include/llvm/IR/Mangler.h
index d6ab5674b1a29..e3dfe1eac6189 100644
--- a/llvm/include/llvm/IR/Mangler.h
+++ b/llvm/include/llvm/IR/Mangler.h
@@ -13,9 +13,9 @@
#ifndef LLVM_IR_MANGLER_H
#define LLVM_IR_MANGLER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -38,31 +38,36 @@ class Mangler {
/// If the global variable doesn't have a name, this fills in a unique name
/// for the global.
LLVM_ABI void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
- bool CannotUsePrivateLabel) const;
- LLVM_ABI void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
- bool CannotUsePrivateLabel) const;
+ bool CannotUsePrivateLabel) const;
+ LLVM_ABI void getNameWithPrefix(SmallVectorImpl<char> &OutName,
+ const GlobalValue *GV,
+ bool CannotUsePrivateLabel) const;
/// Print the appropriate prefix and the specified name as the global variable
/// name. GVName must not be empty.
LLVM_ABI static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
- const DataLayout &DL);
+ const DataLayout &DL);
LLVM_ABI static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
- const Twine &GVName, const DataLayout &DL);
+ const Twine &GVName,
+ const DataLayout &DL);
};
-LLVM_ABI void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
- const Triple &TT, Mangler &Mangler);
+LLVM_ABI void emitLinkerFlagsForGlobalCOFF(raw_ostream &OS,
+ const GlobalValue *GV,
+ const Triple &TT, Mangler &Mangler);
LLVM_ABI void emitLinkerFlagsForUsedCOFF(raw_ostream &OS, const GlobalValue *GV,
- const Triple &T, Mangler &M);
+ const Triple &T, Mangler &M);
/// Returns the ARM64EC mangled function name unless the input is already
/// mangled.
-LLVM_ABI std::optional<std::string> getArm64ECMangledFunctionName(StringRef Name);
+LLVM_ABI std::optional<std::string>
+getArm64ECMangledFunctionName(StringRef Name);
/// Returns the ARM64EC demangled function name, unless the input is not
/// mangled.
-LLVM_ABI std::optional<std::string> getArm64ECDemangledFunctionName(StringRef Name);
+LLVM_ABI std::optional<std::string>
+getArm64ECDemangledFunctionName(StringRef Name);
/// Check if an ARM64EC function name is mangled.
bool inline isArm64ECMangledFunctionName(StringRef Name) {
diff --git a/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h b/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
index 8011878478bc2..535635a9ad9b0 100644
--- a/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
+++ b/llvm/include/llvm/IR/MemoryModelRelaxationAnnotations.h
@@ -18,9 +18,9 @@
#ifndef LLVM_IR_MEMORYMODELRELAXATIONANNOTATIONS_H
#define LLVM_IR_MEMORYMODELRELAXATIONANNOTATIONS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <tuple> // for std::pair
namespace llvm {
@@ -63,14 +63,14 @@ class MMRAMetadata {
/// Combines \p A and \p B according to MMRA semantics.
/// \returns !mmra metadata for the combined MMRAs.
LLVM_ABI static MDNode *combine(LLVMContext &Ctx, const MMRAMetadata &A,
- const MMRAMetadata &B);
+ const MMRAMetadata &B);
/// Creates !mmra metadata for a single tag.
///
/// !mmra metadata can either be a single tag, or a MDTuple containing
/// multiple tags.
LLVM_ABI static MDTuple *getTagMD(LLVMContext &Ctx, StringRef Prefix,
- StringRef Suffix);
+ StringRef Suffix);
static MDTuple *getTagMD(LLVMContext &Ctx, const TagT &T) {
return getTagMD(Ctx, T.first, T.second);
}
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index ca950593dceba..2de26c0c1f7c7 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -15,7 +15,6 @@
#ifndef LLVM_IR_METADATA_H
#define LLVM_IR_METADATA_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
@@ -29,6 +28,7 @@
#include "llvm/IR/Value.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstddef>
@@ -123,9 +123,9 @@ class Metadata {
/// otherwise, pointer addresses are substituted.
/// @{
LLVM_ABI void print(raw_ostream &OS, const Module *M = nullptr,
- bool IsForDebug = false) const;
- LLVM_ABI void print(raw_ostream &OS, ModuleSlotTracker &MST, const Module *M = nullptr,
- bool IsForDebug = false) const;
+ bool IsForDebug = false) const;
+ LLVM_ABI void print(raw_ostream &OS, ModuleSlotTracker &MST,
+ const Module *M = nullptr, bool IsForDebug = false) const;
/// @}
/// Print as operand.
@@ -135,9 +135,10 @@ class Metadata {
/// If \c M is provided, metadata nodes will be numbered canonically;
/// otherwise, pointer addresses are substituted.
/// @{
- LLVM_ABI void printAsOperand(raw_ostream &OS, const Module *M = nullptr) const;
+ LLVM_ABI void printAsOperand(raw_ostream &OS,
+ const Module *M = nullptr) const;
LLVM_ABI void printAsOperand(raw_ostream &OS, ModuleSlotTracker &MST,
- const Module *M = nullptr) const;
+ const Module *M = nullptr) const;
/// @}
/// Metadata IDs that may generate poison.
@@ -193,7 +194,8 @@ class MetadataAsValue : public Value {
LLVM_ABI ~MetadataAsValue();
LLVM_ABI static MetadataAsValue *get(LLVMContext &Context, Metadata *MD);
- LLVM_ABI static MetadataAsValue *getIfExists(LLVMContext &Context, Metadata *MD);
+ LLVM_ABI static MetadataAsValue *getIfExists(LLVMContext &Context,
+ Metadata *MD);
Metadata *getMetadata() const { return MD; }
@@ -408,8 +410,8 @@ class ReplaceableMetadataImpl {
///
/// Replace all uses of this with \c MD, which is allowed to be null.
LLVM_ABI void replaceAllUsesWith(Metadata *MD);
- /// Replace all uses of the constant with Undef in debug info metadata
- LLVM_ABI static void SalvageDebugInfo(const Constant &C);
+ /// Replace all uses of the constant with Undef in debug info metadata
+ LLVM_ABI static void SalvageDebugInfo(const Constant &C);
/// Returns the list of all DIArgList users of this.
LLVM_ABI SmallVector<Metadata *> getAllArgListUsers();
/// Returns the list of all DbgVariableRecord users of this.
@@ -850,7 +852,7 @@ struct AAMDNodes {
/// Finally, !tbaa.struct is zeroed out.
LLVM_ABI AAMDNodes adjustForAccess(unsigned AccessSize);
LLVM_ABI AAMDNodes adjustForAccess(size_t Offset, Type *AccessTy,
- const DataLayout &DL);
+ const DataLayout &DL);
LLVM_ABI AAMDNodes adjustForAccess(size_t Offset, unsigned AccessSize);
};
@@ -1179,7 +1181,7 @@ class MDNode : public Metadata {
protected:
LLVM_ABI MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
- ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = {});
+ ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = {});
~MDNode() = default;
LLVM_ABI void *operator new(size_t Size, size_t NumOps, StorageType Storage);
@@ -1319,7 +1321,7 @@ class MDNode : public Metadata {
/// @{
LLVM_ABI void printTree(raw_ostream &OS, const Module *M = nullptr) const;
LLVM_ABI void printTree(raw_ostream &OS, ModuleSlotTracker &MST,
- const Module *M = nullptr) const;
+ const Module *M = nullptr) const;
/// @}
/// User-friendly dump in tree shape.
@@ -1456,12 +1458,13 @@ class MDNode : public Metadata {
LLVM_ABI static MDNode *getMostGenericRange(MDNode *A, MDNode *B);
LLVM_ABI static MDNode *getMostGenericNoaliasAddrspace(MDNode *A, MDNode *B);
LLVM_ABI static MDNode *getMostGenericAliasScope(MDNode *A, MDNode *B);
- LLVM_ABI static MDNode *getMostGenericAlignmentOrDereferenceable(MDNode *A, MDNode *B);
+ LLVM_ABI static MDNode *getMostGenericAlignmentOrDereferenceable(MDNode *A,
+ MDNode *B);
/// Merge !prof metadata from two instructions.
/// Currently only implemented with direct callsites with branch weights.
LLVM_ABI static MDNode *getMergedProfMetadata(MDNode *A, MDNode *B,
- const Instruction *AInstr,
- const Instruction *BInstr);
+ const Instruction *AInstr,
+ const Instruction *BInstr);
LLVM_ABI static MDNode *getMergedMemProfMetadata(MDNode *A, MDNode *B);
LLVM_ABI static MDNode *getMergedCallsiteMetadata(MDNode *A, MDNode *B);
};
@@ -1485,8 +1488,10 @@ class MDTuple : public MDNode {
void setHash(unsigned Hash) { SubclassData32 = Hash; }
void recalculateHash();
- LLVM_ABI static MDTuple *getImpl(LLVMContext &Context, ArrayRef<Metadata *> MDs,
- StorageType Storage, bool ShouldCreate = true);
+ LLVM_ABI static MDTuple *getImpl(LLVMContext &Context,
+ ArrayRef<Metadata *> MDs,
+ StorageType Storage,
+ bool ShouldCreate = true);
TempMDTuple cloneImpl() const {
ArrayRef<MDOperand> Operands = operands();
@@ -1808,7 +1813,7 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
LLVM_ABI StringRef getName() const;
LLVM_ABI void print(raw_ostream &ROS, bool IsForDebug = false) const;
LLVM_ABI void print(raw_ostream &ROS, ModuleSlotTracker &MST,
- bool IsForDebug = false) const;
+ bool IsForDebug = false) const;
LLVM_ABI void dump() const;
// ---------------------------------------------------------------------------
diff --git a/llvm/include/llvm/IR/Module.h b/llvm/include/llvm/IR/Module.h
index 04590afa3b1ab..7a26efb74b324 100644
--- a/llvm/include/llvm/IR/Module.h
+++ b/llvm/include/llvm/IR/Module.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_MODULE_H
#define LLVM_IR_MODULE_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
@@ -32,6 +31,7 @@
#include "llvm/IR/SymbolTableListTraits.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/CodeGen.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
#include <cstddef>
#include <cstdint>
@@ -1066,9 +1066,9 @@ class LLVM_ABI Module {
/// Given "llvm.used" or "llvm.compiler.used" as a global name, collect the
/// initializer elements of that global in a SmallVector and return the global
/// itself.
-LLVM_ABI GlobalVariable *collectUsedGlobalVariables(const Module &M,
- SmallVectorImpl<GlobalValue *> &Vec,
- bool CompilerUsed);
+LLVM_ABI GlobalVariable *
+collectUsedGlobalVariables(const Module &M, SmallVectorImpl<GlobalValue *> &Vec,
+ bool CompilerUsed);
/// An raw_ostream inserter for modules.
inline raw_ostream &operator<<(raw_ostream &O, const Module &M) {
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index d69f7de4bb9eb..ac79d91d417c2 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1796,8 +1796,9 @@ class ModuleSummaryIndex {
/// Returns the first GlobalValueSummary for \p ValueGUID, asserting that
/// there
/// is only one if \p PerModuleIndex.
- LLVM_ABI GlobalValueSummary *getGlobalValueSummary(GlobalValue::GUID ValueGUID,
- bool PerModuleIndex = true) const;
+ LLVM_ABI GlobalValueSummary *
+ getGlobalValueSummary(GlobalValue::GUID ValueGUID,
+ bool PerModuleIndex = true) const;
/// Table of modules, containing module hash and id.
const StringMap<ModuleHash> &modulePaths() const {
@@ -1925,8 +1926,9 @@ class ModuleSummaryIndex {
/// Collect for the given module the list of functions it defines
/// (GUID -> Summary).
- LLVM_ABI void collectDefinedFunctionsForModule(StringRef ModulePath,
- GVSummaryMapTy &GVSummaryMap) const;
+ LLVM_ABI void
+ collectDefinedFunctionsForModule(StringRef ModulePath,
+ GVSummaryMapTy &GVSummaryMap) const;
/// Collect for each module the list of Summaries it defines (GUID ->
/// Summary).
@@ -1956,15 +1958,17 @@ class ModuleSummaryIndex {
LLVM_ABI void dumpSCCs(raw_ostream &OS);
/// Do the access attribute and DSOLocal propagation in combined index.
- LLVM_ABI void propagateAttributes(const DenseSet<GlobalValue::GUID> &PreservedSymbols);
+ LLVM_ABI void
+ propagateAttributes(const DenseSet<GlobalValue::GUID> &PreservedSymbols);
/// Checks if we can import global variable from another module.
- LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs) const;
+ LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S,
+ bool AnalyzeRefs) const;
/// Same as above but checks whether the global var is importable as a
/// declaration.
- LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S, bool AnalyzeRefs,
- bool &CanImportDecl) const;
+ LLVM_ABI bool canImportGlobalVar(const GlobalValueSummary *S,
+ bool AnalyzeRefs, bool &CanImportDecl) const;
};
/// GraphTraits definition to build SCC for the index
diff --git a/llvm/include/llvm/IR/NoFolder.h b/llvm/include/llvm/IR/NoFolder.h
index afabe0f7e843f..9f16c6983313a 100644
--- a/llvm/include/llvm/IR/NoFolder.h
+++ b/llvm/include/llvm/IR/NoFolder.h
@@ -21,7 +21,6 @@
#ifndef LLVM_IR_NOFOLDER_H
#define LLVM_IR_NOFOLDER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/FMF.h"
@@ -29,6 +28,7 @@
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h
index 065666dbff65d..8344eaec807b3 100644
--- a/llvm/include/llvm/IR/Operator.h
+++ b/llvm/include/llvm/IR/Operator.h
@@ -14,7 +14,6 @@
#ifndef LLVM_IR_OPERATOR_H
#define LLVM_IR_OPERATOR_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/FMF.h"
@@ -23,6 +22,7 @@
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include <cstddef>
#include <optional>
@@ -546,9 +546,10 @@ class GEPOperator
/// Collect the offset of this GEP as a map of Values to their associated
/// APInt multipliers, as well as a total Constant Offset.
- LLVM_ABI bool collectOffset(const DataLayout &DL, unsigned BitWidth,
- SmallMapVector<Value *, APInt, 4> &VariableOffsets,
- APInt &ConstantOffset) const;
+ LLVM_ABI bool
+ collectOffset(const DataLayout &DL, unsigned BitWidth,
+ SmallMapVector<Value *, APInt, 4> &VariableOffsets,
+ APInt &ConstantOffset) const;
};
template <>
diff --git a/llvm/include/llvm/IR/OptBisect.h b/llvm/include/llvm/IR/OptBisect.h
index 1064eacd203ed..be6aef3298b23 100644
--- a/llvm/include/llvm/IR/OptBisect.h
+++ b/llvm/include/llvm/IR/OptBisect.h
@@ -14,8 +14,8 @@
#ifndef LLVM_IR_OPTBISECT_H
#define LLVM_IR_OPTBISECT_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include <limits>
namespace llvm {
diff --git a/llvm/include/llvm/IR/PassInstrumentation.h b/llvm/include/llvm/IR/PassInstrumentation.h
index 356ddcd1a64a7..031571599f9ad 100644
--- a/llvm/include/llvm/IR/PassInstrumentation.h
+++ b/llvm/include/llvm/IR/PassInstrumentation.h
@@ -344,7 +344,8 @@ class PassInstrumentation {
}
};
-LLVM_ABI bool isSpecialPass(StringRef PassID, const std::vector<StringRef> &Specials);
+LLVM_ABI bool isSpecialPass(StringRef PassID,
+ const std::vector<StringRef> &Specials);
/// Pseudo-analysis pass that exposes the \c PassInstrumentation to pass
/// managers.
diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index ed71ecb458b37..4f44ae56eb3c7 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -37,13 +37,13 @@
#ifndef LLVM_IR_PASSMANAGER_H
#define LLVM_IR_PASSMANAGER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/IR/Analysis.h"
#include "llvm/IR/PassManagerInternal.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/TypeName.h"
#include <cassert>
#include <cstring>
@@ -230,7 +230,8 @@ template <typename IRUnitT>
void printIRUnitNameForStackTrace(raw_ostream &OS, const IRUnitT &IR);
template <>
-LLVM_ABI void printIRUnitNameForStackTrace<Module>(raw_ostream &OS, const Module &IR);
+LLVM_ABI void printIRUnitNameForStackTrace<Module>(raw_ostream &OS,
+ const Module &IR);
extern template class LLVM_TEMPLATE_ABI PassManager<Module>;
@@ -239,7 +240,7 @@ using ModulePassManager = PassManager<Module>;
template <>
LLVM_ABI void printIRUnitNameForStackTrace<Function>(raw_ostream &OS,
- const Function &IR);
+ const Function &IR);
extern template class LLVM_TEMPLATE_ABI PassManager<Function>;
@@ -796,8 +797,8 @@ template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
AnalysisKey
OuterAnalysisManagerProxy<AnalysisManagerT, IRUnitT, ExtraArgTs...>::Key;
-extern template class LLVM_TEMPLATE_ABI OuterAnalysisManagerProxy<ModuleAnalysisManager,
- Function>;
+extern template class LLVM_TEMPLATE_ABI
+ OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
/// Provide the \c ModuleAnalysisManager to \c Function proxy.
using ModuleAnalysisManagerFunctionProxy =
OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
@@ -836,8 +837,9 @@ class ModuleToFunctionPassAdaptor
/// Runs the function pass across every function in the module.
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
- LLVM_ABI void printPipeline(raw_ostream &OS,
- function_ref<StringRef(StringRef)> MapClassName2PassName);
+ LLVM_ABI void
+ printPipeline(raw_ostream &OS,
+ function_ref<StringRef(StringRef)> MapClassName2PassName);
static bool isRequired() { return true; }
diff --git a/llvm/include/llvm/IR/PassManagerImpl.h b/llvm/include/llvm/IR/PassManagerImpl.h
index d833f2c06a76d..04ccbbbccb428 100644
--- a/llvm/include/llvm/IR/PassManagerImpl.h
+++ b/llvm/include/llvm/IR/PassManagerImpl.h
@@ -15,11 +15,11 @@
#ifndef LLVM_IR_PASSMANAGERIMPL_H
#define LLVM_IR_PASSMANAGERIMPL_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/PassInstrumentation.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/PrettyStackTrace.h"
LLVM_ABI extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
diff --git a/llvm/include/llvm/IR/PassTimingInfo.h b/llvm/include/llvm/IR/PassTimingInfo.h
index 8f05b10ea1e27..03e481a50342b 100644
--- a/llvm/include/llvm/IR/PassTimingInfo.h
+++ b/llvm/include/llvm/IR/PassTimingInfo.h
@@ -15,10 +15,10 @@
#ifndef LLVM_IR_PASSTIMINGINFO_H
#define LLVM_IR_PASSTIMINGINFO_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Timer.h"
#include <memory>
#include <utility>
diff --git a/llvm/include/llvm/IR/ProfDataUtils.h b/llvm/include/llvm/IR/ProfDataUtils.h
index 4c6d7bc0c48b1..8e8d069b836f1 100644
--- a/llvm/include/llvm/IR/ProfDataUtils.h
+++ b/llvm/include/llvm/IR/ProfDataUtils.h
@@ -15,10 +15,10 @@
#ifndef LLVM_IR_PROFDATAUTILS_H
#define LLVM_IR_PROFDATAUTILS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Metadata.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -76,17 +76,17 @@ LLVM_ABI unsigned getNumBranchWeights(const MDNode &ProfileData);
/// \returns True if weights were extracted, False otherwise. When false Weights
/// will be cleared.
LLVM_ABI bool extractBranchWeights(const MDNode *ProfileData,
- SmallVectorImpl<uint32_t> &Weights);
+ SmallVectorImpl<uint32_t> &Weights);
/// Faster version of extractBranchWeights() that skips checks and must only
/// be called with "branch_weights" metadata nodes. Supports uint32_t.
LLVM_ABI void extractFromBranchWeightMD32(const MDNode *ProfileData,
- SmallVectorImpl<uint32_t> &Weights);
+ SmallVectorImpl<uint32_t> &Weights);
/// Faster version of extractBranchWeights() that skips checks and must only
/// be called with "branch_weights" metadata nodes. Supports uint64_t.
LLVM_ABI void extractFromBranchWeightMD64(const MDNode *ProfileData,
- SmallVectorImpl<uint64_t> &Weights);
+ SmallVectorImpl<uint64_t> &Weights);
/// Extract branch weights attatched to an Instruction
///
@@ -95,7 +95,7 @@ LLVM_ABI void extractFromBranchWeightMD64(const MDNode *ProfileData,
/// \returns True if weights were extracted, False otherwise. When false Weights
/// will be cleared.
LLVM_ABI bool extractBranchWeights(const Instruction &I,
- SmallVectorImpl<uint32_t> &Weights);
+ SmallVectorImpl<uint32_t> &Weights);
/// Extract branch weights from a conditional branch or select Instruction.
///
@@ -105,7 +105,7 @@ LLVM_ABI bool extractBranchWeights(const Instruction &I,
/// \returns True on success with profile weights filled in. False if no
/// metadata or invalid metadata was found.
LLVM_ABI bool extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
- uint64_t &FalseVal);
+ uint64_t &FalseVal);
/// Retrieve the total of all weights from MD_prof data.
///
@@ -113,7 +113,8 @@ LLVM_ABI bool extractBranchWeights(const Instruction &I, uint64_t &TrueVal,
/// \param [out] TotalWeights input variable to fill with total weights
/// \returns True on success with profile total weights filled in. False if no
/// metadata was found.
-LLVM_ABI bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalWeights);
+LLVM_ABI bool extractProfTotalWeight(const MDNode *ProfileData,
+ uint64_t &TotalWeights);
/// Retrieve the total of all weights from an instruction.
///
@@ -121,7 +122,8 @@ LLVM_ABI bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalW
/// \param [out] TotalWeights input variable to fill with total weights
/// \returns True on success with profile total weights filled in. False if no
/// metadata was found.
-LLVM_ABI bool extractProfTotalWeight(const Instruction &I, uint64_t &TotalWeights);
+LLVM_ABI bool extractProfTotalWeight(const Instruction &I,
+ uint64_t &TotalWeights);
/// Create a new `branch_weights` metadata node and add or overwrite
/// a `prof` metadata reference to instruction `I`.
@@ -129,7 +131,7 @@ LLVM_ABI bool extractProfTotalWeight(const Instruction &I, uint64_t &TotalWeight
/// \param Weights an array of weights to set on instruction I.
/// \param IsExpected were these weights added from an llvm.expect* intrinsic.
LLVM_ABI void setBranchWeights(Instruction &I, ArrayRef<uint32_t> Weights,
- bool IsExpected);
+ bool IsExpected);
/// Scaling the profile data attached to 'I' using the ratio of S/T.
LLVM_ABI void scaleProfData(Instruction &I, uint64_t S, uint64_t T);
diff --git a/llvm/include/llvm/IR/ProfileSummary.h b/llvm/include/llvm/IR/ProfileSummary.h
index 1325bb120868e..6c087ea02b3c3 100644
--- a/llvm/include/llvm/IR/ProfileSummary.h
+++ b/llvm/include/llvm/IR/ProfileSummary.h
@@ -83,7 +83,7 @@ class ProfileSummary {
Kind getKind() const { return PSK; }
/// Return summary information as metadata.
LLVM_ABI Metadata *getMD(LLVMContext &Context, bool AddPartialField = true,
- bool AddPartialProfileRatioField = true);
+ bool AddPartialProfileRatioField = true);
/// Construct profile summary from metdata.
LLVM_ABI static ProfileSummary *getFromMD(Metadata *MD);
const SummaryEntryVector &getDetailedSummary() { return DetailedSummary; }
diff --git a/llvm/include/llvm/IR/ReplaceConstant.h b/llvm/include/llvm/IR/ReplaceConstant.h
index 7b40dbde27d0f..cbea22115310b 100644
--- a/llvm/include/llvm/IR/ReplaceConstant.h
+++ b/llvm/include/llvm/IR/ReplaceConstant.h
@@ -35,10 +35,9 @@ class Function;
///
/// If \p IncludeSelf is enabled, also convert the passed constants themselves
/// to instructions, rather than only their users.
-LLVM_ABI bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
- Function *RestrictToFunc = nullptr,
- bool RemoveDeadConstants = true,
- bool IncludeSelf = false);
+LLVM_ABI bool convertUsersOfConstantsToInstructions(
+ ArrayRef<Constant *> Consts, Function *RestrictToFunc = nullptr,
+ bool RemoveDeadConstants = true, bool IncludeSelf = false);
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index afb366da4c43a..26c085031a48a 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -14,10 +14,10 @@
#ifndef LLVM_IR_RUNTIME_LIBCALLS_H
#define LLVM_IR_RUNTIME_LIBCALLS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/Support/AtomicOrdering.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/StructuralHash.h b/llvm/include/llvm/IR/StructuralHash.h
index 2b955d55b076f..fc4b97ee2d41e 100644
--- a/llvm/include/llvm/IR/StructuralHash.h
+++ b/llvm/include/llvm/IR/StructuralHash.h
@@ -14,10 +14,10 @@
#ifndef LLVM_IR_STRUCTURALHASH_H
#define LLVM_IR_STRUCTURALHASH_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StableHashing.h"
#include "llvm/IR/Instruction.h"
+#include "llvm/Support/Compiler.h"
#include <cstdint>
namespace llvm {
@@ -30,7 +30,8 @@ class Module;
/// \param DetailedHash Whether or not to encode additional information in the
/// hash. The additional information added into the hash when this flag is set
/// to true includes instruction and operand type information.
-LLVM_ABI stable_hash StructuralHash(const Function &F, bool DetailedHash = false);
+LLVM_ABI stable_hash StructuralHash(const Function &F,
+ bool DetailedHash = false);
/// Returns a hash of the global variable \p G.
LLVM_ABI stable_hash StructuralHash(const GlobalVariable &G);
@@ -81,8 +82,8 @@ struct FunctionHashInfo {
/// \param IgnoreOp A callable that takes an instruction and an operand index,
/// and returns true if the operand should be ignored in the hash computation.
/// \return A FunctionHashInfo structure
-LLVM_ABI FunctionHashInfo StructuralHashWithDifferences(const Function &F,
- IgnoreOperandFunc IgnoreOp);
+LLVM_ABI FunctionHashInfo
+StructuralHashWithDifferences(const Function &F, IgnoreOperandFunc IgnoreOp);
} // end namespace llvm
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index 3d2d2906e6be3..fd987179645dd 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -120,7 +120,7 @@ class Type {
/// Put differently, \p NoDetails prints the type as if
/// inlined with the operands when printing an instruction.
LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false,
- bool NoDetails = false) const;
+ bool NoDetails = false) const;
LLVM_ABI void dump() const;
@@ -469,7 +469,8 @@ class Type {
}
llvm_unreachable("Unsupported type in Type::getScalarTy");
}
- LLVM_ABI static Type *getFloatingPointTy(LLVMContext &C, const fltSemantics &S);
+ LLVM_ABI static Type *getFloatingPointTy(LLVMContext &C,
+ const fltSemantics &S);
//===--------------------------------------------------------------------===//
// Convenience methods for getting pointer types.
@@ -481,13 +482,14 @@ class Type {
/// PointerType::get(Ctx, AddrSpace).
/// TODO: Remove this after opaque pointer transition is complete.
LLVM_ABI LLVM_DEPRECATED("Use PointerType::get instead", "PointerType::get")
- PointerType *getPointerTo(unsigned AddrSpace = 0) const;
+ PointerType *getPointerTo(unsigned AddrSpace = 0) const;
private:
/// Derived types like structures and arrays are sized iff all of the members
/// of the type are sized as well. Since asking for their size is relatively
/// uncommon, move this operation out-of-line.
- LLVM_ABI bool isSizedDerivedType(SmallPtrSetImpl<Type*> *Visited = nullptr) const;
+ LLVM_ABI bool
+ isSizedDerivedType(SmallPtrSetImpl<Type *> *Visited = nullptr) const;
};
// Printing of types.
diff --git a/llvm/include/llvm/IR/TypedPointerType.h b/llvm/include/llvm/IR/TypedPointerType.h
index cecc0f0065acc..6d1486bb319bf 100644
--- a/llvm/include/llvm/IR/TypedPointerType.h
+++ b/llvm/include/llvm/IR/TypedPointerType.h
@@ -14,8 +14,8 @@
#ifndef LLVM_IR_TYPEDPOINTERTYPE_H
#define LLVM_IR_TYPEDPOINTERTYPE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/Type.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -34,7 +34,8 @@ class TypedPointerType : public Type {
/// This constructs a pointer to an object of the specified type in a numbered
/// address space.
- LLVM_ABI static TypedPointerType *get(Type *ElementType, unsigned AddressSpace);
+ LLVM_ABI static TypedPointerType *get(Type *ElementType,
+ unsigned AddressSpace);
/// Return true if the specified type is valid as a element type.
LLVM_ABI static bool isValidElementType(Type *ElemTy);
diff --git a/llvm/include/llvm/IR/User.h b/llvm/include/llvm/IR/User.h
index fd0dd5a00b09c..cbb4379b68c41 100644
--- a/llvm/include/llvm/IR/User.h
+++ b/llvm/include/llvm/IR/User.h
@@ -106,13 +106,15 @@ class User : public Value {
/// Allocate a User with the operands co-allocated.
///
/// This is used for subclasses which have a fixed number of operands.
- LLVM_ABI void *operator new(size_t Size, IntrusiveOperandsAllocMarker allocTrait);
+ LLVM_ABI void *operator new(size_t Size,
+ IntrusiveOperandsAllocMarker allocTrait);
/// Allocate a User with the operands co-allocated. If DescBytes is non-zero
/// then allocate an additional DescBytes bytes before the operands. These
/// bytes can be accessed by calling getDescriptor.
- LLVM_ABI void *operator new(size_t Size,
- IntrusiveOperandsAndDescriptorAllocMarker allocTrait);
+ LLVM_ABI void *
+ operator new(size_t Size,
+ IntrusiveOperandsAndDescriptorAllocMarker allocTrait);
User(Type *ty, unsigned vty, AllocInfo AllocInfo) : Value(ty, vty) {
assert(AllocInfo.NumOps < (1u << NumUserOperandsBits) &&
diff --git a/llvm/include/llvm/IR/VFABIDemangler.h b/llvm/include/llvm/IR/VFABIDemangler.h
index 936f52a3671b8..0b287987665ec 100644
--- a/llvm/include/llvm/IR/VFABIDemangler.h
+++ b/llvm/include/llvm/IR/VFABIDemangler.h
@@ -13,11 +13,11 @@
#ifndef LLVM_IR_VFABIDEMANGLER_H
#define LLVM_IR_VFABIDEMANGLER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/Alignment.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/TypeSize.h"
namespace llvm {
@@ -182,7 +182,7 @@ static constexpr char const *_LLVM_Scalarize_ = "_LLVM_Scalarize_";
/// it needs to be derived from the widest element types of vector arguments
/// or return values.
LLVM_ABI std::optional<VFInfo> tryDemangleForVFABI(StringRef MangledName,
- const FunctionType *FTy);
+ const FunctionType *FTy);
/// Retrieve the `VFParamKind` from a string token.
LLVM_ABI VFParamKind getVFParamKindFromString(const StringRef Token);
@@ -195,8 +195,9 @@ static constexpr char const *MappingsAttrName = "vector-function-abi-variant";
/// vector-function-abi-variant attribute, we return without populating
/// VariantMappings, i.e. callers of getVectorVariantNames need not check for
/// the presence of the attribute (see InjectTLIMappings).
-LLVM_ABI void getVectorVariantNames(const CallInst &CI,
- SmallVectorImpl<std::string> &VariantMappings);
+LLVM_ABI void
+getVectorVariantNames(const CallInst &CI,
+ SmallVectorImpl<std::string> &VariantMappings);
/// Constructs a FunctionType by applying vector function information to the
/// type of a matching scalar function.
@@ -206,11 +207,12 @@ LLVM_ABI void getVectorVariantNames(const CallInst &CI,
/// stored in \p Info.
/// \returns a pointer to a newly created vector FunctionType
LLVM_ABI FunctionType *createFunctionType(const VFInfo &Info,
- const FunctionType *ScalarFTy);
+ const FunctionType *ScalarFTy);
/// Overwrite the Vector Function ABI variants attribute with the names provide
/// in \p VariantMappings.
-LLVM_ABI void setVectorVariantNames(CallInst *CI, ArrayRef<std::string> VariantMappings);
+LLVM_ABI void setVectorVariantNames(CallInst *CI,
+ ArrayRef<std::string> VariantMappings);
} // end namespace VFABI
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index bc4c4052a9034..04d0391c04098 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -13,7 +13,6 @@
#ifndef LLVM_IR_VALUE_H
#define LLVM_IR_VALUE_H
-#include "llvm/Support/Compiler.h"
#include "llvm-c/Types.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -22,6 +21,7 @@
#include "llvm/Support/Alignment.h"
#include "llvm/Support/CBindingWrapping.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
#include <iterator>
#include <memory>
@@ -236,7 +236,7 @@ class Value {
/// @{
LLVM_ABI void print(raw_ostream &O, bool IsForDebug = false) const;
LLVM_ABI void print(raw_ostream &O, ModuleSlotTracker &MST,
- bool IsForDebug = false) const;
+ bool IsForDebug = false) const;
/// @}
/// Print the name of this Value out to the specified raw_ostream.
@@ -247,9 +247,9 @@ class Value {
/// pointer is printed symbolically.
/// @{
LLVM_ABI void printAsOperand(raw_ostream &O, bool PrintType = true,
- const Module *M = nullptr) const;
+ const Module *M = nullptr) const;
LLVM_ABI void printAsOperand(raw_ostream &O, bool PrintType,
- ModuleSlotTracker &MST) const;
+ ModuleSlotTracker &MST) const;
/// @}
/// All values are typed, get the type of this value.
@@ -310,8 +310,8 @@ class Value {
/// to "V" if the callback ShouldReplace returns true for the given Use.
/// Unlike replaceAllUsesWith() this function does not support basic block
/// values.
- LLVM_ABI void replaceUsesWithIf(Value *New,
- llvm::function_ref<bool(Use &U)> ShouldReplace);
+ LLVM_ABI void
+ replaceUsesWithIf(Value *New, llvm::function_ref<bool(Use &U)> ShouldReplace);
/// replaceUsesOutsideBlock - Go through the uses list for this definition and
/// make each use point to "V" instead of "this" when the use is outside the
@@ -488,8 +488,9 @@ class Value {
/// some Droppable uses pervent it.
/// This function optionally takes a filter to only remove some droppable
/// uses.
- LLVM_ABI void dropDroppableUses(llvm::function_ref<bool(const Use *)> ShouldDrop =
- [](const Use *) { return true; });
+ LLVM_ABI void
+ dropDroppableUses(llvm::function_ref<bool(const Use *)> ShouldDrop =
+ [](const Use *) { return true; });
/// Remove every use of this value in \p User that can safely be removed.
LLVM_ABI void dropDroppableUsesIn(User &Usr);
@@ -584,8 +585,10 @@ class Value {
/// If the Value has no attachments with the given ID, or if ID is invalid,
/// leaves MDs unchanged.
/// @{
- LLVM_ABI void getMetadata(unsigned KindID, SmallVectorImpl<MDNode *> &MDs) const;
- LLVM_ABI void getMetadata(StringRef Kind, SmallVectorImpl<MDNode *> &MDs) const;
+ LLVM_ABI void getMetadata(unsigned KindID,
+ SmallVectorImpl<MDNode *> &MDs) const;
+ LLVM_ABI void getMetadata(StringRef Kind,
+ SmallVectorImpl<MDNode *> &MDs) const;
/// @}
/// Appends all metadata attached to this value to \c MDs, sorting by
@@ -768,8 +771,8 @@ class Value {
///
/// Returns the original pointer value. If this is called on a non-pointer
/// value, it returns 'this'.
- LLVM_ABI const Value *stripInBoundsOffsets(function_ref<void(const Value *)> Func =
- [](const Value *) {}) const;
+ LLVM_ABI const Value *stripInBoundsOffsets(
+ function_ref<void(const Value *)> Func = [](const Value *) {}) const;
inline Value *stripInBoundsOffsets(function_ref<void(const Value *)> Func =
[](const Value *) {}) {
return const_cast<Value *>(
@@ -778,8 +781,8 @@ class Value {
/// If this ptr is provably equal to \p Other plus a constant offset, return
/// that offset in bytes. Essentially `ptr this` subtract `ptr Other`.
- LLVM_ABI std::optional<int64_t> getPointerOffsetFrom(const Value *Other,
- const DataLayout &DL) const;
+ LLVM_ABI std::optional<int64_t>
+ getPointerOffsetFrom(const Value *Other, const DataLayout &DL) const;
/// Return true if the memory object referred to by V can by freed in the
/// scope for which the SSA value defining the allocation is statically
@@ -797,8 +800,8 @@ class Value {
/// point of definition only. Caller must prove that allocation is not
/// deallocated between point of definition and use.
LLVM_ABI uint64_t getPointerDereferenceableBytes(const DataLayout &DL,
- bool &CanBeNull,
- bool &CanBeFreed) const;
+ bool &CanBeNull,
+ bool &CanBeFreed) const;
/// Returns an alignment of the pointer value.
///
@@ -813,7 +816,7 @@ class Value {
/// useful if you want to know the value something has in a predecessor
/// block.
LLVM_ABI const Value *DoPHITranslation(const BasicBlock *CurBB,
- const BasicBlock *PredBB) const;
+ const BasicBlock *PredBB) const;
Value *DoPHITranslation(const BasicBlock *CurBB, const BasicBlock *PredBB) {
return const_cast<Value *>(
static_cast<const Value *>(this)->DoPHITranslation(CurBB, PredBB));
diff --git a/llvm/include/llvm/IR/ValueHandle.h b/llvm/include/llvm/IR/ValueHandle.h
index 4cb27fb29ac18..05555bd5efb1b 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -13,11 +13,11 @@
#ifndef LLVM_IR_VALUEHANDLE_H
#define LLVM_IR_VALUEHANDLE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Compiler.h"
#include <cassert>
namespace llvm {
diff --git a/llvm/include/llvm/IR/ValueSymbolTable.h b/llvm/include/llvm/IR/ValueSymbolTable.h
index fe92ccb42315d..b792ee64a02e6 100644
--- a/llvm/include/llvm/IR/ValueSymbolTable.h
+++ b/llvm/include/llvm/IR/ValueSymbolTable.h
@@ -13,10 +13,10 @@
#ifndef LLVM_IR_VALUESYMBOLTABLE_H
#define LLVM_IR_VALUESYMBOLTABLE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Value.h"
+#include "llvm/Support/Compiler.h"
#include <cstdint>
namespace llvm {
@@ -94,9 +94,9 @@ class ValueSymbolTable {
/// Print out symbol table on stderr
LLVM_ABI void dump() const;
-/// @}
-/// @name Iteration
-/// @{
+ /// @}
+ /// @name Iteration
+ /// @{
/// Get an iterator that from the beginning of the symbol table.
inline iterator begin() { return vmap.begin(); }
diff --git a/llvm/include/llvm/IR/VectorBuilder.h b/llvm/include/llvm/IR/VectorBuilder.h
index efe12a3159e29..bc23842d8e6bd 100644
--- a/llvm/include/llvm/IR/VectorBuilder.h
+++ b/llvm/include/llvm/IR/VectorBuilder.h
@@ -102,8 +102,8 @@ class VectorBuilder {
// \p ReturnTy The return type of the operation.
// \p VecOpArray The operand list.
LLVM_ABI Value *createVectorInstruction(unsigned Opcode, Type *ReturnTy,
- ArrayRef<Value *> VecOpArray,
- const Twine &Name = Twine());
+ ArrayRef<Value *> VecOpArray,
+ const Twine &Name = Twine());
/// Emit a VP reduction intrinsic call for recurrence kind.
/// \param RdxID The intrinsic ID of llvm.vector.reduce.*
@@ -111,8 +111,8 @@ class VectorBuilder {
/// performed.
/// \param VecOpArray The operand list.
LLVM_ABI Value *createSimpleReduction(Intrinsic::ID RdxID, Type *ValTy,
- ArrayRef<Value *> VecOpArray,
- const Twine &Name = Twine());
+ ArrayRef<Value *> VecOpArray,
+ const Twine &Name = Twine());
};
} // namespace llvm
diff --git a/llvm/include/llvm/IR/VectorTypeUtils.h b/llvm/include/llvm/IR/VectorTypeUtils.h
index eb2271f9e2dad..e3d7fadad6089 100644
--- a/llvm/include/llvm/IR/VectorTypeUtils.h
+++ b/llvm/include/llvm/IR/VectorTypeUtils.h
@@ -9,8 +9,8 @@
#ifndef LLVM_IR_VECTORTYPEUTILS_H
#define LLVM_IR_VECTORTYPEUTILS_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/DerivedTypes.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
diff --git a/llvm/include/llvm/IR/Verifier.h b/llvm/include/llvm/IR/Verifier.h
index a3c95a9d04b14..8dbb9c8a41d7e 100644
--- a/llvm/include/llvm/IR/Verifier.h
+++ b/llvm/include/llvm/IR/Verifier.h
@@ -20,9 +20,9 @@
#ifndef LLVM_IR_VERIFIER_H
#define LLVM_IR_VERIFIER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
#include <utility>
namespace llvm {
@@ -99,7 +99,7 @@ LLVM_ABI bool verifyFunction(const Function &F, raw_ostream *OS = nullptr);
/// error and instead *BrokenDebugInfo will be set to true. Debug
/// info errors can be "recovered" from by stripping the debug info.
LLVM_ABI bool verifyModule(const Module &M, raw_ostream *OS = nullptr,
- bool *BrokenDebugInfo = nullptr);
+ bool *BrokenDebugInfo = nullptr);
LLVM_ABI FunctionPass *createVerifierPass(bool FatalErrors = true);
diff --git a/llvm/include/llvm/IRPrinter/IRPrintingPasses.h b/llvm/include/llvm/IRPrinter/IRPrintingPasses.h
index a1168ecc3e23e..0d5dd1124733e 100644
--- a/llvm/include/llvm/IRPrinter/IRPrintingPasses.h
+++ b/llvm/include/llvm/IRPrinter/IRPrintingPasses.h
@@ -18,8 +18,8 @@
#ifndef LLVM_IRPRINTER_IRPRINTINGPASSES_H
#define LLVM_IRPRINTER_IRPRINTINGPASSES_H
-#include "llvm/Support/Compiler.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/Support/Compiler.h"
#include <string>
namespace llvm {
@@ -39,8 +39,8 @@ class PrintModulePass : public PassInfoMixin<PrintModulePass> {
public:
LLVM_ABI PrintModulePass();
LLVM_ABI PrintModulePass(raw_ostream &OS, const std::string &Banner = "",
- bool ShouldPreserveUseListOrder = false,
- bool EmitSummaryIndex = false);
+ bool ShouldPreserveUseListOrder = false,
+ bool EmitSummaryIndex = false);
LLVM_ABI PreservedAnalyses run(Module &M, AnalysisManager<Module> &);
static bool isRequired() { return true; }
diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h
index e5f704d4bfe9a..790140f19934e 100644
--- a/llvm/include/llvm/IRReader/IRReader.h
+++ b/llvm/include/llvm/IRReader/IRReader.h
@@ -14,9 +14,9 @@
#ifndef LLVM_IRREADER_IRREADER_H
#define LLVM_IRREADER_IRREADER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitcode/BitcodeReader.h"
+#include "llvm/Support/Compiler.h"
#include <memory>
namespace llvm {
@@ -33,9 +33,9 @@ class LLVMContext;
/// Module. The ShouldLazyLoadMetadata flag is passed down to the bitcode
/// reader to optionally enable lazy metadata loading. This takes ownership
/// of \p Buffer.
-LLVM_ABI std::unique_ptr<Module> getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer,
- SMDiagnostic &Err, LLVMContext &Context,
- bool ShouldLazyLoadMetadata = false);
+LLVM_ABI std::unique_ptr<Module>
+getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
+ LLVMContext &Context, bool ShouldLazyLoadMetadata = false);
/// If the given file holds a bitcode image, return a Module
/// for it which does lazy deserialization of function bodies. Otherwise,
@@ -50,17 +50,19 @@ getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
/// for it. Otherwise, attempt to parse it as LLVM Assembly and return
/// a Module for it.
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
-LLVM_ABI std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer, SMDiagnostic &Err,
- LLVMContext &Context,
- ParserCallbacks Callbacks = {});
+LLVM_ABI std::unique_ptr<Module> parseIR(MemoryBufferRef Buffer,
+ SMDiagnostic &Err,
+ LLVMContext &Context,
+ ParserCallbacks Callbacks = {});
/// If the given file holds a bitcode image, return a Module for it.
/// Otherwise, attempt to parse it as LLVM Assembly and return a Module
/// for it.
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
-LLVM_ABI std::unique_ptr<Module> parseIRFile(StringRef Filename, SMDiagnostic &Err,
- LLVMContext &Context,
- ParserCallbacks Callbacks = {});
+LLVM_ABI std::unique_ptr<Module> parseIRFile(StringRef Filename,
+ SMDiagnostic &Err,
+ LLVMContext &Context,
+ ParserCallbacks Callbacks = {});
}
#endif
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index e91078acbc9e8..628f062580fa5 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -42,9 +42,9 @@ STATISTIC(NumInstrRenumberings, "Number of renumberings across all blocks");
// that might be needed to remove debug intrinsics.
//
// https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578
-LLVM_ABI cl::opt<bool> UseNewDbgInfoFormat(
- "dont-pass-this-flag-please-experimental-debuginfo", cl::Hidden,
- cl::init(true));
+LLVM_ABI cl::opt<bool>
+ UseNewDbgInfoFormat("dont-pass-this-flag-please-experimental-debuginfo",
+ cl::Hidden, cl::init(true));
// This cl-opt collects the --experimental-debuginfo-iterators flag and then
// does nothing with it (because the it gets stored into an otherwise unused
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index 6f9425bb51a64..2b9b0f958a171 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugProgramInstruction.h"
#include "llvm/IR/DIBuilder.h"
+#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/Compiler.h"
diff --git a/llvm/lib/IR/Dominators.cpp b/llvm/lib/IR/Dominators.cpp
index 7b3c6901357e6..e1e88bb2aaff5 100644
--- a/llvm/lib/IR/Dominators.cpp
+++ b/llvm/lib/IR/Dominators.cpp
@@ -72,42 +72,54 @@ bool BasicBlockEdge::isSingleEdge() const {
//===----------------------------------------------------------------------===//
template class LLVM_EXPORT_TEMPLATE llvm::DomTreeNodeBase<BasicBlock>;
-template class LLVM_EXPORT_TEMPLATE llvm::DominatorTreeBase<BasicBlock, false>; // DomTreeBase
-template class LLVM_EXPORT_TEMPLATE llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
+template class LLVM_EXPORT_TEMPLATE
+ llvm::DominatorTreeBase<BasicBlock, false>; // DomTreeBase
+template class LLVM_EXPORT_TEMPLATE
+ llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
template class llvm::cfg::Update<BasicBlock *>;
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT);
template LLVM_EXPORT_TEMPLATE void
llvm::DomTreeBuilder::CalculateWithUpdates<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, BBUpdates U);
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::Calculate<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT);
// No CalculateWithUpdates<PostDomTree> instantiation, unless a usecase arises.
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, BasicBlock *From, BasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::InsertEdge<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT, BasicBlock *From, BasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, BasicBlock *From, BasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::DeleteEdge<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT, BasicBlock *From, BasicBlock *To);
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBDomTree>(
DomTreeBuilder::BBDomTree &DT, DomTreeBuilder::BBDomTreeGraphDiff &,
DomTreeBuilder::BBDomTreeGraphDiff *);
-template LLVM_EXPORT_TEMPLATE void llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE void
+llvm::DomTreeBuilder::ApplyUpdates<DomTreeBuilder::BBPostDomTree>(
DomTreeBuilder::BBPostDomTree &DT, DomTreeBuilder::BBPostDomTreeGraphDiff &,
DomTreeBuilder::BBPostDomTreeGraphDiff *);
-template LLVM_EXPORT_TEMPLATE bool llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBDomTree>(
+template LLVM_EXPORT_TEMPLATE bool
+llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBDomTree>(
const DomTreeBuilder::BBDomTree &DT,
DomTreeBuilder::BBDomTree::VerificationLevel VL);
-template LLVM_EXPORT_TEMPLATE bool llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBPostDomTree>(
+template LLVM_EXPORT_TEMPLATE bool
+llvm::DomTreeBuilder::Verify<DomTreeBuilder::BBPostDomTree>(
const DomTreeBuilder::BBPostDomTree &DT,
DomTreeBuilder::BBPostDomTree::VerificationLevel VL);
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 35555c74fd5bd..9606bb0e3048e 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -488,7 +488,8 @@ Attribute CallBase::getFnAttrOnCalledFunction(AK Kind) const {
template LLVM_ABI Attribute
CallBase::getFnAttrOnCalledFunction(Attribute::AttrKind Kind) const;
-template LLVM_ABI Attribute CallBase::getFnAttrOnCalledFunction(StringRef Kind) const;
+template LLVM_ABI Attribute
+CallBase::getFnAttrOnCalledFunction(StringRef Kind) const;
template <typename AK>
Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
@@ -500,11 +501,10 @@ Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
return Attribute();
}
+template LLVM_ABI Attribute CallBase::getParamAttrOnCalledFunction(
+ unsigned ArgNo, Attribute::AttrKind Kind) const;
template LLVM_ABI Attribute
-CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
- Attribute::AttrKind Kind) const;
-template LLVM_ABI Attribute CallBase::getParamAttrOnCalledFunction(unsigned ArgNo,
- StringRef Kind) const;
+CallBase::getParamAttrOnCalledFunction(unsigned ArgNo, StringRef Kind) const;
void CallBase::getOperandBundlesAsDefs(
SmallVectorImpl<OperandBundleDef> &Defs) const {
diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp
index 9741bfef01674..132a8c8d19d8a 100644
--- a/llvm/lib/IR/Module.cpp
+++ b/llvm/lib/IR/Module.cpp
@@ -38,8 +38,8 @@
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/Compiler.h"
#include "llvm/Support/CodeGen.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp
index ef1c744724c77..af22b779ddbb0 100644
--- a/llvm/lib/IR/PassManager.cpp
+++ b/llvm/lib/IR/PassManager.cpp
@@ -23,8 +23,10 @@ template class LLVM_EXPORT_TEMPLATE PassManager<Module>;
template class LLVM_EXPORT_TEMPLATE PassManager<Function>;
template class LLVM_EXPORT_TEMPLATE AnalysisManager<Module>;
template class LLVM_EXPORT_TEMPLATE AnalysisManager<Function>;
-template class LLVM_EXPORT_TEMPLATE InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>;
-template class LLVM_EXPORT_TEMPLATE OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
+template class LLVM_EXPORT_TEMPLATE
+ InnerAnalysisManagerProxy<FunctionAnalysisManager, Module>;
+template class LLVM_EXPORT_TEMPLATE
+ OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>;
template <>
bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
diff --git a/llvm/unittests/IR/InstructionsTest.cpp b/llvm/unittests/IR/InstructionsTest.cpp
index e9227f6d8c4ac..acf169278a9fd 100644
--- a/llvm/unittests/IR/InstructionsTest.cpp
+++ b/llvm/unittests/IR/InstructionsTest.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/IR/Instructions.h"
+#include "llvm-c/Core.h"
#include "llvm/ADT/CombinationGenerator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Analysis/ValueTracking.h"
@@ -28,7 +29,6 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SourceMgr.h"
-#include "llvm-c/Core.h"
#include "gmock/gmock-matchers.h"
#include "gtest/gtest.h"
#include <memory>
More information about the llvm-commits
mailing list