mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
566cb6310b
Many Pipeline objects (Globals, Ranks, Kinds, Targets in a TargetList)
were ordered by load order, this makes the playback of traces difficult.
Moreover the order of loading of pipeline files also influences the
ordering of other elements (Step, Analys{is,esLists}). These are also
ordered to prevent incosistent ordering.
40 lines
1.0 KiB
C++
40 lines
1.0 KiB
C++
/// \file GlobalsMap.cpp
|
|
/// \brief GlobalsMap methods implementations
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include <system_error>
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/Support/FileSystem.h"
|
|
#include "llvm/Support/Path.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include "revng/Pipeline/GlobalsMap.h"
|
|
|
|
using namespace std;
|
|
using namespace pipeline;
|
|
using namespace llvm;
|
|
|
|
llvm::Error GlobalsMap::storeToDisk(llvm::StringRef Path) const {
|
|
for (const auto &Global : Map) {
|
|
llvm::SmallString<128> Filename;
|
|
llvm::sys::path::append(Filename, Path, Global.first);
|
|
if (auto E = Global.second->storeToDisk(Filename); !!E)
|
|
return E;
|
|
}
|
|
return llvm::Error::success();
|
|
}
|
|
|
|
llvm::Error GlobalsMap::loadFromDisk(llvm::StringRef Path) {
|
|
for (const auto &Global : Map) {
|
|
llvm::SmallString<128> Filename;
|
|
llvm::sys::path::append(Filename, Path, Global.first);
|
|
if (auto E = Global.second->loadFromDisk(Filename); !!E)
|
|
return E;
|
|
}
|
|
return llvm::Error::success();
|
|
}
|