mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Assing line number info to new PHIs created by SSA updater.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130551 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "llvm/BasicBlock.h"
|
#include "llvm/BasicBlock.h"
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
|
#include "llvm/Support/DebugLoc.h"
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
@ -181,6 +182,10 @@ BasicBlock *SplitBlockPredecessors(BasicBlock *BB, BasicBlock *const *Preds,
|
|||||||
ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
|
ReturnInst *FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
|
||||||
BasicBlock *Pred);
|
BasicBlock *Pred);
|
||||||
|
|
||||||
|
/// GetFirstDebugLocInBasicBlock - Return first valid DebugLoc entry in a
|
||||||
|
/// given basic block.
|
||||||
|
DebugLoc GetFirstDebugLocInBasicBlock(const BasicBlock *BB);
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -538,3 +538,15 @@ ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
|
|||||||
UncondBranch->eraseFromParent();
|
UncondBranch->eraseFromParent();
|
||||||
return cast<ReturnInst>(NewRet);
|
return cast<ReturnInst>(NewRet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// GetFirstDebugLocInBasicBlock - Return first valid DebugLoc entry in a
|
||||||
|
/// given basic block.
|
||||||
|
DebugLoc llvm::GetFirstDebugLocInBasicBlock(const BasicBlock *BB) {
|
||||||
|
for (BasicBlock::const_iterator BI = BB->begin(), BE = BB->end();
|
||||||
|
BI != BE; ++BI) {
|
||||||
|
DebugLoc DL = BI->getDebugLoc();
|
||||||
|
if (!DL.isUnknown())
|
||||||
|
return DL;
|
||||||
|
}
|
||||||
|
return DebugLoc();
|
||||||
|
}
|
||||||
|
@ -21,8 +21,10 @@
|
|||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
|
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||||
#include "llvm/Transforms/Utils/SSAUpdater.h"
|
#include "llvm/Transforms/Utils/SSAUpdater.h"
|
||||||
#include "llvm/Transforms/Utils/SSAUpdaterImpl.h"
|
#include "llvm/Transforms/Utils/SSAUpdaterImpl.h"
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
typedef DenseMap<BasicBlock*, Value*> AvailableValsTy;
|
typedef DenseMap<BasicBlock*, Value*> AvailableValsTy;
|
||||||
@ -185,6 +187,9 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {
|
|||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set DebugLoc.
|
||||||
|
InsertedPHI->setDebugLoc(GetFirstDebugLocInBasicBlock(BB));
|
||||||
|
|
||||||
// If the client wants to know about all new instructions, tell it.
|
// If the client wants to know about all new instructions, tell it.
|
||||||
if (InsertedPHIs) InsertedPHIs->push_back(InsertedPHI);
|
if (InsertedPHIs) InsertedPHIs->push_back(InsertedPHI);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user