diff options
author | dim <dim@FreeBSD.org> | 2015-05-27 20:26:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-05-27 20:26:41 +0000 |
commit | 5ef8fd3549d38e883a31881636be3dc2a275de20 (patch) | |
tree | bd13a22d9db57ccf3eddbc07b32c18109521d050 /contrib/llvm/lib/IR/Module.cpp | |
parent | 77794ebe2d5718eb502c93ec32f8ccae4d8a0b7b (diff) | |
parent | 782067d0278612ee75d024b9b135c221c327e9e8 (diff) | |
download | FreeBSD-src-5ef8fd3549d38e883a31881636be3dc2a275de20.zip FreeBSD-src-5ef8fd3549d38e883a31881636be3dc2a275de20.tar.gz |
Merge llvm trunk r238337 from ^/vendor/llvm/dist, resolve conflicts, and
preserve our customizations, where necessary.
Diffstat (limited to 'contrib/llvm/lib/IR/Module.cpp')
-rw-r--r-- | contrib/llvm/lib/IR/Module.cpp | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/contrib/llvm/lib/IR/Module.cpp b/contrib/llvm/lib/IR/Module.cpp index d32ffcd..043f74e 100644 --- a/contrib/llvm/lib/IR/Module.cpp +++ b/contrib/llvm/lib/IR/Module.cpp @@ -278,7 +278,7 @@ void Module::eraseNamedMetadata(NamedMDNode *NMD) { } bool Module::isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB) { - if (ConstantInt *Behavior = mdconst::dyn_extract<ConstantInt>(MD)) { + if (ConstantInt *Behavior = mdconst::dyn_extract_or_null<ConstantInt>(MD)) { uint64_t Val = Behavior->getLimitedValue(); if (Val >= ModFlagBehaviorFirstVal && Val <= ModFlagBehaviorLastVal) { MFB = static_cast<ModFlagBehavior>(Val); @@ -298,7 +298,7 @@ getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags) const { ModFlagBehavior MFB; if (Flag->getNumOperands() >= 3 && isValidModFlagBehavior(Flag->getOperand(0), MFB) && - isa<MDString>(Flag->getOperand(1))) { + dyn_cast_or_null<MDString>(Flag->getOperand(1))) { // Check the operands of the MDNode before accessing the operands. // The verifier will actually catch these failures. MDString *Key = cast<MDString>(Flag->getOperand(1)); @@ -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. @@ -414,15 +394,15 @@ std::error_code Module::materialize(GlobalValue *GV) { return Materializer->materialize(GV); } -void Module::Dematerialize(GlobalValue *GV) { +void Module::dematerialize(GlobalValue *GV) { if (Materializer) - return Materializer->Dematerialize(GV); + return Materializer->dematerialize(GV); } std::error_code Module::materializeAll() { if (!Materializer) return std::error_code(); - return Materializer->MaterializeModule(this); + return Materializer->materializeModule(this); } std::error_code Module::materializeAllPermanently() { @@ -433,6 +413,12 @@ std::error_code Module::materializeAllPermanently() { return std::error_code(); } +std::error_code Module::materializeMetadata() { + if (!Materializer) + return std::error_code(); + return Materializer->materializeMetadata(); +} + //===----------------------------------------------------------------------===// // Other module related stuff. // |