mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-06 01:24:35 +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:
@ -219,14 +219,7 @@ private:
|
||||
std::string TargetTriple; ///< Platform target triple Module compiled on
|
||||
///< Format: (arch)(sub)-(vendor)-(sys0-(abi)
|
||||
void *NamedMDSymTab; ///< NamedMDNode names.
|
||||
|
||||
// We need to keep the string because the C API expects us to own the string
|
||||
// representation.
|
||||
// Since we have it, we also use an empty string to represent a module without
|
||||
// a DataLayout. If it has a DataLayout, these variables are in sync and the
|
||||
// string is just a cache of getDataLayout()->getStringRepresentation().
|
||||
std::string DataLayoutStr;
|
||||
DataLayout DL;
|
||||
DataLayout DL; ///< DataLayout associated with the module
|
||||
|
||||
friend class Constant;
|
||||
|
||||
@ -256,10 +249,12 @@ public:
|
||||
|
||||
/// Get the data layout string for the module's target platform. This is
|
||||
/// equivalent to getDataLayout()->getStringRepresentation().
|
||||
const std::string &getDataLayoutStr() const { return DataLayoutStr; }
|
||||
const std::string getDataLayoutStr() const {
|
||||
return DL.getStringRepresentation();
|
||||
}
|
||||
|
||||
/// Get the data layout for the module's target platform.
|
||||
const DataLayout *getDataLayout() const;
|
||||
const DataLayout &getDataLayout() const;
|
||||
|
||||
/// Get the target triple which is a string describing the target host.
|
||||
/// @returns a string containing the target triple.
|
||||
@ -293,7 +288,7 @@ public:
|
||||
|
||||
/// Set the data layout
|
||||
void setDataLayout(StringRef Desc);
|
||||
void setDataLayout(const DataLayout *Other);
|
||||
void setDataLayout(const DataLayout &Other);
|
||||
|
||||
/// Set the target triple.
|
||||
void setTargetTriple(StringRef T) { TargetTriple = T; }
|
||||
|
Reference in New Issue
Block a user