summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen/MachineFunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen/MachineFunction.h')
-rw-r--r--include/llvm/CodeGen/MachineFunction.h77
1 files changed, 44 insertions, 33 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index ea6a384..ba831ca 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -18,15 +18,16 @@
#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
#define LLVM_CODEGEN_MACHINEFUNCTION_H
+#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/ADT/ilist.h"
#include "llvm/Support/DebugLoc.h"
-#include "llvm/CodeGen/MachineBasicBlock.h"
-#include "llvm/Support/Annotation.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Recycler.h"
+#include <map>
namespace llvm {
+class Value;
class Function;
class MachineRegisterInfo;
class MachineFrameInfo;
@@ -38,7 +39,7 @@ class TargetRegisterClass;
template <>
struct ilist_traits<MachineBasicBlock>
: public ilist_default_traits<MachineBasicBlock> {
- mutable ilist_node<MachineBasicBlock> Sentinel;
+ mutable ilist_half_node<MachineBasicBlock> Sentinel;
public:
MachineBasicBlock *createSentinel() const {
return static_cast<MachineBasicBlock*>(&Sentinel);
@@ -63,11 +64,11 @@ private:
/// of type are accessed/created with MF::getInfo and destroyed when the
/// MachineFunction is destroyed.
struct MachineFunctionInfo {
- virtual ~MachineFunctionInfo() {}
+ virtual ~MachineFunctionInfo();
};
-class MachineFunction : private Annotation {
- const Function *Fn;
+class MachineFunction {
+ Function *Fn;
const TargetMachine &Target;
// RegInfo - Information about each register in use in the function.
@@ -115,12 +116,12 @@ class MachineFunction : private Annotation {
unsigned Alignment;
public:
- MachineFunction(const Function *Fn, const TargetMachine &TM);
+ MachineFunction(Function *Fn, const TargetMachine &TM);
~MachineFunction();
/// getFunction - Return the LLVM function that this machine code represents
///
- const Function *getFunction() const { return Fn; }
+ Function *getFunction() const { return Fn; }
/// getTarget - Return the target machine this machine code is compiled with
///
@@ -159,8 +160,8 @@ public:
///
void setAlignment(unsigned A) { Alignment = A; }
- /// MachineFunctionInfo - Keep track of various per-function pieces of
- /// information for backends that would like to do so.
+ /// getInfo - Keep track of various per-function pieces of information for
+ /// backends that would like to do so.
///
template<typename Ty>
Ty *getInfo() {
@@ -207,8 +208,7 @@ public:
/// print - Print out the MachineFunction in a format suitable for debugging
/// to the specified stream.
///
- void print(std::ostream &OS) const;
- void print(std::ostream *OS) const { if (OS) print(*OS); }
+ void print(raw_ostream &OS) const;
/// viewCFG - This function is meant for use from the debugger. You can just
/// say 'call F->viewCFG()' and a ghostview window should pop up from the
@@ -229,21 +229,6 @@ public:
///
void dump() const;
- /// construct - Allocate and initialize a MachineFunction for a given Function
- /// and Target
- ///
- static MachineFunction& construct(const Function *F, const TargetMachine &TM);
-
- /// destruct - Destroy the MachineFunction corresponding to a given Function
- ///
- static void destruct(const Function *F);
-
- /// get - Return a handle to a MachineFunction corresponding to the given
- /// Function. This should not be called before "construct()" for a given
- /// Function.
- ///
- static MachineFunction& get(const Function *F);
-
// Provide accessors for the MachineBasicBlock list...
typedef BasicBlockListType::iterator iterator;
typedef BasicBlockListType::const_iterator const_iterator;
@@ -336,16 +321,42 @@ public:
///
void DeleteMachineBasicBlock(MachineBasicBlock *MBB);
+ /// getMachineMemOperand - Allocate a new MachineMemOperand.
+ /// MachineMemOperands are owned by the MachineFunction and need not be
+ /// explicitly deallocated.
+ MachineMemOperand *getMachineMemOperand(const Value *v, unsigned f,
+ int64_t o, uint64_t s,
+ unsigned base_alignment);
+
+ /// getMachineMemOperand - Allocate a new MachineMemOperand by copying
+ /// an existing one, adjusting by an offset and using the given size.
+ /// MachineMemOperands are owned by the MachineFunction and need not be
+ /// explicitly deallocated.
+ MachineMemOperand *getMachineMemOperand(const MachineMemOperand *MMO,
+ int64_t Offset, uint64_t Size);
+
+ /// allocateMemRefsArray - Allocate an array to hold MachineMemOperand
+ /// pointers. This array is owned by the MachineFunction.
+ MachineInstr::mmo_iterator allocateMemRefsArray(unsigned long Num);
+
+ /// extractLoadMemRefs - Allocate an array and populate it with just the
+ /// load information from the given MachineMemOperand sequence.
+ std::pair<MachineInstr::mmo_iterator,
+ MachineInstr::mmo_iterator>
+ extractLoadMemRefs(MachineInstr::mmo_iterator Begin,
+ MachineInstr::mmo_iterator End);
+
+ /// extractStoreMemRefs - Allocate an array and populate it with just the
+ /// store information from the given MachineMemOperand sequence.
+ std::pair<MachineInstr::mmo_iterator,
+ MachineInstr::mmo_iterator>
+ extractStoreMemRefs(MachineInstr::mmo_iterator Begin,
+ MachineInstr::mmo_iterator End);
+
//===--------------------------------------------------------------------===//
// Debug location.
//
- /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
- /// source file, line, and column. If none currently exists, create a new
- /// DebugLocTuple, and insert it into the DebugIdMap.
- unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit,
- unsigned Line, unsigned Col);
-
/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
DebugLocTuple getDebugLocTuple(DebugLoc DL) const;
OpenPOWER on IntegriCloud