summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/Transforms/Scalar.h7
-rw-r--r--include/llvm/ADT/STLExtras.h22
-rw-r--r--include/llvm/Analysis/InlineCost.h4
-rw-r--r--include/llvm/Analysis/LoopInfo.h2
-rw-r--r--include/llvm/CallingConv.h3
-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
-rw-r--r--include/llvm/Config/config.h.cmake3
-rw-r--r--include/llvm/Config/config.h.in3
-rw-r--r--include/llvm/Instructions.h2
-rw-r--r--include/llvm/Intrinsics.td8
-rw-r--r--include/llvm/MC/MCAsmInfo.h9
-rw-r--r--include/llvm/MC/MCAsmLayout.h36
-rw-r--r--include/llvm/MC/MCAssembler.h100
-rw-r--r--include/llvm/MC/MCContext.h20
-rw-r--r--include/llvm/MC/MCExpr.h66
-rw-r--r--include/llvm/MC/MCParser/AsmParser.h3
-rw-r--r--include/llvm/MC/MCParser/MCAsmParser.h1
-rw-r--r--include/llvm/MC/MCSection.h2
-rw-r--r--include/llvm/MC/MCSectionELF.h11
-rw-r--r--include/llvm/MC/MCSectionMachO.h8
-rw-r--r--include/llvm/MC/MCStreamer.h16
-rw-r--r--include/llvm/MC/MCSymbol.h13
-rw-r--r--include/llvm/Metadata.h7
-rw-r--r--include/llvm/OperandTraits.h7
-rw-r--r--include/llvm/Support/MemoryBuffer.h7
-rw-r--r--include/llvm/System/Valgrind.h32
-rw-r--r--include/llvm/Target/Mangler.h19
-rw-r--r--include/llvm/Target/TargetAsmBackend.h29
-rw-r--r--include/llvm/Target/TargetLowering.h7
-rw-r--r--include/llvm/Target/TargetLoweringObjectFile.h20
-rw-r--r--include/llvm/Target/TargetMachine.h7
-rw-r--r--include/llvm/Target/TargetRegistry.h28
-rw-r--r--include/llvm/Target/TargetSelectionDAG.td2
-rw-r--r--include/llvm/Transforms/Utils/BuildLibCalls.h18
54 files changed, 686 insertions, 279 deletions
diff --git a/include/llvm-c/Transforms/Scalar.h b/include/llvm-c/Transforms/Scalar.h
index 2c5a3714d4d1..c94019ac98b0 100644
--- a/include/llvm-c/Transforms/Scalar.h
+++ b/include/llvm-c/Transforms/Scalar.h
@@ -79,6 +79,10 @@ void LLVMAddSCCPPass(LLVMPassManagerRef PM);
/** See llvm::createScalarReplAggregatesPass function. */
void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM);
+/** See llvm::createScalarReplAggregatesPass function. */
+void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
+ int Threshold);
+
/** See llvm::createSimplifyLibCallsPass function. */
void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM);
@@ -91,6 +95,9 @@ void LLVMAddConstantPropagationPass(LLVMPassManagerRef PM);
/** See llvm::demotePromoteMemoryToRegisterPass function. */
void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM);
+/** See llvm::createVerifierPass function. */
+void LLVMAddVerifierPass(LLVMPassManagerRef PM);
+
#ifdef __cplusplus
}
#endif /* defined(__cplusplus) */
diff --git a/include/llvm/ADT/STLExtras.h b/include/llvm/ADT/STLExtras.h
index 32cf4590e993..8dbf79031c35 100644
--- a/include/llvm/ADT/STLExtras.h
+++ b/include/llvm/ADT/STLExtras.h
@@ -279,6 +279,28 @@ static inline void array_pod_sort(IteratorTy Start, IteratorTy End,
qsort(&*Start, End-Start, sizeof(*Start), Compare);
}
+//===----------------------------------------------------------------------===//
+// Extra additions to <algorithm>
+//===----------------------------------------------------------------------===//
+
+/// For a container of pointers, deletes the pointers and then clears the
+/// container.
+template<typename Container>
+void DeleteContainerPointers(Container &C) {
+ for (typename Container::iterator I = C.begin(), E = C.end(); I != E; ++I)
+ delete *I;
+ C.clear();
+}
+
+/// In a container of pairs (usually a map) whose second element is a pointer,
+/// deletes the second elements and then clears the container.
+template<typename Container>
+void DeleteContainerSeconds(Container &C) {
+ for (typename Container::iterator I = C.begin(), E = C.end(); I != E; ++I)
+ delete I->second;
+ C.clear();
+}
+
} // End llvm namespace
#endif
diff --git a/include/llvm/Analysis/InlineCost.h b/include/llvm/Analysis/InlineCost.h
index f0e97d7a181b..a0c521d7ed3b 100644
--- a/include/llvm/Analysis/InlineCost.h
+++ b/include/llvm/Analysis/InlineCost.h
@@ -18,6 +18,7 @@
#include <climits>
#include <map>
#include <vector>
+#include "llvm/ADT/DenseMap.h"
namespace llvm {
@@ -42,6 +43,9 @@ namespace llvm {
/// is used to estimate the code size cost of inlining it.
unsigned NumInsts, NumBlocks;
+ /// NumBBInsts - Keeps track of basic block code size estimates.
+ DenseMap<const BasicBlock *, unsigned> NumBBInsts;
+
/// NumCalls - Keep track of the number of calls to 'big' functions.
unsigned NumCalls;
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index f792a7fae3ee..2babc25cb140 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -571,7 +571,7 @@ public:
unsigned getSmallConstantTripMultiple() const;
/// isLCSSAForm - Return true if the Loop is in LCSSA form
- bool isLCSSAForm() const;
+ bool isLCSSAForm(DominatorTree &DT) const;
/// isLoopSimplifyForm - Return true if the Loop is in the form that
/// the LoopSimplify form transforms loops to, which is sometimes called
diff --git a/include/llvm/CallingConv.h b/include/llvm/CallingConv.h
index c54527c21877..624390d1cd84 100644
--- a/include/llvm/CallingConv.h
+++ b/include/llvm/CallingConv.h
@@ -44,6 +44,9 @@ namespace CallingConv {
// call does not break any live ranges in the caller side.
Cold = 9,
+ // GHC - Calling convention used by the Glasgow Haskell Compiler (GHC).
+ GHC = 10,
+
// Target - This is the start of the target-specific calling conventions,
// e.g. fastcall and thiscall on X86.
FirstTargetCC = 64,
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 6187447597c9..2cd477e8065c 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 04fd8bed9724..783f636740c2 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 ff1a205adbfd..62875c398b89 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 0a1d4f47e980..5da4961dbd39 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 e8856ac10377..1a2cc25ba490 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 d92650b42c9c..2995bea9df07 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 48b4082ef9a5..7abb49a219ef 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 3c5b466da7bd..76ec9db5510d 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 47f7cf7b3f4f..9baa592f96e0 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 5a4c9a9fb761..b8d04bf2132e 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 2db4e5571ecd..a1fcb9fe7576 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 fff8e83354c0..d446eaeb7f49 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 89b820740a82..9401ffd199d4 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 0978057c2090..e5229479f1e2 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 170c0c8ed3be..d46628caae79 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 c404ab6ea3f5..4ac316084c52 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 955965bccfa9..81e9ab31529e 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 ad01e89b3c6c..c8d29aa0c7d1 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 d9c1374a01d3..a1576be90b78 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 21a0b984b64c..c16a48aea2a9 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 3d99fa76e0bd..b34ac21cf1ee 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;
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index 1f48ae96878b..adbcc1132fb5 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -452,6 +452,9 @@
/* Define to 1 if the system has the type `u_int64_t'. */
#undef HAVE_U_INT64_T
+/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
+#cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H}
+
/* Define to 1 if you have the <windows.h> header file. */
#cmakedefine HAVE_WINDOWS_H ${HAVE_WINDOWS_H}
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index ce4f37487eb8..5caf778a2d7a 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -440,6 +440,9 @@
/* Define to 1 if the system has the type `u_int64_t'. */
#undef HAVE_U_INT64_T
+/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
+#undef HAVE_VALGRIND_VALGRIND_H
+
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index f07291cc62c4..80b7ca4f82df 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1984,7 +1984,7 @@ public:
};
template <>
-struct OperandTraits<ReturnInst> : public OptionalOperandTraits<> {
+struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 3a0da9cabdae..54c7b1f102b3 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -450,6 +450,14 @@ def int_flt_rounds : Intrinsic<[llvm_i32_ty]>,
def int_trap : Intrinsic<[llvm_void_ty]>,
GCCBuiltin<"__builtin_trap">;
+// Intrisics to support half precision floating point format
+let Properties = [IntrNoMem] in {
+def int_convert_to_fp16 : Intrinsic<[llvm_i16_ty], [llvm_float_ty]>,
+ GCCBuiltin<"__gnu_f2h_ieee">;
+def int_convert_from_fp16 : Intrinsic<[llvm_float_ty], [llvm_i16_ty]>,
+ GCCBuiltin<"__gnu_h2f_ieee">;
+}
+
// These convert intrinsics are to support various conversions between
// various types with rounding and saturation. NOTE: avoid using these
// intrinsics as they might be removed sometime in the future and
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index 7e0c8a54319f..4dfe9f0e52eb 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -145,6 +145,11 @@ namespace llvm {
/// which doesn't support the '.bss' directive only.
bool UsesELFSectionDirectiveForBSS; // Defaults to false.
+ /// HasMicrosoftFastStdCallMangling - True if this target uses microsoft
+ /// style mangling for functions with X86_StdCall/X86_FastCall calling
+ /// convention.
+ bool HasMicrosoftFastStdCallMangling; // Defaults to false.
+
//===--- Alignment Information ----------------------------------------===//
/// AlignDirective - The directive used to emit round up to an alignment
@@ -295,6 +300,10 @@ namespace llvm {
return UsesELFSectionDirectiveForBSS;
}
+ bool hasMicrosoftFastStdCallMangling() const {
+ return HasMicrosoftFastStdCallMangling;
+ }
+
// Accessors.
//
bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
diff --git a/include/llvm/MC/MCAsmLayout.h b/include/llvm/MC/MCAsmLayout.h
new file mode 100644
index 000000000000..27bdbe9cbf59
--- /dev/null
+++ b/include/llvm/MC/MCAsmLayout.h
@@ -0,0 +1,36 @@
+//===- MCAsmLayout.h - Assembly Layout Object -------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_MC_MCASMLAYOUT_H
+#define LLVM_MC_MCASMLAYOUT_H
+
+namespace llvm {
+class MCAssembler;
+
+/// Encapsulates the layout of an assembly file at a particular point in time.
+///
+/// Assembly may requiring compute multiple layouts for a particular assembly
+/// file as part of the relaxation process. This class encapsulates the layout
+/// at a single point in time in such a way that it is always possible to
+/// efficiently compute the exact addresses of any symbol in the assembly file,
+/// even during the relaxation process.
+class MCAsmLayout {
+private:
+ MCAssembler &Assembler;
+
+public:
+ MCAsmLayout(MCAssembler &_Assembler) : Assembler(_Assembler) {}
+
+ /// Get the assembler object this is a layout for.
+ MCAssembler &getAssembler() const { return Assembler; }
+};
+
+} // end namespace llvm
+
+#endif
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 882929f2eeef..1d8051fdb060 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -10,6 +10,7 @@
#ifndef LLVM_MC_MCASSEMBLER_H
#define LLVM_MC_MCASSEMBLER_H
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
@@ -20,6 +21,7 @@
namespace llvm {
class raw_ostream;
+class MCAsmLayout;
class MCAssembler;
class MCContext;
class MCExpr;
@@ -27,6 +29,8 @@ class MCFragment;
class MCSection;
class MCSectionData;
class MCSymbol;
+class MCValue;
+class TargetAsmBackend;
/// MCAsmFixup - Represent a fixed size region of bytes inside some fragment
/// which needs to be rewritten. This region will either be rewritten by the
@@ -160,6 +164,13 @@ public:
/// @name Fixup Access
/// @{
+ void addFixup(MCAsmFixup Fixup) {
+ // Enforce invariant that fixups are in offset order.
+ assert((Fixups.empty() || Fixup.Offset > Fixups.back().Offset) &&
+ "Fixups must be added in order!");
+ Fixups.push_back(Fixup);
+ }
+
std::vector<MCAsmFixup> &getFixups() { return Fixups; }
const std::vector<MCAsmFixup> &getFixups() const { return Fixups; }
@@ -195,7 +206,8 @@ class MCAlignFragment : public MCFragment {
/// cannot be satisfied in this width then this fragment is ignored.
unsigned MaxBytesToEmit;
- /// EmitNops - true when aligning code and optimal nops to be used for filling
+ /// EmitNops - true when aligning code and optimal nops to be used for
+ /// filling.
bool EmitNops;
public:
@@ -505,6 +517,11 @@ public:
uint64_t getOffset() const { return Offset; }
void setOffset(uint64_t Value) { Offset = Value; }
+ uint64_t getAddress() const {
+ assert(getFragment() && "Invalid getAddress() on undefined symbol!");
+ return getFragment()->getAddress() + getOffset();
+ }
+
/// @}
/// @name Symbol Attributes
/// @{
@@ -581,22 +598,61 @@ private:
MCContext &Context;
+ TargetAsmBackend &Backend;
+
raw_ostream &OS;
iplist<MCSectionData> Sections;
iplist<MCSymbolData> Symbols;
+ /// The map of sections to their associated assembler backend data.
+ //
+ // FIXME: Avoid this indirection?
+ DenseMap<const MCSection*, MCSectionData*> SectionMap;
+
+ /// The map of symbols to their associated assembler backend data.
+ //
+ // FIXME: Avoid this indirection?
+ DenseMap<const MCSymbol*, MCSymbolData*> SymbolMap;
+
std::vector<IndirectSymbolData> IndirectSymbols;
unsigned SubsectionsViaSymbols : 1;
private:
+ /// Check whether a fixup can be satisfied, or whether it needs to be relaxed
+ /// (increased in size, in order to hold its value correctly).
+ bool FixupNeedsRelaxation(MCAsmFixup &Fixup, MCDataFragment *DF);
+
/// LayoutSection - Assign offsets and sizes to the fragments in the section
/// \arg SD, and update the section size. The section file offset should
/// already have been computed.
void LayoutSection(MCSectionData &SD);
+ /// LayoutOnce - Perform one layout iteration and return true if any offsets
+ /// were adjusted.
+ bool LayoutOnce();
+
+ // FIXME: Make protected once we factor out object writer classes.
+public:
+ /// Evaluate a fixup to a relocatable expression and the value which should be
+ /// placed into the fixup.
+ ///
+ /// \param Layout The layout to use for evaluation.
+ /// \param Fixup The fixup to evaluate.
+ /// \param DF The fragment the fixup is inside.
+ /// \param Target [out] On return, the relocatable expression the fixup
+ /// evaluates to.
+ /// \param Value [out] On return, the value of the fixup as currently layed
+ /// out.
+ /// \return Whether the fixup value was fully resolved. This is true if the
+ /// \arg Value result is fixed, otherwise the value may change due to
+ /// relocation.
+ bool EvaluateFixup(const MCAsmLayout &Layout,
+ MCAsmFixup &Fixup, MCDataFragment *DF,
+ MCValue &Target, uint64_t &Value) const;
+
public:
/// Construct a new assembler instance.
///
@@ -606,11 +662,13 @@ public:
// concrete and require clients to pass in a target like object. The other
// option is to make this abstract, and have targets provide concrete
// implementations as we do with AsmParser.
- MCAssembler(MCContext &_Context, raw_ostream &OS);
+ MCAssembler(MCContext &_Context, TargetAsmBackend &_Backend, raw_ostream &OS);
~MCAssembler();
MCContext &getContext() const { return Context; }
+ TargetAsmBackend &getBackend() const { return Backend; }
+
/// Finish - Do final processing and write the object to the output stream.
void Finish();
@@ -673,6 +731,44 @@ public:
size_t indirect_symbol_size() const { return IndirectSymbols.size(); }
/// @}
+ /// @name Backend Data Access
+ /// @{
+
+ MCSectionData &getSectionData(const MCSection &Section) const {
+ MCSectionData *Entry = SectionMap.lookup(&Section);
+ assert(Entry && "Missing section data!");
+ return *Entry;
+ }
+
+ MCSectionData &getOrCreateSectionData(const MCSection &Section,
+ bool *Created = 0) {
+ MCSectionData *&Entry = SectionMap[&Section];
+
+ if (Created) *Created = !Entry;
+ if (!Entry)
+ Entry = new MCSectionData(Section, this);
+
+ return *Entry;
+ }
+
+ MCSymbolData &getSymbolData(const MCSymbol &Symbol) const {
+ MCSymbolData *Entry = SymbolMap.lookup(&Symbol);
+ assert(Entry && "Missing symbol data!");
+ return *Entry;
+ }
+
+ MCSymbolData &getOrCreateSymbolData(const MCSymbol &Symbol,
+ bool *Created = 0) {
+ MCSymbolData *&Entry = SymbolMap[&Symbol];
+
+ if (Created) *Created = !Entry;
+ if (!Entry)
+ Entry = new MCSymbolData(Symbol, 0, 0, this);
+
+ return *Entry;
+ }
+
+ /// @}
void dump();
};
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index f2f1456c4a9a..85114e30995e 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -15,6 +15,7 @@
#include "llvm/Support/Allocator.h"
namespace llvm {
+ class MCAsmInfo;
class MCExpr;
class MCSection;
class MCSymbol;
@@ -28,31 +29,44 @@ namespace llvm {
MCContext(const MCContext&); // DO NOT IMPLEMENT
MCContext &operator=(const MCContext&); // DO NOT IMPLEMENT
+ /// The MCAsmInfo for this target.
+ const MCAsmInfo &MAI;
+
/// Sections - Bindings of names to allocated sections.
StringMap<MCSection*> Sections;
/// Symbols - Bindings of names to symbols.
StringMap<MCSymbol*> Symbols;
+ /// NextUniqueID - The next ID to dole out to an unnamed assembler temporary
+ /// symbol.
+ unsigned NextUniqueID;
+
/// Allocator - Allocator object used for creating machine code objects.
///
/// We use a bump pointer allocator to avoid the need to track all allocated
/// objects.
BumpPtrAllocator Allocator;
public:
- MCContext();
+ explicit MCContext(const MCAsmInfo &MAI);
~MCContext();
+
+ const MCAsmInfo &getAsmInfo() const { return MAI; }
/// @name Symbol Managment
/// @{
+
+ /// CreateTempSymbol - Create and return a new assembler temporary symbol
+ /// with a unique but unspecified name.
+ MCSymbol *CreateTempSymbol();
/// GetOrCreateSymbol - Lookup the symbol inside with the specified
/// @p Name. If it exists, return it. If not, create a forward
/// reference and return it.
///
/// @param Name - The symbol name, which must be unique across all symbols.
- MCSymbol *GetOrCreateSymbol(StringRef Name);
- MCSymbol *GetOrCreateSymbol(const Twine &Name);
+ MCSymbol *GetOrCreateSymbol(StringRef Name, bool isTemporary = false);
+ MCSymbol *GetOrCreateSymbol(const Twine &Name, bool isTemporary = false);
/// GetOrCreateTemporarySymbol - Create a new assembler temporary symbol
/// with the specified @p Name if it doesn't exist or return the existing
diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h
index 3f17492c6b47..6efec52751c0 100644
--- a/include/llvm/MC/MCExpr.h
+++ b/include/llvm/MC/MCExpr.h
@@ -15,6 +15,7 @@
namespace llvm {
class MCAsmInfo;
+class MCAsmLayout;
class MCContext;
class MCSymbol;
class MCValue;
@@ -62,21 +63,25 @@ public:
/// EvaluateAsAbsolute - Try to evaluate the expression to an absolute value.
///
/// @param Res - The absolute value, if evaluation succeeds.
+ /// @param Layout - The assembler layout object to use for evaluating symbol
+ /// values. If not given, then only non-symbolic expressions will be
+ /// evaluated.
/// @result - True on success.
- bool EvaluateAsAbsolute(int64_t &Res) const;
+ bool EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout = 0) const;
/// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable
/// value, i.e. an expression of the fixed form (a - b + constant).
///
/// @param Res - The relocatable value, if evaluation succeeds.
+ /// @param Layout - The assembler layout object to use for evaluating values.
/// @result - True on success.
- bool EvaluateAsRelocatable(MCValue &Res) const;
+ bool EvaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout = 0) const;
/// @}
static bool classof(const MCExpr *) { return true; }
};
-
+
inline raw_ostream &operator<<(raw_ostream &OS, const MCExpr &E) {
E.print(OS);
return OS;
@@ -116,21 +121,49 @@ public:
/// assembler variable (defined constant), or constitute an implicit definition
/// of the symbol as external.
class MCSymbolRefExpr : public MCExpr {
+public:
+ enum VariantKind {
+ VK_None,
+ VK_Invalid,
+
+ VK_GOT,
+ VK_GOTOFF,
+ VK_GOTPCREL,
+ VK_GOTTPOFF,
+ VK_INDNTPOFF,
+ VK_NTPOFF,
+ VK_PLT,
+ VK_TLSGD,
+ VK_TPOFF
+ };
+
+private:
+ /// The symbol being referenced.
const MCSymbol *Symbol;
- explicit MCSymbolRefExpr(const MCSymbol *_Symbol)
- : MCExpr(MCExpr::SymbolRef), Symbol(_Symbol) {}
+ /// The symbol reference modifier.
+ const VariantKind Kind;
+
+ explicit MCSymbolRefExpr(const MCSymbol *_Symbol, VariantKind _Kind)
+ : MCExpr(MCExpr::SymbolRef), Symbol(_Symbol), Kind(_Kind) {}
public:
/// @name Construction
/// @{
- static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx);
- static const MCSymbolRefExpr *Create(StringRef Name, MCContext &Ctx);
+ static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, MCContext &Ctx) {
+ return MCSymbolRefExpr::Create(Symbol, VK_None, Ctx);
+ }
+
+ static const MCSymbolRefExpr *Create(const MCSymbol *Symbol, VariantKind Kind,
+ MCContext &Ctx);
+ static const MCSymbolRefExpr *Create(StringRef Name, VariantKind Kind,
+ MCContext &Ctx);
/// CreateTemp - Create a reference to an assembler temporary label with the
/// specified name.
- static const MCSymbolRefExpr *CreateTemp(StringRef Name, MCContext &Ctx);
+ static const MCSymbolRefExpr *CreateTemp(StringRef Name, VariantKind Kind,
+ MCContext &Ctx);
/// @}
/// @name Accessors
@@ -138,6 +171,16 @@ public:
const MCSymbol &getSymbol() const { return *Symbol; }
+ VariantKind getKind() const { return Kind; }
+
+ /// @}
+ /// @name Static Utility Functions
+ /// @{
+
+ static StringRef getVariantKindName(VariantKind Kind);
+
+ static VariantKind getVariantKindForName(StringRef Name);
+
/// @}
static bool classof(const MCExpr *E) {
@@ -346,11 +389,12 @@ protected:
MCTargetExpr() : MCExpr(Target) {}
virtual ~MCTargetExpr() {}
public:
-
+
virtual void PrintImpl(raw_ostream &OS) const = 0;
- virtual bool EvaluateAsRelocatableImpl(MCValue &Res) const = 0;
+ virtual bool EvaluateAsRelocatableImpl(MCValue &Res,
+ const MCAsmLayout *Layout) const = 0;
+
-
static bool classof(const MCExpr *E) {
return E->getKind() == MCExpr::Target;
}
diff --git a/include/llvm/MC/MCParser/AsmParser.h b/include/llvm/MC/MCParser/AsmParser.h
index 829604c81f7c..06e0920950d4 100644
--- a/include/llvm/MC/MCParser/AsmParser.h
+++ b/include/llvm/MC/MCParser/AsmParser.h
@@ -31,7 +31,6 @@ class MCExpr;
class MCInst;
class MCStreamer;
class MCAsmInfo;
-class MCValue;
class SourceMgr;
class TargetAsmParser;
class Twine;
@@ -65,7 +64,7 @@ public:
const MCAsmInfo &MAI);
~AsmParser();
- bool Run();
+ bool Run(bool NoInitialTextSection);
void AddDirectiveHandler(StringRef Directive,
diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h
index 843c692148bf..7f7f1b60f67d 100644
--- a/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/include/llvm/MC/MCParser/MCAsmParser.h
@@ -18,7 +18,6 @@ class MCAsmLexer;
class MCContext;
class MCExpr;
class MCStreamer;
-class MCValue;
class SMLoc;
class Twine;
diff --git a/include/llvm/MC/MCSection.h b/include/llvm/MC/MCSection.h
index ceb6d278c9c0..3d8815a7783f 100644
--- a/include/llvm/MC/MCSection.h
+++ b/include/llvm/MC/MCSection.h
@@ -42,6 +42,8 @@ namespace llvm {
};
class MCSectionCOFF : public MCSection {
+ // FIXME: This memory is leaked because MCSectionCOFF is bump pointer
+ // allocated and this never gets freed.
std::string Name;
/// IsDirective - This is true if the section name is a directive, not
diff --git a/include/llvm/MC/MCSectionELF.h b/include/llvm/MC/MCSectionELF.h
index 2dccf5c57286..cdd2f73b3484 100644
--- a/include/llvm/MC/MCSectionELF.h
+++ b/include/llvm/MC/MCSectionELF.h
@@ -21,7 +21,9 @@ namespace llvm {
/// MCSectionELF - This represents a section on linux, lots of unix variants
/// and some bare metal systems.
class MCSectionELF : public MCSection {
- std::string SectionName;
+ /// SectionName - This is the name of the section. The referenced memory is
+ /// owned by TargetLoweringObjectFileELF's ELFUniqueMap.
+ StringRef SectionName;
/// Type - This is the sh_type field of a section, drawn from the enums below.
unsigned Type;
@@ -37,7 +39,7 @@ class MCSectionELF : public MCSection {
protected:
MCSectionELF(StringRef Section, unsigned type, unsigned flags,
SectionKind K, bool isExplicit)
- : MCSection(K), SectionName(Section.str()), Type(type), Flags(flags),
+ : MCSection(K), SectionName(Section), Type(type), Flags(flags),
IsExplicit(isExplicit) {}
public:
@@ -163,10 +165,7 @@ public:
TARGET_INDEP_SHF = FIRST_TARGET_DEP_FLAG-1U
};
- StringRef getSectionName() const {
- return StringRef(SectionName);
- }
-
+ StringRef getSectionName() const { return SectionName; }
unsigned getType() const { return Type; }
unsigned getFlags() const { return Flags; }
diff --git a/include/llvm/MC/MCSectionMachO.h b/include/llvm/MC/MCSectionMachO.h
index 61568194d700..5839c281ed6f 100644
--- a/include/llvm/MC/MCSectionMachO.h
+++ b/include/llvm/MC/MCSectionMachO.h
@@ -151,10 +151,12 @@ public:
return StringRef(SectionName, 16);
return StringRef(SectionName);
}
-
+
unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
unsigned getStubSize() const { return Reserved2; }
-
+
+ unsigned getType() const { return TypeAndAttributes & SECTION_TYPE; }
+
/// ParseSectionSpecifier - Parse the section specifier indicated by "Spec".
/// This is a string that can appear after a .section directive in a mach-o
/// flavored .s file. If successful, this fills in the specified Out
@@ -165,7 +167,7 @@ public:
StringRef &Section, // Out.
unsigned &TAA, // Out.
unsigned &StubSize); // Out.
-
+
virtual void PrintSwitchToSection(const MCAsmInfo &MAI,
raw_ostream &OS) const;
};
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index 6359ccefe63a..47befcaf6b0d 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -27,6 +27,7 @@ namespace llvm {
class MCSection;
class MCSymbol;
class StringRef;
+class TargetAsmBackend;
class Twine;
class raw_ostream;
class formatted_raw_ostream;
@@ -298,24 +299,15 @@ namespace llvm {
/// \param ShowInst - Whether to show the MCInst representation inline with
/// the assembly.
MCStreamer *createAsmStreamer(MCContext &Ctx, formatted_raw_ostream &OS,
- const MCAsmInfo &MAI, bool isLittleEndian,
- bool isVerboseAsm,
+ bool isLittleEndian, bool isVerboseAsm,
MCInstPrinter *InstPrint = 0,
MCCodeEmitter *CE = 0,
bool ShowInst = false);
- // FIXME: These two may end up getting rolled into a single
- // createObjectStreamer interface, which implements the assembler backend, and
- // is parameterized on an output object file writer.
-
/// createMachOStream - Create a machine code streamer which will generative
/// Mach-O format object files.
- MCStreamer *createMachOStreamer(MCContext &Ctx, raw_ostream &OS,
- MCCodeEmitter *CE);
-
- /// createELFStreamer - Create a machine code streamer which will generative
- /// ELF format object files.
- MCStreamer *createELFStreamer(MCContext &Ctx, raw_ostream &OS);
+ MCStreamer *createMachOStreamer(MCContext &Ctx, TargetAsmBackend &TAB,
+ raw_ostream &OS, MCCodeEmitter *CE);
} // end namespace llvm
diff --git a/include/llvm/MC/MCSymbol.h b/include/llvm/MC/MCSymbol.h
index d5c4d95c183c..e41eb2ab8859 100644
--- a/include/llvm/MC/MCSymbol.h
+++ b/include/llvm/MC/MCSymbol.h
@@ -14,9 +14,7 @@
#ifndef LLVM_MC_MCSYMBOL_H
#define LLVM_MC_MCSYMBOL_H
-#include <string>
#include "llvm/ADT/StringRef.h"
-#include "llvm/System/DataTypes.h"
namespace llvm {
class MCExpr;
@@ -38,8 +36,9 @@ namespace llvm {
// FIXME: Use a PointerInt wrapper for this?
static const MCSection *AbsolutePseudoSection;
- /// Name - The name of the symbol.
- std::string Name;
+ /// Name - The name of the symbol. The referred-to string data is actually
+ /// held by the StringMap that lives in MCContext.
+ StringRef Name;
/// Section - The section the symbol is defined in. This is null for
/// undefined symbols, and the special AbsolutePseudoSection value for
@@ -56,14 +55,14 @@ namespace llvm {
private: // MCContext creates and uniques these.
friend class MCContext;
- MCSymbol(StringRef _Name, bool _IsTemporary)
- : Name(_Name), Section(0), Value(0), IsTemporary(_IsTemporary) {}
+ MCSymbol(StringRef name, bool isTemporary)
+ : Name(name), Section(0), Value(0), IsTemporary(isTemporary) {}
MCSymbol(const MCSymbol&); // DO NOT IMPLEMENT
void operator=(const MCSymbol&); // DO NOT IMPLEMENT
public:
/// getName - Get the symbol name.
- const std::string &getName() const { return Name; }
+ StringRef getName() const { return Name; }
/// @name Symbol Type
/// @{
diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h
index cf87989062a8..ff3e03e96fd8 100644
--- a/include/llvm/Metadata.h
+++ b/include/llvm/Metadata.h
@@ -110,9 +110,6 @@ class MDNode : public Value, public FoldingSetNode {
/// node with T.
void replaceOperand(MDNodeOperand *Op, Value *NewVal);
~MDNode();
- /// replaceAllOperandsWithNull - This is used while destroying llvm context to
- /// gracefully delete all nodes. This method replaces all operands with null.
- void replaceAllOperandsWithNull();
protected:
explicit MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
@@ -168,9 +165,7 @@ private:
bool isNotUniqued() const {
return (getSubclassDataFromValue() & NotUniquedBit) != 0;
}
- void setIsNotUniqued() {
- setValueSubclassData(getSubclassDataFromValue() | NotUniquedBit);
- }
+ void setIsNotUniqued();
// Shadow Value::setValueSubclassData with a private forwarding method so that
// any future subclasses cannot accidentally use it.
diff --git a/include/llvm/OperandTraits.h b/include/llvm/OperandTraits.h
index 7c879c88f13b..b614ccbc3777 100644
--- a/include/llvm/OperandTraits.h
+++ b/include/llvm/OperandTraits.h
@@ -20,7 +20,7 @@
namespace llvm {
//===----------------------------------------------------------------------===//
-// FixedNumOperands Trait Class
+// FixedNumOperand Trait Class
//===----------------------------------------------------------------------===//
/// FixedNumOperandTraits - determine the allocation regime of the Use array
@@ -51,9 +51,12 @@ struct FixedNumOperandTraits {
};
//===----------------------------------------------------------------------===//
-// OptionalOperands Trait Class
+// OptionalOperand Trait Class
//===----------------------------------------------------------------------===//
+/// OptionalOperandTraits - when the number of operands may change at runtime.
+/// Naturally it may only decrease, because the allocations may not change.
+
template <unsigned ARITY = 1>
struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> {
static unsigned operands(const User *U) {
diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h
index 65c7167318a9..fcea5d20de4b 100644
--- a/include/llvm/Support/MemoryBuffer.h
+++ b/include/llvm/Support/MemoryBuffer.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/System/DataTypes.h"
#include <string>
+#include <sys/stat.h>
namespace llvm {
@@ -59,7 +60,8 @@ public:
/// it has the specified size.
static MemoryBuffer *getFile(StringRef Filename,
std::string *ErrStr = 0,
- int64_t FileSize = -1);
+ int64_t FileSize = -1,
+ struct stat *FileInfo = 0);
/// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
/// that EndPtr[0] must be a null byte and be accessible!
@@ -95,7 +97,8 @@ public:
/// in *ErrStr with a reason.
static MemoryBuffer *getFileOrSTDIN(StringRef Filename,
std::string *ErrStr = 0,
- int64_t FileSize = -1);
+ int64_t FileSize = -1,
+ struct stat *FileInfo = 0);
};
} // end namespace llvm
diff --git a/include/llvm/System/Valgrind.h b/include/llvm/System/Valgrind.h
new file mode 100644
index 000000000000..5ec79c3c5573
--- /dev/null
+++ b/include/llvm/System/Valgrind.h
@@ -0,0 +1,32 @@
+//===- llvm/System/Valgrind.h - Communication with Valgrind -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Methods for communicating with a valgrind instance this program is running
+// under. These are all no-ops unless LLVM was configured on a system with the
+// valgrind headers installed and valgrind is controlling this process.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SYSTEM_VALGRIND_H
+#define LLVM_SYSTEM_VALGRIND_H
+
+#include <stddef.h>
+
+namespace llvm {
+namespace sys {
+ // True if Valgrind is controlling this process.
+ bool RunningOnValgrind();
+
+ // Discard valgrind's translation of code in the range [Addr .. Addr + Len).
+ // Otherwise valgrind may continue to execute the old version of the code.
+ void ValgrindDiscardTranslations(const void *Addr, size_t Len);
+}
+}
+
+#endif
diff --git a/include/llvm/Target/Mangler.h b/include/llvm/Target/Mangler.h
index 45cbf9da1e4e..a9f3576559d4 100644
--- a/include/llvm/Target/Mangler.h
+++ b/include/llvm/Target/Mangler.h
@@ -1,4 +1,4 @@
-//===-- llvm/Target/Mangler.h - Self-contained name mangler ----*- C++ -*-===//
+//===-- llvm/Target/Mangler.h - Self-contained name mangler -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -23,7 +23,9 @@ class Twine;
class Value;
class GlobalValue;
template <typename T> class SmallVectorImpl;
-class MCAsmInfo;
+class MCContext;
+class MCSymbol;
+class TargetData;
class Mangler {
public:
@@ -34,7 +36,8 @@ public:
};
private:
- const MCAsmInfo &MAI;
+ MCContext &Context;
+ const TargetData &TD;
/// AnonGlobalIDs - We need to give global values the same name every time
/// they are mangled. This keeps track of the number we give to anonymous
@@ -47,10 +50,14 @@ private:
unsigned NextAnonGlobalID;
public:
- // Mangler ctor - if a prefix is specified, it will be prepended onto all
- // symbols.
- Mangler(const MCAsmInfo &mai) : MAI(mai), NextAnonGlobalID(1) {}
+ Mangler(MCContext &context, const TargetData &td)
+ : Context(context), TD(td), NextAnonGlobalID(1) {}
+ /// getSymbol - Return the MCSymbol for the specified global value. This
+ /// symbol is the main label that is the address of the global.
+ MCSymbol *getSymbol(const GlobalValue *GV);
+
+
/// getNameWithPrefix - Fill OutName with the name of the appropriate prefix
/// and the specified global variable's name. If the global variable doesn't
/// have a name, this fills in a unique name for the global.
diff --git a/include/llvm/Target/TargetAsmBackend.h b/include/llvm/Target/TargetAsmBackend.h
index dfdabdb7fa3b..35a995f541e2 100644
--- a/include/llvm/Target/TargetAsmBackend.h
+++ b/include/llvm/Target/TargetAsmBackend.h
@@ -11,6 +11,7 @@
#define LLVM_TARGET_TARGETASMBACKEND_H
namespace llvm {
+class MCSection;
class Target;
/// TargetAsmBackend - Generic interface to target specific assembler backends.
@@ -28,6 +29,34 @@ public:
const Target &getTarget() const { return TheTarget; }
+ /// hasAbsolutizedSet - Check whether this target "absolutizes"
+ /// assignments. That is, given code like:
+ /// a:
+ /// ...
+ /// b:
+ /// tmp = a - b
+ /// .long tmp
+ /// will the value of 'tmp' be a relocatable expression, or the assembly time
+ /// value of L0 - L1. This distinction is only relevant for platforms that
+ /// support scattered symbols, since in the absence of scattered symbols (a -
+ /// b) cannot change after assembly.
+ virtual bool hasAbsolutizedSet() const { return false; }
+
+ /// hasScatteredSymbols - Check whether this target supports scattered
+ /// symbols. If so, the assembler should assume that atoms can be scattered by
+ /// the linker. In particular, this means that the offsets between symbols
+ /// which are in distinct atoms is not known at link time, and the assembler
+ /// must generate fixups and relocations appropriately.
+ ///
+ /// Note that the assembler currently does not reason about atoms, instead it
+ /// assumes all temporary symbols reside in the "current atom".
+ virtual bool hasScatteredSymbols() const { return false; }
+
+ /// doesSectionRequireSymbols - Check whether the given section requires that
+ /// all symbols (even temporaries) have symbol table entries.
+ virtual bool doesSectionRequireSymbols(const MCSection &Section) const {
+ return false;
+ }
};
} // End llvm namespace
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index 5bc1c0e60927..b19c20af346f 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -323,13 +323,6 @@ public:
return false;
}
- /// getWidenVectorType: given a vector type, returns the type to widen to
- /// (e.g., v7i8 to v8i8). If the vector type is legal, it returns itself.
- /// If there is no vector type that we want to widen to, returns MVT::Other
- /// When and were to widen is target dependent based on the cost of
- /// scalarizing vs using the wider vector type.
- virtual EVT getWidenVectorType(EVT VT) const;
-
/// isFPImmLegal - Returns true if the target can instruction select the
/// specified FP immediate natively. If false, the legalizer will materialize
/// the FP immediate as a load from a constant pool.
diff --git a/include/llvm/Target/TargetLoweringObjectFile.h b/include/llvm/Target/TargetLoweringObjectFile.h
index 056efea30caa..6c99598ea6ee 100644
--- a/include/llvm/Target/TargetLoweringObjectFile.h
+++ b/include/llvm/Target/TargetLoweringObjectFile.h
@@ -22,11 +22,12 @@ namespace llvm {
class MachineModuleInfo;
class Mangler;
class MCAsmInfo;
+ class MCContext;
class MCExpr;
class MCSection;
class MCSectionMachO;
class MCSymbol;
- class MCContext;
+ class MCStreamer;
class GlobalValue;
class TargetMachine;
@@ -197,17 +198,20 @@ public:
return 0;
}
- /// 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;
-
- virtual const MCExpr *
- getSymbolForDwarfReference(const MCSymbol *Sym, MachineModuleInfo *MMI,
- unsigned Encoding) const;
+ getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
+ MachineModuleInfo *MMI, unsigned Encoding,
+ MCStreamer &Streamer) const;
+ ///
+ const MCExpr *
+ getExprForDwarfReference(const MCSymbol *Sym, Mangler *Mang,
+ MachineModuleInfo *MMI, unsigned Encoding,
+ MCStreamer &Streamer) const;
+
virtual unsigned getPersonalityEncoding() const;
virtual unsigned getLSDAEncoding() const;
virtual unsigned getFDEEncoding() const;
diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h
index a7062ac94f35..b239a306761f 100644
--- a/include/llvm/Target/TargetMachine.h
+++ b/include/llvm/Target/TargetMachine.h
@@ -30,6 +30,7 @@ class TargetJITInfo;
class TargetLowering;
class TargetFrameInfo;
class JITCodeEmitter;
+class MCContext;
class TargetRegisterInfo;
class PassManagerBase;
class PassManager;
@@ -224,16 +225,18 @@ public:
/// implemented with the LLVM target-independent code generator.
///
class LLVMTargetMachine : public TargetMachine {
+ std::string TargetTriple;
+
protected: // Can only create subclasses.
LLVMTargetMachine(const Target &T, const std::string &TargetTriple);
+private:
/// addCommonCodeGenPasses - Add standard LLVM codegen passes used for
/// both emitting to assembly files or machine code output.
///
bool addCommonCodeGenPasses(PassManagerBase &, CodeGenOpt::Level,
- bool DisableVerify);
+ bool DisableVerify, MCContext *&OutCtx);
-private:
virtual void setCodeModelForJIT();
virtual void setCodeModelForStatic();
diff --git a/include/llvm/Target/TargetRegistry.h b/include/llvm/Target/TargetRegistry.h
index a409b621af2b..43738638cf8e 100644
--- a/include/llvm/Target/TargetRegistry.h
+++ b/include/llvm/Target/TargetRegistry.h
@@ -62,11 +62,9 @@ namespace llvm {
const std::string &Features);
typedef AsmPrinter *(*AsmPrinterCtorTy)(formatted_raw_ostream &OS,
TargetMachine &TM,
- MCContext &Ctx,
- MCStreamer &Streamer,
- const MCAsmInfo *MAI);
+ MCStreamer &Streamer);
typedef TargetAsmBackend *(*AsmBackendCtorTy)(const Target &T,
- MCAssembler &A);
+ const std::string &TT);
typedef TargetAsmLexer *(*AsmLexerCtorTy)(const Target &T,
const MCAsmInfo &MAI);
typedef TargetAsmParser *(*AsmParserCtorTy)(const Target &T,MCAsmParser &P);
@@ -208,11 +206,12 @@ namespace llvm {
/// createAsmBackend - Create a target specific assembly parser.
///
+ /// \arg Triple - The target triple string.
/// \arg Backend - The target independent assembler object.
- TargetAsmBackend *createAsmBackend(MCAssembler &Backend) const {
+ TargetAsmBackend *createAsmBackend(const std::string &Triple) const {
if (!AsmBackendCtorFn)
return 0;
- return AsmBackendCtorFn(*this, Backend);
+ return AsmBackendCtorFn(*this, Triple);
}
/// createAsmLexer - Create a target specific assembly lexer.
@@ -234,13 +233,12 @@ namespace llvm {
}
/// createAsmPrinter - Create a target specific assembly printer pass. This
- /// takes ownership of the MCContext and MCStreamer objects but not the MAI.
+ /// takes ownership of the MCStreamer object.
AsmPrinter *createAsmPrinter(formatted_raw_ostream &OS, TargetMachine &TM,
- MCContext &Ctx, MCStreamer &Streamer,
- const MCAsmInfo *MAI) const {
+ MCStreamer &Streamer) const {
if (!AsmPrinterCtorFn)
return 0;
- return AsmPrinterCtorFn(OS, TM, Ctx, Streamer, MAI);
+ return AsmPrinterCtorFn(OS, TM, Streamer);
}
const MCDisassembler *createMCDisassembler() const {
@@ -587,8 +585,9 @@ namespace llvm {
}
private:
- static TargetAsmBackend *Allocator(const Target &T, MCAssembler &Backend) {
- return new AsmBackendImpl(T, Backend);
+ static TargetAsmBackend *Allocator(const Target &T,
+ const std::string &Triple) {
+ return new AsmBackendImpl(T, Triple);
}
};
@@ -648,9 +647,8 @@ namespace llvm {
private:
static AsmPrinter *Allocator(formatted_raw_ostream &OS, TargetMachine &TM,
- MCContext &Ctx, MCStreamer &Streamer,
- const MCAsmInfo *MAI) {
- return new AsmPrinterImpl(OS, TM, Ctx, Streamer, MAI);
+ MCStreamer &Streamer) {
+ return new AsmPrinterImpl(OS, TM, Streamer);
}
};
diff --git a/include/llvm/Target/TargetSelectionDAG.td b/include/llvm/Target/TargetSelectionDAG.td
index 4365d332c044..c718c86e60ad 100644
--- a/include/llvm/Target/TargetSelectionDAG.td
+++ b/include/llvm/Target/TargetSelectionDAG.td
@@ -345,6 +345,8 @@ def sint_to_fp : SDNode<"ISD::SINT_TO_FP" , SDTIntToFPOp>;
def uint_to_fp : SDNode<"ISD::UINT_TO_FP" , SDTIntToFPOp>;
def fp_to_sint : SDNode<"ISD::FP_TO_SINT" , SDTFPToIntOp>;
def fp_to_uint : SDNode<"ISD::FP_TO_UINT" , SDTFPToIntOp>;
+def f16_to_f32 : SDNode<"ISD::FP16_TO_FP32", SDTIntToFPOp>;
+def f32_to_f16 : SDNode<"ISD::FP32_TO_FP16", SDTFPToIntOp>;
def setcc : SDNode<"ISD::SETCC" , SDTSetCC>;
def select : SDNode<"ISD::SELECT" , SDTSelect>;
diff --git a/include/llvm/Transforms/Utils/BuildLibCalls.h b/include/llvm/Transforms/Utils/BuildLibCalls.h
index 03716a8eed73..ac5f07e2d384 100644
--- a/include/llvm/Transforms/Utils/BuildLibCalls.h
+++ b/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -37,6 +37,11 @@ namespace llvm {
/// EmitStrCpy - Emit a call to the strcpy function to the builder, for the
/// specified pointer arguments.
Value *EmitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B,
+ const TargetData *TD, StringRef Name = "strcpy");
+
+ /// EmitStrNCpy - Emit a call to the strncpy function to the builder, for the
+ /// specified pointer arguments and length.
+ Value *EmitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B,
const TargetData *TD);
/// EmitMemCpy - Emit a call to the memcpy function to the builder. This
@@ -91,6 +96,19 @@ namespace llvm {
/// a pointer, Size is an 'intptr_t', and File is a pointer to FILE.
void EmitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B,
const TargetData *TD);
+
+ /// SimplifyFortifiedLibCalls - Helper class for folding checked library
+ /// calls (e.g. __strcpy_chk) into their unchecked counterparts.
+ class SimplifyFortifiedLibCalls {
+ protected:
+ CallInst *CI;
+ virtual void replaceCall(Value *With) = 0;
+ virtual bool isFoldable(unsigned SizeCIOp, unsigned SizeArgOp,
+ bool isString) const = 0;
+ public:
+ virtual ~SimplifyFortifiedLibCalls();
+ bool fold(CallInst *CI, const TargetData *TD);
+ };
}
#endif