mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 17:29:19 +00:00
Suppress a warning on gcc 4.4.
warning: suggest parentheses around ‘&&’ within ‘||’. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93121 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aa9c894523
commit
0d75d874bf
@ -31,7 +31,7 @@ MDString::MDString(LLVMContext &C, StringRef S)
|
||||
|
||||
MDString *MDString::get(LLVMContext &Context, StringRef Str) {
|
||||
LLVMContextImpl *pImpl = Context.pImpl;
|
||||
StringMapEntry<MDString *> &Entry =
|
||||
StringMapEntry<MDString *> &Entry =
|
||||
pImpl->MDStringCache.GetOrCreateValue(Str);
|
||||
MDString *&S = Entry.getValue();
|
||||
if (!S) S = new MDString(Context, Entry.getKey());
|
||||
@ -40,7 +40,7 @@ MDString *MDString::get(LLVMContext &Context, StringRef Str) {
|
||||
|
||||
MDString *MDString::get(LLVMContext &Context, const char *Str) {
|
||||
LLVMContextImpl *pImpl = Context.pImpl;
|
||||
StringMapEntry<MDString *> &Entry =
|
||||
StringMapEntry<MDString *> &Entry =
|
||||
pImpl->MDStringCache.GetOrCreateValue(Str ? StringRef(Str) : StringRef());
|
||||
MDString *&S = Entry.getValue();
|
||||
if (!S) S = new MDString(Context, Entry.getKey());
|
||||
@ -58,11 +58,11 @@ class MDNodeOperand : public CallbackVH {
|
||||
public:
|
||||
MDNodeOperand(Value *V, MDNode *P) : CallbackVH(V), Parent(P) {}
|
||||
~MDNodeOperand() {}
|
||||
|
||||
|
||||
void set(Value *V) {
|
||||
setValPtr(V);
|
||||
}
|
||||
|
||||
|
||||
virtual void deleted();
|
||||
virtual void allUsesReplacedWith(Value *NV);
|
||||
};
|
||||
@ -94,7 +94,7 @@ MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
|
||||
bool isFunctionLocal)
|
||||
: MetadataBase(Type::getMetadataTy(C), Value::MDNodeVal) {
|
||||
NumOperands = NumVals;
|
||||
|
||||
|
||||
if (isFunctionLocal)
|
||||
setValueSubclassData(getSubclassDataFromValue() | FunctionLocalBit);
|
||||
|
||||
@ -107,13 +107,13 @@ MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
|
||||
|
||||
/// ~MDNode - Destroy MDNode.
|
||||
MDNode::~MDNode() {
|
||||
assert((getSubclassDataFromValue() & DestroyFlag) != 0 &&
|
||||
assert((getSubclassDataFromValue() & DestroyFlag) != 0 &&
|
||||
"Not being destroyed through destroy()?");
|
||||
if (!isNotUniqued()) {
|
||||
LLVMContextImpl *pImpl = getType()->getContext().pImpl;
|
||||
pImpl->MDNodeSet.RemoveNode(this);
|
||||
}
|
||||
|
||||
|
||||
// Destroy the operands.
|
||||
for (MDNodeOperand *Op = getOperandPtr(this, 0), *E = Op+NumOperands;
|
||||
Op != E; ++Op)
|
||||
@ -145,7 +145,7 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
|
||||
Value *V = Vals[i];
|
||||
if (!V) continue;
|
||||
if (isa<Instruction>(V) || isa<Argument>(V) || isa<BasicBlock>(V) ||
|
||||
isa<MDNode>(V) && cast<MDNode>(V)->isFunctionLocal()) {
|
||||
(isa<MDNode>(V) && cast<MDNode>(V)->isFunctionLocal())) {
|
||||
isFunctionLocal = true;
|
||||
break;
|
||||
}
|
||||
@ -162,7 +162,7 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, Value *const *Vals,
|
||||
// Coallocate space for the node and Operands together, then placement new.
|
||||
void *Ptr = malloc(sizeof(MDNode)+NumVals*sizeof(MDNodeOperand));
|
||||
N = new (Ptr) MDNode(Context, Vals, NumVals, isFunctionLocal);
|
||||
|
||||
|
||||
// InsertPoint will have been set by the FindNodeOrInsertPos call.
|
||||
pImpl->MDNodeSet.InsertNode(N, InsertPoint);
|
||||
}
|
||||
@ -192,7 +192,7 @@ void MDNode::Profile(FoldingSetNodeID &ID) const {
|
||||
// Replace value from this node's operand list.
|
||||
void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
|
||||
Value *From = *Op;
|
||||
|
||||
|
||||
if (From == To)
|
||||
return;
|
||||
|
||||
@ -202,7 +202,7 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
|
||||
// If this node is already not being uniqued (because one of the operands
|
||||
// already went to null), then there is nothing else to do here.
|
||||
if (isNotUniqued()) return;
|
||||
|
||||
|
||||
LLVMContextImpl *pImpl = getType()->getContext().pImpl;
|
||||
|
||||
// Remove "this" from the context map. FoldingSet doesn't have to reprofile
|
||||
@ -216,7 +216,7 @@ void MDNode::replaceOperand(MDNodeOperand *Op, Value *To) {
|
||||
setIsNotUniqued();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Now that the node is out of the folding set, get ready to reinsert it.
|
||||
// First, check to see if another node with the same operands already exists
|
||||
// in the set. If it doesn't exist, this returns the position to insert it.
|
||||
@ -244,12 +244,12 @@ static SmallVector<WeakVH, 4> &getNMDOps(void *Operands) {
|
||||
}
|
||||
|
||||
NamedMDNode::NamedMDNode(LLVMContext &C, StringRef N,
|
||||
MDNode *const *MDs,
|
||||
MDNode *const *MDs,
|
||||
unsigned NumMDs, Module *ParentModule)
|
||||
: Value(Type::getMetadataTy(C), Value::NamedMDNodeVal), Parent(0) {
|
||||
setName(N);
|
||||
Operands = new SmallVector<WeakVH, 4>();
|
||||
|
||||
|
||||
SmallVector<WeakVH, 4> &Node = getNMDOps(Operands);
|
||||
for (unsigned i = 0; i != NumMDs; ++i)
|
||||
Node.push_back(WeakVH(MDs[i]));
|
||||
@ -264,7 +264,7 @@ NamedMDNode *NamedMDNode::Create(const NamedMDNode *NMD, Module *M) {
|
||||
assert(NMD && "Invalid source NamedMDNode!");
|
||||
SmallVector<MDNode *, 4> Elems;
|
||||
Elems.reserve(NMD->getNumOperands());
|
||||
|
||||
|
||||
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i)
|
||||
Elems.push_back(NMD->getOperand(i));
|
||||
return new NamedMDNode(NMD->getContext(), NMD->getName().data(),
|
||||
@ -340,9 +340,9 @@ static bool isValidName(StringRef MDName) {
|
||||
/// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
|
||||
unsigned LLVMContext::getMDKindID(StringRef Name) const {
|
||||
assert(isValidName(Name) && "Invalid MDNode name");
|
||||
|
||||
|
||||
unsigned &Entry = pImpl->CustomMDKindNames[Name];
|
||||
|
||||
|
||||
// If this is new, assign it its ID.
|
||||
if (Entry == 0) Entry = pImpl->CustomMDKindNames.size();
|
||||
return Entry;
|
||||
@ -354,7 +354,7 @@ void LLVMContext::getMDKindNames(SmallVectorImpl<StringRef> &Names) const {
|
||||
Names.resize(pImpl->CustomMDKindNames.size()+1);
|
||||
Names[0] = "";
|
||||
for (StringMap<unsigned>::const_iterator I = pImpl->CustomMDKindNames.begin(),
|
||||
E = pImpl->CustomMDKindNames.end(); I != E; ++I)
|
||||
E = pImpl->CustomMDKindNames.end(); I != E; ++I)
|
||||
// MD Handlers are numbered from 1.
|
||||
Names[I->second] = I->first();
|
||||
}
|
||||
@ -377,7 +377,7 @@ MDNode *Instruction::getMetadataImpl(const char *Kind) const {
|
||||
/// Node is null.
|
||||
void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
|
||||
if (Node == 0 && !hasMetadata()) return;
|
||||
|
||||
|
||||
// Handle the case when we're adding/updating metadata on an instruction.
|
||||
if (Node) {
|
||||
LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
|
||||
@ -392,24 +392,24 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No replacement, just add it to the list.
|
||||
Info.push_back(std::make_pair(KindID, Node));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, we're removing metadata from an instruction.
|
||||
assert(hasMetadata() && getContext().pImpl->MetadataStore.count(this) &&
|
||||
"HasMetadata bit out of date!");
|
||||
LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
|
||||
|
||||
|
||||
// Common case is removing the only entry.
|
||||
if (Info.size() == 1 && Info[0].first == KindID) {
|
||||
getContext().pImpl->MetadataStore.erase(this);
|
||||
setHasMetadata(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Handle replacement of an existing value.
|
||||
for (unsigned i = 0, e = Info.size(); i != e; ++i)
|
||||
if (Info[i].first == KindID) {
|
||||
@ -424,7 +424,7 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
|
||||
MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
|
||||
LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this];
|
||||
assert(hasMetadata() && !Info.empty() && "Shouldn't have called this");
|
||||
|
||||
|
||||
for (LLVMContextImpl::MDMapTy::iterator I = Info.begin(), E = Info.end();
|
||||
I != E; ++I)
|
||||
if (I->first == KindID)
|
||||
@ -439,10 +439,10 @@ void Instruction::getAllMetadataImpl(SmallVectorImpl<std::pair<unsigned,
|
||||
const LLVMContextImpl::MDMapTy &Info =
|
||||
getContext().pImpl->MetadataStore.find(this)->second;
|
||||
assert(!Info.empty() && "Shouldn't have called this");
|
||||
|
||||
|
||||
Result.clear();
|
||||
Result.append(Info.begin(), Info.end());
|
||||
|
||||
|
||||
// Sort the resulting array so it is stable.
|
||||
if (Result.size() > 1)
|
||||
array_pod_sort(Result.begin(), Result.end());
|
||||
|
Loading…
Reference in New Issue
Block a user