summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h16
-rw-r--r--include/llvm/CodeGen/BinaryObject.h2
-rw-r--r--include/llvm/CodeGen/CallingConvLower.h7
-rw-r--r--include/llvm/CodeGen/DAGISelHeader.h8
-rw-r--r--include/llvm/CodeGen/DwarfWriter.h20
-rw-r--r--include/llvm/CodeGen/LinkAllAsmWriterComponents.h1
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h25
-rw-r--r--include/llvm/CodeGen/LiveVariables.h11
-rw-r--r--include/llvm/CodeGen/MachORelocation.h2
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h12
-rw-r--r--include/llvm/CodeGen/MachineCodeInfo.h2
-rw-r--r--include/llvm/CodeGen/MachineDominators.h2
-rw-r--r--include/llvm/CodeGen/MachineFrameInfo.h39
-rw-r--r--include/llvm/CodeGen/MachineFunction.h8
-rw-r--r--include/llvm/CodeGen/MachineFunctionAnalysis.h2
-rw-r--r--include/llvm/CodeGen/MachineInstr.h24
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h5
-rw-r--r--include/llvm/CodeGen/MachineMemOperand.h2
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h9
-rw-r--r--include/llvm/CodeGen/MachineRegisterInfo.h6
-rw-r--r--include/llvm/CodeGen/MachineRelocation.h32
-rw-r--r--include/llvm/CodeGen/PseudoSourceValue.h35
-rw-r--r--include/llvm/CodeGen/RuntimeLibcalls.h5
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h4
-rw-r--r--include/llvm/CodeGen/SlotIndexes.h190
25 files changed, 289 insertions, 180 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index d051f84..109ff74 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -86,6 +86,14 @@ namespace llvm {
DwarfWriter *DW;
public:
+ /// Flags to specify different kinds of comments to output in
+ /// assembly code. These flags carry semantic information not
+ /// otherwise easily derivable from the IR text.
+ ///
+ enum CommentFlag {
+ ReloadReuse = 0x1
+ };
+
/// Output stream on which we're printing assembly code.
///
formatted_raw_ostream &O;
@@ -172,11 +180,11 @@ namespace llvm {
/// EmitStartOfAsmFile - This virtual method can be overridden by targets
/// that want to emit something at the start of their file.
- virtual void EmitStartOfAsmFile(Module &M) {}
+ 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 &M) {}
+ virtual void EmitEndOfAsmFile(Module &) {}
/// doFinalization - Shut down the asmprinter. If you override this in your
/// pass, you must make sure to call it explicitly.
@@ -373,10 +381,10 @@ namespace llvm {
/// printImplicitDef - This method prints the specified machine instruction
/// that is an implicit def.
- virtual void printImplicitDef(const MachineInstr *MI) const;
+ void printImplicitDef(const MachineInstr *MI) const;
/// printKill - This method prints the specified kill machine instruction.
- virtual void printKill(const MachineInstr *MI) const;
+ void printKill(const MachineInstr *MI) const;
/// printPICJumpTableSetLabel - This method prints a set label for the
/// specified MachineBasicBlock for a jumptable entry.
diff --git a/include/llvm/CodeGen/BinaryObject.h b/include/llvm/CodeGen/BinaryObject.h
index 9e2ef18..3ade7c9 100644
--- a/include/llvm/CodeGen/BinaryObject.h
+++ b/include/llvm/CodeGen/BinaryObject.h
@@ -15,6 +15,7 @@
#ifndef LLVM_CODEGEN_BINARYOBJECT_H
#define LLVM_CODEGEN_BINARYOBJECT_H
+#include "llvm/CodeGen/MachineRelocation.h"
#include "llvm/System/DataTypes.h"
#include <string>
@@ -22,7 +23,6 @@
namespace llvm {
-class MachineRelocation;
typedef std::vector<uint8_t> BinaryData;
class BinaryObject {
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h
index 5e730fc..45a2757 100644
--- a/include/llvm/CodeGen/CallingConvLower.h
+++ b/include/llvm/CodeGen/CallingConvLower.h
@@ -183,6 +183,13 @@ public:
void AnalyzeReturn(const SmallVectorImpl<ISD::OutputArg> &Outs,
CCAssignFn Fn);
+ /// CheckReturn - Analyze the return values of a function, returning
+ /// true if the return can be performed without sret-demotion, and
+ /// false otherwise.
+ bool CheckReturn(const SmallVectorImpl<EVT> &OutTys,
+ const SmallVectorImpl<ISD::ArgFlagsTy> &ArgsFlags,
+ CCAssignFn Fn);
+
/// AnalyzeCallOperands - Analyze the outgoing arguments to a call,
/// incorporating info about the passed values into this state.
void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
diff --git a/include/llvm/CodeGen/DAGISelHeader.h b/include/llvm/CodeGen/DAGISelHeader.h
index b2acbc1..624f18a 100644
--- a/include/llvm/CodeGen/DAGISelHeader.h
+++ b/include/llvm/CodeGen/DAGISelHeader.h
@@ -64,22 +64,22 @@ public:
/// ReplaceUses - replace all uses of the old node F with the use
/// of the new node T.
-void ReplaceUses(SDValue F, SDValue T) DISABLE_INLINE {
+DISABLE_INLINE void ReplaceUses(SDValue F, SDValue T) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISU);
}
/// ReplaceUses - replace all uses of the old nodes F with the use
/// of the new nodes T.
-void ReplaceUses(const SDValue *F, const SDValue *T,
- unsigned Num) DISABLE_INLINE {
+DISABLE_INLINE void ReplaceUses(const SDValue *F, const SDValue *T,
+ unsigned Num) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesOfValuesWith(F, T, Num, &ISU);
}
/// ReplaceUses - replace all uses of the old node F with the use
/// of the new node T.
-void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {
+DISABLE_INLINE void ReplaceUses(SDNode *F, SDNode *T) {
ISelUpdater ISU(ISelPosition);
CurDAG->ReplaceAllUsesWith(F, T, &ISU);
}
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
index e7a2f66..460c3c7 100644
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ b/include/llvm/CodeGen/DwarfWriter.h
@@ -87,31 +87,15 @@ public:
/// the source line list.
unsigned RecordSourceLine(unsigned Line, unsigned Col, MDNode *Scope);
- /// RecordRegionStart - Indicate the start of a region.
- unsigned RecordRegionStart(MDNode *N);
-
- /// RecordRegionEnd - Indicate the end of a region.
- unsigned RecordRegionEnd(MDNode *N);
-
/// getRecordSourceLineCount - Count source lines.
unsigned getRecordSourceLineCount();
- /// RecordVariable - Indicate the declaration of a local variable.
- ///
- void RecordVariable(MDNode *N, unsigned FrameIndex);
-
/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
/// be emitted.
bool ShouldEmitDwarfDebug() const;
- //// RecordInlinedFnStart - Indicate the start of a inlined function.
- unsigned RecordInlinedFnStart(DISubprogram SP, DICompileUnit CU,
- unsigned Line, unsigned Col);
-
- /// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
- unsigned RecordInlinedFnEnd(DISubprogram SP);
- void SetDbgScopeBeginLabels(const MachineInstr *MI, unsigned L);
- void SetDbgScopeEndLabels(const MachineInstr *MI, unsigned L);
+ void BeginScope(const MachineInstr *MI, unsigned Label);
+ void EndScope(const MachineInstr *MI);
};
} // end llvm namespace
diff --git a/include/llvm/CodeGen/LinkAllAsmWriterComponents.h b/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
index 1673c89..7d1b1fe 100644
--- a/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
+++ b/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
@@ -16,6 +16,7 @@
#define LLVM_CODEGEN_LINKALLASMWRITERCOMPONENTS_H
#include "llvm/CodeGen/GCs.h"
+#include <cstdlib>
namespace {
struct ForceAsmWriterLinking {
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index efb4a03..cf768c3 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -189,20 +189,8 @@ namespace llvm {
return indexes_->getMBBFromIndex(index);
}
- bool hasGapBeforeInstr(SlotIndex index) {
- return indexes_->hasGapBeforeInstr(index);
- }
-
- bool hasGapAfterInstr(SlotIndex index) {
- return indexes_->hasGapAfterInstr(index);
- }
-
- SlotIndex findGapBeforeInstr(SlotIndex index, bool furthest = false) {
- return indexes_->findGapBeforeInstr(index, furthest);
- }
-
- void InsertMachineInstrInMaps(MachineInstr *MI, SlotIndex Index) {
- indexes_->insertMachineInstrInMaps(MI, Index);
+ SlotIndex InsertMachineInstrInMaps(MachineInstr *MI) {
+ return indexes_->insertMachineInstrInMaps(MI);
}
void RemoveMachineInstrFromMaps(MachineInstr *MI) {
@@ -219,7 +207,7 @@ namespace llvm {
}
void renumber() {
- indexes_->renumber();
+ indexes_->renumberIndexes();
}
BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; }
@@ -290,9 +278,10 @@ namespace llvm {
/// computeIntervals - Compute live intervals.
void computeIntervals();
- bool isProfitableToCoalesce(LiveInterval &DstInt, LiveInterval &SrcInt,
- SmallVector<MachineInstr*,16> &IdentCopies,
- SmallVector<MachineInstr*,16> &OtherCopies);
+ bool isSafeAndProfitableToCoalesce(LiveInterval &DstInt,
+ LiveInterval &SrcInt,
+ SmallVector<MachineInstr*,16> &IdentCopies,
+ SmallVector<MachineInstr*,16> &OtherCopies);
void performEarlyCoalescing();
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index 172fb75..b2be569 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -103,7 +103,10 @@ public:
Kills.erase(I);
return true;
}
-
+
+ /// findKill - Find a kill instruction in MBB. Return NULL if none is found.
+ MachineInstr *findKill(const MachineBasicBlock *MBB) const;
+
void dump() const;
};
@@ -263,6 +266,12 @@ public:
void HandleVirtRegDef(unsigned reg, MachineInstr *MI);
void HandleVirtRegUse(unsigned reg, MachineBasicBlock *MBB,
MachineInstr *MI);
+
+ /// addNewBlock - Add a new basic block BB as an empty succcessor to
+ /// DomBB. All variables that are live out of DomBB will be marked as passing
+ /// live through BB. This method assumes that the machine code is still in SSA
+ /// form.
+ void addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB);
};
} // End llvm namespace
diff --git a/include/llvm/CodeGen/MachORelocation.h b/include/llvm/CodeGen/MachORelocation.h
index d4027cc..27306c6 100644
--- a/include/llvm/CodeGen/MachORelocation.h
+++ b/include/llvm/CodeGen/MachORelocation.h
@@ -15,6 +15,8 @@
#ifndef LLVM_CODEGEN_MACHO_RELOCATION_H
#define LLVM_CODEGEN_MACHO_RELOCATION_H
+#include "llvm/System/DataTypes.h"
+
namespace llvm {
/// MachORelocation - This struct contains information about each relocation
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 585ee14..bb50b5d 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -225,7 +225,13 @@ public:
/// potential fall-throughs at the end of the block.
void moveBefore(MachineBasicBlock *NewAfter);
void moveAfter(MachineBasicBlock *NewBefore);
-
+
+ /// updateTerminator - Update the terminator instructions in block to account
+ /// for changes to the layout. If the block previously used a fallthrough,
+ /// it may now need a branch, and if it previously used branching it may now
+ /// be able to use a fallthrough.
+ void updateTerminator();
+
// Machine-CFG mutators
/// addSuccessor - Add succ as a successor of this MachineBasicBlock.
@@ -246,7 +252,7 @@ public:
/// transferSuccessors - Transfers all the successors from MBB to this
/// machine basic block (i.e., copies all the successors fromMBB and
- /// remove all the successors fromBB).
+ /// remove all the successors from fromMBB).
void transferSuccessors(MachineBasicBlock *fromMBB);
/// isSuccessor - Return true if the specified MBB is a successor of this
@@ -352,6 +358,8 @@ private: // Methods used to maintain doubly linked list of blocks...
raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB);
+void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t);
+
//===--------------------------------------------------------------------===//
// GraphTraits specializations for machine basic block graphs (machine-CFGs)
//===--------------------------------------------------------------------===//
diff --git a/include/llvm/CodeGen/MachineCodeInfo.h b/include/llvm/CodeGen/MachineCodeInfo.h
index 024e602..a75c02a 100644
--- a/include/llvm/CodeGen/MachineCodeInfo.h
+++ b/include/llvm/CodeGen/MachineCodeInfo.h
@@ -17,6 +17,8 @@
#ifndef EE_MACHINE_CODE_INFO_H
#define EE_MACHINE_CODE_INFO_H
+#include "llvm/System/DataTypes.h"
+
namespace llvm {
class MachineCodeInfo {
diff --git a/include/llvm/CodeGen/MachineDominators.h b/include/llvm/CodeGen/MachineDominators.h
index e56776b..086528a 100644
--- a/include/llvm/CodeGen/MachineDominators.h
+++ b/include/llvm/CodeGen/MachineDominators.h
@@ -23,8 +23,6 @@
namespace llvm {
-inline void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t) { }
-
template<>
inline void DominatorTreeBase<MachineBasicBlock>::addRoot(MachineBasicBlock* MBB) {
this->Roots.push_back(MBB);
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index 07c1eca..bed82af 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -15,9 +15,11 @@
#define LLVM_CODEGEN_MACHINEFRAMEINFO_H
#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/DenseSet.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
#include "llvm/System/DataTypes.h"
#include <cassert>
+#include <limits>
#include <vector>
namespace llvm {
@@ -106,8 +108,8 @@ class MachineFrameInfo {
// cannot alias any other memory objects.
bool isSpillSlot;
- StackObject(uint64_t Sz, unsigned Al, int64_t SP = 0, bool IM = false,
- bool isSS = false)
+ StackObject(uint64_t Sz, unsigned Al, int64_t SP, bool IM,
+ bool isSS)
: SPOffset(SP), Size(Sz), Alignment(Al), isImmutable(IM),
isSpillSlot(isSS) {}
};
@@ -182,6 +184,10 @@ class MachineFrameInfo {
/// CSIValid - Has CSInfo been set yet?
bool CSIValid;
+ /// SpillObjects - A vector indicating which frame indices refer to
+ /// 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
@@ -192,6 +198,7 @@ class MachineFrameInfo {
/// TargetFrameInfo - Target information about frame layout.
///
const TargetFrameInfo &TFI;
+
public:
explicit MachineFrameInfo(const TargetFrameInfo &tfi) : TFI(tfi) {
StackSize = NumFixedObjects = OffsetAdjustment = MaxAlignment = 0;
@@ -341,7 +348,7 @@ public:
/// index with a negative value.
///
int CreateFixedObject(uint64_t Size, int64_t SPOffset,
- bool Immutable = true);
+ bool Immutable, bool isSS);
/// isFixedObjectIndex - Returns true if the specified index corresponds to a
@@ -374,13 +381,25 @@ public:
return Objects[ObjectIdx+NumFixedObjects].Size == ~0ULL;
}
- /// CreateStackObject - Create a new statically sized stack object, returning
- /// a nonnegative identifier to represent it.
+ /// CreateStackObject - Create a new statically sized stack object,
+ /// returning a nonnegative identifier to represent it.
///
- int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS = false) {
+ int CreateStackObject(uint64_t Size, unsigned Alignment, bool isSS) {
assert(Size != 0 && "Cannot allocate zero size stack objects!");
Objects.push_back(StackObject(Size, Alignment, 0, false, isSS));
- return (int)Objects.size()-NumFixedObjects-1;
+ int Index = (int)Objects.size()-NumFixedObjects-1;
+ assert(Index >= 0 && "Bad frame index!");
+ return Index;
+ }
+
+ /// CreateSpillStackObject - Create a new statically sized stack
+ /// object that represents a spill slot, returning a nonnegative
+ /// identifier to represent it.
+ ///
+ int CreateSpillStackObject(uint64_t Size, unsigned Alignment) {
+ CreateStackObject(Size, Alignment, true);
+ int Index = (int)Objects.size()-NumFixedObjects-1;
+ return Index;
}
/// RemoveStackObject - Remove or mark dead a statically sized stack object.
@@ -397,10 +416,10 @@ public:
///
int CreateVariableSizedObject() {
HasVarSizedObjects = true;
- Objects.push_back(StackObject(0, 1));
+ Objects.push_back(StackObject(0, 1, 0, false, false));
return (int)Objects.size()-NumFixedObjects-1;
}
-
+
/// getCalleeSavedInfo - Returns a reference to call saved info vector for the
/// current function.
const std::vector<CalleeSavedInfo> &getCalleeSavedInfo() const {
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 40260ea..d2f5224 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -23,7 +23,6 @@
#include "llvm/Support/DebugLoc.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Recycler.h"
-#include <map>
namespace llvm {
@@ -115,6 +114,9 @@ class MachineFunction {
// The alignment of the function.
unsigned Alignment;
+ MachineFunction(const MachineFunction &); // intentionally unimplemented
+ void operator=(const MachineFunction&); // intentionally unimplemented
+
public:
MachineFunction(Function *Fn, const TargetMachine &TM);
~MachineFunction();
@@ -229,6 +231,10 @@ public:
///
void dump() const;
+ /// verify - Run the current MachineFunction through the machine code
+ /// verifier, useful for debugger use.
+ void verify() const;
+
// Provide accessors for the MachineBasicBlock list...
typedef BasicBlockListType::iterator iterator;
typedef BasicBlockListType::const_iterator const_iterator;
diff --git a/include/llvm/CodeGen/MachineFunctionAnalysis.h b/include/llvm/CodeGen/MachineFunctionAnalysis.h
index d020a7b..aa4cc91 100644
--- a/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -31,7 +31,7 @@ private:
public:
static char ID;
- explicit MachineFunctionAnalysis(TargetMachine &tm,
+ explicit MachineFunctionAnalysis(const TargetMachine &tm,
CodeGenOpt::Level OL = CodeGenOpt::Default);
~MachineFunctionAnalysis();
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index de22710..c620449 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/Target/TargetInstrDesc.h"
#include "llvm/Support/DebugLoc.h"
@@ -45,6 +46,13 @@ private:
unsigned short NumImplicitOps; // Number of implicit operands (which
// are determined at construction time).
+ unsigned short AsmPrinterFlags; // Various bits of information used by
+ // the AsmPrinter to emit helpful
+ // comments. This is *not* semantic
+ // information. Do not use this for
+ // anything other than to convey comment
+ // information to AsmPrinter.
+
std::vector<MachineOperand> Operands; // the operands
mmo_iterator MemRefs; // information on memory references
mmo_iterator MemRefsEnd;
@@ -107,6 +115,22 @@ public:
const MachineBasicBlock* getParent() const { return Parent; }
MachineBasicBlock* getParent() { return Parent; }
+ /// getAsmPrinterFlags - Return the asm printer flags bitvector.
+ ///
+ unsigned short getAsmPrinterFlags() const { return AsmPrinterFlags; }
+
+ /// getAsmPrinterFlag - Return whether an AsmPrinter flag is set.
+ ///
+ bool getAsmPrinterFlag(AsmPrinter::CommentFlag Flag) const {
+ return AsmPrinterFlags & Flag;
+ }
+
+ /// setAsmPrinterFlag - Set a flag for the AsmPrinter.
+ ///
+ void setAsmPrinterFlag(unsigned short Flag) {
+ AsmPrinterFlags |= Flag;
+ }
+
/// getDebugLoc - Returns the debug location id of this MachineInstr.
///
DebugLoc getDebugLoc() const { return debugLoc; }
diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h
index 3ff2f2e..57c65c8 100644
--- a/include/llvm/CodeGen/MachineJumpTableInfo.h
+++ b/include/llvm/CodeGen/MachineJumpTableInfo.h
@@ -69,6 +69,11 @@ public:
/// the jump tables to branch to New instead.
bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New);
+ /// ReplaceMBBInJumpTable - If Old is a target of the jump tables, update
+ /// the jump table to branch to New instead.
+ bool ReplaceMBBInJumpTable(unsigned Idx, MachineBasicBlock *Old,
+ MachineBasicBlock *New);
+
/// getEntrySize - Returns the size of an individual field in a jump table.
///
unsigned getEntrySize() const { return EntrySize; }
diff --git a/include/llvm/CodeGen/MachineMemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h
index b7e267d..5dee199 100644
--- a/include/llvm/CodeGen/MachineMemOperand.h
+++ b/include/llvm/CodeGen/MachineMemOperand.h
@@ -16,6 +16,8 @@
#ifndef LLVM_CODEGEN_MACHINEMEMOPERAND_H
#define LLVM_CODEGEN_MACHINEMEMOPERAND_H
+#include "llvm/System/DataTypes.h"
+
namespace llvm {
class Value;
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index f2b027b..47616ce 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -44,8 +44,6 @@
#include "llvm/Pass.h"
#include "llvm/Metadata.h"
-#define ATTACH_DEBUG_INFO_TO_AN_INSN 1
-
namespace llvm {
//===----------------------------------------------------------------------===//
@@ -150,7 +148,8 @@ class MachineModuleInfo : public ImmutablePass {
public:
static char ID; // Pass identification, replacement for typeid
- typedef SmallVector< std::pair<TrackingVH<MDNode>, unsigned>, 4 >
+ typedef std::pair<unsigned, TrackingVH<MDNode> > UnsignedAndMDNodePair;
+ typedef SmallVector< std::pair<TrackingVH<MDNode>, UnsignedAndMDNodePair>, 4>
VariableDbgInfoMapTy;
VariableDbgInfoMapTy VariableDbgInfo;
@@ -336,8 +335,8 @@ public:
/// setVariableDbgInfo - Collect information used to emit debugging information
/// of a variable.
- void setVariableDbgInfo(MDNode *N, unsigned S) {
- VariableDbgInfo.push_back(std::make_pair(N, S));
+ void setVariableDbgInfo(MDNode *N, unsigned Slot, MDNode *Scope) {
+ VariableDbgInfo.push_back(std::make_pair(N, std::make_pair(Slot, Scope)));
}
VariableDbgInfoMapTy &getVariableDbgInfo() { return VariableDbgInfo; }
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h
index 18e6020..c55cb32 100644
--- a/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -243,6 +243,12 @@ public:
return true;
return false;
}
+ bool isLiveOut(unsigned Reg) const {
+ for (liveout_iterator I = liveout_begin(), E = liveout_end(); I != E; ++I)
+ if (*I == Reg)
+ return true;
+ return false;
+ }
private:
void HandleVRegListReallocation();
diff --git a/include/llvm/CodeGen/MachineRelocation.h b/include/llvm/CodeGen/MachineRelocation.h
index 6ea8f07..1c15fab 100644
--- a/include/llvm/CodeGen/MachineRelocation.h
+++ b/include/llvm/CodeGen/MachineRelocation.h
@@ -65,7 +65,7 @@ class MachineRelocation {
unsigned TargetReloType : 6; // The target relocation ID
AddressType AddrType : 4; // The field of Target to use
- bool NeedStub : 1; // True if this relocation requires a stub
+ bool MayNeedFarStub : 1; // True if this relocation may require a far-stub
bool GOTRelative : 1; // Should this relocation be relative to the GOT?
bool TargetResolve : 1; // True if target should resolve the address
@@ -81,7 +81,7 @@ public:
///
static MachineRelocation getGV(uintptr_t offset, unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
- bool NeedStub = 0,
+ bool MayNeedFarStub = 0,
bool GOTrelative = 0) {
assert((RelocationType & ~63) == 0 && "Relocation type too large!");
MachineRelocation Result;
@@ -89,7 +89,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isGV;
- Result.NeedStub = NeedStub;
+ Result.MayNeedFarStub = MayNeedFarStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.GV = GV;
@@ -101,7 +101,7 @@ public:
static MachineRelocation getIndirectSymbol(uintptr_t offset,
unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
- bool NeedStub = 0,
+ bool MayNeedFarStub = 0,
bool GOTrelative = 0) {
assert((RelocationType & ~63) == 0 && "Relocation type too large!");
MachineRelocation Result;
@@ -109,7 +109,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isIndirectSym;
- Result.NeedStub = NeedStub;
+ Result.MayNeedFarStub = MayNeedFarStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.GV = GV;
@@ -126,7 +126,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isBB;
- Result.NeedStub = false;
+ Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = false;
Result.Target.MBB = MBB;
@@ -145,7 +145,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isExtSym;
- Result.NeedStub = true;
+ Result.MayNeedFarStub = true;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
Result.Target.ExtSym = ES;
@@ -164,7 +164,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isConstPool;
- Result.NeedStub = false;
+ Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = letTargetResolve;
Result.Target.Index = CPI;
@@ -183,7 +183,7 @@ public:
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
Result.AddrType = isJumpTable;
- Result.NeedStub = false;
+ Result.MayNeedFarStub = false;
Result.GOTRelative = false;
Result.TargetResolve = letTargetResolve;
Result.Target.Index = JTI;
@@ -258,12 +258,14 @@ public:
return GOTRelative;
}
- /// doesntNeedStub - This function returns true if the JIT for this target
- /// target is capable of directly handling the relocated GlobalValue reference
- /// without using either a stub function or issuing an extra load to get the
- /// GV address.
- bool doesntNeedStub() const {
- return !NeedStub;
+ /// mayNeedFarStub - This function returns true if the JIT for this target may
+ /// need either a stub function or an indirect global-variable load to handle
+ /// the relocated GlobalValue reference. For example, the x86-64 call
+ /// instruction can only call functions within +/-2GB of the call site.
+ /// Anything farther away needs a longer mov+call sequence, which can't just
+ /// be written on top of the existing call.
+ bool mayNeedFarStub() const {
+ return MayNeedFarStub;
}
/// letTargetResolve - Return true if the target JITInfo is usually
diff --git a/include/llvm/CodeGen/PseudoSourceValue.h b/include/llvm/CodeGen/PseudoSourceValue.h
index 26392f5..bace631 100644
--- a/include/llvm/CodeGen/PseudoSourceValue.h
+++ b/include/llvm/CodeGen/PseudoSourceValue.h
@@ -32,7 +32,7 @@ namespace llvm {
virtual void printCustom(raw_ostream &O) const;
public:
- PseudoSourceValue();
+ explicit PseudoSourceValue(enum ValueTy Subclass = PseudoSourceValueVal);
/// isConstant - Test whether the memory pointed to by this
/// PseudoSourceValue has a constant value.
@@ -52,7 +52,8 @@ namespace llvm {
///
static inline bool classof(const PseudoSourceValue *) { return true; }
static inline bool classof(const Value *V) {
- return V->getValueID() == PseudoSourceValueVal;
+ return V->getValueID() == PseudoSourceValueVal ||
+ V->getValueID() == FixedStackPseudoSourceValueVal;
}
/// A pseudo source value referencing a fixed stack frame entry,
@@ -76,6 +77,36 @@ namespace llvm {
/// constant, this doesn't need to identify a specific jump table.
static const PseudoSourceValue *getJumpTable();
};
+
+ /// FixedStackPseudoSourceValue - A specialized PseudoSourceValue
+ /// for holding FixedStack values, which must include a frame
+ /// index.
+ class FixedStackPseudoSourceValue : public PseudoSourceValue {
+ const int FI;
+ public:
+ explicit FixedStackPseudoSourceValue(int fi) :
+ PseudoSourceValue(FixedStackPseudoSourceValueVal), FI(fi) {}
+
+ /// classof - Methods for support type inquiry through isa, cast, and
+ /// dyn_cast:
+ ///
+ static inline bool classof(const FixedStackPseudoSourceValue *) {
+ return true;
+ }
+ static inline bool classof(const Value *V) {
+ return V->getValueID() == FixedStackPseudoSourceValueVal;
+ }
+
+ virtual bool isConstant(const MachineFrameInfo *MFI) const;
+
+ virtual bool isAliased(const MachineFrameInfo *MFI) const;
+
+ virtual bool mayAlias(const MachineFrameInfo *) const;
+
+ virtual void printCustom(raw_ostream &OS) const;
+
+ int getFrameIndex() const { return FI; }
+ };
} // End llvm namespace
#endif
diff --git a/include/llvm/CodeGen/RuntimeLibcalls.h b/include/llvm/CodeGen/RuntimeLibcalls.h
index 7a40f02..c404ab6 100644
--- a/include/llvm/CodeGen/RuntimeLibcalls.h
+++ b/include/llvm/CodeGen/RuntimeLibcalls.h
@@ -41,22 +41,27 @@ namespace RTLIB {
SRA_I32,
SRA_I64,
SRA_I128,
+ MUL_I8,
MUL_I16,
MUL_I32,
MUL_I64,
MUL_I128,
+ SDIV_I8,
SDIV_I16,
SDIV_I32,
SDIV_I64,
SDIV_I128,
+ UDIV_I8,
UDIV_I16,
UDIV_I32,
UDIV_I64,
UDIV_I128,
+ SREM_I8,
SREM_I16,
SREM_I32,
SREM_I64,
SREM_I128,
+ UREM_I8,
UREM_I16,
UREM_I32,
UREM_I64,
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index f960851..d4d40b1 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1953,10 +1953,10 @@ public:
/// that value are zero, and the corresponding bits in the SplatUndef mask
/// are set. The SplatBitSize value is set to the splat element size in
/// bits. HasAnyUndefs is set to true if any bits in the vector are
- /// undefined.
+ /// undefined. isBigEndian describes the endianness of the target.
bool isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
unsigned &SplatBitSize, bool &HasAnyUndefs,
- unsigned MinSplatBits = 0);
+ unsigned MinSplatBits = 0, bool isBigEndian = false);
static inline bool classof(const BuildVectorSDNode *) { return true; }
static inline bool classof(const SDNode *N) {
diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h
index a179725..65d85fc 100644
--- a/include/llvm/CodeGen/SlotIndexes.h
+++ b/include/llvm/CodeGen/SlotIndexes.h
@@ -39,9 +39,6 @@ namespace llvm {
class IndexListEntry {
private:
- static std::auto_ptr<IndexListEntry> emptyKeyEntry,
- tombstoneKeyEntry;
- typedef enum { EMPTY_KEY, TOMBSTONE_KEY } ReservedEntryType;
static const unsigned EMPTY_KEY_INDEX = ~0U & ~3U,
TOMBSTONE_KEY_INDEX = ~0U & ~7U;
@@ -49,6 +46,10 @@ namespace llvm {
MachineInstr *mi;
unsigned index;
+ protected:
+
+ typedef enum { EMPTY_KEY, TOMBSTONE_KEY } ReservedEntryType;
+
// This constructor is only to be used by getEmptyKeyEntry
// & getTombstoneKeyEntry. It sets index to the given
// value and mi to zero.
@@ -58,6 +59,8 @@ namespace llvm {
case TOMBSTONE_KEY: index = TOMBSTONE_KEY_INDEX; break;
default: assert(false && "Invalid value for constructor.");
}
+ next = this;
+ prev = this;
}
public:
@@ -70,36 +73,45 @@ namespace llvm {
}
MachineInstr* getInstr() const { return mi; }
- void setInstr(MachineInstr *mi) { this->mi = mi; }
+ void setInstr(MachineInstr *mi) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to modify reserved index.");
+ this->mi = mi;
+ }
unsigned getIndex() const { return index; }
- void setIndex(unsigned index) { this->index = index; }
+ void setIndex(unsigned index) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to set index to invalid value.");
+ assert(this->index != EMPTY_KEY_INDEX &&
+ this->index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to reset reserved index value.");
+ this->index = index;
+ }
IndexListEntry* getNext() { return next; }
const IndexListEntry* getNext() const { return next; }
- void setNext(IndexListEntry *next) { this->next = next; }
+ void setNext(IndexListEntry *next) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to modify reserved index.");
+ this->next = next;
+ }
IndexListEntry* getPrev() { return prev; }
const IndexListEntry* getPrev() const { return prev; }
- void setPrev(IndexListEntry *prev) { this->prev = prev; }
+ void setPrev(IndexListEntry *prev) {
+ assert(index != EMPTY_KEY_INDEX && index != TOMBSTONE_KEY_INDEX &&
+ "Attempt to modify reserved index.");
+ this->prev = prev;
+ }
// This function returns the index list entry that is to be used for empty
// SlotIndex keys.
- static IndexListEntry* getEmptyKeyEntry() {
- if (emptyKeyEntry.get() == 0) {
- emptyKeyEntry.reset(new IndexListEntry(EMPTY_KEY));
- }
- return emptyKeyEntry.get();
- }
+ static IndexListEntry* getEmptyKeyEntry();
// This function returns the index list entry that is to be used for
// tombstone SlotIndex keys.
- static IndexListEntry* getTombstoneKeyEntry() {
- if (tombstoneKeyEntry.get() == 0) {
- tombstoneKeyEntry.reset(new IndexListEntry(TOMBSTONE_KEY));
- }
- return tombstoneKeyEntry.get();
- }
+ static IndexListEntry* getTombstoneKeyEntry();
};
// Specialize PointerLikeTypeTraits for IndexListEntry.
@@ -118,7 +130,7 @@ namespace llvm {
/// SlotIndex - An opaque wrapper around machine indexes.
class SlotIndex {
friend class SlotIndexes;
- friend class DenseMapInfo<SlotIndex>;
+ friend struct DenseMapInfo<SlotIndex>;
private:
static const unsigned PHI_BIT = 1 << 2;
@@ -475,7 +487,7 @@ namespace llvm {
void dump() const;
/// Renumber the index list, providing space for new instructions.
- void renumber();
+ void renumberIndexes();
/// Returns the zero index for this analysis.
SlotIndex getZeroIndex() {
@@ -635,99 +647,89 @@ namespace llvm {
return 0;
}
- /// Returns true if there is a gap in the numbering before the given index.
- bool hasGapBeforeInstr(SlotIndex index) {
- index = index.getBaseIndex();
- SlotIndex prevIndex = index.getPrevIndex();
-
- if (prevIndex == getZeroIndex())
- return false;
-
- if (getInstructionFromIndex(prevIndex) == 0)
- return true;
-
- if (prevIndex.distance(index) >= 2 * SlotIndex::NUM)
- return true;
+ /// Insert the given machine instruction into the mapping. Returns the
+ /// assigned index.
+ SlotIndex insertMachineInstrInMaps(MachineInstr *mi,
+ bool *deferredRenumber = 0) {
+ assert(mi2iMap.find(mi) == mi2iMap.end() && "Instr already indexed.");
- return false;
- }
-
- /// Returns true if there is a gap in the numbering after the given index.
- bool hasGapAfterInstr(SlotIndex index) const {
- // Not implemented yet.
- assert(false &&
- "SlotIndexes::hasGapAfterInstr(SlotIndex) not implemented yet.");
- return false;
- }
+ MachineBasicBlock *mbb = mi->getParent();
- /// findGapBeforeInstr - Find an empty instruction slot before the
- /// specified index. If "Furthest" is true, find one that's furthest
- /// away from the index (but before any index that's occupied).
- // FIXME: This whole method should go away in future. It should
- // always be possible to insert code between existing indices.
- SlotIndex findGapBeforeInstr(SlotIndex index, bool furthest = false) {
- if (index == getZeroIndex())
- return getInvalidIndex();
+ assert(mbb != 0 && "Instr must be added to function.");
- index = index.getBaseIndex();
- SlotIndex prevIndex = index.getPrevIndex();
+ MBB2IdxMap::iterator mbbRangeItr = mbb2IdxMap.find(mbb);
- if (prevIndex == getZeroIndex())
- return getInvalidIndex();
+ assert(mbbRangeItr != mbb2IdxMap.end() &&
+ "Instruction's parent MBB has not been added to SlotIndexes.");
- // Try to reuse existing index objects with null-instrs.
- if (getInstructionFromIndex(prevIndex) == 0) {
- if (furthest) {
- while (getInstructionFromIndex(prevIndex) == 0 &&
- prevIndex != getZeroIndex()) {
- prevIndex = prevIndex.getPrevIndex();
- }
+ MachineBasicBlock::iterator miItr(mi);
+ bool needRenumber = false;
+ IndexListEntry *newEntry;
- prevIndex = prevIndex.getNextIndex();
- }
-
- assert(getInstructionFromIndex(prevIndex) == 0 && "Index list is broken.");
-
- return prevIndex;
+ IndexListEntry *prevEntry;
+ if (miItr == mbb->begin()) {
+ // If mi is at the mbb beginning, get the prev index from the mbb.
+ prevEntry = &mbbRangeItr->second.first.entry();
+ } else {
+ // Otherwise get it from the previous instr.
+ MachineBasicBlock::iterator pItr(prior(miItr));
+ prevEntry = &getInstructionIndex(pItr).entry();
}
- int dist = prevIndex.distance(index);
+ // Get next entry from previous entry.
+ IndexListEntry *nextEntry = prevEntry->getNext();
- // Double check that the spacing between this instruction and
- // the last is sane.
- assert(dist >= SlotIndex::NUM &&
- "Distance between indexes too small.");
+ // Get a number for the new instr, or 0 if there's no room currently.
+ // In the latter case we'll force a renumber later.
+ unsigned dist = nextEntry->getIndex() - prevEntry->getIndex();
+ unsigned newNumber = dist > SlotIndex::NUM ?
+ prevEntry->getIndex() + ((dist >> 1) & ~3U) : 0;
- // If there's no gap return an invalid index.
- if (dist < 2*SlotIndex::NUM) {
- return getInvalidIndex();
+ if (newNumber == 0) {
+ needRenumber = true;
}
- // Otherwise insert new index entries into the list using the
- // gap in the numbering.
- IndexListEntry *newEntry =
- createEntry(0, prevIndex.entry().getIndex() + SlotIndex::NUM);
+ // Insert a new list entry for mi.
+ newEntry = createEntry(mi, newNumber);
+ insert(nextEntry, newEntry);
+
+ SlotIndex newIndex(newEntry, SlotIndex::LOAD);
+ mi2iMap.insert(std::make_pair(mi, newIndex));
+
+ if (miItr == mbb->end()) {
+ // If this is the last instr in the MBB then we need to fix up the bb
+ // range:
+ mbbRangeItr->second.second = SlotIndex(newEntry, SlotIndex::STORE);
+ }
- insert(&index.entry(), newEntry);
+ // Renumber if we need to.
+ if (needRenumber) {
+ if (deferredRenumber == 0)
+ renumberIndexes();
+ else
+ *deferredRenumber = true;
+ }
- // And return a pointer to the entry at the start of the gap.
- return index.getPrevIndex();
+ return newIndex;
}
- /// Insert the given machine instruction into the mapping at the given
- /// index.
- void insertMachineInstrInMaps(MachineInstr *mi, SlotIndex index) {
- index = index.getBaseIndex();
- IndexListEntry *miEntry = &index.entry();
- assert(miEntry->getInstr() == 0 && "Index already in use.");
- miEntry->setInstr(mi);
+ /// Add all instructions in the vector to the index list. This method will
+ /// defer renumbering until all instrs have been added, and should be
+ /// preferred when adding multiple instrs.
+ void insertMachineInstrsInMaps(SmallVectorImpl<MachineInstr*> &mis) {
+ bool renumber = false;
- assert(mi2iMap.find(mi) == mi2iMap.end() &&
- "MachineInstr already has an index.");
+ for (SmallVectorImpl<MachineInstr*>::iterator
+ miItr = mis.begin(), miEnd = mis.end();
+ miItr != miEnd; ++miItr) {
+ insertMachineInstrInMaps(*miItr, &renumber);
+ }
- mi2iMap.insert(std::make_pair(mi, index));
+ if (renumber)
+ renumberIndexes();
}
+
/// Remove the given machine instruction from the mapping.
void removeMachineInstrFromMaps(MachineInstr *mi) {
// remove index -> MachineInstr and
OpenPOWER on IntegriCloud