mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
Make DataLayout Non-Optional in the Module
Summary: DataLayout keeps the string used for its creation. As a side effect it is no longer needed in the Module. This is "almost" NFC, the string is no longer canonicalized, you can't rely on two "equals" DataLayout having the same string returned by getStringRepresentation(). Get rid of DataLayoutPass: the DataLayout is in the Module The DataLayout is "per-module", let's enforce this by not duplicating it more than necessary. One more step toward non-optionality of the DataLayout in the module. Make DataLayout Non-Optional in the Module Module->getDataLayout() will never returns nullptr anymore. Reviewers: echristo Subscribers: resistor, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D7992 From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231270 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -365,31 +365,11 @@ void Module::addModuleFlag(MDNode *Node) {
|
||||
|
||||
void Module::setDataLayout(StringRef Desc) {
|
||||
DL.reset(Desc);
|
||||
|
||||
if (Desc.empty()) {
|
||||
DataLayoutStr = "";
|
||||
} else {
|
||||
DataLayoutStr = DL.getStringRepresentation();
|
||||
// DataLayoutStr is now equivalent to Desc, but since the representation
|
||||
// is not unique, they may not be identical.
|
||||
}
|
||||
}
|
||||
|
||||
void Module::setDataLayout(const DataLayout *Other) {
|
||||
if (!Other) {
|
||||
DataLayoutStr = "";
|
||||
DL.reset("");
|
||||
} else {
|
||||
DL = *Other;
|
||||
DataLayoutStr = DL.getStringRepresentation();
|
||||
}
|
||||
}
|
||||
void Module::setDataLayout(const DataLayout &Other) { DL = Other; }
|
||||
|
||||
const DataLayout *Module::getDataLayout() const {
|
||||
if (DataLayoutStr.empty())
|
||||
return nullptr;
|
||||
return &DL;
|
||||
}
|
||||
const DataLayout &Module::getDataLayout() const { return DL; }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Methods to control the materialization of GlobalValues in the Module.
|
||||
|
Reference in New Issue
Block a user