summaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h14
-rw-r--r--include/llvm/CodeGen/GCMetadata.h12
-rw-r--r--include/llvm/CodeGen/GCMetadataPrinter.h1
-rw-r--r--include/llvm/CodeGen/JITCodeEmitter.h10
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h10
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h3
-rw-r--r--include/llvm/CodeGen/MachineCodeEmitter.h7
-rw-r--r--include/llvm/CodeGen/MachineFunction.h11
-rw-r--r--include/llvm/CodeGen/MachineInstrBuilder.h5
-rw-r--r--include/llvm/CodeGen/MachineJumpTableInfo.h6
-rw-r--r--include/llvm/CodeGen/MachineLocation.h47
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h125
-rw-r--r--include/llvm/CodeGen/MachineModuleInfoImpls.h22
-rw-r--r--include/llvm/CodeGen/MachineOperand.h17
-rw-r--r--include/llvm/CodeGen/ObjectCodeEmitter.h7
-rw-r--r--include/llvm/CodeGen/RuntimeLibcalls.h6
-rw-r--r--include/llvm/CodeGen/ScheduleDAG.h39
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h61
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h1
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h25
-rw-r--r--include/llvm/CodeGen/TargetLoweringObjectFileImpl.h14
21 files changed, 261 insertions, 182 deletions
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 6187447..2cd477e 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -143,8 +143,7 @@ namespace llvm {
protected:
explicit AsmPrinter(formatted_raw_ostream &o, TargetMachine &TM,
- MCContext &Ctx, MCStreamer &Streamer,
- const MCAsmInfo *T);
+ MCStreamer &Streamer);
public:
virtual ~AsmPrinter();
@@ -306,18 +305,10 @@ namespace llvm {
unsigned ForcedAlignBits = 0,
bool UseFillExpr = true) const;
- /// printLabel - This method prints a local label used by debug and
- /// exception handling tables.
- void printLabel(unsigned Id) const;
-
/// printDeclare - This method prints a local variable declaration used by
/// debug tables.
void printDeclare(const MachineInstr *MI) const;
- /// GetGlobalValueSymbol - Return the MCSymbol for the specified global
- /// value.
- virtual MCSymbol *GetGlobalValueSymbol(const GlobalValue *GV) 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.
@@ -342,8 +333,7 @@ namespace llvm {
/// GetBlockAddressSymbol - Return the MCSymbol used to satisfy BlockAddress
/// uses of the specified basic block.
MCSymbol *GetBlockAddressSymbol(const BlockAddress *BA) const;
- MCSymbol *GetBlockAddressSymbol(const Function *F,
- const BasicBlock *BB) 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
diff --git a/include/llvm/CodeGen/GCMetadata.h b/include/llvm/CodeGen/GCMetadata.h
index 04fd8be..783f636 100644
--- a/include/llvm/CodeGen/GCMetadata.h
+++ b/include/llvm/CodeGen/GCMetadata.h
@@ -38,12 +38,10 @@
#include "llvm/ADT/StringMap.h"
namespace llvm {
-
class AsmPrinter;
class GCStrategy;
class Constant;
- class MCAsmInfo;
-
+ class MCSymbol;
namespace GC {
/// PointKind - The type of a collector-safe point.
@@ -60,9 +58,9 @@ namespace llvm {
///
struct GCPoint {
GC::PointKind Kind; //< The kind of the safe point.
- unsigned Num; //< Usually a label.
+ MCSymbol *Label; //< A label.
- GCPoint(GC::PointKind K, unsigned N) : Kind(K), Num(N) {}
+ GCPoint(GC::PointKind K, MCSymbol *L) : Kind(K), Label(L) {}
};
/// GCRoot - Metadata for a pointer to an object managed by the garbage
@@ -123,8 +121,8 @@ namespace llvm {
/// addSafePoint - Notes the existence of a safe point. Num is the ID of the
/// label just prior to the safe point (if the code generator is using
/// MachineModuleInfo).
- void addSafePoint(GC::PointKind Kind, unsigned Num) {
- SafePoints.push_back(GCPoint(Kind, Num));
+ void addSafePoint(GC::PointKind Kind, MCSymbol *Label) {
+ SafePoints.push_back(GCPoint(Kind, Label));
}
/// getFrameSize/setFrameSize - Records the function's frame size.
diff --git a/include/llvm/CodeGen/GCMetadataPrinter.h b/include/llvm/CodeGen/GCMetadataPrinter.h
index ff1a205..62875c3 100644
--- a/include/llvm/CodeGen/GCMetadataPrinter.h
+++ b/include/llvm/CodeGen/GCMetadataPrinter.h
@@ -28,6 +28,7 @@ namespace llvm {
class GCMetadataPrinter;
class raw_ostream;
+ class MCAsmInfo;
/// GCMetadataPrinterRegistry - The GC assembly printer registry uses all the
/// defaults from Registry.
diff --git a/include/llvm/CodeGen/JITCodeEmitter.h b/include/llvm/CodeGen/JITCodeEmitter.h
index 0a1d4f4..5da4961 100644
--- a/include/llvm/CodeGen/JITCodeEmitter.h
+++ b/include/llvm/CodeGen/JITCodeEmitter.h
@@ -35,7 +35,7 @@ class MachineRelocation;
class Value;
class GlobalValue;
class Function;
-
+
/// JITCodeEmitter - This class defines two sorts of methods: those for
/// emitting the actual bytes of machine code, and those for emitting auxillary
/// structures, such as jump tables, relocations, etc.
@@ -242,7 +242,7 @@ public:
/// emitLabel - Emits a label
- virtual void emitLabel(uint64_t LabelID) = 0;
+ virtual void emitLabel(MCSymbol *Label) = 0;
/// allocateSpace - Allocate a block of space in the current output buffer,
/// returning null (and setting conditions to indicate buffer overflow) on
@@ -316,10 +316,10 @@ public:
///
virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const= 0;
- /// getLabelAddress - Return the address of the specified LabelID, only usable
- /// after the LabelID has been emitted.
+ /// getLabelAddress - Return the address of the specified Label, only usable
+ /// after the Label has been emitted.
///
- virtual uintptr_t getLabelAddress(uint64_t LabelID) const = 0;
+ virtual uintptr_t getLabelAddress(MCSymbol *Label) const = 0;
/// Specifies the MachineModuleInfo object. This is used for exception handling
/// purposes.
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index e8856ac..1a2cc25 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -127,11 +127,11 @@ namespace llvm {
bool conflictsWithPhysReg(const LiveInterval &li, VirtRegMap &vrm,
unsigned reg);
- /// conflictsWithPhysRegRef - Similar to conflictsWithPhysRegRef except
- /// it can check use as well.
- bool conflictsWithPhysRegRef(LiveInterval &li, unsigned Reg,
- bool CheckUse,
- SmallPtrSet<MachineInstr*,32> &JoinedCopies);
+ /// conflictsWithSubPhysRegRef - Similar to conflictsWithPhysRegRef except
+ /// it checks for sub-register reference and it can check use as well.
+ bool conflictsWithSubPhysRegRef(LiveInterval &li, unsigned Reg,
+ bool CheckUse,
+ SmallPtrSet<MachineInstr*,32> &JoinedCopies);
// Interval creation
LiveInterval &getOrCreateInterval(unsigned reg) {
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index d92650b4..2995bea 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -21,7 +21,6 @@ namespace llvm {
class BasicBlock;
class MachineFunction;
-class MCContext;
class MCSymbol;
class StringRef;
class raw_ostream;
@@ -352,7 +351,7 @@ public:
/// getSymbol - Return the MCSymbol for this basic block.
///
- MCSymbol *getSymbol(MCContext &Ctx) const;
+ MCSymbol *getSymbol() const;
private: // Methods used to maintain doubly linked list of blocks...
friend struct ilist_traits<MachineBasicBlock>;
diff --git a/include/llvm/CodeGen/MachineCodeEmitter.h b/include/llvm/CodeGen/MachineCodeEmitter.h
index 48b4082..7abb49a 100644
--- a/include/llvm/CodeGen/MachineCodeEmitter.h
+++ b/include/llvm/CodeGen/MachineCodeEmitter.h
@@ -31,6 +31,7 @@ class MachineRelocation;
class Value;
class GlobalValue;
class Function;
+class MCSymbol;
/// MachineCodeEmitter - This class defines two sorts of methods: those for
/// emitting the actual bytes of machine code, and those for emitting auxillary
@@ -247,7 +248,7 @@ public:
virtual void processDebugLoc(DebugLoc DL, bool BeforePrintintInsn) {}
/// emitLabel - Emits a label
- virtual void emitLabel(uint64_t LabelID) = 0;
+ virtual void emitLabel(MCSymbol *Label) = 0;
/// allocateSpace - Allocate a block of space in the current output buffer,
/// returning null (and setting conditions to indicate buffer overflow) on
@@ -316,10 +317,10 @@ public:
///
virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const= 0;
- /// getLabelAddress - Return the address of the specified LabelID, only usable
+ /// getLabelAddress - Return the address of the specified Label, only usable
/// after the LabelID has been emitted.
///
- virtual uintptr_t getLabelAddress(uint64_t LabelID) const = 0;
+ virtual uintptr_t getLabelAddress(MCSymbol *Label) const = 0;
/// Specifies the MachineModuleInfo object. This is used for exception handling
/// purposes.
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 3c5b466..76ec9db 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -33,6 +33,7 @@ class MachineRegisterInfo;
class MachineFrameInfo;
class MachineConstantPool;
class MachineJumpTableInfo;
+class MCContext;
class Pass;
class TargetMachine;
class TargetRegisterClass;
@@ -71,6 +72,7 @@ struct MachineFunctionInfo {
class MachineFunction {
Function *Fn;
const TargetMachine &Target;
+ MCContext &Ctx;
// RegInfo - Information about each register in use in the function.
MachineRegisterInfo *RegInfo;
@@ -121,13 +123,16 @@ class MachineFunction {
// The alignment of the function.
unsigned Alignment;
- MachineFunction(const MachineFunction &); // intentionally unimplemented
- void operator=(const MachineFunction&); // intentionally unimplemented
+ MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT
+ void operator=(const MachineFunction&); // DO NOT IMPLEMENT
public:
- MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum);
+ MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum,
+ MCContext &Ctx);
~MachineFunction();
+ MCContext &getContext() const { return Ctx; }
+
/// getFunction - Return the LLVM function that this machine code represents
///
Function *getFunction() const { return Fn; }
diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h
index 47f7cf7..9baa592 100644
--- a/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -131,6 +131,11 @@ public:
MI->addOperand(MachineOperand::CreateMetadata(MD));
return *this;
}
+
+ const MachineInstrBuilder &addSym(MCSymbol *Sym) const {
+ MI->addOperand(MachineOperand::CreateMCSymbol(Sym));
+ return *this;
+ }
};
/// BuildMI - Builder interface. Specify how to create the initial instruction
diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h
index 5a4c9a9fb..b8d04bf 100644
--- a/include/llvm/CodeGen/MachineJumpTableInfo.h
+++ b/include/llvm/CodeGen/MachineJumpTableInfo.h
@@ -61,7 +61,11 @@ public:
/// .set L4_5_set_123, LBB123 - LJTI1_2
/// .word L4_5_set_123
EK_LabelDifference32,
-
+
+ /// EK_Inline - Jump table entries are emitted inline at their point of
+ /// use. It is the responsibility of the target to emit the entries.
+ EK_Inline,
+
/// EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the
/// TargetLowering::LowerCustomJumpTableEntry hook.
EK_Custom32
diff --git a/include/llvm/CodeGen/MachineLocation.h b/include/llvm/CodeGen/MachineLocation.h
index 2db4e55..a1fcb9f 100644
--- a/include/llvm/CodeGen/MachineLocation.h
+++ b/include/llvm/CodeGen/MachineLocation.h
@@ -22,13 +22,13 @@
#define LLVM_CODEGEN_MACHINELOCATION_H
namespace llvm {
-
+ class MCSymbol;
+
class MachineLocation {
private:
bool IsRegister; // True if location is a register.
unsigned Register; // gcc/gdb register number.
int Offset; // Displacement if not register.
-
public:
enum {
// The target register number for an abstract frame pointer. The value is
@@ -36,20 +36,11 @@ public:
VirtualFP = ~0U
};
MachineLocation()
- : IsRegister(false)
- , Register(0)
- , Offset(0)
- {}
+ : IsRegister(false), Register(0), Offset(0) {}
explicit MachineLocation(unsigned R)
- : IsRegister(true)
- , Register(R)
- , Offset(0)
- {}
+ : IsRegister(true), Register(R), Offset(0) {}
MachineLocation(unsigned R, int O)
- : IsRegister(false)
- , Register(R)
- , Offset(O)
- {}
+ : IsRegister(false), Register(R), Offset(O) {}
// Accessors
bool isReg() const { return IsRegister; }
@@ -74,29 +65,25 @@ public:
#endif
};
+/// MachineMove - This class represents the save or restore of a callee saved
+/// register that exception or debug info needs to know about.
class MachineMove {
private:
- unsigned LabelID; // Label ID number for post-instruction
- // address when result of move takes
- // effect.
- MachineLocation Destination; // Move to location.
- MachineLocation Source; // Move from location.
+ /// Label - Symbol for post-instruction address when result of move takes
+ /// effect.
+ MCSymbol *Label;
+ // Move to & from location.
+ MachineLocation Destination, Source;
public:
- MachineMove()
- : LabelID(0)
- , Destination()
- , Source()
- {}
+ MachineMove() : Label(0) {}
- MachineMove(unsigned ID, MachineLocation &D, MachineLocation &S)
- : LabelID(ID)
- , Destination(D)
- , Source(S)
- {}
+ MachineMove(MCSymbol *label, const MachineLocation &D,
+ const MachineLocation &S)
+ : Label(label), Destination(D), Source(S) {}
// Accessors
- unsigned getLabelID() const { return LabelID; }
+ MCSymbol *getLabel() const { return Label; }
const MachineLocation &getDestination() const { return Destination; }
const MachineLocation &getSource() const { return Source; }
};
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index fff8e83..d446eae 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -31,48 +31,43 @@
#ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H
#define LLVM_CODEGEN_MACHINEMODULEINFO_H
+#include "llvm/Pass.h"
+#include "llvm/GlobalValue.h"
+#include "llvm/Metadata.h"
+#include "llvm/CodeGen/MachineLocation.h"
+#include "llvm/MC/MCContext.h"
#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/ValueHandle.h"
#include "llvm/System/DataTypes.h"
-#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/UniqueVector.h"
+#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/ADT/SmallSet.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/CodeGen/MachineLocation.h"
-#include "llvm/GlobalValue.h"
-#include "llvm/Pass.h"
-#include "llvm/Metadata.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/ADT/SmallVector.h"
namespace llvm {
//===----------------------------------------------------------------------===//
// Forward declarations.
class Constant;
-class MCSymbol;
-class MDNode;
class GlobalVariable;
+class MDNode;
class MachineBasicBlock;
class MachineFunction;
class Module;
class PointerType;
class StructType;
-
/// MachineModuleInfoImpl - This class can be derived from and used by targets
/// to hold private target-specific information for each Module. Objects of
/// type are accessed/created with MMI::getInfo and destroyed when the
/// MachineModuleInfo is destroyed.
class MachineModuleInfoImpl {
public:
+ typedef PointerIntPair<MCSymbol*, 1, bool> StubValueTy;
virtual ~MachineModuleInfoImpl();
-
- typedef std::vector<std::pair<MCSymbol*, MCSymbol*> >
- SymbolListTy;
+ typedef std::vector<std::pair<MCSymbol*, StubValueTy> > SymbolListTy;
protected:
- static SymbolListTy
- GetSortedStubs(const DenseMap<MCSymbol*, MCSymbol*> &Map);
+ static SymbolListTy GetSortedStubs(const DenseMap<MCSymbol*, StubValueTy>&);
};
@@ -82,37 +77,33 @@ protected:
/// the current function.
///
struct LandingPadInfo {
- MachineBasicBlock *LandingPadBlock; // Landing pad block.
- SmallVector<unsigned, 1> BeginLabels; // Labels prior to invoke.
- SmallVector<unsigned, 1> EndLabels; // Labels after invoke.
- unsigned LandingPadLabel; // Label at beginning of landing pad.
- Function *Personality; // Personality function.
- std::vector<int> TypeIds; // List of type ids (filters negative)
+ MachineBasicBlock *LandingPadBlock; // Landing pad block.
+ SmallVector<MCSymbol*, 1> BeginLabels; // Labels prior to invoke.
+ SmallVector<MCSymbol*, 1> EndLabels; // Labels after invoke.
+ MCSymbol *LandingPadLabel; // Label at beginning of landing pad.
+ Function *Personality; // Personality function.
+ std::vector<int> TypeIds; // List of type ids (filters negative)
explicit LandingPadInfo(MachineBasicBlock *MBB)
- : LandingPadBlock(MBB)
- , LandingPadLabel(0)
- , Personality(NULL)
- {}
+ : LandingPadBlock(MBB), LandingPadLabel(0), Personality(0) {}
};
+class MMIAddrLabelMap;
+
//===----------------------------------------------------------------------===//
/// MachineModuleInfo - This class contains meta information specific to a
/// module. Queries can be made by different debugging and exception handling
/// schemes and reformated for specific use.
///
class MachineModuleInfo : public ImmutablePass {
+ /// Context - This is the MCContext used for the entire code generator.
+ MCContext Context;
+
/// ObjFileMMI - This is the object-file-format-specific implementation of
/// MachineModuleInfoImpl, which lets targets accumulate whatever info they
/// want.
MachineModuleInfoImpl *ObjFileMMI;
- // LabelIDList - One entry per assigned label. Normally the entry is equal to
- // the list index(+1). If the entry is zero then the label has been deleted.
- // Any other value indicates the label has been deleted by is mapped to
- // another label.
- std::vector<unsigned> LabelIDList;
-
// FrameMoves - List of moves done by a function's prolog. Used to construct
// frame maps by debug and exception handling consumers.
std::vector<MachineMove> FrameMoves;
@@ -123,7 +114,7 @@ class MachineModuleInfo : public ImmutablePass {
// Map of invoke call site index values to associated begin EH_LABEL for
// the current function.
- DenseMap<unsigned, unsigned> CallSiteMap;
+ DenseMap<MCSymbol*, unsigned> CallSiteMap;
// The current call site index being processed, if any. 0 if none.
unsigned CurCallSite;
@@ -150,6 +141,11 @@ class MachineModuleInfo : public ImmutablePass {
/// llvm.compiler.used.
SmallPtrSet<const Function *, 32> UsedFunctions;
+
+ /// AddrLabelSymbols - This map keeps track of which symbol is being used for
+ /// the specified basic block's address of label.
+ MMIAddrLabelMap *AddrLabelSymbols;
+
bool CallsEHReturn;
bool CallsUnwindInit;
@@ -165,7 +161,8 @@ public:
VariableDbgInfoMapTy;
VariableDbgInfoMapTy VariableDbgInfo;
- MachineModuleInfo();
+ MachineModuleInfo(); // DUMMY CONSTRUCTOR, DO NOT CALL.
+ MachineModuleInfo(const MCAsmInfo &MAI); // Real constructor.
~MachineModuleInfo();
bool doInitialization();
@@ -174,6 +171,9 @@ public:
/// EndFunction - Discard function meta information.
///
void EndFunction();
+
+ const MCContext &getContext() const { return Context; }
+ MCContext &getContext() { return Context; }
/// getInfo - Keep track of various per-function pieces of information for
/// backends that would like to do so.
@@ -205,37 +205,30 @@ public:
bool callsUnwindInit() const { return CallsUnwindInit; }
void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
- /// NextLabelID - Return the next unique label id.
- ///
- unsigned NextLabelID() {
- unsigned ID = (unsigned)LabelIDList.size() + 1;
- LabelIDList.push_back(ID);
- return ID;
- }
-
- /// InvalidateLabel - Inhibit use of the specified label # from
- /// MachineModuleInfo, for example because the code was deleted.
- void InvalidateLabel(unsigned LabelID) {
- // Remap to zero to indicate deletion.
- assert(0 < LabelID && LabelID <= LabelIDList.size() &&
- "Old label ID out of range.");
- LabelIDList[LabelID - 1] = 0;
- }
-
- /// isLabelDeleted - Return true if the label was deleted.
- /// FIXME: This should eventually be eliminated and use the 'is emitted' bit
- /// on MCSymbol.
- bool isLabelDeleted(unsigned LabelID) const {
- assert(LabelID <= LabelIDList.size() && "Debug label ID out of range.");
- return LabelID == 0 || LabelIDList[LabelID - 1] == 0;
- }
-
/// getFrameMoves - Returns a reference to a list of moves done in the current
/// function's prologue. Used to construct frame maps for debug and exception
/// handling comsumers.
std::vector<MachineMove> &getFrameMoves() { return FrameMoves; }
- //===-EH-----------------------------------------------------------------===//
+ /// getAddrLabelSymbol - Return the symbol to be used for the specified basic
+ /// block when its address is taken. This cannot be its normal LBB label
+ /// because the block may be accessed outside its containing function.
+ MCSymbol *getAddrLabelSymbol(const BasicBlock *BB);
+
+ /// getAddrLabelSymbolToEmit - Return the symbol to be used for the specified
+ /// basic block when its address is taken. If other blocks were RAUW'd to
+ /// this one, we may have to emit them as well, return the whole set.
+ std::vector<MCSymbol*> getAddrLabelSymbolToEmit(const BasicBlock *BB);
+
+ /// takeDeletedSymbolsForFunction - If the specified function has had any
+ /// references to address-taken blocks generated, but the block got deleted,
+ /// return the symbol now so we can emit it. This prevents emitting a
+ /// reference to a symbol that has no definition.
+ void takeDeletedSymbolsForFunction(const Function *F,
+ std::vector<MCSymbol*> &Result);
+
+
+ //===- EH ---------------------------------------------------------------===//
/// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the
/// specified MachineBasicBlock.
@@ -243,12 +236,12 @@ public:
/// addInvoke - Provide the begin and end labels of an invoke style call and
/// associate it with a try landing pad block.
- void addInvoke(MachineBasicBlock *LandingPad, unsigned BeginLabel,
- unsigned EndLabel);
+ void addInvoke(MachineBasicBlock *LandingPad,
+ MCSymbol *BeginLabel, MCSymbol *EndLabel);
/// addLandingPad - Add a new panding pad. Returns the label ID for the
/// landing pad entry.
- unsigned addLandingPad(MachineBasicBlock *LandingPad);
+ MCSymbol *addLandingPad(MachineBasicBlock *LandingPad);
/// addPersonality - Provide the personality function for the exception
/// information.
@@ -303,12 +296,12 @@ public:
}
/// setCallSiteBeginLabel - Map the begin label for a call site
- void setCallSiteBeginLabel(unsigned BeginLabel, unsigned Site) {
+ void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site) {
CallSiteMap[BeginLabel] = Site;
}
/// getCallSiteBeginLabel - Get the call site number for a begin label
- unsigned getCallSiteBeginLabel(unsigned BeginLabel) {
+ unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) {
assert(CallSiteMap.count(BeginLabel) &&
"Missing call site number for EH_LABEL!");
return CallSiteMap[BeginLabel];
diff --git a/include/llvm/CodeGen/MachineModuleInfoImpls.h b/include/llvm/CodeGen/MachineModuleInfoImpls.h
index 89b8207..9401ffd1 100644
--- a/include/llvm/CodeGen/MachineModuleInfoImpls.h
+++ b/include/llvm/CodeGen/MachineModuleInfoImpls.h
@@ -25,32 +25,34 @@ namespace llvm {
class MachineModuleInfoMachO : public MachineModuleInfoImpl {
/// FnStubs - Darwin '$stub' stubs. The key is something like "Lfoo$stub",
/// the value is something like "_foo".
- DenseMap<MCSymbol*, MCSymbol*> FnStubs;
+ DenseMap<MCSymbol*, StubValueTy> FnStubs;
/// GVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
- /// "Lfoo$non_lazy_ptr", the value is something like "_foo".
- DenseMap<MCSymbol*, MCSymbol*> GVStubs;
+ /// "Lfoo$non_lazy_ptr", the value is something like "_foo". The extra bit
+ /// is true if this GV is external.
+ DenseMap<MCSymbol*, StubValueTy> GVStubs;
/// HiddenGVStubs - Darwin '$non_lazy_ptr' stubs. The key is something like
/// "Lfoo$non_lazy_ptr", the value is something like "_foo". Unlike GVStubs
- /// these are for things with hidden visibility.
- DenseMap<MCSymbol*, MCSymbol*> HiddenGVStubs;
+ /// these are for things with hidden visibility. The extra bit is true if
+ /// this GV is external.
+ DenseMap<MCSymbol*, StubValueTy> HiddenGVStubs;
virtual void Anchor(); // Out of line virtual method.
public:
MachineModuleInfoMachO(const MachineModuleInfo &) {}
- MCSymbol *&getFnStubEntry(MCSymbol *Sym) {
+ StubValueTy &getFnStubEntry(MCSymbol *Sym) {
assert(Sym && "Key cannot be null");
return FnStubs[Sym];
}
- MCSymbol *&getGVStubEntry(MCSymbol *Sym) {
+ StubValueTy &getGVStubEntry(MCSymbol *Sym) {
assert(Sym && "Key cannot be null");
return GVStubs[Sym];
}
- MCSymbol *&getHiddenGVStubEntry(MCSymbol *Sym) {
+ StubValueTy &getHiddenGVStubEntry(MCSymbol *Sym) {
assert(Sym && "Key cannot be null");
return HiddenGVStubs[Sym];
}
@@ -72,13 +74,13 @@ namespace llvm {
class MachineModuleInfoELF : public MachineModuleInfoImpl {
/// GVStubs - These stubs are used to materialize global addresses in PIC
/// mode.
- DenseMap<MCSymbol*, MCSymbol*> GVStubs;
+ DenseMap<MCSymbol*, StubValueTy> GVStubs;
virtual void Anchor(); // Out of line virtual method.
public:
MachineModuleInfoELF(const MachineModuleInfo &) {}
- MCSymbol *&getGVStubEntry(MCSymbol *Sym) {
+ StubValueTy &getGVStubEntry(MCSymbol *Sym) {
assert(Sym && "Key cannot be null");
return GVStubs[Sym];
}
diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h
index 0978057..e522947 100644
--- a/include/llvm/CodeGen/MachineOperand.h
+++ b/include/llvm/CodeGen/MachineOperand.h
@@ -28,6 +28,7 @@ class MachineRegisterInfo;
class MDNode;
class TargetMachine;
class raw_ostream;
+class MCSymbol;
/// MachineOperand class - Representation of each machine instruction operand.
///
@@ -44,7 +45,8 @@ public:
MO_ExternalSymbol, ///< Name of external global symbol
MO_GlobalAddress, ///< Address of a global value
MO_BlockAddress, ///< Address of a basic block
- MO_Metadata ///< Metadata reference (for debug info)
+ MO_Metadata, ///< Metadata reference (for debug info)
+ MO_MCSymbol ///< MCSymbol reference (for debug/eh info)
};
private:
@@ -101,6 +103,7 @@ private:
const ConstantFP *CFP; // For MO_FPImmediate.
int64_t ImmVal; // For MO_Immediate.
const MDNode *MD; // For MO_Metadata.
+ MCSymbol *Sym; // For MO_MCSymbol
struct { // For MO_Register.
unsigned RegNo;
@@ -167,6 +170,7 @@ public:
bool isBlockAddress() const { return OpKind == MO_BlockAddress; }
/// isMetadata - Tests if this is a MO_Metadata operand.
bool isMetadata() const { return OpKind == MO_Metadata; }
+ bool isMCSymbol() const { return OpKind == MO_MCSymbol; }
//===--------------------------------------------------------------------===//
// Accessors for Register Operands
@@ -315,6 +319,11 @@ public:
assert(isBlockAddress() && "Wrong MachineOperand accessor");
return Contents.OffsetedInfo.Val.BA;
}
+
+ MCSymbol *getMCSymbol() const {
+ assert(isMCSymbol() && "Wrong MachineOperand accessor");
+ return Contents.Sym;
+ }
/// getOffset - Return the offset from the symbol in this operand. This always
/// returns 0 for ExternalSymbol operands.
@@ -473,6 +482,12 @@ public:
return Op;
}
+ static MachineOperand CreateMCSymbol(MCSymbol *Sym) {
+ MachineOperand Op(MachineOperand::MO_MCSymbol);
+ Op.Contents.Sym = Sym;
+ return Op;
+ }
+
friend class MachineInstr;
friend class MachineRegisterInfo;
private:
diff --git a/include/llvm/CodeGen/ObjectCodeEmitter.h b/include/llvm/CodeGen/ObjectCodeEmitter.h
index 170c0c8..d46628c 100644
--- a/include/llvm/CodeGen/ObjectCodeEmitter.h
+++ b/include/llvm/CodeGen/ObjectCodeEmitter.h
@@ -137,13 +137,6 @@ public:
/// emitted.
virtual uintptr_t getMachineBasicBlockAddress(MachineBasicBlock *MBB) const;
- /// emitLabel - Emits a label
- virtual void emitLabel(uint64_t LabelID) = 0;
-
- /// getLabelAddress - Return the address of the specified LabelID, only usable
- /// after the LabelID has been emitted.
- virtual uintptr_t getLabelAddress(uint64_t LabelID) const = 0;
-
/// emitJumpTables - Emit all the jump tables for a given jump table info
/// record to the appropriate section.
virtual void emitJumpTables(MachineJumpTableInfo *MJTI) = 0;
diff --git a/include/llvm/CodeGen/RuntimeLibcalls.h b/include/llvm/CodeGen/RuntimeLibcalls.h
index c404ab6..4ac3160 100644
--- a/include/llvm/CodeGen/RuntimeLibcalls.h
+++ b/include/llvm/CodeGen/RuntimeLibcalls.h
@@ -150,9 +150,15 @@ namespace RTLIB {
FLOOR_F64,
FLOOR_F80,
FLOOR_PPCF128,
+ COPYSIGN_F32,
+ COPYSIGN_F64,
+ COPYSIGN_F80,
+ COPYSIGN_PPCF128,
// CONVERSION
FPEXT_F32_F64,
+ FPEXT_F16_F32,
+ FPROUND_F32_F16,
FPROUND_F64_F32,
FPROUND_F80_F32,
FPROUND_PPCF128_F32,
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h
index 955965b..81e9ab3 100644
--- a/include/llvm/CodeGen/ScheduleDAG.h
+++ b/include/llvm/CodeGen/ScheduleDAG.h
@@ -227,6 +227,7 @@ namespace llvm {
private:
SDNode *Node; // Representative node.
MachineInstr *Instr; // Alternatively, a MachineInstr.
+ MachineInstr *DbgInstr; // A dbg_value referencing this.
public:
SUnit *OrigNode; // If not this, the node from which
// this node was cloned.
@@ -269,10 +270,10 @@ namespace llvm {
/// SUnit - Construct an SUnit for pre-regalloc scheduling to represent
/// an SDNode and any nodes flagged to it.
SUnit(SDNode *node, unsigned nodenum)
- : Node(node), Instr(0), OrigNode(0), NodeNum(nodenum), NodeQueueId(0),
- Latency(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0), NumSuccsLeft(0),
- isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false),
- hasPhysRegClobbers(false),
+ : Node(node), Instr(0), DbgInstr(0), OrigNode(0), NodeNum(nodenum),
+ NodeQueueId(0), Latency(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0),
+ NumSuccsLeft(0), isTwoAddress(false), isCommutable(false),
+ hasPhysRegDefs(false), hasPhysRegClobbers(false),
isPending(false), isAvailable(false), isScheduled(false),
isScheduleHigh(false), isCloned(false),
isDepthCurrent(false), isHeightCurrent(false), Depth(0), Height(0),
@@ -281,10 +282,10 @@ namespace llvm {
/// SUnit - Construct an SUnit for post-regalloc scheduling to represent
/// a MachineInstr.
SUnit(MachineInstr *instr, unsigned nodenum)
- : Node(0), Instr(instr), OrigNode(0), NodeNum(nodenum), NodeQueueId(0),
- Latency(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0), NumSuccsLeft(0),
- isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false),
- hasPhysRegClobbers(false),
+ : Node(0), Instr(instr), DbgInstr(0), OrigNode(0), NodeNum(nodenum),
+ NodeQueueId(0), Latency(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0),
+ NumSuccsLeft(0), isTwoAddress(false), isCommutable(false),
+ hasPhysRegDefs(false), hasPhysRegClobbers(false),
isPending(false), isAvailable(false), isScheduled(false),
isScheduleHigh(false), isCloned(false),
isDepthCurrent(false), isHeightCurrent(false), Depth(0), Height(0),
@@ -292,10 +293,10 @@ namespace llvm {
/// SUnit - Construct a placeholder SUnit.
SUnit()
- : Node(0), Instr(0), OrigNode(0), NodeNum(~0u), NodeQueueId(0),
- Latency(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0), NumSuccsLeft(0),
- isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false),
- hasPhysRegClobbers(false),
+ : Node(0), Instr(0), DbgInstr(0), OrigNode(0), NodeNum(~0u),
+ NodeQueueId(0), Latency(0), NumPreds(0), NumSuccs(0), NumPredsLeft(0),
+ NumSuccsLeft(0), isTwoAddress(false), isCommutable(false),
+ hasPhysRegDefs(false), hasPhysRegClobbers(false),
isPending(false), isAvailable(false), isScheduled(false),
isScheduleHigh(false), isCloned(false),
isDepthCurrent(false), isHeightCurrent(false), Depth(0), Height(0),
@@ -329,6 +330,20 @@ namespace llvm {
return Instr;
}
+ /// setDbgInstr - Assign the debug instruction for the SUnit.
+ /// This may be used during post-regalloc scheduling.
+ void setDbgInstr(MachineInstr *MI) {
+ assert(!Node && "Setting debug MachineInstr of SUnit with SDNode!");
+ DbgInstr = MI;
+ }
+
+ /// getDbgInstr - Return the debug MachineInstr for this SUnit.
+ /// This may be used during post-regalloc scheduling.
+ MachineInstr *getDbgInstr() const {
+ assert(!Node && "Reading debug MachineInstr of SUnit with SDNode!");
+ return DbgInstr;
+ }
+
/// addPred - This adds the specified edge as a pred of the current node if
/// not already. It also adds the current node as a successor of the
/// specified node.
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index ad01e89..c8d29aa 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -35,6 +35,7 @@ class MachineConstantPoolValue;
class MachineFunction;
class MachineModuleInfo;
class SDNodeOrdering;
+class SDDbgValue;
class TargetLowering;
template<> struct ilist_traits<SDNode> : public ilist_default_traits<SDNode> {
@@ -57,6 +58,46 @@ private:
static void createNode(const SDNode &);
};
+/// SDDbgInfo - Keeps track of dbg_value information through SDISel. We do
+/// not build SDNodes for these so as not to perturb the generated code;
+/// instead the info is kept off to the side in this structure. SDNodes may
+/// have an associated dbg_value entry in DbgValMap. Debug info that is not
+/// associated with any SDNode is held in DbgConstMap. It is possible for
+/// optimizations to change a variable to a constant, in which case the
+/// corresponding debug info is moved from the variable to the constant table
+/// (NYI).
+class SDDbgInfo {
+ DenseMap<const SDNode*, SDDbgValue*> DbgVblMap;
+ SmallVector<SDDbgValue*, 4> DbgConstMap;
+
+ void operator=(const SDDbgInfo&); // Do not implement.
+ SDDbgInfo(const SDDbgInfo&); // Do not implement.
+public:
+ SDDbgInfo() {}
+
+ void add(const SDNode *Node, SDDbgValue *V) {
+ DbgVblMap[Node] = V;
+ }
+ void add(SDDbgValue *V) { DbgConstMap.push_back(V); }
+ void remove(const SDNode *Node) {
+ DenseMap<const SDNode*, SDDbgValue*>::iterator Itr =
+ DbgVblMap.find(Node);
+ if (Itr != DbgVblMap.end())
+ DbgVblMap.erase(Itr);
+ }
+ // No need to remove a constant.
+ void clear() {
+ DbgVblMap.clear();
+ DbgConstMap.clear();
+ }
+ SDDbgValue *getSDDbgValue(const SDNode *Node) {
+ return DbgVblMap[Node];
+ }
+ typedef SmallVector<SDDbgValue*, 4>::iterator ConstDbgIterator;
+ ConstDbgIterator DbgConstBegin() { return DbgConstMap.begin(); }
+ ConstDbgIterator DbgConstEnd() { return DbgConstMap.end(); }
+};
+
enum CombineLevel {
Unrestricted, // Combine may create illegal operations and illegal types.
NoIllegalTypes, // Combine may create illegal operations but no illegal types.
@@ -119,6 +160,9 @@ class SelectionDAG {
/// the ordering of the original LLVM instructions.
SDNodeOrdering *Ordering;
+ /// DbgInfo - Tracks dbg_value information through SDISel.
+ SDDbgInfo *DbgInfo;
+
/// VerifyNode - Sanity check the given node. Aborts if it is invalid.
void VerifyNode(SDNode *N);
@@ -339,8 +383,7 @@ public:
unsigned char TargetFlags = 0);
SDValue getValueType(EVT);
SDValue getRegister(unsigned Reg, EVT VT);
- SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root,
- unsigned LabelID);
+ SDValue getEHLabel(DebugLoc dl, SDValue Root, MCSymbol *Label);
SDValue getBlockAddress(BlockAddress *BA, EVT VT,
bool isTarget = false, unsigned char TargetFlags = 0);
@@ -828,6 +871,20 @@ public:
/// GetOrdering - Get the order for the SDNode.
unsigned GetOrdering(const SDNode *SD) const;
+ /// AssignDbgInfo - Assign debug info to the SDNode.
+ void AssignDbgInfo(SDNode *SD, SDDbgValue *db);
+
+ /// RememberDbgInfo - Remember debug info with no associated SDNode.
+ void RememberDbgInfo(SDDbgValue *db);
+
+ /// GetDbgInfo - Get the debug info for the SDNode.
+ SDDbgValue *GetDbgInfo(const SDNode* SD);
+
+ SDDbgInfo::ConstDbgIterator DbgConstBegin() {
+ return DbgInfo->DbgConstBegin();
+ }
+ SDDbgInfo::ConstDbgIterator DbgConstEnd() { return DbgInfo->DbgConstEnd(); }
+
void dump() const;
/// CreateStackTemporary - Create a stack temporary, suitable for holding the
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index d9c1374..a1576be 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -274,7 +274,6 @@ private:
// Calls to these functions are generated by tblgen.
SDNode *Select_INLINEASM(SDNode *N);
SDNode *Select_UNDEF(SDNode *N);
- SDNode *Select_EH_LABEL(SDNode *N);
void CannotYetSelect(SDNode *N);
private:
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index 21a0b98..c16a48a 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -40,6 +40,7 @@ class MachineBasicBlock;
class MachineConstantPoolValue;
class SDNode;
class Value;
+class MCSymbol;
template <typename T> struct DenseMapInfo;
template <typename T> struct simplify_type;
template <typename T> struct ilist_traits;
@@ -438,6 +439,12 @@ namespace ISD {
// 5) ISD::CvtCode indicating the type of conversion to do
CONVERT_RNDSAT,
+ // FP16_TO_FP32, FP32_TO_FP16 - These operators are used to perform
+ // promotions and truncation for half-precision (16 bit) floating
+ // numbers. We need special nodes since FP16 is a storage-only type with
+ // special semantics of operations.
+ FP16_TO_FP32, FP32_TO_FP16,
+
// FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
// FLOG, FLOG2, FLOG10, FEXP, FEXP2,
// FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary floating
@@ -1383,9 +1390,9 @@ protected:
/// This constructor adds no operands itself; operands can be
/// set later with InitOperands.
SDNode(unsigned Opc, const DebugLoc dl, SDVTList VTs)
- : NodeType(Opc), OperandsNeedDelete(false), SubclassData(0),
- NodeId(-1), OperandList(0), ValueList(VTs.VTs), UseList(NULL),
- NumOperands(0), NumValues(VTs.NumVTs),
+ : NodeType(Opc), OperandsNeedDelete(false), HasDebugValue(false),
+ SubclassData(0), NodeId(-1), OperandList(0), ValueList(VTs.VTs),
+ UseList(NULL), NumOperands(0), NumValues(VTs.NumVTs),
debugLoc(dl) {}
/// InitOperands - Initialize the operands list of this with 1 operand.
@@ -2088,18 +2095,18 @@ public:
}
};
-class LabelSDNode : public SDNode {
+class EHLabelSDNode : public SDNode {
SDUse Chain;
- unsigned LabelID;
+ MCSymbol *Label;
friend class SelectionDAG;
- LabelSDNode(unsigned NodeTy, DebugLoc dl, SDValue ch, unsigned id)
- : SDNode(NodeTy, dl, getSDVTList(MVT::Other)), LabelID(id) {
+ EHLabelSDNode(DebugLoc dl, SDValue ch, MCSymbol *L)
+ : SDNode(ISD::EH_LABEL, dl, getSDVTList(MVT::Other)), Label(L) {
InitOperands(&Chain, ch);
}
public:
- unsigned getLabelID() const { return LabelID; }
+ MCSymbol *getLabel() const { return Label; }
- static bool classof(const LabelSDNode *) { return true; }
+ static bool classof(const EHLabelSDNode *) { return true; }
static bool classof(const SDNode *N) {
return N->getOpcode() == ISD::EH_LABEL;
}
diff --git a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
index 3d99fa7..b34ac21 100644
--- a/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
+++ b/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
@@ -78,12 +78,13 @@ public:
SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
Mangler *Mang, const TargetMachine &TM) const;
- /// getSymbolForDwarfGlobalReference - Return an MCExpr to use for a reference
+ /// getExprForDwarfGlobalReference - Return an MCExpr to use for a reference
/// to the specified global variable from exception handling information.
///
virtual const MCExpr *
- getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
- MachineModuleInfo *MMI, unsigned Encoding) const;
+ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+ MachineModuleInfo *MMI, unsigned Encoding,
+ MCStreamer &Streamer) const;
};
@@ -166,11 +167,12 @@ public:
return NonLazySymbolPointerSection;
}
- /// getSymbolForDwarfGlobalReference - The mach-o version of this method
+ /// getExprForDwarfGlobalReference - The mach-o version of this method
/// defaults to returning a stub reference.
virtual const MCExpr *
- getSymbolForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
- MachineModuleInfo *MMI, unsigned Encoding) const;
+ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+ MachineModuleInfo *MMI, unsigned Encoding,
+ MCStreamer &Streamer) const;
virtual unsigned getPersonalityEncoding() const;
virtual unsigned getLSDAEncoding() const;
OpenPOWER on IntegriCloud