[PATCH] [asan-assembly-instrumentation] Added CFI directives to the generated instrumentation code.

Evgeniy Stepanov eugenis at google.com
Thu Sep 4 05:44:53 PDT 2014


================
Comment at: include/llvm/MC/MCTargetAsmParser.h:126
@@ -125,1 +125,3 @@
 
+  virtual void SetFrameRegister(unsigned RegNo) {}
+
----------------
Please add a comment.
How does it behave when parsing top-level asm?


================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:316
@@ +315,3 @@
+          Out, MCInstBuilder(X86::PUSH32r).addReg(X86::EBP));
+      if (FrameReg == X86::ESP) {
+        Out.EmitCFIAdjustCfaOffset(4 /* byte size of the FrameReg */);
----------------
Don't forget end-to-end tests for both cases (esp and non-esp), i.e. omit-frame-pointer and no-omit-frame-pointer.

================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:557
@@ -529,1 +556,3 @@
+      : X86AddressSanitizer(STI),
+        RegisterInfo(TheX86_64Target.createMCRegInfo(STI.getTargetTriple())) {}
   virtual ~X86AddressSanitizer64() {}
----------------
Is it the right way to obtain MCRegisterInfo?
Direct calls to TheXXXTarget seem to be rather uncommon.

http://reviews.llvm.org/D5189






More information about the llvm-commits mailing list