[PATCH] [asan-asm-instrumentation] Fixed memory references which includes %rsp as a base or an index register.

Evgeniy Stepanov eugenis at google.com
Tue Oct 7 13:37:26 PDT 2014


================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:302
@@ -307,2 +301,3 @@
 
-  virtual void StoreFlags(MCStreamer &Out) override {
+  virtual void StoreReg(MCStreamer &Out, unsigned Reg) {
+    EmitInstruction(Out, MCInstBuilder(X86::PUSH32r).addReg(Reg));
----------------
I think the common term is "spill".

================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:707
@@ +706,3 @@
+
+  void ComputeMemOperandAddress(X86Operand &Op, unsigned Reg, MCContext &Ctx,
+                                MCStreamer &Out) {
----------------
I wonder if this could be moved to the parent class to reduce code duplication.

================
Comment at: test/Instrumentation/AddressSanitizer/X86/asm_rsp_mem_op.s:12
@@ +11,3 @@
+# CHECK: leaq 8(%rsp), %rdi
+# CHECK-NEXT: leaq 152(%rdi), %rdi
+# CHECK: callq __asan_report_load8 at PLT
----------------
This could be done with 1 lea instruction.

http://reviews.llvm.org/D5599






More information about the llvm-commits mailing list