2014-03-06 03:50:29 +00:00
|
|
|
//===- GVMaterializer.h - Interface for GV materializers --------*- C++ -*-===//
|
2010-01-27 20:34:15 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file provides an abstract interface for loading a module from some
|
|
|
|
// place. This interface allows incremental or random access loading of
|
|
|
|
// functions from the file. This is useful for applications like JIT compilers
|
|
|
|
// or interprocedural optimizers that do not need the entire program in memory
|
|
|
|
// at the same time.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-03-06 03:50:29 +00:00
|
|
|
#ifndef LLVM_IR_GVMATERIALIZER_H
|
|
|
|
#define LLVM_IR_GVMATERIALIZER_H
|
2010-01-27 20:34:15 +00:00
|
|
|
|
2014-06-12 17:38:55 +00:00
|
|
|
#include <system_error>
|
2010-01-27 20:34:15 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class Function;
|
|
|
|
class GlobalValue;
|
|
|
|
class Module;
|
|
|
|
|
|
|
|
class GVMaterializer {
|
|
|
|
protected:
|
|
|
|
GVMaterializer() {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~GVMaterializer();
|
|
|
|
|
2014-05-07 17:04:45 +00:00
|
|
|
/// True if GV can be materialized from whatever backing store this
|
|
|
|
/// GVMaterializer uses and has not been materialized yet.
|
2010-01-27 20:34:15 +00:00
|
|
|
virtual bool isMaterializable(const GlobalValue *GV) const = 0;
|
|
|
|
|
2014-05-07 17:04:45 +00:00
|
|
|
/// True if GV has been materialized and can be dematerialized back to
|
|
|
|
/// whatever backing store this GVMaterializer uses.
|
2010-01-27 20:34:15 +00:00
|
|
|
virtual bool isDematerializable(const GlobalValue *GV) const = 0;
|
|
|
|
|
2014-05-07 17:04:45 +00:00
|
|
|
/// Make sure the given GlobalValue is fully read.
|
2010-01-27 20:34:15 +00:00
|
|
|
///
|
2014-06-12 21:46:39 +00:00
|
|
|
virtual std::error_code Materialize(GlobalValue *GV) = 0;
|
2010-01-27 20:34:15 +00:00
|
|
|
|
2014-05-07 17:04:45 +00:00
|
|
|
/// If the given GlobalValue is read in, and if the GVMaterializer supports
|
|
|
|
/// it, release the memory for the GV, and set it up to be materialized
|
|
|
|
/// lazily. If the Materializer doesn't support this capability, this method
|
|
|
|
/// is a noop.
|
2010-01-27 20:34:15 +00:00
|
|
|
///
|
|
|
|
virtual void Dematerialize(GlobalValue *) {}
|
|
|
|
|
2014-05-07 17:04:45 +00:00
|
|
|
/// Make sure the entire Module has been completely read.
|
2010-01-27 20:34:15 +00:00
|
|
|
///
|
2014-06-12 21:46:39 +00:00
|
|
|
virtual std::error_code MaterializeModule(Module *M) = 0;
|
2014-06-23 21:53:12 +00:00
|
|
|
|
|
|
|
virtual void releaseBuffer() = 0;
|
2010-01-27 20:34:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|