[llvm-commits] [llvm] r162781 - in /llvm/trunk: test/Object/Mips/ test/Object/Mips/dext-test.elf-mips64r2 test/Object/Mips/feature.test tools/llvm-objdump/llvm-objdump.cpp
Jack Carter
jcarter at mips.com
Tue Aug 28 12:24:50 PDT 2012
Author: jacksprat
Date: Tue Aug 28 14:24:49 2012
New Revision: 162781
URL: http://llvm.org/viewvc/llvm-project?rev=162781&view=rev
Log:
Some of the instructions in the Mips instruction set are revision
delimited. llvm-mc -disassemble access these through the -mattr
option.
llvm-objdump -disassemble had no such way to set the attribute so
some instructions were just not recognized for disassembly.
This patch accepts llvm-mc mechanism for specifying the attributes.
Added:
llvm/trunk/test/Object/Mips/
llvm/trunk/test/Object/Mips/dext-test.elf-mips64r2 (with props)
llvm/trunk/test/Object/Mips/feature.test
Modified:
llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
Added: llvm/trunk/test/Object/Mips/dext-test.elf-mips64r2
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Mips/dext-test.elf-mips64r2?rev=162781&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/Object/Mips/dext-test.elf-mips64r2
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: llvm/trunk/test/Object/Mips/feature.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Mips/feature.test?rev=162781&view=auto
==============================================================================
--- llvm/trunk/test/Object/Mips/feature.test (added)
+++ llvm/trunk/test/Object/Mips/feature.test Tue Aug 28 14:24:49 2012
@@ -0,0 +1,11 @@
+RUN: llvm-objdump -disassemble -triple mips64el -mattr +mips64r2 %p/dext-test.elf-mips64r2 \
+RUN: | FileCheck %s
+
+CHECK: Disassembly of section .text:
+CHECK: .text:
+CHECK: 0: 08 00 e0 03 jr $ra
+CHECK: 4: 43 49 82 7c dext $2, $4, 5, 10
+CHECK: 8: 08 00 e0 03 jr $ra
+CHECK: c: 83 28 82 7c dext $2, $4, 2, 6
+CHECK: 10: 08 00 e0 03 jr $ra
+CHECK: 14: 43 09 82 7c dext $2, $4, 5, 2
Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=162781&r1=162780&r2=162781&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Tue Aug 28 14:24:49 2012
@@ -94,6 +94,12 @@
SectionHeadersShorter("h", cl::desc("Alias for --section-headers"),
cl::aliasopt(SectionHeaders));
+static cl::list<std::string>
+MAttrs("mattr",
+ cl::CommaSeparated,
+ cl::desc("Target specific attributes"),
+ cl::value_desc("a1,+a2,-a3,..."));
+
static StringRef ToolName;
static bool error(error_code ec) {
@@ -169,6 +175,15 @@
if (!TheTarget)
return;
+ // 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();
+ }
+
error_code ec;
for (section_iterator i = Obj->begin_sections(),
e = Obj->end_sections();
@@ -233,7 +248,7 @@
}
OwningPtr<const MCSubtargetInfo> STI(
- TheTarget->createMCSubtargetInfo(TripleName, "", ""));
+ TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
if (!STI) {
errs() << "error: no subtarget info for target " << TripleName << "\n";
More information about the llvm-commits
mailing list