mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 14:10:41 +00:00
Add the -mcpu= option to llvm-objdump for use with the disassemblers.
Also make the disassembler created with the Mach-O parser (the -m option) pick up the Target specific attributes specified with -mattr option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215032 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
41d6599bb1
commit
75d423feed
5
test/tools/llvm-objdump/macho-mattr-arm.test
Normal file
5
test/tools/llvm-objdump/macho-mattr-arm.test
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
@ RUN: llvm-mc < %s -triple armv8-apple-darwin10 -mattr=+fp-armv8 -filetype=obj -o - | llvm-objdump -d -m -mattr=+fp-armv8 - | FileCheck %s
|
||||||
|
|
||||||
|
vcvtt.f64.f16 d3, s1
|
||||||
|
|
||||||
|
@ CHECK: e0 3b b2 ee vcvtt.f64.f16 d3, s1
|
10
test/tools/llvm-objdump/macho-mcpu-arm.test
Normal file
10
test/tools/llvm-objdump/macho-mcpu-arm.test
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
@ RUN: llvm-mc < %s -triple thumbv7-apple-darwin -mcpu=cortex-a7 -filetype=obj | llvm-objdump -triple thumbv7-apple-darwin10 -m -d -mcpu=cortex-a7 - | FileCheck %s
|
||||||
|
|
||||||
|
.thumb
|
||||||
|
.thumb_func _t
|
||||||
|
_t:
|
||||||
|
sdiv r1, r2, r3
|
||||||
|
udiv r1, r2, r3
|
||||||
|
|
||||||
|
@ CHECK: 92 fb f3 f1 sdiv r1, r2, r3
|
||||||
|
@ CHECK: b2 fb f3 f1 udiv r1, r2, r3
|
@ -220,13 +220,22 @@ static void DisassembleInputMachO2(StringRef Filename,
|
|||||||
std::unique_ptr<MCInstrAnalysis> InstrAnalysis(
|
std::unique_ptr<MCInstrAnalysis> InstrAnalysis(
|
||||||
TheTarget->createMCInstrAnalysis(InstrInfo.get()));
|
TheTarget->createMCInstrAnalysis(InstrInfo.get()));
|
||||||
|
|
||||||
|
// Package up features to be passed to target/subtarget
|
||||||
|
std::string FeaturesStr;
|
||||||
|
if (MAttrs.size()) {
|
||||||
|
SubtargetFeatures Features;
|
||||||
|
for (unsigned i = 0; i != MAttrs.size(); ++i)
|
||||||
|
Features.AddFeature(MAttrs[i]);
|
||||||
|
FeaturesStr = Features.getString();
|
||||||
|
}
|
||||||
|
|
||||||
// Set up disassembler.
|
// Set up disassembler.
|
||||||
std::unique_ptr<const MCRegisterInfo> MRI(
|
std::unique_ptr<const MCRegisterInfo> MRI(
|
||||||
TheTarget->createMCRegInfo(TripleName));
|
TheTarget->createMCRegInfo(TripleName));
|
||||||
std::unique_ptr<const MCAsmInfo> AsmInfo(
|
std::unique_ptr<const MCAsmInfo> AsmInfo(
|
||||||
TheTarget->createMCAsmInfo(*MRI, TripleName));
|
TheTarget->createMCAsmInfo(*MRI, TripleName));
|
||||||
std::unique_ptr<const MCSubtargetInfo> STI(
|
std::unique_ptr<const MCSubtargetInfo> STI(
|
||||||
TheTarget->createMCSubtargetInfo(TripleName, "", ""));
|
TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
|
||||||
MCContext Ctx(AsmInfo.get(), MRI.get(), nullptr);
|
MCContext Ctx(AsmInfo.get(), MRI.get(), nullptr);
|
||||||
std::unique_ptr<const MCDisassembler> DisAsm(
|
std::unique_ptr<const MCDisassembler> DisAsm(
|
||||||
TheTarget->createMCDisassembler(*STI, Ctx));
|
TheTarget->createMCDisassembler(*STI, Ctx));
|
||||||
|
@ -93,6 +93,12 @@ cl::opt<std::string>
|
|||||||
llvm::TripleName("triple", cl::desc("Target triple to disassemble for, "
|
llvm::TripleName("triple", cl::desc("Target triple to disassemble for, "
|
||||||
"see -version for available targets"));
|
"see -version for available targets"));
|
||||||
|
|
||||||
|
cl::opt<std::string>
|
||||||
|
llvm::MCPU("mcpu",
|
||||||
|
cl::desc("Target a specific cpu type (-mcpu=help for details)"),
|
||||||
|
cl::value_desc("cpu-name"),
|
||||||
|
cl::init(""));
|
||||||
|
|
||||||
cl::opt<std::string>
|
cl::opt<std::string>
|
||||||
llvm::ArchName("arch", cl::desc("Target arch to disassemble for, "
|
llvm::ArchName("arch", cl::desc("Target arch to disassemble for, "
|
||||||
"see -version for available targets"));
|
"see -version for available targets"));
|
||||||
@ -107,8 +113,8 @@ static cl::alias
|
|||||||
SectionHeadersShorter("h", cl::desc("Alias for --section-headers"),
|
SectionHeadersShorter("h", cl::desc("Alias for --section-headers"),
|
||||||
cl::aliasopt(SectionHeaders));
|
cl::aliasopt(SectionHeaders));
|
||||||
|
|
||||||
static cl::list<std::string>
|
cl::list<std::string>
|
||||||
MAttrs("mattr",
|
llvm::MAttrs("mattr",
|
||||||
cl::CommaSeparated,
|
cl::CommaSeparated,
|
||||||
cl::desc("Target specific attributes"),
|
cl::desc("Target specific attributes"),
|
||||||
cl::value_desc("a1,+a2,-a3,..."));
|
cl::value_desc("a1,+a2,-a3,..."));
|
||||||
@ -303,7 +309,7 @@ static void DisassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<const MCSubtargetInfo> STI(
|
std::unique_ptr<const MCSubtargetInfo> STI(
|
||||||
TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
|
TheTarget->createMCSubtargetInfo(TripleName, MCPU, FeaturesStr));
|
||||||
if (!STI) {
|
if (!STI) {
|
||||||
errs() << "error: no subtarget info for target " << TripleName << "\n";
|
errs() << "error: no subtarget info for target " << TripleName << "\n";
|
||||||
return;
|
return;
|
||||||
|
@ -25,6 +25,8 @@ namespace object {
|
|||||||
|
|
||||||
extern cl::opt<std::string> TripleName;
|
extern cl::opt<std::string> TripleName;
|
||||||
extern cl::opt<std::string> ArchName;
|
extern cl::opt<std::string> ArchName;
|
||||||
|
extern cl::opt<std::string> MCPU;
|
||||||
|
extern cl::list<std::string> MAttrs;
|
||||||
|
|
||||||
// Various helper functions.
|
// Various helper functions.
|
||||||
bool error(std::error_code ec);
|
bool error(std::error_code ec);
|
||||||
|
Loading…
Reference in New Issue
Block a user