summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt/Debugify.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-05-24 23:00:23 +0000
committerVedant Kumar <vsk@apple.com>2018-05-24 23:00:23 +0000
commit4872535eb9573efb6b08a205458c845a988b74e2 (patch)
tree955cd10f08254ab87591c8378f6587678e7059e1 /llvm/tools/opt/Debugify.cpp
parentb70e35686b18a23d7fffa3060ef37a2279306155 (diff)
downloadbcm5719-llvm-4872535eb9573efb6b08a205458c845a988b74e2.tar.gz
bcm5719-llvm-4872535eb9573efb6b08a205458c845a988b74e2.zip
[Debugify] Set a DI version module flag for llc compatibility
Setting the "Debug Info Version" module flag makes it possible to pipe synthetic debug info into llc, which is useful for testing backends. llvm-svn: 333237
Diffstat (limited to 'llvm/tools/opt/Debugify.cpp')
-rw-r--r--llvm/tools/opt/Debugify.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/tools/opt/Debugify.cpp b/llvm/tools/opt/Debugify.cpp
index fb810da231f..ba8927fd19c 100644
--- a/llvm/tools/opt/Debugify.cpp
+++ b/llvm/tools/opt/Debugify.cpp
@@ -121,6 +121,12 @@ bool applyDebugifyMetadata(Module &M,
addDebugifyOperand(NextVar - 1); // Original number of variables.
assert(NMD->getNumOperands() == 2 &&
"llvm.debugify should have exactly 2 operands!");
+
+ // Claim that this synthetic debug info is valid.
+ StringRef DIVersionKey = "Debug Info Version";
+ if (!M.getModuleFlag(DIVersionKey))
+ M.addModuleFlag(Module::Warning, DIVersionKey, DEBUG_METADATA_VERSION);
+
return true;
}
@@ -270,10 +276,12 @@ struct CheckDebugifyFunctionPass : public FunctionPass {
Module &M = *F.getParent();
auto FuncIt = F.getIterator();
return checkDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)),
- NameOfWrappedPass, "CheckFunctionDebugify", Strip);
+ NameOfWrappedPass, "CheckFunctionDebugify",
+ Strip);
}
- CheckDebugifyFunctionPass(bool Strip = false, StringRef NameOfWrappedPass = "")
+ CheckDebugifyFunctionPass(bool Strip = false,
+ StringRef NameOfWrappedPass = "")
: FunctionPass(ID), Strip(Strip), NameOfWrappedPass(NameOfWrappedPass) {}
void getAnalysisUsage(AnalysisUsage &AU) const override {
OpenPOWER on IntegriCloud