summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-04-06 15:52:58 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-04-06 15:52:58 +0000
commit5f970ec96e421f64db6b1c6509a902ea73d98cc7 (patch)
tree0dd020f28a4846707f8d60717d9b2921ea187bd8 /include/llvm/CodeGen
parent62cc576dca6a6aa62c0424f0a1e93a0a679d4c8a (diff)
downloadFreeBSD-src-5f970ec96e421f64db6b1c6509a902ea73d98cc7.zip
FreeBSD-src-5f970ec96e421f64db6b1c6509a902ea73d98cc7.tar.gz
Update LLVM to r100520.
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h376
-rw-r--r--include/llvm/CodeGen/DwarfWriter.h96
-rw-r--r--include/llvm/CodeGen/FastISel.h6
-rw-r--r--include/llvm/CodeGen/GCMetadataPrinter.h8
-rw-r--r--include/llvm/CodeGen/MachineDominators.h9
-rw-r--r--include/llvm/CodeGen/MachineFrameInfo.h28
-rw-r--r--include/llvm/CodeGen/MachineFunction.h14
-rw-r--r--include/llvm/CodeGen/MachineFunctionAnalysis.h2
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h6
-rw-r--r--include/llvm/CodeGen/ScheduleDAG.h1
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h16
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h4
12 files changed, 248 insertions, 318 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index a405932..2eff501 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -18,8 +18,6 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Support/DebugLoc.h"
-#include "llvm/Target/TargetMachine.h"
-#include "llvm/ADT/DenseMap.h"
namespace llvm {
class BlockAddress;
@@ -43,63 +41,33 @@ namespace llvm {
class MachineConstantPoolValue;
class MachineJumpTableInfo;
class MachineModuleInfo;
+ class MachineMove;
+ class MCAsmInfo;
class MCInst;
class MCContext;
class MCSection;
class MCStreamer;
class MCSymbol;
- class DwarfWriter;
+ class DwarfDebug;
+ class DwarfException;
class Mangler;
- class MCAsmInfo;
class TargetLoweringObjectFile;
+ class TargetData;
class Twine;
class Type;
- class formatted_raw_ostream;
/// AsmPrinter - This class is intended to be used as a driving class for all
/// asm writers.
class AsmPrinter : public MachineFunctionPass {
- static char ID;
-
- // GCMetadataPrinters - The garbage collection metadata printer table.
- typedef DenseMap<GCStrategy*,GCMetadataPrinter*> gcp_map_type;
- typedef gcp_map_type::iterator gcp_iterator;
- gcp_map_type GCMetadataPrinters;
-
- /// If VerboseAsm is set, a pointer to the loop info for this
- /// function.
- ///
- MachineLoopInfo *LI;
-
- public:
- /// MMI - If available, this is a pointer to the current MachineModuleInfo.
- MachineModuleInfo *MMI;
-
- protected:
- /// DW - If available, this is a pointer to the current dwarf writer.
- DwarfWriter *DW;
-
public:
-
- /// Output stream on which we're printing assembly code.
- ///
- formatted_raw_ostream &O;
-
/// Target machine description.
///
TargetMachine &TM;
- /// getObjFileLowering - Return information about object file lowering.
- TargetLoweringObjectFile &getObjFileLowering() const;
-
/// Target Asm Printer information.
///
const MCAsmInfo *MAI;
- /// Target Register Information.
- ///
- const TargetRegisterInfo *TRI;
-
/// OutContext - This is the context for the output file that we are
/// streaming. This owns all of the global MC-related objects for the
/// generated translation unit.
@@ -114,6 +82,9 @@ namespace llvm {
/// The current machine function.
const MachineFunction *MF;
+ /// MMI - This is a pointer to the current MachineModuleInfo.
+ MachineModuleInfo *MMI;
+
/// Name-mangler for global names.
///
Mangler *Mang;
@@ -123,24 +94,28 @@ namespace llvm {
///
MCSymbol *CurrentFnSym;
- /// getCurrentSection() - Return the current section we are emitting to.
- const MCSection *getCurrentSection() const;
+ private:
+ // GCMetadataPrinters - The garbage collection metadata printer table.
+ void *GCMetadataPrinters; // Really a DenseMap.
-
/// VerboseAsm - Emit comments in assembly output if this is true.
///
bool VerboseAsm;
+ static char ID;
+
+ /// If VerboseAsm is set, a pointer to the loop info for this
+ /// function.
+ MachineLoopInfo *LI;
- /// Private state for PrintSpecial()
- // Assign a unique ID to this machine instruction.
- mutable const MachineInstr *LastMI;
- mutable const Function *LastFn;
- mutable unsigned Counter;
- mutable unsigned SetCounter;
+ /// DD - If the target supports dwarf debug info, this pointer is non-null.
+ DwarfDebug *DD;
+
+ /// DE - If the target supports dwarf exception info, this pointer is
+ /// non-null.
+ DwarfException *DE;
protected:
- explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
- MCStreamer &Streamer);
+ explicit AsmPrinter(TargetMachine &TM, MCStreamer &Streamer);
public:
virtual ~AsmPrinter();
@@ -153,7 +128,20 @@ namespace llvm {
///
unsigned getFunctionNumber() const;
- protected:
+ /// getObjFileLowering - Return information about object file lowering.
+ TargetLoweringObjectFile &getObjFileLowering() const;
+
+ /// getTargetData - Return information about data layout.
+ const TargetData &getTargetData() const;
+
+ /// getCurrentSection() - Return the current section we are emitting to.
+ const MCSection *getCurrentSection() const;
+
+
+ //===------------------------------------------------------------------===//
+ // MachineFunctionPass Implementation.
+ //===------------------------------------------------------------------===//
+
/// getAnalysisUsage - Record analysis usage.
///
void getAnalysisUsage(AnalysisUsage &AU) const;
@@ -163,41 +151,10 @@ namespace llvm {
/// call this implementation.
bool doInitialization(Module &M);
- /// EmitStartOfAsmFile - This virtual method can be overridden by targets
- /// that want to emit something at the start of their file.
- virtual void EmitStartOfAsmFile(Module &) {}
-
- /// EmitEndOfAsmFile - This virtual method can be overridden by targets that
- /// want to emit something at the end of their file.
- virtual void EmitEndOfAsmFile(Module &) {}
-
/// doFinalization - Shut down the asmprinter. If you override this in your
/// pass, you must make sure to call it explicitly.
bool doFinalization(Module &M);
- /// PrintSpecial - Print information related to the specified machine instr
- /// that is independent of the operand, and may be independent of the instr
- /// itself. This can be useful for portably encoding the comment character
- /// or other bits of target-specific knowledge into the asmstrings. The
- /// syntax used is ${:comment}. Targets can override this to add support
- /// for their own strange codes.
- virtual void PrintSpecial(const MachineInstr *MI, const char *Code) const;
-
- /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
- /// instruction, using the specified assembler variant. Targets should
- /// override this to format as appropriate. This method can return true if
- /// the operand is erroneous.
- virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
- unsigned AsmVariant, const char *ExtraCode);
-
- /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM
- /// instruction, using the specified assembler variant as an address.
- /// Targets should override this to format as appropriate. This method can
- /// return true if the operand is erroneous.
- virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
- unsigned AsmVariant,
- const char *ExtraCode);
-
/// runOnMachineFunction - Emit the specified function out to the
/// OutStreamer.
virtual bool runOnMachineFunction(MachineFunction &MF) {
@@ -207,6 +164,10 @@ namespace llvm {
return false;
}
+ //===------------------------------------------------------------------===//
+ // Coarse grained IR lowering routines.
+ //===------------------------------------------------------------------===//
+
/// SetupMachineFunction - This should be called when a new MachineFunction
/// is being processed from runOnMachineFunction.
void SetupMachineFunction(MachineFunction &MF);
@@ -219,19 +180,6 @@ namespace llvm {
/// function.
void EmitFunctionBody();
- /// EmitInstruction - Targets should implement this to emit instructions.
- virtual void EmitInstruction(const MachineInstr *) {
- assert(0 && "EmitInstruction not implemented");
- }
-
- /// EmitFunctionBodyStart - Targets can override this to emit stuff before
- /// the first basic block in the function.
- virtual void EmitFunctionBodyStart() {}
-
- /// EmitFunctionBodyEnd - Targets can override this to emit stuff after
- /// the last basic block in the function.
- virtual void EmitFunctionBodyEnd() {}
-
/// EmitConstantPool - Print to the current output stream assembly
/// representations of the constants in the constant pool MCP. This is
/// used to print out constants which have been "spilled to memory" by
@@ -252,36 +200,6 @@ namespace llvm {
/// do nothing and return false.
bool EmitSpecialLLVMGlobal(const GlobalVariable *GV);
- public:
- //===------------------------------------------------------------------===//
- // Emission and print routines
- //
-
- /// EmitInt8 - Emit a byte directive and value.
- ///
- void EmitInt8(int Value) const;
-
- /// EmitInt16 - Emit a short directive and value.
- ///
- void EmitInt16(int Value) const;
-
- /// EmitInt32 - Emit a long directive and value.
- ///
- void EmitInt32(int Value) const;
-
- /// EmitInt64 - Emit a long long directive and value.
- ///
- void EmitInt64(uint64_t Value) const;
-
-
- /// EmitLabelDifference - Emit something like ".long Hi-Lo" where the size
- /// in bytes of the directive is specified by Size and Hi/Lo specify the
- /// labels. This implicitly uses .set if it is available.
- void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
- unsigned Size) const;
-
- //===------------------------------------------------------------------===//
-
/// EmitAlignment - Emit an alignment directive to the specified power of
/// two boundary. For example, if you pass in 3 here, you will get an 8
/// byte alignment. If a global value is specified, and if that global has
@@ -301,11 +219,69 @@ namespace llvm {
void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0,
unsigned ForcedAlignBits = 0,
bool UseFillExpr = true) const;
+
+ /// EmitBasicBlockStart - This method prints the label for the specified
+ /// MachineBasicBlock, an alignment (if present) and a comment describing
+ /// it if appropriate.
+ void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
+
+
+ /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
+ void EmitGlobalConstant(const Constant *CV, unsigned AddrSpace = 0);
+
+
+ //===------------------------------------------------------------------===//
+ // Overridable Hooks
+ //===------------------------------------------------------------------===//
+
+ // Targets can, or in the case of EmitInstruction, must implement these to
+ // customize output.
+
+ /// EmitStartOfAsmFile - This virtual method can be overridden by targets
+ /// that want to emit something at the start of their file.
+ virtual void EmitStartOfAsmFile(Module &) {}
+
+ /// EmitEndOfAsmFile - This virtual method can be overridden by targets that
+ /// want to emit something at the end of their file.
+ virtual void EmitEndOfAsmFile(Module &) {}
+
+ /// EmitFunctionBodyStart - Targets can override this to emit stuff before
+ /// the first basic block in the function.
+ virtual void EmitFunctionBodyStart() {}
+
+ /// EmitFunctionBodyEnd - Targets can override this to emit stuff after
+ /// the last basic block in the function.
+ virtual void EmitFunctionBodyEnd() {}
+
+ /// EmitInstruction - Targets should implement this to emit instructions.
+ virtual void EmitInstruction(const MachineInstr *) {
+ assert(0 && "EmitInstruction not implemented");
+ }
+
+ virtual void EmitFunctionEntryLabel();
+
+ virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
+
+ /// isBlockOnlyReachableByFallthough - Return true if the basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ virtual bool
+ isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
+
+ //===------------------------------------------------------------------===//
+ // Symbol Lowering Routines.
+ //===------------------------------------------------------------------===//
+ public:
- /// printDeclare - This method prints a local variable declaration used by
- /// debug tables.
- void printDeclare(const MachineInstr *MI) const;
-
+ /// GetTempSymbol - Return the MCSymbol corresponding to the assembler
+ /// temporary label with the specified stem and unique ID.
+ MCSymbol *GetTempSymbol(StringRef Name, unsigned ID) const;
+
+ /// GetTempSymbol - Return an assembler temporary label with the specified
+ /// stem.
+ MCSymbol *GetTempSymbol(StringRef Name) const;
+
+
/// GetSymbolWithGlobalValueBase - Return the MCSymbol for a symbol with
/// global value name as its base, with the specified suffix, and where the
/// symbol is forced to have private linkage if ForcePrivate is true.
@@ -332,49 +308,131 @@ namespace llvm {
MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const;
MCSymbol *GetBlockAddressSymbol(const BasicBlock *BB) const;
- /// EmitBasicBlockStart - This method prints the label for the specified
- /// MachineBasicBlock, an alignment (if present) and a comment describing
- /// it if appropriate.
- void EmitBasicBlockStart(const MachineBasicBlock *MBB) const;
+ //===------------------------------------------------------------------===//
+ // Emission Helper Routines.
+ //===------------------------------------------------------------------===//
+ public:
+ /// printOffset - This is just convenient handler for printing offsets.
+ void printOffset(int64_t Offset, raw_ostream &OS) const;
+ /// EmitInt8 - Emit a byte directive and value.
+ ///
+ void EmitInt8(int Value) const;
- // Data emission.
+ /// EmitInt16 - Emit a short directive and value.
+ ///
+ void EmitInt16(int Value) const;
- /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
- void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0);
+ /// EmitInt32 - Emit a long directive and value.
+ ///
+ void EmitInt32(int Value) const;
- protected:
- virtual void EmitFunctionEntryLabel();
+ /// EmitLabelDifference - Emit something like ".long Hi-Lo" where the size
+ /// in bytes of the directive is specified by Size and Hi/Lo specify the
+ /// labels. This implicitly uses .set if it is available.
+ void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo,
+ unsigned Size) const;
- virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
-
- /// printOffset - This is just convenient handler for printing offsets.
- void printOffset(int64_t Offset) const;
-
- /// isBlockOnlyReachableByFallthough - Return true if the basic block has
- /// exactly one predecessor and the control transfer mechanism between
- /// the predecessor and this block is a fall-through.
- virtual bool isBlockOnlyReachableByFallthrough(const MachineBasicBlock *MBB) const;
+ //===------------------------------------------------------------------===//
+ // Dwarf Emission Helper Routines
+ //===------------------------------------------------------------------===//
+
+ /// EmitSLEB128 - emit the specified signed leb128 value.
+ void EmitSLEB128(int Value, const char *Desc = 0) const;
+
+ /// EmitULEB128 - emit the specified unsigned leb128 value.
+ void EmitULEB128(unsigned Value, const char *Desc = 0,
+ unsigned PadTo = 0) const;
+
+ /// EmitCFAByte - Emit a .byte 42 directive for a DW_CFA_xxx value.
+ void EmitCFAByte(unsigned Val) const;
+ /// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an
+ /// encoding. If verbose assembly output is enabled, we output comments
+ /// describing the encoding. Desc is a string saying what the encoding is
+ /// specifying (e.g. "LSDA").
+ void EmitEncodingByte(unsigned Val, const char *Desc = 0) const;
+
+ /// GetSizeOfEncodedValue - Return the size of the encoding in bytes.
+ unsigned GetSizeOfEncodedValue(unsigned Encoding) const;
+
+ /// EmitReference - Emit a reference to a label with a specified encoding.
+ ///
+ void EmitReference(const MCSymbol *Sym, unsigned Encoding) const;
+ void EmitReference(const GlobalValue *GV, unsigned Encoding) const;
+
+ /// EmitSectionOffset - Emit the 4-byte offset of Label from the start of
+ /// its section. This can be done with a special directive if the target
+ /// supports it (e.g. cygwin) or by emitting it as an offset from a label at
+ /// the start of the section.
+ ///
+ /// SectionLabel is a temporary label emitted at the start of the section
+ /// that Label lives in.
+ void EmitSectionOffset(const MCSymbol *Label,
+ const MCSymbol *SectionLabel) const;
+
+ //===------------------------------------------------------------------===//
+ // Dwarf Lowering Routines
+ //===------------------------------------------------------------------===//
+
+ /// EmitFrameMoves - Emit frame instructions to describe the layout of the
+ /// frame.
+ void EmitFrameMoves(const std::vector<MachineMove> &Moves,
+ MCSymbol *BaseLabel, bool isEH) const;
+
+
+ //===------------------------------------------------------------------===//
+ // Inline Asm Support
+ //===------------------------------------------------------------------===//
+ public:
+ // These are hooks that targets can override to implement inline asm
+ // support. These should probably be moved out of AsmPrinter someday.
+
+ /// PrintSpecial - Print information related to the specified machine instr
+ /// that is independent of the operand, and may be independent of the instr
+ /// itself. This can be useful for portably encoding the comment character
+ /// or other bits of target-specific knowledge into the asmstrings. The
+ /// syntax used is ${:comment}. Targets can override this to add support
+ /// for their own strange codes.
+ virtual void PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
+ const char *Code) const;
+
+ /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM
+ /// instruction, using the specified assembler variant. Targets should
+ /// override this to format as appropriate. This method can return true if
+ /// the operand is erroneous.
+ virtual bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant, const char *ExtraCode,
+ raw_ostream &OS);
+
+ /// PrintAsmMemoryOperand - Print the specified operand of MI, an INLINEASM
+ /// instruction, using the specified assembler variant as an address.
+ /// Targets should override this to format as appropriate. This method can
+ /// return true if the operand is erroneous.
+ virtual bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
+ unsigned AsmVariant,
+ const char *ExtraCode,
+ raw_ostream &OS);
+
private:
+ /// Private state for PrintSpecial()
+ // Assign a unique ID to this machine instruction.
+ mutable const MachineInstr *LastMI;
+ mutable unsigned LastFn;
+ mutable unsigned Counter;
+ mutable unsigned SetCounter;
- /// processDebugLoc - Processes the debug information of each machine
- /// instruction's DebugLoc.
- void processDebugLoc(const MachineInstr *MI, bool BeforePrintingInsn);
+ /// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
+ void EmitInlineAsm(StringRef Str, unsigned LocCookie) const;
- void printLabelInst(const MachineInstr *MI) const;
-
- /// printInlineAsm - This method formats and prints the specified machine
+ /// EmitInlineAsm - This method formats and emits the specified machine
/// instruction that is an inline asm.
- void printInlineAsm(const MachineInstr *MI) const;
-
- /// printImplicitDef - This method prints the specified machine instruction
- /// that is an implicit def.
- void printImplicitDef(const MachineInstr *MI) const;
-
- /// printKill - This method prints the specified kill machine instruction.
- void printKill(const MachineInstr *MI) const;
+ void EmitInlineAsm(const MachineInstr *MI) const;
+ //===------------------------------------------------------------------===//
+ // Internal Implementation Details
+ //===------------------------------------------------------------------===//
+
/// EmitVisibility - This emits visibility information about symbol, if
/// this is suported by the target.
void EmitVisibility(MCSymbol *Sym, unsigned Visibility) const;
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
deleted file mode 100644
index 494400e..0000000
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ /dev/null
@@ -1,96 +0,0 @@
-//===-- llvm/CodeGen/DwarfWriter.h - Dwarf Framework ------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains support for writing Dwarf debug and exception info into
-// asm files. For Details on the Dwarf 3 specfication see DWARF Debugging
-// Information Format V.3 reference manual http://dwarf.freestandards.org ,
-//
-// The role of the Dwarf Writer class is to extract information from the
-// MachineModuleInfo object, organize it in Dwarf form and then emit it into asm
-// the current asm file using data and high level Dwarf directives.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_CODEGEN_DWARFWRITER_H
-#define LLVM_CODEGEN_DWARFWRITER_H
-
-#include "llvm/Pass.h"
-#include "llvm/Target/TargetMachine.h"
-
-namespace llvm {
-
-class AsmPrinter;
-class DwarfDebug;
-class DwarfException;
-class MachineModuleInfo;
-class MachineFunction;
-class MachineInstr;
-class Value;
-class Module;
-class MDNode;
-class MCAsmInfo;
-class MCSymbol;
-class raw_ostream;
-class Instruction;
-class DICompileUnit;
-class DISubprogram;
-class DIVariable;
-
-//===----------------------------------------------------------------------===//
-// DwarfWriter - Emits Dwarf debug and exception handling directives.
-//
-
-class DwarfWriter : public ImmutablePass {
-private:
- /// DD - Provides the DwarfWriter debug implementation.
- ///
- DwarfDebug *DD;
-
- /// DE - Provides the DwarfWriter exception implementation.
- ///
- DwarfException *DE;
-
-public:
- static char ID; // Pass identification, replacement for typeid
-
- DwarfWriter();
- virtual ~DwarfWriter();
-
- //===--------------------------------------------------------------------===//
- // Main entry points.
- //
-
- /// BeginModule - Emit all Dwarf sections that should come prior to the
- /// content.
- void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
- AsmPrinter *A, const MCAsmInfo *T);
-
- /// EndModule - Emit all Dwarf sections that should come after the content.
- ///
- void EndModule();
-
- /// BeginFunction - Gather pre-function debug information. Assumes being
- /// emitted immediately after the function entry point.
- void BeginFunction(const MachineFunction *MF);
-
- /// EndFunction - Gather and emit post-function debug information.
- ///
- void EndFunction(const MachineFunction *MF);
-
- /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
- /// be emitted.
- bool ShouldEmitDwarfDebug() const;
-
- void BeginScope(const MachineInstr *MI);
- void EndScope(const MachineInstr *MI);
-};
-
-} // end llvm namespace
-
-#endif
diff --git a/include/llvm/CodeGen/FastISel.h b/include/llvm/CodeGen/FastISel.h
index 9d0f0d9..8d33665 100644
--- a/include/llvm/CodeGen/FastISel.h
+++ b/include/llvm/CodeGen/FastISel.h
@@ -27,8 +27,6 @@ class MachineBasicBlock;
class MachineConstantPool;
class MachineFunction;
class MachineFrameInfo;
-class MachineModuleInfo;
-class DwarfWriter;
class MachineRegisterInfo;
class TargetData;
class TargetInstrInfo;
@@ -50,8 +48,6 @@ protected:
SmallSet<Instruction*, 8> &CatchInfoLost;
#endif
MachineFunction &MF;
- MachineModuleInfo *MMI;
- DwarfWriter *DW;
MachineRegisterInfo &MRI;
MachineFrameInfo &MFI;
MachineConstantPool &MCP;
@@ -116,8 +112,6 @@ public:
protected:
FastISel(MachineFunction &mf,
- MachineModuleInfo *mmi,
- DwarfWriter *dw,
DenseMap<const Value *, unsigned> &vm,
DenseMap<const BasicBlock *, MachineBasicBlock *> &bm,
DenseMap<const AllocaInst *, int> &am
diff --git a/include/llvm/CodeGen/GCMetadataPrinter.h b/include/llvm/CodeGen/GCMetadataPrinter.h
index 62875c3..3703545 100644
--- a/include/llvm/CodeGen/GCMetadataPrinter.h
+++ b/include/llvm/CodeGen/GCMetadataPrinter.h
@@ -27,8 +27,6 @@
namespace llvm {
class GCMetadataPrinter;
- class raw_ostream;
- class MCAsmInfo;
/// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
/// defaults from Registry.
@@ -63,11 +61,9 @@ namespace llvm {
iterator end() { return S->end(); }
/// beginAssembly/finishAssembly - Emit module metadata as assembly code.
- virtual void beginAssembly(raw_ostream &OS, AsmPrinter &AP,
- const MCAsmInfo &MAI);
+ virtual void beginAssembly(AsmPrinter &AP);
- virtual void finishAssembly(raw_ostream &OS, AsmPrinter &AP,
- const MCAsmInfo &MAI);
+ virtual void finishAssembly(AsmPrinter &AP);
virtual ~GCMetadataPrinter();
};
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h
index 086528a..48695d5 100644
--- a/include/llvm/CodeGen/MachineDominators.h
+++ b/include/llvm/CodeGen/MachineDominators.h
@@ -156,8 +156,13 @@ public:
inline void splitBlock(MachineBasicBlock* NewBB) {
DT->splitBlock(NewBB);
}
-
-
+
+ /// isReachableFromEntry - Return true if A is dominated by the entry
+ /// block of the function containing it.
+ bool isReachableFromEntry(MachineBasicBlock *A) {
+ return DT->isReachableFromEntry(A);
+ }
+
virtual void releaseMemory();
virtual void print(raw_ostream &OS, const Module*) const;
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index 043e97f..c7c5300 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -14,12 +14,9 @@
#ifndef LLVM_CODEGEN_MACHINEFRAMEINFO_H
#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
-#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/System/DataTypes.h"
#include <cassert>
-#include <limits>
#include <vector>
namespace llvm {
@@ -27,26 +24,21 @@ class raw_ostream;
class TargetData;
class TargetRegisterClass;
class Type;
-class MachineModuleInfo;
class MachineFunction;
class MachineBasicBlock;
class TargetFrameInfo;
+class BitVector;
/// The CalleeSavedInfo class tracks the information need to locate where a
/// callee saved register in the current frame.
class CalleeSavedInfo {
-
-private:
unsigned Reg;
const TargetRegisterClass *RegClass;
int FrameIdx;
public:
CalleeSavedInfo(unsigned R, const TargetRegisterClass *RC, int FI = 0)
- : Reg(R)
- , RegClass(RC)
- , FrameIdx(FI)
- {}
+ : Reg(R), RegClass(RC), FrameIdx(FI) {}
// Accessors.
unsigned getReg() const { return Reg; }
@@ -188,13 +180,6 @@ class MachineFrameInfo {
/// spill slots.
SmallVector<bool, 8> SpillObjects;
- /// MMI - This field is set (via setMachineModuleInfo) by a module info
- /// consumer (ex. DwarfWriter) to indicate that frame layout information
- /// should be acquired. Typically, it's the responsibility of the target's
- /// TargetRegisterInfo prologue/epilogue emitting code to inform
- /// MachineModuleInfo of frame layouts.
- MachineModuleInfo *MMI;
-
/// TargetFrameInfo - Target information about frame layout.
///
const TargetFrameInfo &TFI;
@@ -208,7 +193,6 @@ public:
StackProtectorIdx = -1;
MaxCallFrameSize = 0;
CSIValid = false;
- MMI = 0;
}
/// hasStackObjects - Return true if there are any stack objects in this
@@ -451,14 +435,6 @@ public:
/// method always returns an empty set.
BitVector getPristineRegs(const MachineBasicBlock *MBB) const;
- /// getMachineModuleInfo - Used by a prologue/epilogue
- /// emitter (TargetRegisterInfo) to provide frame layout information.
- MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
-
- /// setMachineModuleInfo - Used by a meta info consumer (DwarfWriter) to
- /// indicate that frame layout information should be gathered.
- void setMachineModuleInfo(MachineModuleInfo *mmi) { MMI = mmi; }
-
/// print - Used by the MachineFunction printer to print information about
/// stack objects. Implemented in MachineFunction.cpp
///
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 59b1718..b3609c2 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -32,6 +32,7 @@ class MachineRegisterInfo;
class MachineFrameInfo;
class MachineConstantPool;
class MachineJumpTableInfo;
+class MachineModuleInfo;
class MCContext;
class Pass;
class TargetMachine;
@@ -72,7 +73,8 @@ class MachineFunction {
Function *Fn;
const TargetMachine &Target;
MCContext &Ctx;
-
+ MachineModuleInfo &MMI;
+
// RegInfo - Information about each register in use in the function.
MachineRegisterInfo *RegInfo;
@@ -107,8 +109,8 @@ class MachineFunction {
typedef ilist<MachineBasicBlock> BasicBlockListType;
BasicBlockListType BasicBlocks;
- // Default debug location. Used to print out the debug label at the beginning
- // of a function.
+ /// Default debug location. Used to print out the debug label at the beginning
+ /// of a function.
DebugLoc DefaultDebugLoc;
/// FunctionNumber - This provides a unique ID for each function emitted in
@@ -116,17 +118,17 @@ class MachineFunction {
///
unsigned FunctionNumber;
- // The alignment of the function.
+ /// The alignment of the function.
unsigned Alignment;
MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT
void operator=(const MachineFunction&); // DO NOT IMPLEMENT
-
public:
MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum,
- MCContext &Ctx);
+ MachineModuleInfo &MMI);
~MachineFunction();
+ MachineModuleInfo &getMMI() const { return MMI; }
MCContext &getContext() const { return Ctx; }
/// getFunction - Return the LLVM function that this machine code represents
diff --git a/include/llvm/CodeGen/MachineFunctionAnalysis.h b/include/llvm/CodeGen/MachineFunctionAnalysis.h
index ee2c6dd..75dbaab 100644
--- a/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -39,7 +39,7 @@ public:
CodeGenOpt::Level getOptLevel() const { return OptLevel; }
private:
- virtual bool doInitialization(Module &) { NextFnNum = 1; return false; }
+ virtual bool doInitialization(Module &M);
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index d610390..17da43b 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -100,6 +100,9 @@ class MachineModuleInfo : public ImmutablePass {
/// Context - This is the MCContext used for the entire code generator.
MCContext Context;
+ /// TheModule - This is the LLVM Module being worked on.
+ Module *TheModule;
+
/// ObjFileMMI - This is the object-file-format-specific implementation of
/// MachineModuleInfoImpl, which lets targets accumulate whatever info they
/// want.
@@ -176,6 +179,9 @@ public:
const MCContext &getContext() const { return Context; }
MCContext &getContext() { return Context; }
+ void setModule(Module *M) { TheModule = M; }
+ Module *getModule() const { return TheModule; }
+
/// getInfo - Keep track of various per-function pieces of information for
/// backends that would like to do so.
///
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h
index 81e9ab3..9563d08 100644
--- a/include/llvm/CodeGen/ScheduleDAG.h
+++ b/include/llvm/CodeGen/ScheduleDAG.h
@@ -27,7 +27,6 @@ namespace llvm {
class SUnit;
class MachineConstantPool;
class MachineFunction;
- class MachineModuleInfo;
class MachineRegisterInfo;
class MachineInstr;
class TargetRegisterInfo;
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index ef5d7e2..5dd0aa8 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -29,11 +29,9 @@
namespace llvm {
class AliasAnalysis;
-class DwarfWriter;
class FunctionLoweringInfo;
class MachineConstantPoolValue;
class MachineFunction;
-class MachineModuleInfo;
class MDNode;
class SDNodeOrdering;
class SDDbgValue;
@@ -122,9 +120,7 @@ class SelectionDAG {
TargetLowering &TLI;
MachineFunction *MF;
FunctionLoweringInfo &FLI;
- MachineModuleInfo *MMI;
- DwarfWriter *DW;
- LLVMContext* Context;
+ LLVMContext *Context;
/// EntryNode - The starting token.
SDNode EntryNode;
@@ -182,7 +178,7 @@ public:
/// init - Prepare this SelectionDAG to process code in the given
/// MachineFunction.
///
- void init(MachineFunction &mf, MachineModuleInfo *mmi, DwarfWriter *dw);
+ void init(MachineFunction &mf);
/// clear - Clear state and free memory necessary to make this
/// SelectionDAG ready to process a new block.
@@ -193,8 +189,6 @@ public:
const TargetMachine &getTarget() const;
TargetLowering &getTargetLoweringInfo() const { return TLI; }
FunctionLoweringInfo &getFunctionLoweringInfo() const { return FLI; }
- MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
- DwarfWriter *getDwarfWriter() const { return DW; }
LLVMContext *getContext() const {return Context; }
/// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
@@ -532,17 +526,17 @@ public:
SDValue getStackArgumentTokenFactor(SDValue Chain);
SDValue getMemcpy(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
- SDValue Size, unsigned Align, bool AlwaysInline,
+ SDValue Size, unsigned Align, bool isVol, bool AlwaysInline,
const Value *DstSV, uint64_t DstSVOff,
const Value *SrcSV, uint64_t SrcSVOff);
SDValue getMemmove(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
- SDValue Size, unsigned Align,
+ SDValue Size, unsigned Align, bool isVol,
const Value *DstSV, uint64_t DstOSVff,
const Value *SrcSV, uint64_t SrcSVOff);
SDValue getMemset(SDValue Chain, DebugLoc dl, SDValue Dst, SDValue Src,
- SDValue Size, unsigned Align,
+ SDValue Size, unsigned Align, bool isVol,
const Value *DstSV, uint64_t DstSVOff);
/// getSetCC - Helper function to make it easier to build SetCC's if you just
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index def09c7..3c000f0 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -29,8 +29,6 @@ namespace llvm {
class MachineBasicBlock;
class MachineFunction;
class MachineInstr;
- class MachineModuleInfo;
- class DwarfWriter;
class TargetLowering;
class TargetInstrInfo;
class FunctionLoweringInfo;
@@ -284,8 +282,6 @@ private:
const SDValue *Ops, unsigned NumOps, unsigned EmitNodeInfo);
void SelectAllBasicBlocks(Function &Fn, MachineFunction &MF,
- MachineModuleInfo *MMI,
- DwarfWriter *DW,
const TargetInstrInfo &TII);
void FinishBasicBlock();
OpenPOWER on IntegriCloud