Created Ice::Instrumentation base class and accompanying hooks.

Also added a command line flag for AddressSanitizer

BUG=None
R=kschimpf@google.com

Review URL: https://codereview.chromium.org/2042063002 .
diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
index 8f6a2ff..a113b95 100644
--- a/src/IceCfg.cpp
+++ b/src/IceCfg.cpp
@@ -22,6 +22,7 @@
 #include "IceELFObjectWriter.h"
 #include "IceGlobalInits.h"
 #include "IceInst.h"
+#include "IceInstrumentation.h"
 #include "IceInstVarIter.h"
 #include "IceLiveness.h"
 #include "IceLoopAnalyzer.h"
@@ -238,6 +239,12 @@
     if (auto *Var64On32 = llvm::dyn_cast<Variable64On32>(Var))
       Var64On32->initHiLo(this);
 
+  // Instrument the Cfg, e.g. with AddressSanitizer
+  if (!BuildDefs::minimal() && getFlags().getSanitizeAddresses()) {
+    getContext()->instrumentFunc(this);
+    dump("Instrumented CFG");
+  }
+
   // The set of translation passes and their order are determined by the
   // target.
   getTarget()->translate();