mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-01 01:30:36 +00:00
Strip trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82359 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
65b660743c
commit
ce99a6e49e
@ -64,11 +64,11 @@ Value::~Value() {
|
|||||||
LLVMContext &Context = getContext();
|
LLVMContext &Context = getContext();
|
||||||
Context.pImpl->TheMetadata.ValueIsDeleted(this);
|
Context.pImpl->TheMetadata.ValueIsDeleted(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify all ValueHandles (if present) that this value is going away.
|
// Notify all ValueHandles (if present) that this value is going away.
|
||||||
if (HasValueHandle)
|
if (HasValueHandle)
|
||||||
ValueHandleBase::ValueIsDeleted(this);
|
ValueHandleBase::ValueIsDeleted(this);
|
||||||
|
|
||||||
#ifndef NDEBUG // Only in -g mode...
|
#ifndef NDEBUG // Only in -g mode...
|
||||||
// Check to make sure that there are no uses of this value that are still
|
// Check to make sure that there are no uses of this value that are still
|
||||||
// around when the value is destroyed. If there are, then we have a dangling
|
// around when the value is destroyed. If there are, then we have a dangling
|
||||||
@ -89,7 +89,7 @@ Value::~Value() {
|
|||||||
// at this point.
|
// at this point.
|
||||||
if (Name)
|
if (Name)
|
||||||
Name->Destroy();
|
Name->Destroy();
|
||||||
|
|
||||||
// There should be no uses of this object anymore, remove it.
|
// There should be no uses of this object anymore, remove it.
|
||||||
LeakDetector::removeGarbageObject(this);
|
LeakDetector::removeGarbageObject(this);
|
||||||
}
|
}
|
||||||
@ -142,13 +142,13 @@ static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
|
|||||||
if (Function *PP = P->getParent())
|
if (Function *PP = P->getParent())
|
||||||
ST = &PP->getValueSymbolTable();
|
ST = &PP->getValueSymbolTable();
|
||||||
} else if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
|
} else if (BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
|
||||||
if (Function *P = BB->getParent())
|
if (Function *P = BB->getParent())
|
||||||
ST = &P->getValueSymbolTable();
|
ST = &P->getValueSymbolTable();
|
||||||
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
|
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
|
||||||
if (Module *P = GV->getParent())
|
if (Module *P = GV->getParent())
|
||||||
ST = &P->getValueSymbolTable();
|
ST = &P->getValueSymbolTable();
|
||||||
} else if (Argument *A = dyn_cast<Argument>(V)) {
|
} else if (Argument *A = dyn_cast<Argument>(V)) {
|
||||||
if (Function *P = A->getParent())
|
if (Function *P = A->getParent())
|
||||||
ST = &P->getValueSymbolTable();
|
ST = &P->getValueSymbolTable();
|
||||||
} else if (NamedMDNode *N = dyn_cast<NamedMDNode>(V)) {
|
} else if (NamedMDNode *N = dyn_cast<NamedMDNode>(V)) {
|
||||||
if (Module *P = N->getParent()) {
|
if (Module *P = N->getParent()) {
|
||||||
@ -192,7 +192,7 @@ void Value::setName(const Twine &NewName) {
|
|||||||
|
|
||||||
assert(getType() != Type::getVoidTy(getContext()) &&
|
assert(getType() != Type::getVoidTy(getContext()) &&
|
||||||
"Cannot assign a name to void values!");
|
"Cannot assign a name to void values!");
|
||||||
|
|
||||||
// Get the symbol table to update for this object.
|
// Get the symbol table to update for this object.
|
||||||
ValueSymbolTable *ST;
|
ValueSymbolTable *ST;
|
||||||
if (getSymTab(this, ST))
|
if (getSymTab(this, ST))
|
||||||
@ -205,19 +205,19 @@ void Value::setName(const Twine &NewName) {
|
|||||||
Name = 0;
|
Name = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Name)
|
if (Name)
|
||||||
Name->Destroy();
|
Name->Destroy();
|
||||||
|
|
||||||
// NOTE: Could optimize for the case the name is shrinking to not deallocate
|
// NOTE: Could optimize for the case the name is shrinking to not deallocate
|
||||||
// then reallocated.
|
// then reallocated.
|
||||||
|
|
||||||
// Create the new name.
|
// Create the new name.
|
||||||
Name = ValueName::Create(NameStr, NameStr+NameLen);
|
Name = ValueName::Create(NameStr, NameStr+NameLen);
|
||||||
Name->setValue(this);
|
Name->setValue(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Could optimize for the case the name is shrinking to not deallocate
|
// NOTE: Could optimize for the case the name is shrinking to not deallocate
|
||||||
// then reallocated.
|
// then reallocated.
|
||||||
if (hasName()) {
|
if (hasName()) {
|
||||||
@ -236,7 +236,7 @@ void Value::setName(const Twine &NewName) {
|
|||||||
|
|
||||||
|
|
||||||
/// takeName - transfer the name from V to this value, setting V's name to
|
/// takeName - transfer the name from V to this value, setting V's name to
|
||||||
/// empty. It is an error to call V->takeName(V).
|
/// empty. It is an error to call V->takeName(V).
|
||||||
void Value::takeName(Value *V) {
|
void Value::takeName(Value *V) {
|
||||||
ValueSymbolTable *ST = 0;
|
ValueSymbolTable *ST = 0;
|
||||||
// If this value has a name, drop it.
|
// If this value has a name, drop it.
|
||||||
@ -248,19 +248,19 @@ void Value::takeName(Value *V) {
|
|||||||
if (V->hasName()) V->setName("");
|
if (V->hasName()) V->setName("");
|
||||||
return; // Cannot set a name on this value (e.g. constant).
|
return; // Cannot set a name on this value (e.g. constant).
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove old name.
|
// Remove old name.
|
||||||
if (ST)
|
if (ST)
|
||||||
ST->removeValueName(Name);
|
ST->removeValueName(Name);
|
||||||
Name->Destroy();
|
Name->Destroy();
|
||||||
Name = 0;
|
Name = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we know that this has no name.
|
// Now we know that this has no name.
|
||||||
|
|
||||||
// If V has no name either, we're done.
|
// If V has no name either, we're done.
|
||||||
if (!V->hasName()) return;
|
if (!V->hasName()) return;
|
||||||
|
|
||||||
// Get this's symtab if we didn't before.
|
// Get this's symtab if we didn't before.
|
||||||
if (!ST) {
|
if (!ST) {
|
||||||
if (getSymTab(this, ST)) {
|
if (getSymTab(this, ST)) {
|
||||||
@ -269,12 +269,12 @@ void Value::takeName(Value *V) {
|
|||||||
return; // Cannot set a name on this value (e.g. constant).
|
return; // Cannot set a name on this value (e.g. constant).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get V's ST, this should always succed, because V has a name.
|
// Get V's ST, this should always succed, because V has a name.
|
||||||
ValueSymbolTable *VST;
|
ValueSymbolTable *VST;
|
||||||
bool Failure = getSymTab(V, VST);
|
bool Failure = getSymTab(V, VST);
|
||||||
assert(!Failure && "V has a name, so it should have a ST!"); Failure=Failure;
|
assert(!Failure && "V has a name, so it should have a ST!"); Failure=Failure;
|
||||||
|
|
||||||
// If these values are both in the same symtab, we can do this very fast.
|
// If these values are both in the same symtab, we can do this very fast.
|
||||||
// This works even if both values have no symtab yet.
|
// This works even if both values have no symtab yet.
|
||||||
if (ST == VST) {
|
if (ST == VST) {
|
||||||
@ -284,16 +284,16 @@ void Value::takeName(Value *V) {
|
|||||||
Name->setValue(this);
|
Name->setValue(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, things are slightly more complex. Remove V's name from VST and
|
// Otherwise, things are slightly more complex. Remove V's name from VST and
|
||||||
// then reinsert it into ST.
|
// then reinsert it into ST.
|
||||||
|
|
||||||
if (VST)
|
if (VST)
|
||||||
VST->removeValueName(V->Name);
|
VST->removeValueName(V->Name);
|
||||||
Name = V->Name;
|
Name = V->Name;
|
||||||
V->Name = 0;
|
V->Name = 0;
|
||||||
Name->setValue(this);
|
Name->setValue(this);
|
||||||
|
|
||||||
if (ST)
|
if (ST)
|
||||||
ST->reinsertValue(this);
|
ST->reinsertValue(this);
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
|
|||||||
// Notify all ValueHandles (if present) that this value is going away.
|
// Notify all ValueHandles (if present) that this value is going away.
|
||||||
if (HasValueHandle)
|
if (HasValueHandle)
|
||||||
ValueHandleBase::ValueIsRAUWd(this, New);
|
ValueHandleBase::ValueIsRAUWd(this, New);
|
||||||
|
|
||||||
while (!use_empty()) {
|
while (!use_empty()) {
|
||||||
Use &U = *UseList;
|
Use &U = *UseList;
|
||||||
// Must handle Constants specially, we cannot call replaceUsesOfWith on a
|
// Must handle Constants specially, we cannot call replaceUsesOfWith on a
|
||||||
@ -320,7 +320,7 @@ void Value::uncheckedReplaceAllUsesWith(Value *New) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U.set(New);
|
U.set(New);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,7 +382,7 @@ Value *Value::getUnderlyingObject() {
|
|||||||
/// return the value in the PHI node corresponding to PredBB. If not, return
|
/// return the value in the PHI node corresponding to PredBB. If not, return
|
||||||
/// ourself. This is useful if you want to know the value something has in a
|
/// ourself. This is useful if you want to know the value something has in a
|
||||||
/// predecessor block.
|
/// predecessor block.
|
||||||
Value *Value::DoPHITranslation(const BasicBlock *CurBB,
|
Value *Value::DoPHITranslation(const BasicBlock *CurBB,
|
||||||
const BasicBlock *PredBB) {
|
const BasicBlock *PredBB) {
|
||||||
PHINode *PN = dyn_cast<PHINode>(this);
|
PHINode *PN = dyn_cast<PHINode>(this);
|
||||||
if (PN && PN->getParent() == CurBB)
|
if (PN && PN->getParent() == CurBB)
|
||||||
@ -400,7 +400,7 @@ LLVMContext &Value::getContext() const { return VTy->getContext(); }
|
|||||||
/// List is known to point into the existing use list.
|
/// List is known to point into the existing use list.
|
||||||
void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) {
|
void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) {
|
||||||
assert(List && "Handle list is null?");
|
assert(List && "Handle list is null?");
|
||||||
|
|
||||||
// Splice ourselves into the list.
|
// Splice ourselves into the list.
|
||||||
Next = *List;
|
Next = *List;
|
||||||
*List = this;
|
*List = this;
|
||||||
@ -414,9 +414,9 @@ void ValueHandleBase::AddToExistingUseList(ValueHandleBase **List) {
|
|||||||
/// AddToUseList - Add this ValueHandle to the use list for VP.
|
/// AddToUseList - Add this ValueHandle to the use list for VP.
|
||||||
void ValueHandleBase::AddToUseList() {
|
void ValueHandleBase::AddToUseList() {
|
||||||
assert(VP && "Null pointer doesn't have a use list!");
|
assert(VP && "Null pointer doesn't have a use list!");
|
||||||
|
|
||||||
LLVMContextImpl *pImpl = VP->getContext().pImpl;
|
LLVMContextImpl *pImpl = VP->getContext().pImpl;
|
||||||
|
|
||||||
if (VP->HasValueHandle) {
|
if (VP->HasValueHandle) {
|
||||||
// If this value already has a ValueHandle, then it must be in the
|
// If this value already has a ValueHandle, then it must be in the
|
||||||
// ValueHandles map already.
|
// ValueHandles map already.
|
||||||
@ -425,7 +425,7 @@ void ValueHandleBase::AddToUseList() {
|
|||||||
AddToExistingUseList(&Entry);
|
AddToExistingUseList(&Entry);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ok, it doesn't have any handles yet, so we must insert it into the
|
// Ok, it doesn't have any handles yet, so we must insert it into the
|
||||||
// DenseMap. However, doing this insertion could cause the DenseMap to
|
// DenseMap. However, doing this insertion could cause the DenseMap to
|
||||||
// reallocate itself, which would invalidate all of the PrevP pointers that
|
// reallocate itself, which would invalidate all of the PrevP pointers that
|
||||||
@ -433,19 +433,19 @@ void ValueHandleBase::AddToUseList() {
|
|||||||
// updating the stale pointers only if needed.
|
// updating the stale pointers only if needed.
|
||||||
DenseMap<Value*, ValueHandleBase*> &Handles = pImpl->ValueHandles;
|
DenseMap<Value*, ValueHandleBase*> &Handles = pImpl->ValueHandles;
|
||||||
const void *OldBucketPtr = Handles.getPointerIntoBucketsArray();
|
const void *OldBucketPtr = Handles.getPointerIntoBucketsArray();
|
||||||
|
|
||||||
ValueHandleBase *&Entry = Handles[VP];
|
ValueHandleBase *&Entry = Handles[VP];
|
||||||
assert(Entry == 0 && "Value really did already have handles?");
|
assert(Entry == 0 && "Value really did already have handles?");
|
||||||
AddToExistingUseList(&Entry);
|
AddToExistingUseList(&Entry);
|
||||||
VP->HasValueHandle = true;
|
VP->HasValueHandle = true;
|
||||||
|
|
||||||
// If reallocation didn't happen or if this was the first insertion, don't
|
// If reallocation didn't happen or if this was the first insertion, don't
|
||||||
// walk the table.
|
// walk the table.
|
||||||
if (Handles.isPointerIntoBucketsArray(OldBucketPtr) ||
|
if (Handles.isPointerIntoBucketsArray(OldBucketPtr) ||
|
||||||
Handles.size() == 1) {
|
Handles.size() == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay, reallocation did happen. Fix the Prev Pointers.
|
// Okay, reallocation did happen. Fix the Prev Pointers.
|
||||||
for (DenseMap<Value*, ValueHandleBase*>::iterator I = Handles.begin(),
|
for (DenseMap<Value*, ValueHandleBase*>::iterator I = Handles.begin(),
|
||||||
E = Handles.end(); I != E; ++I) {
|
E = Handles.end(); I != E; ++I) {
|
||||||
@ -461,14 +461,14 @@ void ValueHandleBase::RemoveFromUseList() {
|
|||||||
// Unlink this from its use list.
|
// Unlink this from its use list.
|
||||||
ValueHandleBase **PrevPtr = getPrevPtr();
|
ValueHandleBase **PrevPtr = getPrevPtr();
|
||||||
assert(*PrevPtr == this && "List invariant broken");
|
assert(*PrevPtr == this && "List invariant broken");
|
||||||
|
|
||||||
*PrevPtr = Next;
|
*PrevPtr = Next;
|
||||||
if (Next) {
|
if (Next) {
|
||||||
assert(Next->getPrevPtr() == &Next && "List invariant broken");
|
assert(Next->getPrevPtr() == &Next && "List invariant broken");
|
||||||
Next->setPrevPtr(PrevPtr);
|
Next->setPrevPtr(PrevPtr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the Next pointer was null, then it is possible that this was the last
|
// If the Next pointer was null, then it is possible that this was the last
|
||||||
// ValueHandle watching VP. If so, delete its entry from the ValueHandles
|
// ValueHandle watching VP. If so, delete its entry from the ValueHandles
|
||||||
// map.
|
// map.
|
||||||
@ -489,12 +489,12 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
|
|||||||
LLVMContextImpl *pImpl = V->getContext().pImpl;
|
LLVMContextImpl *pImpl = V->getContext().pImpl;
|
||||||
ValueHandleBase *Entry = pImpl->ValueHandles[V];
|
ValueHandleBase *Entry = pImpl->ValueHandles[V];
|
||||||
assert(Entry && "Value bit set but no entries exist");
|
assert(Entry && "Value bit set but no entries exist");
|
||||||
|
|
||||||
while (Entry) {
|
while (Entry) {
|
||||||
// Advance pointer to avoid invalidation.
|
// Advance pointer to avoid invalidation.
|
||||||
ValueHandleBase *ThisNode = Entry;
|
ValueHandleBase *ThisNode = Entry;
|
||||||
Entry = Entry->Next;
|
Entry = Entry->Next;
|
||||||
|
|
||||||
switch (ThisNode->getKind()) {
|
switch (ThisNode->getKind()) {
|
||||||
case Assert:
|
case Assert:
|
||||||
#ifndef NDEBUG // Only in -g mode...
|
#ifndef NDEBUG // Only in -g mode...
|
||||||
@ -513,7 +513,7 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All callbacks and weak references should be dropped by now.
|
// All callbacks and weak references should be dropped by now.
|
||||||
assert(!V->HasValueHandle && "All references to V were not removed?");
|
assert(!V->HasValueHandle && "All references to V were not removed?");
|
||||||
}
|
}
|
||||||
@ -522,19 +522,19 @@ void ValueHandleBase::ValueIsDeleted(Value *V) {
|
|||||||
void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) {
|
void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) {
|
||||||
assert(Old->HasValueHandle &&"Should only be called if ValueHandles present");
|
assert(Old->HasValueHandle &&"Should only be called if ValueHandles present");
|
||||||
assert(Old != New && "Changing value into itself!");
|
assert(Old != New && "Changing value into itself!");
|
||||||
|
|
||||||
// Get the linked list base, which is guaranteed to exist since the
|
// Get the linked list base, which is guaranteed to exist since the
|
||||||
// HasValueHandle flag is set.
|
// HasValueHandle flag is set.
|
||||||
LLVMContextImpl *pImpl = Old->getContext().pImpl;
|
LLVMContextImpl *pImpl = Old->getContext().pImpl;
|
||||||
ValueHandleBase *Entry = pImpl->ValueHandles[Old];
|
ValueHandleBase *Entry = pImpl->ValueHandles[Old];
|
||||||
|
|
||||||
assert(Entry && "Value bit set but no entries exist");
|
assert(Entry && "Value bit set but no entries exist");
|
||||||
|
|
||||||
while (Entry) {
|
while (Entry) {
|
||||||
// Advance pointer to avoid invalidation.
|
// Advance pointer to avoid invalidation.
|
||||||
ValueHandleBase *ThisNode = Entry;
|
ValueHandleBase *ThisNode = Entry;
|
||||||
Entry = Entry->Next;
|
Entry = Entry->Next;
|
||||||
|
|
||||||
switch (ThisNode->getKind()) {
|
switch (ThisNode->getKind()) {
|
||||||
case Assert:
|
case Assert:
|
||||||
// Asserting handle does not follow RAUW implicitly.
|
// Asserting handle does not follow RAUW implicitly.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user