mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Syntactic sugar'ify stuff :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48182 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -316,7 +316,7 @@ static Value *RemapOperand(const Value *In,
|
|||||||
|
|
||||||
// Cache the mapping in our local map structure
|
// Cache the mapping in our local map structure
|
||||||
if (Result) {
|
if (Result) {
|
||||||
ValueMap.insert(std::make_pair(In, Result));
|
ValueMap[In] = Result;
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,7 +512,8 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
|||||||
ForceRenaming(NewDGV, SGV->getName());
|
ForceRenaming(NewDGV, SGV->getName());
|
||||||
|
|
||||||
// Make sure to remember this mapping...
|
// Make sure to remember this mapping...
|
||||||
ValueMap.insert(std::make_pair(SGV, NewDGV));
|
ValueMap[SGV] = NewDGV;
|
||||||
|
|
||||||
if (SGV->hasAppendingLinkage())
|
if (SGV->hasAppendingLinkage())
|
||||||
// Keep track that this is an appending variable...
|
// Keep track that this is an appending variable...
|
||||||
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
|
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
|
||||||
@ -532,22 +533,23 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
|||||||
CopyGVAttributes(NewDGV, SGV);
|
CopyGVAttributes(NewDGV, SGV);
|
||||||
|
|
||||||
// Make sure to remember this mapping...
|
// Make sure to remember this mapping...
|
||||||
ValueMap.insert(std::make_pair(SGV, NewDGV));
|
ValueMap[SGV] = NewDGV;
|
||||||
|
|
||||||
// Keep track that this is an appending variable...
|
// Keep track that this is an appending variable...
|
||||||
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
|
AppendingVars.insert(std::make_pair(SGV->getName(), NewDGV));
|
||||||
} else if (GlobalAlias *DGA = dyn_cast<GlobalAlias>(DGV)) {
|
} else if (GlobalAlias *DGA = dyn_cast<GlobalAlias>(DGV)) {
|
||||||
// SGV is global, but DGV is alias. The only valid mapping is when SGV is
|
// SGV is global, but DGV is alias. The only valid mapping is when SGV is
|
||||||
// external declaration, which is effectively a no-op. Also make sure
|
// external declaration, which is effectively a no-op. Also make sure
|
||||||
// linkage is correct.
|
// linkage calculation was correct.
|
||||||
if (SGV->isDeclaration() && !LinkFromSrc) {
|
if (SGV->isDeclaration() && !LinkFromSrc) {
|
||||||
// Make sure to remember this mapping...
|
// Make sure to remember this mapping...
|
||||||
ValueMap.insert(std::make_pair(SGV, DGA));
|
ValueMap[SGV] = DGA;
|
||||||
} else
|
} else
|
||||||
return Error(Err, "Global-Alias Collision on '" + SGV->getName() +
|
return Error(Err, "Global-Alias Collision on '" + SGV->getName() +
|
||||||
"': symbol multiple defined");
|
"': symbol multiple defined");
|
||||||
} else if (GlobalVariable *DGVar = dyn_cast<GlobalVariable>(DGV)) {
|
} else if (GlobalVariable *DGVar = dyn_cast<GlobalVariable>(DGV)) {
|
||||||
// Otherwise, perform the mapping as instructed by GetLinkageResult.
|
// Otherwise, perform the global-global mapping as instructed by
|
||||||
|
// GetLinkageResult.
|
||||||
if (LinkFromSrc) {
|
if (LinkFromSrc) {
|
||||||
// Propagate alignment, section, and visibility info.
|
// Propagate alignment, section, and visibility info.
|
||||||
CopyGVAttributes(DGVar, SGV);
|
CopyGVAttributes(DGVar, SGV);
|
||||||
@ -592,9 +594,7 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
|
|||||||
DGVar->setLinkage(NewLinkage);
|
DGVar->setLinkage(NewLinkage);
|
||||||
|
|
||||||
// Make sure to remember this mapping...
|
// Make sure to remember this mapping...
|
||||||
ValueMap.insert(std::make_pair(SGV,
|
ValueMap[SGV] = ConstantExpr::getBitCast(DGVar, SGV->getType());
|
||||||
ConstantExpr::getBitCast(DGVar,
|
|
||||||
SGV->getType())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -726,7 +726,7 @@ static bool LinkAlias(Module *Dest, const Module *Src,
|
|||||||
|
|
||||||
// Remember this mapping so uses in the source module get remapped
|
// Remember this mapping so uses in the source module get remapped
|
||||||
// later by RemapOperand.
|
// later by RemapOperand.
|
||||||
ValueMap.insert(std::make_pair(SGA, NewGA));
|
ValueMap[SGA] = NewGA;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -860,7 +860,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
ForceRenaming(NewDF, SF->getName());
|
ForceRenaming(NewDF, SF->getName());
|
||||||
|
|
||||||
// ... and remember this mapping...
|
// ... and remember this mapping...
|
||||||
ValueMap.insert(std::make_pair(SF, NewDF));
|
ValueMap[SF] = NewDF;
|
||||||
} else if (SF->isDeclaration()) {
|
} else if (SF->isDeclaration()) {
|
||||||
// If SF is a declaration or if both SF & DF are declarations, just link
|
// If SF is a declaration or if both SF & DF are declarations, just link
|
||||||
// the declarations, we aren't adding anything.
|
// the declarations, we aren't adding anything.
|
||||||
@ -870,7 +870,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
DF->setLinkage(SF->getLinkage());
|
DF->setLinkage(SF->getLinkage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ValueMap.insert(std::make_pair(SF, DF));
|
ValueMap[SF] = DF;
|
||||||
}
|
}
|
||||||
} else if (DF->isDeclaration() && !DF->hasDLLImportLinkage()) {
|
} else if (DF->isDeclaration() && !DF->hasDLLImportLinkage()) {
|
||||||
// If DF is external but SF is not...
|
// If DF is external but SF is not...
|
||||||
@ -881,7 +881,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
DF->setVisibility(SF->getVisibility());
|
DF->setVisibility(SF->getVisibility());
|
||||||
} else if (SF->hasWeakLinkage() || SF->hasLinkOnceLinkage()) {
|
} else if (SF->hasWeakLinkage() || SF->hasLinkOnceLinkage()) {
|
||||||
// At this point we know that DF has LinkOnce, Weak, or External* linkage.
|
// At this point we know that DF has LinkOnce, Weak, or External* linkage.
|
||||||
ValueMap.insert(std::make_pair(SF, DF));
|
ValueMap[SF] = DF;
|
||||||
|
|
||||||
// Linkonce+Weak = Weak
|
// Linkonce+Weak = Weak
|
||||||
// *+External Weak = *
|
// *+External Weak = *
|
||||||
@ -890,7 +890,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
|
|||||||
DF->setLinkage(SF->getLinkage());
|
DF->setLinkage(SF->getLinkage());
|
||||||
} else if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage()) {
|
} else if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage()) {
|
||||||
// At this point we know that SF has LinkOnce or External* linkage.
|
// At this point we know that SF has LinkOnce or External* linkage.
|
||||||
ValueMap.insert(std::make_pair(SF, DF));
|
ValueMap[SF] = DF;
|
||||||
if (!SF->hasLinkOnceLinkage() && !SF->hasExternalWeakLinkage())
|
if (!SF->hasLinkOnceLinkage() && !SF->hasExternalWeakLinkage())
|
||||||
// Don't inherit linkonce & external weak linkage
|
// Don't inherit linkonce & external weak linkage
|
||||||
DF->setLinkage(SF->getLinkage());
|
DF->setLinkage(SF->getLinkage());
|
||||||
@ -924,7 +924,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src,
|
|||||||
DI->setName(I->getName()); // Copy the name information over...
|
DI->setName(I->getName()); // Copy the name information over...
|
||||||
|
|
||||||
// Add a mapping to our local map
|
// Add a mapping to our local map
|
||||||
ValueMap.insert(std::make_pair(I, DI));
|
ValueMap[I] = DI;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Splice the body of the source function into the dest function.
|
// Splice the body of the source function into the dest function.
|
||||||
|
Reference in New Issue
Block a user