[PATCH] MachineFunction is exposed to X86AsmParser.

Evgeniy Stepanov eugenis at google.com
Tue Mar 18 02:37:43 PDT 2014


  Blacklist needs to live somewhere with a longer lifetime.
  Also, we need a "more global" place anyway to pass down -fsanitize=(address|memory|thread) setting for top-level assembly.
  I suggest looking at EmitAssemblyHelper::CreateTargetMachine() in clang.
  We could add a field (or several fields) to llvm::TargetOptions to pass through the sanitizer to run (if any) and, potentially, all the information that is currently passes through *SanitizerPass constructor arguments, like blacklist pass, MSanTrackOrigins, etc.

  MCCodeGenInfo also looks like a good place for blacklist to live in.
    /// CodeGenInfo - Low level target information such as relocation model.
    /// Non-const to allow resetting optimization level per-function.


================
Comment at: lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp:32
@@ +31,3 @@
+static cl::opt<bool> ClAsanNoInstrumentInlineAssembly(
+    "asan-no-instrument-inline-assembly",
+    cl::desc("don't instrument inline assembly"), cl::Hidden, cl::init(false));
----------------
This would enable not yet well tested asm instrumentation by default.

I think it's better to keep the flag name positive, and off by default (for now).


================
Comment at: lib/Target/X86/AsmParser/X86AsmParser.cpp:722
@@ +721,3 @@
+  void onMachineFunctionSet() override {
+    Instrumentation.reset(CreateX86AsmInstrumentation(MF, STI));
+  }
----------------
This would read and parse the blacklist anew for every machine function.

The whole AsmParser is created from scratch for every inline asm instruction, so it's not a good owner for the blacklist.



http://llvm-reviews.chandlerc.com/D3106



More information about the llvm-commits mailing list