ARM .code directive should always go to the streamer.
authorJim Grosbach <grosbach@apple.com>
Tue, 6 Sep 2011 18:46:23 +0000 (18:46 +0000)
committerJim Grosbach <grosbach@apple.com>
Tue, 6 Sep 2011 18:46:23 +0000 (18:46 +0000)
Even if there's no mode switch performed, the .code directive should still
be sent to the output streamer. Otherwise, for example, an output asm stream
is not equivalent to the input stream which generated it (a dependency on
the input target triple arm vs. thumb is introduced which was not originally
there).

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

lib/Target/ARM/AsmParser/ARMAsmParser.cpp

index 0c4bbac4f699fb41ea023a815472e0cb8e429d20..6668fc9f557eb36b071ae9c1deffa96bf62acc3b 100644 (file)
@@ -3797,15 +3797,13 @@ bool ARMAsmParser::parseDirectiveCode(SMLoc L) {
   Parser.Lex();
 
   if (Val == 16) {
-    if (!isThumb()) {
+    if (!isThumb())
       SwitchMode();
-      getParser().getStreamer().EmitAssemblerFlag(MCAF_Code16);
-    }
+    getParser().getStreamer().EmitAssemblerFlag(MCAF_Code16);
   } else {
-    if (isThumb()) {
+    if (isThumb())
       SwitchMode();
-      getParser().getStreamer().EmitAssemblerFlag(MCAF_Code32);
-    }
+    getParser().getStreamer().EmitAssemblerFlag(MCAF_Code32);
   }
 
   return false;