Skip to content

Commit

Permalink
Revert [llvm-nm] Add tapi file support
Browse files Browse the repository at this point in the history
This reverts r371576 (git commit f88f463)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371676 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
cyndyishida committed Sep 11, 2019
1 parent f4c5861 commit c50052e
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 298 deletions.
3 changes: 0 additions & 3 deletions include/llvm/Object/TapiFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class TapiFile : public SymbolicFile {

static bool classof(const Binary *v) { return v->isTapiFile(); }

bool is64Bit() { return MachO::is64Bit(Arch); }

private:
struct Symbol {
StringRef Prefix;
Expand All @@ -54,7 +52,6 @@ class TapiFile : public SymbolicFile {
};

std::vector<Symbol> Symbols;
MachO::Architecture Arch;
};

} // end namespace object.
Expand Down
26 changes: 13 additions & 13 deletions include/llvm/TextAPI/MachO/Architecture.def
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@
///
/// X86 architectures sorted by cpu type and sub type id.
///
ARCHINFO(i386, MachO::CPU_TYPE_I386, MachO::CPU_SUBTYPE_I386_ALL, 32)
ARCHINFO(x86_64, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_ALL, 64)
ARCHINFO(x86_64h, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_H, 64)
ARCHINFO(i386, MachO::CPU_TYPE_I386, MachO::CPU_SUBTYPE_I386_ALL)
ARCHINFO(x86_64, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_ALL)
ARCHINFO(x86_64h, MachO::CPU_TYPE_X86_64, MachO::CPU_SUBTYPE_X86_64_H)


///
/// ARM architectures sorted by cpu sub type id.
///
ARCHINFO(armv4t, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V4T, 32)
ARCHINFO(armv6, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6, 32)
ARCHINFO(armv5, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V5TEJ, 32)
ARCHINFO(armv7, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7, 32)
ARCHINFO(armv7s, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7S, 32)
ARCHINFO(armv7k, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7K, 32)
ARCHINFO(armv6m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6M, 32)
ARCHINFO(armv7m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7M, 32)
ARCHINFO(armv7em, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7EM, 32)
ARCHINFO(armv4t, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V4T)
ARCHINFO(armv6, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6)
ARCHINFO(armv5, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V5TEJ)
ARCHINFO(armv7, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7)
ARCHINFO(armv7s, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7S)
ARCHINFO(armv7k, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7K)
ARCHINFO(armv6m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V6M)
ARCHINFO(armv7m, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7M)
ARCHINFO(armv7em, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7EM)


///
/// ARM64 architectures sorted by cpu sub type id.
///
ARCHINFO(arm64, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64_ALL, 64)
ARCHINFO(arm64, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64_ALL)
5 changes: 1 addition & 4 deletions include/llvm/TextAPI/MachO/Architecture.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace MachO {

/// Defines the architecture slices that are supported by Text-based Stub files.
enum Architecture : uint8_t {
#define ARCHINFO(Arch, Type, SubType, NumBits) AK_##Arch,
#define ARCHINFO(Arch, Type, SubType) AK_##Arch,
#include "llvm/TextAPI/MachO/Architecture.def"
#undef ARCHINFO
AK_unknown, // this has to go last.
Expand All @@ -39,9 +39,6 @@ StringRef getArchitectureName(Architecture Arch);
/// Convert an architecture slice to a CPU Type and Subtype pair.
std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch);

/// Check if architecture is 64 bit
bool is64Bit(Architecture);

raw_ostream &operator<<(raw_ostream &OS, Architecture Arch);

} // end namespace MachO.
Expand Down
2 changes: 1 addition & 1 deletion lib/Object/TapiFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static uint32_t getFlags(const Symbol *Sym) {

TapiFile::TapiFile(MemoryBufferRef Source, const InterfaceFile &interface,
Architecture Arch)
: SymbolicFile(ID_TapiFile, Source), Arch(Arch) {
: SymbolicFile(ID_TapiFile, Source) {
for (const auto *Symbol : interface.symbols()) {
if (!Symbol->getArchitectures().has(Arch))
continue;
Expand Down
25 changes: 4 additions & 21 deletions lib/TextAPI/MachO/Architecture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
//===----------------------------------------------------------------------===//

#include "llvm/TextAPI/MachO/Architecture.h"
#include "llvm/TextAPI/MachO/ArchitectureSet.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/MachO.h"

namespace llvm {
namespace MachO {

Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType) {
#define ARCHINFO(Arch, Type, Subtype, NumBits) \
#define ARCHINFO(Arch, Type, Subtype) \
if (CPUType == (Type) && \
(CPUSubType & ~MachO::CPU_SUBTYPE_MASK) == (Subtype)) \
return AK_##Arch;
Expand All @@ -31,15 +30,15 @@ Architecture getArchitectureFromCpuType(uint32_t CPUType, uint32_t CPUSubType) {

Architecture getArchitectureFromName(StringRef Name) {
return StringSwitch<Architecture>(Name)
#define ARCHINFO(Arch, Type, Subtype, NumBits) .Case(#Arch, AK_##Arch)
#define ARCHINFO(Arch, Type, Subtype) .Case(#Arch, AK_##Arch)
#include "llvm/TextAPI/MachO/Architecture.def"
#undef ARCHINFO
.Default(AK_unknown);
}

StringRef getArchitectureName(Architecture Arch) {
switch (Arch) {
#define ARCHINFO(Arch, Type, Subtype, NumBits) \
#define ARCHINFO(Arch, Type, Subtype) \
case AK_##Arch: \
return #Arch;
#include "llvm/TextAPI/MachO/Architecture.def"
Expand All @@ -55,7 +54,7 @@ StringRef getArchitectureName(Architecture Arch) {

std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch) {
switch (Arch) {
#define ARCHINFO(Arch, Type, Subtype, NumBits) \
#define ARCHINFO(Arch, Type, Subtype) \
case AK_##Arch: \
return std::make_pair(Type, Subtype);
#include "llvm/TextAPI/MachO/Architecture.def"
Expand All @@ -69,22 +68,6 @@ std::pair<uint32_t, uint32_t> getCPUTypeFromArchitecture(Architecture Arch) {
return std::make_pair(0, 0);
}

bool is64Bit(Architecture Arch) {
switch (Arch) {
#define ARCHINFO(Arch, Type, Subtype, NumBits) \
case AK_##Arch: \
return NumBits == 64;
#include "llvm/TextAPI/MachO/Architecture.def"
#undef ARCHINFO
case AK_unknown:
return false;
}

// Appease some compilers that cannot figure out that this is a fully covered
// switch statement.
return false;
}

raw_ostream &operator<<(raw_ostream &OS, Architecture Arch) {
OS << getArchitectureName(Arch);
return OS;
Expand Down
2 changes: 1 addition & 1 deletion lib/TextAPI/MachO/TextStubCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ QuotingType ScalarTraits<PlatformKind>::mustQuote(StringRef) {

void ScalarBitSetTraits<ArchitectureSet>::bitset(IO &IO,
ArchitectureSet &Archs) {
#define ARCHINFO(arch, type, subtype, numbits) \
#define ARCHINFO(arch, type, subtype) \
IO.bitSetCase(Archs, #arch, 1U << static_cast<int>(AK_##arch));
#include "llvm/TextAPI/MachO/Architecture.def"
#undef ARCHINFO
Expand Down
21 changes: 0 additions & 21 deletions test/Object/Inputs/tapi-invalid-v1.tbd

This file was deleted.

29 changes: 0 additions & 29 deletions test/Object/Inputs/tapi-invalid-v2.tbd

This file was deleted.

24 changes: 0 additions & 24 deletions test/Object/Inputs/tapi-invalid-v3.tbd

This file was deleted.

21 changes: 0 additions & 21 deletions test/Object/Inputs/tapi-v1.tbd

This file was deleted.

30 changes: 0 additions & 30 deletions test/Object/Inputs/tapi-v2.tbd

This file was deleted.

24 changes: 0 additions & 24 deletions test/Object/Inputs/tapi-v3.tbd

This file was deleted.

20 changes: 0 additions & 20 deletions test/Object/nm-tapi-invalids.test

This file was deleted.

56 changes: 0 additions & 56 deletions test/Object/nm-tapi.test

This file was deleted.

Loading

0 comments on commit c50052e

Please sign in to comment.