[PATCH] D79361: Revert "[llvm][dfsan][NFC] Factor out fcn initialization"
Zola Bridges via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 4 12:54:27 PDT 2020
zbrid created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
This reverts commit 8d8fda49c99dcb854d0fb58422f513ae909770cd <https://reviews.llvm.org/rG8d8fda49c99dcb854d0fb58422f513ae909770cd>.
DO NOT MERGE - merely testing how git revert works
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D79361
Files:
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -389,8 +389,6 @@
GlobalValue::LinkageTypes NewFLink,
FunctionType *NewFT);
Constant *getOrBuildTrampolineFunction(FunctionType *FT, StringRef FName);
- void initializeCallbackFunctions(Module &M);
- void initializeRuntimeFunctions(Module &M);
public:
static char ID;
@@ -742,8 +740,25 @@
return cast<Constant>(C.getCallee());
}
-// Initialize DataFlowSanitizer runtime functions and declare them in the module
-void DataFlowSanitizer::initializeRuntimeFunctions(Module &M) {
+bool DataFlowSanitizer::runOnModule(Module &M) {
+ if (ABIList.isIn(M, "skip"))
+ return false;
+
+ if (!GetArgTLSPtr) {
+ Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
+ ArgTLS = Mod->getOrInsertGlobal("__dfsan_arg_tls", ArgTLSTy);
+ if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS))
+ G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
+ }
+ if (!GetRetvalTLSPtr) {
+ RetvalTLS = Mod->getOrInsertGlobal("__dfsan_retval_tls", ShadowTy);
+ if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS))
+ G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
+ }
+
+ ExternalShadowMask =
+ Mod->getOrInsertGlobal(kDFSanExternShadowPtrMask, IntptrTy);
+
{
AttributeList AL;
AL = AL.addAttribute(M.getContext(), AttributeList::FunctionIndex,
@@ -757,6 +772,7 @@
DFSanUnionFn =
Mod->getOrInsertFunction("__dfsan_union", DFSanUnionFnTy, AL);
}
+
{
AttributeList AL;
AL = AL.addAttribute(M.getContext(), AttributeList::FunctionIndex,
@@ -793,10 +809,7 @@
Mod->getOrInsertFunction("__dfsan_nonzero_label", DFSanNonzeroLabelFnTy);
DFSanVarargWrapperFn = Mod->getOrInsertFunction("__dfsan_vararg_wrapper",
DFSanVarargWrapperFnTy);
-}
-// Initializes event callback functions and declare them in the module
-void DataFlowSanitizer::initializeCallbackFunctions(Module &M) {
DFSanLoadCallbackFn = Mod->getOrInsertFunction("__dfsan_load_callback",
DFSanLoadStoreCmpCallbackFnTy);
DFSanStoreCallbackFn = Mod->getOrInsertFunction(
@@ -805,29 +818,6 @@
"__dfsan_mem_transfer_callback", DFSanMemTransferCallbackFnTy);
DFSanCmpCallbackFn = Mod->getOrInsertFunction("__dfsan_cmp_callback",
DFSanLoadStoreCmpCallbackFnTy);
-}
-
-bool DataFlowSanitizer::runOnModule(Module &M) {
- if (ABIList.isIn(M, "skip"))
- return false;
-
- if (!GetArgTLSPtr) {
- Type *ArgTLSTy = ArrayType::get(ShadowTy, 64);
- ArgTLS = Mod->getOrInsertGlobal("__dfsan_arg_tls", ArgTLSTy);
- if (GlobalVariable *G = dyn_cast<GlobalVariable>(ArgTLS))
- G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
- }
- if (!GetRetvalTLSPtr) {
- RetvalTLS = Mod->getOrInsertGlobal("__dfsan_retval_tls", ShadowTy);
- if (GlobalVariable *G = dyn_cast<GlobalVariable>(RetvalTLS))
- G->setThreadLocalMode(GlobalVariable::InitialExecTLSModel);
- }
-
- ExternalShadowMask =
- Mod->getOrInsertGlobal(kDFSanExternShadowPtrMask, IntptrTy);
-
- initializeCallbackFunctions(M);
- initializeRuntimeFunctions(M);
std::vector<Function *> FnsToInstrument;
SmallPtrSet<Function *, 2> FnsWithNativeABI;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79361.261910.patch
Type: text/x-patch
Size: 3590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200504/c1e91ecd/attachment-0001.bin>
More information about the llvm-commits
mailing list