 diff -r c06933b0e3e6 llvm-trunk/lib/Target/ARM/ARM.h
 --- a/llvm-trunk/lib/Target/ARM/ARM.h
 +++ b/llvm-trunk/lib/Target/ARM/ARM.h
-@@ -105,6 +105,7 @@
+@@ -105,6 +105,8 @@
  FunctionPass *createARMLoadStoreOptimizationPass(bool PreAlloc = false);
  FunctionPass *createARMExpandPseudoPass();
  FunctionPass *createARMConstantIslandPass();
 +FunctionPass *createARMSFIPlacementPass();
++FunctionPass *createARMSFIBranchPass();
  FunctionPass *createNEONPreAllocPass();
  FunctionPass *createNEONMoveFixPass();
  FunctionPass *createThumb2ITBlockPass();

+  }
+}
+
+
+static bool IsDirectCall(const MachineInstr &MI) {
+  switch (MI.getOpcode()) {
+   default: return false;
+
+   case ARM::BLr9:
+   case ARM::BLr9_pred:
+    assert(0 && "This should not have happend. We do not support usage of r9.");
+    return true;
+
+   case ARM::BL:
+   case ARM::BL_pred:
+   case ARM::TPsoft:
+    return true;
+  }
+}
+
+
+static bool IsIndirectCall(const MachineInstr &MI) {
+  switch (MI.getOpcode()) {
+   default: return false;
+
+   case ARM::BLXr9:
+    assert(0 && "we do not support usage of r9");
+
+   case ARM::BLX:
+    return true;
+  }
+}
+
+
+static bool IsIndirectJump(const MachineInstr &MI) {
+  switch (MI.getOpcode()) {
+   default: return false;
+
+   case ARM::BRIND:
+    return true;
+  }
+}
+
+
+static bool IsReturn(const MachineInstr &MI) {
+  switch (MI.getOpcode()) {
+   default: return false;
+
+   case ARM::BX_RET:
+    return true;
+  }
+}
+
+
+
+
+static bool IsDangerousStore(const MachineInstr &MI, int *AddrIdx) {
+  unsigned Opcode = MI.getOpcode();
+  switch (Opcode) {

+  for (MachineFunction::iterator MFI = MF.begin(), E = MF.end();
+       MFI != E;
+       ++MFI)
+    Modified |= SandboxStoresInBlock(*MFI);
+  return Modified;
+}
+
