OSDN Git Service

Fix translation of instruction "move" in ARM integrated assembler.
authorKarl Schimpf <kschimpf@google.com>
Mon, 16 Nov 2015 20:38:12 +0000 (12:38 -0800)
committerKarl Schimpf <kschimpf@google.com>
Mon, 16 Nov 2015 20:38:12 +0000 (12:38 -0800)
Fixes case where the ARM integrated assembler for class InstARM32Mov
did not revert to using the stand-alone assembler (method emit) to
generate the corresponding assembly instructions(s).

This fixes last known problem with method emitIAS (other than
reverting to the stand-alone assembler if not implemented). Removes
use of workaround flag "-unsafe-ias".

BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4334
R=stichnot@chromium.org

Review URL: https://codereview.chromium.org/1448783004 .

12 files changed:
src/IceClFlags.cpp
src/IceClFlags.h
src/IceInstARM32.cpp
tests_lit/assembler/arm32/bic.ll
tests_lit/assembler/arm32/branch-mult-fwd.ll
tests_lit/assembler/arm32/load-store.ll
tests_lit/assembler/arm32/mov-const.ll
tests_lit/assembler/arm32/mov-imm.ll
tests_lit/assembler/arm32/mul.ll
tests_lit/assembler/arm32/push-pop.ll
tests_lit/assembler/arm32/store-sf.ll
tests_lit/assembler/arm32/uxtb.ll

index fedd422..6966210 100644 (file)
@@ -50,12 +50,6 @@ cl::opt<bool> AllowIacaMarks(
              "inserted. These binaries are not executable."),
     cl::init(false));
 
-cl::opt<bool> AllowUnsafeIas(
-    "unsafe-ias",
-    cl::desc("Convert (potentially broken) instructions to bytes in "
-             "integrated assembler."),
-    cl::init(false));
-
 // This is currently needed by crosstest.py.
 cl::opt<bool> AllowUninitializedGlobals(
     "allow-uninitialized-globals",
@@ -390,7 +384,6 @@ void ClFlags::resetClFlags(ClFlags &OutFlags) {
   OutFlags.AllowErrorRecovery = false;
   OutFlags.AllowExternDefinedSymbols = false;
   OutFlags.AllowIacaMarks = false;
-  OutFlags.AllowUnsafeIas = false;
   OutFlags.AllowUninitializedGlobals = false;
   OutFlags.DataSections = false;
   OutFlags.DecorateAsm = false;
@@ -465,7 +458,6 @@ void ClFlags::getParsedClFlags(ClFlags &OutFlags) {
   OutFlags.setDisableInternal(::DisableInternal);
   OutFlags.setDisableIRGeneration(::DisableIRGeneration);
   OutFlags.setDisableTranslation(::DisableTranslation);
-  OutFlags.setAllowUnsafeIas(::AllowUnsafeIas);
   OutFlags.setDumpStats(::DumpStats);
   OutFlags.setEnableBlockProfile(::EnableBlockProfile);
   OutFlags.setForceMemIntrinOpt(::ForceMemIntrinOpt);
index 6683df4..1072bd0 100644 (file)
@@ -49,9 +49,6 @@ public:
   bool getAllowIacaMarks() const { return AllowIacaMarks; }
   void setAllowIacaMarks(bool NewValue) { AllowIacaMarks = NewValue; }
 
-  bool getAllowUnsafeIas() const { return AllowUnsafeIas; }
-  void setAllowUnsafeIas(bool NewValue) { AllowUnsafeIas = NewValue; }
-
   bool getAllowUninitializedGlobals() const {
     return AllowUninitializedGlobals;
   }
@@ -259,9 +256,6 @@ private:
   bool AllowExternDefinedSymbols;
   bool AllowIacaMarks;
   bool AllowUninitializedGlobals;
-  // TODO(kschimpf): This is a temporary flag. Nuke this once the ARM integrated
-  // assembler is working.
-  bool AllowUnsafeIas;
   bool DataSections;
   bool DecorateAsm;
   bool DisableHybridAssembly;
index 5507b63..f8f6b4f 100644 (file)
@@ -777,7 +777,6 @@ void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const {
       return Asm->setNeedsTextFixup();
     return Asm->str(Src0, Dest, getPredicate(), Func->getTarget());
   }
-  Asm->setNeedsTextFixup();
 }
 
 void InstARM32Mov::emit(const Cfg *Func) const {
@@ -798,14 +797,13 @@ void InstARM32Mov::emit(const Cfg *Func) const {
 }
 
 void InstARM32Mov::emitIAS(const Cfg *Func) const {
-  if (!Func->getContext()->getFlags().getAllowUnsafeIas())
-    return emitUsingTextFixup(Func);
   assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type.");
   auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>();
-  if (!(isMultiDest() || isMultiSource())) {
+  if (!(isMultiDest() || isMultiSource()))
     // Must be single source/dest.
     emitIASSingleDestSingleSource(Func);
-  }
+  else
+    Asm->setNeedsTextFixup();
   if (Asm->needsTextFixup())
     emitUsingTextFixup(Func);
 }
index 3977b2a..8d50c27 100644 (file)
 ; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
 ; RUN:   | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -O2 -unsafe-ias | FileCheck %s --check-prefix=DIS
+; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
 
 define internal i32 @AllocBigAlign() {
   %addr = alloca i8, align 32
index 05a4758..344d55c 100644 (file)
@@ -9,12 +9,12 @@
 ; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \
 ; RUN:   | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -Om1 -unsafe-ias | FileCheck %s --check-prefix=DIS
+; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
 
 ; REQUIRES: allow_dump
 
index bca5c92..2dcd886 100644 (file)
 ; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \
 ; RUN:   | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -Om1 -unsafe-ias | FileCheck %s --check-prefix=DIS
+; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
 
 define internal i32 @add1ToR0(i32 %p) {
   %v = add i32 %p, 1
index 05b1d7a..4d732b4 100644 (file)
 ; RUN:   --args -Om1 --test-stack-extra 4084 | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \
 ; RUN:   --test-stack-extra 4084 | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -Om1 -unsafe-ias --test-stack-extra 4084 \
+; RUN:   --args -Om1 --test-stack-extra 4084 \
 ; RUN:   | FileCheck %s --check-prefix=DIS
 
 define internal i32 @foo(i32 %x) {
index cbd7bb6..d7c97e3 100644 (file)
 ; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
 ; RUN:   | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -O2 -unsafe-ias | FileCheck %s --check-prefix=DIS
+; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
 
 define internal i32 @Imm1() {
   ret i32 1
index 23791cf..0923376 100644 (file)
 ; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
 ; RUN:   | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -O2 -unsafe-ias | FileCheck %s --check-prefix=DIS
+; RUN:   --args -O2 | FileCheck %s --check-prefix=DIS
 
 define internal i32 @MulTwoRegs(i32 %a, i32 %b) {
   %v = mul i32 %a, %b
index 629da02..a61496c 100644 (file)
 ; RUN:   --args -O2 -allow-extern | FileCheck %s --check-prefix=DIS
 
 ; Compile using integrated assembler.
-; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 -unsafe-ias \
+; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -O2 \
 ; RUN:   -allow-extern | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -O2 -unsafe-ias -allow-extern | FileCheck %s --check-prefix=DIS
+; RUN:   --args -O2 -allow-extern | FileCheck %s --check-prefix=DIS
 
 declare external void @DoSomething()
 
index 27901f4..49de98e 100644 (file)
 
 ; Compile using integrated assembler.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --args -Om1 \
-; RUN:   -unsafe-ias | FileCheck %s --check-prefix=IASM
+; RUN:   | FileCheck %s --check-prefix=IASM
 
 ; Show bytes in assembled integrated code.
 ; RUN: %p2i --filetype=iasm -i %s --target=arm32 --assemble --disassemble \
-; RUN:   --args -Om1 -unsafe-ias | FileCheck %s --check-prefix=DIS
+; RUN:   --args -Om1 | FileCheck %s --check-prefix=DIS
 
 define internal void @test_vla_in_loop(i32 %n) {
 ; ASM-LABEL: test_vla_in_loop:
index df2d4dc..fb17eaa 100644 (file)
@@ -73,7 +73,11 @@ entry:
 
 ; ASM-NEXT:     mov     r0, r1
 ; DIS-NEXT:   10:       e1a00001
-; IASM-NEXT:    mov     r0, r1
+; IASM-NEXT:    .byte 0x1
+; IASM-NEXT:    .byte 0x0
+; IASM-NEXT:    .byte 0xa0
+; IASM-NEXT:    .byte 0xe1
+
 
 ; ASM-NEXT:     bx      lr
 ; DIS-NEXT:   14:       e12fff1e