Simplify the EncodeInstruction method now that a lot of the special case stuff
authorBill Wendling <isanbard@gmail.com>
Tue, 2 Nov 2010 22:44:12 +0000 (22:44 +0000)
committerBill Wendling <isanbard@gmail.com>
Tue, 2 Nov 2010 22:44:12 +0000 (22:44 +0000)
is handled with the MC encoder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118098 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMMCCodeEmitter.cpp

index bc16fe04c389876b0931257430f13b7ab19184ea..86c9330e3031cd6f3daf1b5f95e3335d816262de 100644 (file)
@@ -323,22 +323,15 @@ unsigned ARMMCCodeEmitter::getAddrMode6OffsetOpValue(const MCInst &MI,
 void ARMMCCodeEmitter::
 EncodeInstruction(const MCInst &MI, raw_ostream &OS,
                   SmallVectorImpl<MCFixup> &Fixups) const {
-  unsigned Opcode = MI.getOpcode();
-  const TargetInstrDesc &Desc = TII.get(Opcode);
-  uint64_t TSFlags = Desc.TSFlags;
-  // Keep track of the current byte being emitted.
-  unsigned CurByte = 0;
-
   // Pseudo instructions don't get encoded.
-  if ((TSFlags & ARMII::FormMask) == ARMII::Pseudo)
+  const TargetInstrDesc &Desc = TII.get(MI.getOpcode());
+  if ((Desc.TSFlags & ARMII::FormMask) == ARMII::Pseudo)
     return;
 
-  ++MCNumEmitted;  // Keep track of the # of mi's emitted
-  unsigned Value = getBinaryCodeForInstr(MI);
-  switch (Opcode) {
-  default: break;
-  }
-  EmitConstant(Value, 4, CurByte, OS);
+  // Keep track of the current byte being emitted.
+  unsigned CurByte = 0;
+  EmitConstant(getBinaryCodeForInstr(MI), 4, CurByte, OS);
+  ++MCNumEmitted;  // Keep track of the # of mi's emitted.
 }
 
 // FIXME: These #defines shouldn't be necessary. Instead, tblgen should