[llvm-commits] [llvm] r118859 - in /llvm/trunk/lib/Target/ARM: ARMAsmBackend.cpp ARMMCCodeEmitter.cpp
Jim Grosbach
grosbach at apple.com
Thu Nov 11 15:41:09 PST 2010
Author: grosbach
Date: Thu Nov 11 17:41:09 2010
New Revision: 118859
URL: http://llvm.org/viewvc/llvm-project?rev=118859&view=rev
Log:
Start of support for binary emit of 16-it Thumb instructions.
Modified:
llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp?rev=118859&r1=118858&r2=118859&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmBackend.cpp Thu Nov 11 17:41:09 2010
@@ -56,10 +56,14 @@
}
bool ARMAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const {
- if ((Count % 4) != 0) {
- // Fixme: % 2 for Thumb?
- return false;
- }
+// if ((Count % 4) != 0) {
+// // Fixme: % 2 for Thumb?
+// return false;
+// }
+ // FIXME: Zero fill for now. That's not right, but at least will get the
+ // section size right.
+ for (uint64_t i = 0; i != Count; ++i)
+ OW->Write8(0);
return true;
}
} // end anonymous namespace
Modified: llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp?rev=118859&r1=118858&r2=118859&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMMCCodeEmitter.cpp Thu Nov 11 17:41:09 2010
@@ -608,10 +608,17 @@
SmallVectorImpl<MCFixup> &Fixups) const {
// Pseudo instructions don't get encoded.
const TargetInstrDesc &Desc = TII.get(MI.getOpcode());
- if ((Desc.TSFlags & ARMII::FormMask) == ARMII::Pseudo)
+ uint64_t TSFlags = Desc.TSFlags;
+ if ((TSFlags & ARMII::FormMask) == ARMII::Pseudo)
return;
-
- EmitConstant(getBinaryCodeForInstr(MI, Fixups), 4, OS);
+ int Size;
+ // Basic size info comes from the TSFlags field.
+ switch ((TSFlags & ARMII::SizeMask) >> ARMII::SizeShift) {
+ default: llvm_unreachable("Unexpected instruction size!");
+ case ARMII::Size2Bytes: Size = 2; break;
+ case ARMII::Size4Bytes: Size = 4; break;
+ }
+ EmitConstant(getBinaryCodeForInstr(MI, Fixups), Size, OS);
++MCNumEmitted; // Keep track of the # of mi's emitted.
}
More information about the llvm-commits
mailing list