Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/include/llvm/Analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(LLVM_TARGET_DEFINITIONS TargetLibraryInfo.td)
tablegen(LLVM TargetLibraryInfo.inc -gen-target-library-info)
add_public_tablegen_target(analysis_gen)
2,698 changes: 0 additions & 2,698 deletions llvm/include/llvm/Analysis/TargetLibraryInfo.def

This file was deleted.

24 changes: 13 additions & 11 deletions llvm/include/llvm/Analysis/TargetLibraryInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define LLVM_ANALYSIS_TARGETLIBRARYINFO_H

#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringTable.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Module.h"
Expand Down Expand Up @@ -69,13 +70,8 @@ class VecDesc {
LLVM_ABI std::string getVectorFunctionABIVariantString() const;
};

enum LibFunc : unsigned {
#define TLI_DEFINE_ENUM
#include "llvm/Analysis/TargetLibraryInfo.def"

NumLibFuncs,
NotLibFunc
};
#define GET_TARGET_LIBRARY_INFO_ENUM
#include "llvm/Analysis/TargetLibraryInfo.inc"

/// Implementation of the target library information.
///
Expand All @@ -88,7 +84,8 @@ class TargetLibraryInfoImpl {

unsigned char AvailableArray[(NumLibFuncs+3)/4];
DenseMap<unsigned, std::string> CustomNames;
LLVM_ABI static StringLiteral const StandardNames[NumLibFuncs];
#define GET_TARGET_LIBRARY_INFO_IMPL_DECL
#include "llvm/Analysis/TargetLibraryInfo.inc"
bool ShouldExtI32Param, ShouldExtI32Return, ShouldSignExtI32Param, ShouldSignExtI32Return;
unsigned SizeOfInt;

Expand Down Expand Up @@ -177,7 +174,8 @@ class TargetLibraryInfoImpl {
/// Forces a function to be marked as available and provide an alternate name
/// that must be used.
void setAvailableWithName(LibFunc F, StringRef Name) {
if (StandardNames[F] != Name) {
if (StringRef(StandardNamesStrTable.getCString(StandardNamesOffsets[F]),
StandardNamesSizeTable[F]) != Name) {
setState(F, CustomName);
CustomNames[F] = std::string(Name);
assert(CustomNames.contains(F));
Expand Down Expand Up @@ -455,15 +453,19 @@ class TargetLibraryInfo {
/// Return the canonical name for a LibFunc. This should not be used for
/// semantic purposes, use getName instead.
static StringRef getStandardName(LibFunc F) {
return TargetLibraryInfoImpl::StandardNames[F];
return StringRef(TargetLibraryInfoImpl::StandardNamesStrTable.getCString(
TargetLibraryInfoImpl::StandardNamesOffsets[F]),
TargetLibraryInfoImpl::StandardNamesSizeTable[F]);
}

StringRef getName(LibFunc F) const {
auto State = getState(F);
if (State == TargetLibraryInfoImpl::Unavailable)
return StringRef();
if (State == TargetLibraryInfoImpl::StandardName)
return Impl->StandardNames[F];
return StringRef(
Impl->StandardNamesStrTable.getCString(Impl->StandardNamesOffsets[F]),
Impl->StandardNamesSizeTable[F]);
assert(State == TargetLibraryInfoImpl::CustomName);
return Impl->CustomNames.find(F)->second;
}
Expand Down
Loading
Loading