mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
Refactor into a separate utility function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "llvm/IntrinsicInst.h"
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/SmallPtrSet.h"
|
||||
#include "llvm/Analysis/DebugInfo.h"
|
||||
#include "llvm/Analysis/DIBuilder.h"
|
||||
#include "llvm/Analysis/Dominators.h"
|
||||
#include "llvm/Analysis/ConstantFolding.h"
|
||||
#include "llvm/Analysis/InstructionSimplify.h"
|
||||
@@ -755,3 +757,29 @@ unsigned llvm::getOrEnforceKnownAlignment(Value *V, unsigned PrefAlign,
|
||||
return Align;
|
||||
}
|
||||
|
||||
///===---------------------------------------------------------------------===//
|
||||
/// Dbg Intrinsic utilities
|
||||
///
|
||||
|
||||
/// Inserts a llvm.dbg.value instrinsic before the stores to an alloca'd value
|
||||
/// that has an associated llvm.dbg.decl intrinsic.
|
||||
bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
|
||||
StoreInst *SI, DIBuilder &Builder) {
|
||||
DIVariable DIVar(DDI->getVariable());
|
||||
if (!DIVar.Verify())
|
||||
return false;
|
||||
|
||||
Instruction *DbgVal =
|
||||
Builder.insertDbgValueIntrinsic(SI->getOperand(0), 0,
|
||||
DIVar, SI);
|
||||
|
||||
// Propagate any debug metadata from the store onto the dbg.value.
|
||||
DebugLoc SIDL = SI->getDebugLoc();
|
||||
if (!SIDL.isUnknown())
|
||||
DbgVal->setDebugLoc(SIDL);
|
||||
// Otherwise propagate debug metadata from dbg.declare.
|
||||
else
|
||||
DbgVal->setDebugLoc(DDI->getDebugLoc());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user