mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Remove 'static' from inline functions defined in header files.
There is a pretty staggering amount of this in LLVM's header files, this is not all of the instances I'm afraid. These include all of the functions that (in my build) are used by a non-static inline (or external) function. Specifically, these issues were caught by the new '-Winternal-linkage-in-inline' warning. I'll try to just clean up the remainder of the clearly redundant "static inline" cases on functions (not methods!) defined within headers if I can do so in a reliable way. There were even several cases of a missing 'inline' altogether, or my personal favorite "static bool inline". Go figure. ;] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158800 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -59,7 +59,7 @@ struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
|
|||||||
// for_each(V.begin(), B.end(), deleter<Interval>);
|
// for_each(V.begin(), B.end(), deleter<Interval>);
|
||||||
//
|
//
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline void deleter(T *Ptr) {
|
inline void deleter(T *Ptr) {
|
||||||
delete Ptr;
|
delete Ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ inline size_t array_lengthof(T (&)[N]) {
|
|||||||
/// array_pod_sort_comparator - This is helper function for array_pod_sort,
|
/// array_pod_sort_comparator - This is helper function for array_pod_sort,
|
||||||
/// which just uses operator< on T.
|
/// which just uses operator< on T.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static inline int array_pod_sort_comparator(const void *P1, const void *P2) {
|
inline int array_pod_sort_comparator(const void *P1, const void *P2) {
|
||||||
if (*reinterpret_cast<const T*>(P1) < *reinterpret_cast<const T*>(P2))
|
if (*reinterpret_cast<const T*>(P1) < *reinterpret_cast<const T*>(P2))
|
||||||
return -1;
|
return -1;
|
||||||
if (*reinterpret_cast<const T*>(P2) < *reinterpret_cast<const T*>(P1))
|
if (*reinterpret_cast<const T*>(P2) < *reinterpret_cast<const T*>(P1))
|
||||||
@@ -249,7 +249,7 @@ static inline int array_pod_sort_comparator(const void *P1, const void *P2) {
|
|||||||
/// get_array_pad_sort_comparator - This is an internal helper function used to
|
/// get_array_pad_sort_comparator - This is an internal helper function used to
|
||||||
/// get type deduction of T right.
|
/// get type deduction of T right.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static int (*get_array_pad_sort_comparator(const T &))
|
inline int (*get_array_pad_sort_comparator(const T &))
|
||||||
(const void*, const void*) {
|
(const void*, const void*) {
|
||||||
return array_pod_sort_comparator<T>;
|
return array_pod_sort_comparator<T>;
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ static int (*get_array_pad_sort_comparator(const T &))
|
|||||||
/// NOTE: If qsort_r were portable, we could allow a custom comparator and
|
/// NOTE: If qsort_r were portable, we could allow a custom comparator and
|
||||||
/// default to std::less.
|
/// default to std::less.
|
||||||
template<class IteratorTy>
|
template<class IteratorTy>
|
||||||
static inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
|
inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
|
||||||
// Don't dereference start iterator of empty sequence.
|
// Don't dereference start iterator of empty sequence.
|
||||||
if (Start == End) return;
|
if (Start == End) return;
|
||||||
qsort(&*Start, End-Start, sizeof(*Start),
|
qsort(&*Start, End-Start, sizeof(*Start),
|
||||||
@@ -278,7 +278,7 @@ static inline void array_pod_sort(IteratorTy Start, IteratorTy End) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class IteratorTy>
|
template<class IteratorTy>
|
||||||
static inline void array_pod_sort(IteratorTy Start, IteratorTy End,
|
inline void array_pod_sort(IteratorTy Start, IteratorTy End,
|
||||||
int (*Compare)(const void*, const void*)) {
|
int (*Compare)(const void*, const void*)) {
|
||||||
// Don't dereference start iterator of empty sequence.
|
// Don't dereference start iterator of empty sequence.
|
||||||
if (Start == End) return;
|
if (Start == End) return;
|
||||||
|
@@ -152,7 +152,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<BasicBlock>);
|
|||||||
EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
|
EXTERN_TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
|
||||||
|
|
||||||
template<class NodeT>
|
template<class NodeT>
|
||||||
static raw_ostream &operator<<(raw_ostream &o,
|
inline raw_ostream &operator<<(raw_ostream &o,
|
||||||
const DomTreeNodeBase<NodeT> *Node) {
|
const DomTreeNodeBase<NodeT> *Node) {
|
||||||
if (Node->getBlock())
|
if (Node->getBlock())
|
||||||
WriteAsOperand(o, Node->getBlock(), false);
|
WriteAsOperand(o, Node->getBlock(), false);
|
||||||
@@ -165,7 +165,7 @@ static raw_ostream &operator<<(raw_ostream &o,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<class NodeT>
|
template<class NodeT>
|
||||||
static void PrintDomTree(const DomTreeNodeBase<NodeT> *N, raw_ostream &o,
|
inline void PrintDomTree(const DomTreeNodeBase<NodeT> *N, raw_ostream &o,
|
||||||
unsigned Lev) {
|
unsigned Lev) {
|
||||||
o.indent(2*Lev) << "[" << Lev << "] " << N;
|
o.indent(2*Lev) << "[" << Lev << "] " << N;
|
||||||
for (typename DomTreeNodeBase<NodeT>::const_iterator I = N->begin(),
|
for (typename DomTreeNodeBase<NodeT>::const_iterator I = N->begin(),
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static void RemoveFromVector(std::vector<T*> &V, T *N) {
|
inline void RemoveFromVector(std::vector<T*> &V, T *N) {
|
||||||
typename std::vector<T*>::iterator I = std::find(V.begin(), V.end(), N);
|
typename std::vector<T*>::iterator I = std::find(V.begin(), V.end(), N);
|
||||||
assert(I != V.end() && "N is not in this list!");
|
assert(I != V.end() && "N is not in this list!");
|
||||||
V.erase(I);
|
V.erase(I);
|
||||||
|
@@ -71,8 +71,8 @@ namespace llvm {
|
|||||||
/// isBitcodeWrapper - Return true if the given bytes are the magic bytes
|
/// isBitcodeWrapper - Return true if the given bytes are the magic bytes
|
||||||
/// for an LLVM IR bitcode wrapper.
|
/// for an LLVM IR bitcode wrapper.
|
||||||
///
|
///
|
||||||
static inline bool isBitcodeWrapper(const unsigned char *BufPtr,
|
inline bool isBitcodeWrapper(const unsigned char *BufPtr,
|
||||||
const unsigned char *BufEnd) {
|
const unsigned char *BufEnd) {
|
||||||
// See if you can find the hidden message in the magic bytes :-).
|
// See if you can find the hidden message in the magic bytes :-).
|
||||||
// (Hint: it's a little-endian encoding.)
|
// (Hint: it's a little-endian encoding.)
|
||||||
return BufPtr != BufEnd &&
|
return BufPtr != BufEnd &&
|
||||||
@@ -85,8 +85,8 @@ namespace llvm {
|
|||||||
/// isRawBitcode - Return true if the given bytes are the magic bytes for
|
/// isRawBitcode - Return true if the given bytes are the magic bytes for
|
||||||
/// raw LLVM IR bitcode (without a wrapper).
|
/// raw LLVM IR bitcode (without a wrapper).
|
||||||
///
|
///
|
||||||
static inline bool isRawBitcode(const unsigned char *BufPtr,
|
inline bool isRawBitcode(const unsigned char *BufPtr,
|
||||||
const unsigned char *BufEnd) {
|
const unsigned char *BufEnd) {
|
||||||
// These bytes sort of have a hidden message, but it's not in
|
// These bytes sort of have a hidden message, but it's not in
|
||||||
// little-endian this time, and it's a little redundant.
|
// little-endian this time, and it's a little redundant.
|
||||||
return BufPtr != BufEnd &&
|
return BufPtr != BufEnd &&
|
||||||
@@ -99,8 +99,8 @@ namespace llvm {
|
|||||||
/// isBitcode - Return true if the given bytes are the magic bytes for
|
/// isBitcode - Return true if the given bytes are the magic bytes for
|
||||||
/// LLVM IR bitcode, either with or without a wrapper.
|
/// LLVM IR bitcode, either with or without a wrapper.
|
||||||
///
|
///
|
||||||
static bool inline isBitcode(const unsigned char *BufPtr,
|
inline bool isBitcode(const unsigned char *BufPtr,
|
||||||
const unsigned char *BufEnd) {
|
const unsigned char *BufEnd) {
|
||||||
return isBitcodeWrapper(BufPtr, BufEnd) ||
|
return isBitcodeWrapper(BufPtr, BufEnd) ||
|
||||||
isRawBitcode(BufPtr, BufEnd);
|
isRawBitcode(BufPtr, BufEnd);
|
||||||
}
|
}
|
||||||
@@ -121,9 +121,9 @@ namespace llvm {
|
|||||||
/// BC file.
|
/// BC file.
|
||||||
/// If 'VerifyBufferSize' is true, check that the buffer is large enough to
|
/// If 'VerifyBufferSize' is true, check that the buffer is large enough to
|
||||||
/// contain the whole bitcode file.
|
/// contain the whole bitcode file.
|
||||||
static inline bool SkipBitcodeWrapperHeader(const unsigned char *&BufPtr,
|
inline bool SkipBitcodeWrapperHeader(const unsigned char *&BufPtr,
|
||||||
const unsigned char *&BufEnd,
|
const unsigned char *&BufEnd,
|
||||||
bool VerifyBufferSize) {
|
bool VerifyBufferSize) {
|
||||||
enum {
|
enum {
|
||||||
KnownHeaderSize = 4*4, // Size of header we read.
|
KnownHeaderSize = 4*4, // Size of header we read.
|
||||||
OffsetField = 2*4, // Offset in bytes to Offset field.
|
OffsetField = 2*4, // Offset in bytes to Offset field.
|
||||||
|
@@ -43,14 +43,14 @@ bool finalizeBundles(MachineFunction &MF);
|
|||||||
|
|
||||||
/// getBundleStart - Returns the first instruction in the bundle containing MI.
|
/// getBundleStart - Returns the first instruction in the bundle containing MI.
|
||||||
///
|
///
|
||||||
static inline MachineInstr *getBundleStart(MachineInstr *MI) {
|
inline MachineInstr *getBundleStart(MachineInstr *MI) {
|
||||||
MachineBasicBlock::instr_iterator I = MI;
|
MachineBasicBlock::instr_iterator I = MI;
|
||||||
while (I->isInsideBundle())
|
while (I->isInsideBundle())
|
||||||
--I;
|
--I;
|
||||||
return I;
|
return I;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const MachineInstr *getBundleStart(const MachineInstr *MI) {
|
inline const MachineInstr *getBundleStart(const MachineInstr *MI) {
|
||||||
MachineBasicBlock::const_instr_iterator I = MI;
|
MachineBasicBlock::const_instr_iterator I = MI;
|
||||||
while (I->isInsideBundle())
|
while (I->isInsideBundle())
|
||||||
--I;
|
--I;
|
||||||
|
@@ -701,7 +701,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(AtomicRMWInst, Value)
|
|||||||
// checkGEPType - Simple wrapper function to give a better assertion failure
|
// checkGEPType - Simple wrapper function to give a better assertion failure
|
||||||
// message on bad indexes for a gep instruction.
|
// message on bad indexes for a gep instruction.
|
||||||
//
|
//
|
||||||
static inline Type *checkGEPType(Type *Ty) {
|
inline Type *checkGEPType(Type *Ty) {
|
||||||
assert(Ty && "Invalid GetElementPtrInst indices for type!");
|
assert(Ty && "Invalid GetElementPtrInst indices for type!");
|
||||||
return Ty;
|
return Ty;
|
||||||
}
|
}
|
||||||
|
@@ -76,13 +76,13 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool operator ==(const DataRefImpl &a, const DataRefImpl &b) {
|
inline bool operator ==(const DataRefImpl &a, const DataRefImpl &b) {
|
||||||
// Check bitwise identical. This is the only legal way to compare a union w/o
|
// Check bitwise identical. This is the only legal way to compare a union w/o
|
||||||
// knowing which member is in use.
|
// knowing which member is in use.
|
||||||
return std::memcmp(&a, &b, sizeof(DataRefImpl)) == 0;
|
return std::memcmp(&a, &b, sizeof(DataRefImpl)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool operator <(const DataRefImpl &a, const DataRefImpl &b) {
|
inline bool operator <(const DataRefImpl &a, const DataRefImpl &b) {
|
||||||
// Check bitwise identical. This is the only legal way to compare a union w/o
|
// Check bitwise identical. This is the only legal way to compare a union w/o
|
||||||
// knowing which member is in use.
|
// knowing which member is in use.
|
||||||
return std::memcmp(&a, &b, sizeof(DataRefImpl)) < 0;
|
return std::memcmp(&a, &b, sizeof(DataRefImpl)) < 0;
|
||||||
|
@@ -57,7 +57,7 @@ struct AlignOf {
|
|||||||
/// class besides some cosmetic cleanliness. Example usage:
|
/// class besides some cosmetic cleanliness. Example usage:
|
||||||
/// alignOf<int>() returns the alignment of an int.
|
/// alignOf<int>() returns the alignment of an int.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline unsigned alignOf() { return AlignOf<T>::Alignment; }
|
inline unsigned alignOf() { return AlignOf<T>::Alignment; }
|
||||||
|
|
||||||
|
|
||||||
/// \brief Helper for building an aligned character array type.
|
/// \brief Helper for building an aligned character array type.
|
||||||
|
@@ -49,7 +49,7 @@ struct alignment_access_helper<value_type, unaligned>
|
|||||||
|
|
||||||
namespace endian {
|
namespace endian {
|
||||||
template<typename value_type, alignment align>
|
template<typename value_type, alignment align>
|
||||||
static value_type read_le(const void *memory) {
|
inline value_type read_le(const void *memory) {
|
||||||
value_type t =
|
value_type t =
|
||||||
reinterpret_cast<const detail::alignment_access_helper
|
reinterpret_cast<const detail::alignment_access_helper
|
||||||
<value_type, align> *>(memory)->val;
|
<value_type, align> *>(memory)->val;
|
||||||
@@ -59,7 +59,7 @@ namespace endian {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename value_type, alignment align>
|
template<typename value_type, alignment align>
|
||||||
static void write_le(void *memory, value_type value) {
|
inline void write_le(void *memory, value_type value) {
|
||||||
if (sys::isBigEndianHost())
|
if (sys::isBigEndianHost())
|
||||||
value = sys::SwapByteOrder(value);
|
value = sys::SwapByteOrder(value);
|
||||||
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
|
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
|
||||||
@@ -67,7 +67,7 @@ namespace endian {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename value_type, alignment align>
|
template<typename value_type, alignment align>
|
||||||
static value_type read_be(const void *memory) {
|
inline value_type read_be(const void *memory) {
|
||||||
value_type t =
|
value_type t =
|
||||||
reinterpret_cast<const detail::alignment_access_helper
|
reinterpret_cast<const detail::alignment_access_helper
|
||||||
<value_type, align> *>(memory)->val;
|
<value_type, align> *>(memory)->val;
|
||||||
@@ -77,7 +77,7 @@ namespace endian {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename value_type, alignment align>
|
template<typename value_type, alignment align>
|
||||||
static void write_be(void *memory, value_type value) {
|
inline void write_be(void *memory, value_type value) {
|
||||||
if (sys::isLittleEndianHost())
|
if (sys::isLittleEndianHost())
|
||||||
value = sys::SwapByteOrder(value);
|
value = sys::SwapByteOrder(value);
|
||||||
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
|
reinterpret_cast<detail::alignment_access_helper<value_type, align> *>
|
||||||
|
@@ -414,14 +414,14 @@ int IsInf(double d);
|
|||||||
|
|
||||||
/// MinAlign - A and B are either alignments or offsets. Return the minimum
|
/// MinAlign - A and B are either alignments or offsets. Return the minimum
|
||||||
/// alignment that may be assumed after adding the two together.
|
/// alignment that may be assumed after adding the two together.
|
||||||
static inline uint64_t MinAlign(uint64_t A, uint64_t B) {
|
inline uint64_t MinAlign(uint64_t A, uint64_t B) {
|
||||||
// The largest power of 2 that divides both A and B.
|
// The largest power of 2 that divides both A and B.
|
||||||
return (A | B) & -(A | B);
|
return (A | B) & -(A | B);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// NextPowerOf2 - Returns the next power of two (in 64-bits)
|
/// NextPowerOf2 - Returns the next power of two (in 64-bits)
|
||||||
/// that is strictly greater than A. Returns zero on overflow.
|
/// that is strictly greater than A. Returns zero on overflow.
|
||||||
static inline uint64_t NextPowerOf2(uint64_t A) {
|
inline uint64_t NextPowerOf2(uint64_t A) {
|
||||||
A |= (A >> 1);
|
A |= (A >> 1);
|
||||||
A |= (A >> 2);
|
A |= (A >> 2);
|
||||||
A |= (A >> 4);
|
A |= (A >> 4);
|
||||||
|
@@ -481,17 +481,17 @@ namespace X86II {
|
|||||||
// getBaseOpcodeFor - This function returns the "base" X86 opcode for the
|
// getBaseOpcodeFor - This function returns the "base" X86 opcode for the
|
||||||
// specified machine instruction.
|
// specified machine instruction.
|
||||||
//
|
//
|
||||||
static inline unsigned char getBaseOpcodeFor(uint64_t TSFlags) {
|
inline unsigned char getBaseOpcodeFor(uint64_t TSFlags) {
|
||||||
return TSFlags >> X86II::OpcodeShift;
|
return TSFlags >> X86II::OpcodeShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool hasImm(uint64_t TSFlags) {
|
inline bool hasImm(uint64_t TSFlags) {
|
||||||
return (TSFlags & X86II::ImmMask) != 0;
|
return (TSFlags & X86II::ImmMask) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getSizeOfImm - Decode the "size of immediate" field from the TSFlags field
|
/// getSizeOfImm - Decode the "size of immediate" field from the TSFlags field
|
||||||
/// of the specified instruction.
|
/// of the specified instruction.
|
||||||
static inline unsigned getSizeOfImm(uint64_t TSFlags) {
|
inline unsigned getSizeOfImm(uint64_t TSFlags) {
|
||||||
switch (TSFlags & X86II::ImmMask) {
|
switch (TSFlags & X86II::ImmMask) {
|
||||||
default: llvm_unreachable("Unknown immediate size");
|
default: llvm_unreachable("Unknown immediate size");
|
||||||
case X86II::Imm8:
|
case X86II::Imm8:
|
||||||
@@ -506,7 +506,7 @@ namespace X86II {
|
|||||||
|
|
||||||
/// isImmPCRel - Return true if the immediate of the specified instruction's
|
/// isImmPCRel - Return true if the immediate of the specified instruction's
|
||||||
/// TSFlags indicates that it is pc relative.
|
/// TSFlags indicates that it is pc relative.
|
||||||
static inline unsigned isImmPCRel(uint64_t TSFlags) {
|
inline unsigned isImmPCRel(uint64_t TSFlags) {
|
||||||
switch (TSFlags & X86II::ImmMask) {
|
switch (TSFlags & X86II::ImmMask) {
|
||||||
default: llvm_unreachable("Unknown immediate size");
|
default: llvm_unreachable("Unknown immediate size");
|
||||||
case X86II::Imm8PCRel:
|
case X86II::Imm8PCRel:
|
||||||
@@ -529,7 +529,7 @@ namespace X86II {
|
|||||||
/// is duplicated in the MCInst (e.g. "EAX = addl EAX, [mem]") it is only
|
/// is duplicated in the MCInst (e.g. "EAX = addl EAX, [mem]") it is only
|
||||||
/// counted as one operand.
|
/// counted as one operand.
|
||||||
///
|
///
|
||||||
static inline int getMemoryOperandNo(uint64_t TSFlags, unsigned Opcode) {
|
inline int getMemoryOperandNo(uint64_t TSFlags, unsigned Opcode) {
|
||||||
switch (TSFlags & X86II::FormMask) {
|
switch (TSFlags & X86II::FormMask) {
|
||||||
case X86II::MRMInitReg:
|
case X86II::MRMInitReg:
|
||||||
// FIXME: Remove this form.
|
// FIXME: Remove this form.
|
||||||
@@ -591,7 +591,7 @@ namespace X86II {
|
|||||||
|
|
||||||
/// isX86_64ExtendedReg - Is the MachineOperand a x86-64 extended (r8 or
|
/// isX86_64ExtendedReg - Is the MachineOperand a x86-64 extended (r8 or
|
||||||
/// higher) register? e.g. r8, xmm8, xmm13, etc.
|
/// higher) register? e.g. r8, xmm8, xmm13, etc.
|
||||||
static inline bool isX86_64ExtendedReg(unsigned RegNo) {
|
inline bool isX86_64ExtendedReg(unsigned RegNo) {
|
||||||
switch (RegNo) {
|
switch (RegNo) {
|
||||||
default: break;
|
default: break;
|
||||||
case X86::R8: case X86::R9: case X86::R10: case X86::R11:
|
case X86::R8: case X86::R9: case X86::R10: case X86::R11:
|
||||||
@@ -613,7 +613,7 @@ namespace X86II {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isX86_64NonExtLowByteReg(unsigned reg) {
|
inline bool isX86_64NonExtLowByteReg(unsigned reg) {
|
||||||
return (reg == X86::SPL || reg == X86::BPL ||
|
return (reg == X86::SPL || reg == X86::BPL ||
|
||||||
reg == X86::SIL || reg == X86::DIL);
|
reg == X86::SIL || reg == X86::DIL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user