-//===-- llvm/Target/TargetMachine.h - General Target Information -*- C++ -*-==//
+//===-- llvm/Target/TargetMachine.h - Target Information --------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
//
// This file describes the general parts of a Target machine.
//
#define LLVM_TARGET_TARGETMACHINE_H
#include "llvm/Target/TargetData.h"
-#include "Support/NonCopyable.h"
+#include <cassert>
+
+namespace llvm {
class TargetInstrInfo;
class TargetInstrDescriptor;
class TargetRegInfo;
class TargetFrameInfo;
class TargetCacheInfo;
-class TargetOptInfo;
class MachineCodeEmitter;
class MRegisterInfo;
+class FunctionPassManager;
class PassManager;
class Pass;
/// the target machine. All target-specific information should be accessible
/// through this interface.
///
-class TargetMachine : public NonCopyableV {
+class TargetMachine {
const std::string Name;
- const TargetData DataLayout; // Calculates type size & alignment
+ const TargetData DataLayout; // Calculates type size & alignment
+ TargetMachine(const TargetMachine&); // DO NOT IMPLEMENT
+ void operator=(const TargetMachine&); // DO NOT IMPLEMENT
protected:
TargetMachine(const std::string &name, // Can only create subclasses...
bool LittleEndian = false,
virtual const TargetRegInfo& getRegInfo() const = 0;
virtual const TargetFrameInfo& getFrameInfo() const = 0;
virtual const TargetCacheInfo& getCacheInfo() const = 0;
- virtual const TargetOptInfo& getOptInfo() const = 0;
const TargetData &getTargetData() const { return DataLayout; }
/// getRegisterInfo - If register information is available, return it. If
/// implement a fast dynamic compiler for this target. Return true if this is
/// not supported for this target.
///
- virtual bool addPassesToJITCompile(PassManager &PM) { return true; }
+ virtual bool addPassesToJITCompile(FunctionPassManager &PM) { return true; }
/// addPassesToEmitAssembly - Add passes to the specified pass manager to get
/// assembly langage code emitted. Typically this will involve several steps
}
/// addPassesToEmitMachineCode - Add passes to the specified pass manager to
- /// get machine code emitted. This uses a MAchineCodeEmitter object to handle
+ /// get machine code emitted. This uses a MachineCodeEmitter object to handle
/// actually outputting the machine code and resolving things like the address
/// of functions. This method should returns true if machine code emission is
/// not supported.
///
- virtual bool addPassesToEmitMachineCode(PassManager &PM,
+ virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
MachineCodeEmitter &MCE) {
return true;
}
+
+ /// replaceMachineCodeForFunction - Make it so that calling the
+ /// function whose machine code is at OLD turns into a call to NEW,
+ /// perhaps by overwriting OLD with a branch to NEW.
+ ///
+ /// FIXME: this is JIT-specific.
+ ///
+ virtual void replaceMachineCodeForFunction (void *Old, void *New) {
+ assert (0 && "Current target cannot replace machine code for functions");
+ }
+
+ /// getJITStubForFunction - Create or return a stub for the specified
+ /// function. This stub acts just like the specified function, except that it
+ /// allows the "address" of the function to be taken without having to
+ /// generate code for it.
+ virtual void *getJITStubForFunction(Function *F, MachineCodeEmitter &MCE) {
+ return 0;
+ }
};
+} // End llvm namespace
+
#endif