mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Removed trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
47d6e07a9b
commit
c02dbeb429
@ -66,7 +66,7 @@ namespace {
|
|||||||
unsigned SSPBufferSize;
|
unsigned SSPBufferSize;
|
||||||
|
|
||||||
/// VisitedPHIs - The set of PHI nodes visited when determining
|
/// VisitedPHIs - The set of PHI nodes visited when determining
|
||||||
/// if a variable's reference has been taken. This set
|
/// if a variable's reference has been taken. This set
|
||||||
/// is maintained to ensure we don't visit the same PHI node multiple
|
/// is maintained to ensure we don't visit the same PHI node multiple
|
||||||
/// times.
|
/// times.
|
||||||
SmallPtrSet<const PHINode*, 16> VisitedPHIs;
|
SmallPtrSet<const PHINode*, 16> VisitedPHIs;
|
||||||
@ -245,7 +245,7 @@ bool StackProtector::RequiresStackProtector() {
|
|||||||
// of size.
|
// of size.
|
||||||
if (Strong)
|
if (Strong)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (const ConstantInt *CI =
|
if (const ConstantInt *CI =
|
||||||
dyn_cast<ConstantInt>(AI->getArraySize())) {
|
dyn_cast<ConstantInt>(AI->getArraySize())) {
|
||||||
if (CI->getLimitedValue(SSPBufferSize) >= SSPBufferSize)
|
if (CI->getLimitedValue(SSPBufferSize) >= SSPBufferSize)
|
||||||
@ -262,7 +262,7 @@ bool StackProtector::RequiresStackProtector() {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Strong && HasAddressTaken(AI)) {
|
if (Strong && HasAddressTaken(AI)) {
|
||||||
++NumAddrTaken;
|
++NumAddrTaken;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ static bool CreatePrologue(Function *F, Module *M, ReturnInst *RI,
|
|||||||
if (TLI->getStackCookieLocation(AddressSpace, Offset)) {
|
if (TLI->getStackCookieLocation(AddressSpace, Offset)) {
|
||||||
Constant *OffsetVal =
|
Constant *OffsetVal =
|
||||||
ConstantInt::get(Type::getInt32Ty(RI->getContext()), Offset);
|
ConstantInt::get(Type::getInt32Ty(RI->getContext()), Offset);
|
||||||
|
|
||||||
StackGuardVar = ConstantExpr::getIntToPtr(OffsetVal,
|
StackGuardVar = ConstantExpr::getIntToPtr(OffsetVal,
|
||||||
PointerType::get(PtrTy,
|
PointerType::get(PtrTy,
|
||||||
AddressSpace));
|
AddressSpace));
|
||||||
@ -357,15 +357,15 @@ static bool CreatePrologue(Function *F, Module *M, ReturnInst *RI,
|
|||||||
->setVisibility(GlobalValue::HiddenVisibility);
|
->setVisibility(GlobalValue::HiddenVisibility);
|
||||||
} else {
|
} else {
|
||||||
SupportsSelectionDAGSP = true;
|
SupportsSelectionDAGSP = true;
|
||||||
StackGuardVar = M->getOrInsertGlobal("__stack_chk_guard", PtrTy);
|
StackGuardVar = M->getOrInsertGlobal("__stack_chk_guard", PtrTy);
|
||||||
}
|
}
|
||||||
|
|
||||||
BasicBlock &Entry = F->getEntryBlock();
|
BasicBlock &Entry = F->getEntryBlock();
|
||||||
Instruction *InsPt = &Entry.front();
|
Instruction *InsPt = &Entry.front();
|
||||||
|
|
||||||
AI = new AllocaInst(PtrTy, "StackGuardSlot", InsPt);
|
AI = new AllocaInst(PtrTy, "StackGuardSlot", InsPt);
|
||||||
LoadInst *LI = new LoadInst(StackGuardVar, "StackGuard", false, InsPt);
|
LoadInst *LI = new LoadInst(StackGuardVar, "StackGuard", false, InsPt);
|
||||||
|
|
||||||
Value *Args[] = { LI, AI };
|
Value *Args[] = { LI, AI };
|
||||||
CallInst::
|
CallInst::
|
||||||
Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector),
|
Create(Intrinsic::getDeclaration(M, Intrinsic::stackprotector),
|
||||||
@ -384,7 +384,7 @@ bool StackProtector::InsertStackProtectors() {
|
|||||||
bool HasPrologue = false;
|
bool HasPrologue = false;
|
||||||
bool SupportsSelectionDAGSP = false;
|
bool SupportsSelectionDAGSP = false;
|
||||||
AllocaInst *AI = 0; // Place on stack that stores the stack guard.
|
AllocaInst *AI = 0; // Place on stack that stores the stack guard.
|
||||||
Value *StackGuardVar = 0; // The stack guard variable.
|
Value *StackGuardVar = 0; // The stack guard variable.
|
||||||
|
|
||||||
for (Function::iterator I = F->begin(), E = F->end(); I != E; ) {
|
for (Function::iterator I = F->begin(), E = F->end(); I != E; ) {
|
||||||
BasicBlock *BB = I++;
|
BasicBlock *BB = I++;
|
||||||
@ -394,8 +394,8 @@ bool StackProtector::InsertStackProtectors() {
|
|||||||
if (!HasPrologue) {
|
if (!HasPrologue) {
|
||||||
HasPrologue = true;
|
HasPrologue = true;
|
||||||
SupportsSelectionDAGSP = CreatePrologue(F, M, RI, TLI, Trip, AI,
|
SupportsSelectionDAGSP = CreatePrologue(F, M, RI, TLI, Trip, AI,
|
||||||
StackGuardVar);
|
StackGuardVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EnableSelectionDAGSP && !TM->Options.EnableFastISel &&
|
if (EnableSelectionDAGSP && !TM->Options.EnableFastISel &&
|
||||||
SupportsSelectionDAGSP) {
|
SupportsSelectionDAGSP) {
|
||||||
@ -404,7 +404,7 @@ bool StackProtector::InsertStackProtectors() {
|
|||||||
Instruction *InsertionPt = 0;
|
Instruction *InsertionPt = 0;
|
||||||
if (CallInst *CI = FindPotentialTailCall(BB, RI, TLI)) {
|
if (CallInst *CI = FindPotentialTailCall(BB, RI, TLI)) {
|
||||||
InsertionPt = CI;
|
InsertionPt = CI;
|
||||||
} else {
|
} else {
|
||||||
InsertionPt = RI;
|
InsertionPt = RI;
|
||||||
// At this point we know that BB has a return statement so it *DOES*
|
// At this point we know that BB has a return statement so it *DOES*
|
||||||
// have a terminator.
|
// have a terminator.
|
||||||
@ -445,25 +445,25 @@ bool StackProtector::InsertStackProtectors() {
|
|||||||
|
|
||||||
// Create the FailBB. We duplicate the BB every time since the MI tail
|
// Create the FailBB. We duplicate the BB every time since the MI tail
|
||||||
// merge pass will merge together all of the various BB into one including
|
// merge pass will merge together all of the various BB into one including
|
||||||
// fail BB generated by the stack protector pseudo instruction.
|
// fail BB generated by the stack protector pseudo instruction.
|
||||||
BasicBlock *FailBB = CreateFailBB();
|
BasicBlock *FailBB = CreateFailBB();
|
||||||
|
|
||||||
// Split the basic block before the return instruction.
|
// Split the basic block before the return instruction.
|
||||||
BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return");
|
BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return");
|
||||||
|
|
||||||
// Update the dominator tree if we need to.
|
// Update the dominator tree if we need to.
|
||||||
if (DT && DT->isReachableFromEntry(BB)) {
|
if (DT && DT->isReachableFromEntry(BB)) {
|
||||||
DT->addNewBlock(NewBB, BB);
|
DT->addNewBlock(NewBB, BB);
|
||||||
DT->addNewBlock(FailBB, BB);
|
DT->addNewBlock(FailBB, BB);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove default branch instruction to the new BB.
|
// Remove default branch instruction to the new BB.
|
||||||
BB->getTerminator()->eraseFromParent();
|
BB->getTerminator()->eraseFromParent();
|
||||||
|
|
||||||
// Move the newly created basic block to the point right after the old
|
// Move the newly created basic block to the point right after the old
|
||||||
// basic block so that it's in the "fall through" position.
|
// basic block so that it's in the "fall through" position.
|
||||||
NewBB->moveAfter(BB);
|
NewBB->moveAfter(BB);
|
||||||
|
|
||||||
// Generate the stack protector instructions in the old basic block.
|
// Generate the stack protector instructions in the old basic block.
|
||||||
LoadInst *LI1 = new LoadInst(StackGuardVar, "", false, BB);
|
LoadInst *LI1 = new LoadInst(StackGuardVar, "", false, BB);
|
||||||
LoadInst *LI2 = new LoadInst(AI, "", true, BB);
|
LoadInst *LI2 = new LoadInst(AI, "", true, BB);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user