summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-03-06 09:22:29 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-03-06 09:22:29 +0000
commit9bef28eb9e224d641ce31a423e215ccf82bf1d43 (patch)
tree542734eaa7870f95912cbaebccb87dbec0c20b4f /include
parent8230c40430a1325b5cc5bc0221931487b4bd573c (diff)
downloadFreeBSD-src-9bef28eb9e224d641ce31a423e215ccf82bf1d43.zip
FreeBSD-src-9bef28eb9e224d641ce31a423e215ccf82bf1d43.tar.gz
Update LLVM to r97873.
Diffstat (limited to 'include')
-rw-r--r--include/llvm-c/BitWriter.h13
-rw-r--r--include/llvm-c/Core.h4
-rw-r--r--include/llvm/ADT/ScopedHashTable.h2
-rw-r--r--include/llvm/Analysis/ValueTracking.h4
-rw-r--r--include/llvm/CodeGen/MachineInstr.h24
-rw-r--r--include/llvm/CodeGen/MachineRegisterInfo.h8
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h1
-rw-r--r--include/llvm/CodeGen/SelectionDAGNodes.h16
-rw-r--r--include/llvm/CompilerDriver/Common.td1
-rw-r--r--include/llvm/GlobalValue.h82
-rw-r--r--include/llvm/Support/Compiler.h4
-rw-r--r--include/llvm/Support/IRBuilder.h4
-rw-r--r--include/llvm/Transforms/Utils/BuildLibCalls.h96
13 files changed, 227 insertions, 32 deletions
diff --git a/include/llvm-c/BitWriter.h b/include/llvm-c/BitWriter.h
index 008ff9f..bcbfb11 100644
--- a/include/llvm-c/BitWriter.h
+++ b/include/llvm-c/BitWriter.h
@@ -28,13 +28,16 @@ extern "C" {
/*===-- Operations on modules ---------------------------------------------===*/
-/* Writes a module to an open file descriptor. Returns 0 on success.
- Closes the Handle. Use dup first if this is not what you want. */
-int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
-
-/* Writes a module to the specified path. Returns 0 on success. */
+/** Writes a module to the specified path. Returns 0 on success. */
int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);
+/** Writes a module to an open file descriptor. Returns 0 on success. */
+int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
+ int Unbuffered);
+
+/** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file
+ descriptor. Returns 0 on success. Closes the Handle. */
+int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
#ifdef __cplusplus
}
diff --git a/include/llvm-c/Core.h b/include/llvm-c/Core.h
index 457436d..733b92c 100644
--- a/include/llvm-c/Core.h
+++ b/include/llvm-c/Core.h
@@ -112,11 +112,13 @@ typedef enum {
LLVMOptimizeForSizeAttribute = 1<<13,
LLVMStackProtectAttribute = 1<<14,
LLVMStackProtectReqAttribute = 1<<15,
+ LLVMAlignment = 31<<16,
LLVMNoCaptureAttribute = 1<<21,
LLVMNoRedZoneAttribute = 1<<22,
LLVMNoImplicitFloatAttribute = 1<<23,
LLVMNakedAttribute = 1<<24,
- LLVMInlineHintAttribute = 1<<25
+ LLVMInlineHintAttribute = 1<<25,
+ LLVMStackAlignment = 7<<26
} LLVMAttribute;
typedef enum {
diff --git a/include/llvm/ADT/ScopedHashTable.h b/include/llvm/ADT/ScopedHashTable.h
index f325e2b..b5ca374a 100644
--- a/include/llvm/ADT/ScopedHashTable.h
+++ b/include/llvm/ADT/ScopedHashTable.h
@@ -139,7 +139,7 @@ public:
}
V lookup(const K &Key) {
- return TopLevelMap[Key].getValue();
+ return TopLevelMap[Key]->getValue();
}
void insert(const K &Key, const V &Val) {
diff --git a/include/llvm/Analysis/ValueTracking.h b/include/llvm/Analysis/ValueTracking.h
index 7c673c3..0791b7b 100644
--- a/include/llvm/Analysis/ValueTracking.h
+++ b/include/llvm/Analysis/ValueTracking.h
@@ -124,6 +124,10 @@ namespace llvm {
/// character is included in the result string.
bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0,
bool StopAtNul = true);
+
+ /// GetStringLength - If we can compute the length of the string pointed to by
+ /// the specified pointer, return 'len+1'. If we can't, return 0.
+ uint64_t GetStringLength(Value *V);
} // end namespace llvm
#endif
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 66be26c..d84f882 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -419,6 +419,30 @@ private:
void AddRegOperandsToUseLists(MachineRegisterInfo &RegInfo);
};
+/// MachineInstrExpressionTrait - Special DenseMapInfo traits to compare
+/// MachineInstr* by *value* of the instruction rather than by pointer value.
+/// The hashing and equality testing functions ignore definitions so this is
+/// useful for CSE, etc.
+struct MachineInstrExpressionTrait : DenseMapInfo<MachineInstr*> {
+ static inline MachineInstr *getEmptyKey() {
+ return 0;
+ }
+
+ static inline MachineInstr *getTombstoneKey() {
+ return reinterpret_cast<MachineInstr*>(-1);
+ }
+
+ static unsigned getHashValue(const MachineInstr* const &MI);
+
+ static bool isEqual(const MachineInstr* const &LHS,
+ const MachineInstr* const &RHS) {
+ if (RHS == getEmptyKey() || RHS == getTombstoneKey() ||
+ LHS == getEmptyKey() || LHS == getTombstoneKey())
+ return LHS == RHS;
+ return LHS->isIdenticalTo(RHS, MachineInstr::IgnoreVRegDefs);
+ }
+};
+
//===----------------------------------------------------------------------===//
// Debugging Support
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h
index 01dc018..f2e5e10 100644
--- a/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -115,6 +115,10 @@ public:
/// register.
bool use_empty(unsigned RegNo) const { return use_begin(RegNo) == use_end(); }
+ /// hasOneUse - Return true if there is exactly one instruction using the
+ /// specified register.
+ bool hasOneUse(unsigned RegNo) const;
+
/// use_nodbg_iterator/use_nodbg_begin/use_nodbg_end - Walk all uses of the
/// specified register, skipping those marked as Debug.
typedef defusechain_iterator<true,false,true> use_nodbg_iterator;
@@ -129,6 +133,10 @@ public:
return use_nodbg_begin(RegNo) == use_nodbg_end();
}
+ /// hasOneNonDBGUse - Return true if there is exactly one non-Debug
+ /// instruction using the specified register.
+ bool hasOneNonDBGUse(unsigned RegNo) const;
+
/// replaceRegWith - Replace all instances of FromReg with ToReg in the
/// machine function. This is like llvm-level X->replaceAllUsesWith(Y),
/// except that it also changes any definitions of the register as well.
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index 23ff001..d9c1374 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -276,7 +276,6 @@ private:
SDNode *Select_UNDEF(SDNode *N);
SDNode *Select_EH_LABEL(SDNode *N);
void CannotYetSelect(SDNode *N);
- void CannotYetSelectIntrinsic(SDNode *N);
private:
void DoInstructionSelection();
diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h
index 950963e..21a0b98 100644
--- a/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -1027,11 +1027,15 @@ private:
/// then they will be delete[]'d when the node is destroyed.
uint16_t OperandsNeedDelete : 1;
+ /// HasDebugValue - This tracks whether this node has one or more dbg_value
+ /// nodes corresponding to it.
+ uint16_t HasDebugValue : 1;
+
protected:
/// SubclassData - This member is defined by this class, but is not used for
/// anything. Subclasses can use it to hold whatever state they find useful.
/// This field is initialized to zero by the ctor.
- uint16_t SubclassData : 15;
+ uint16_t SubclassData : 14;
private:
/// NodeId - Unique id per SDNode in the DAG.
@@ -1094,6 +1098,12 @@ public:
return ~NodeType;
}
+ /// getHasDebugValue - get this bit.
+ bool getHasDebugValue() const { return HasDebugValue; }
+
+ /// setHasDebugValue - set this bit.
+ void setHasDebugValue(bool b) { HasDebugValue = b; }
+
/// use_empty - Return true if there are no uses of this node.
///
bool use_empty() const { return UseList == NULL; }
@@ -1357,8 +1367,8 @@ protected:
SDNode(unsigned Opc, const DebugLoc dl, SDVTList VTs, const SDValue *Ops,
unsigned NumOps)
- : NodeType(Opc), OperandsNeedDelete(true), SubclassData(0),
- NodeId(-1),
+ : NodeType(Opc), OperandsNeedDelete(true), HasDebugValue(false),
+ SubclassData(0), NodeId(-1),
OperandList(NumOps ? new SDUse[NumOps] : 0),
ValueList(VTs.VTs), UseList(NULL),
NumOperands(NumOps), NumValues(VTs.NumVTs),
diff --git a/include/llvm/CompilerDriver/Common.td b/include/llvm/CompilerDriver/Common.td
index 479bd6e..31a627d 100644
--- a/include/llvm/CompilerDriver/Common.td
+++ b/include/llvm/CompilerDriver/Common.td
@@ -45,6 +45,7 @@ def hidden;
def init;
def multi_val;
def one_or_more;
+def zero_or_more;
def optional;
def really_hidden;
def required;
diff --git a/include/llvm/GlobalValue.h b/include/llvm/GlobalValue.h
index c15b555..658967d 100644
--- a/include/llvm/GlobalValue.h
+++ b/include/llvm/GlobalValue.h
@@ -110,36 +110,51 @@ public:
return ODR ? WeakODRLinkage : WeakAnyLinkage;
}
- bool hasExternalLinkage() const { return Linkage == ExternalLinkage; }
- bool hasAvailableExternallyLinkage() const {
+ static bool isExternalLinkage(LinkageTypes Linkage) {
+ return Linkage == ExternalLinkage;
+ }
+ static bool isAvailableExternallyLinkage(LinkageTypes Linkage) {
return Linkage == AvailableExternallyLinkage;
}
- bool hasLinkOnceLinkage() const {
+ static bool isLinkOnceLinkage(LinkageTypes Linkage) {
return Linkage == LinkOnceAnyLinkage || Linkage == LinkOnceODRLinkage;
}
- bool hasWeakLinkage() const {
+ static bool isWeakLinkage(LinkageTypes Linkage) {
return Linkage == WeakAnyLinkage || Linkage == WeakODRLinkage;
}
- bool hasAppendingLinkage() const { return Linkage == AppendingLinkage; }
- bool hasInternalLinkage() const { return Linkage == InternalLinkage; }
- bool hasPrivateLinkage() const { return Linkage == PrivateLinkage; }
- bool hasLinkerPrivateLinkage() const { return Linkage==LinkerPrivateLinkage; }
- bool hasLocalLinkage() const {
- return hasInternalLinkage() || hasPrivateLinkage() ||
- hasLinkerPrivateLinkage();
+ static bool isAppendingLinkage(LinkageTypes Linkage) {
+ return Linkage == AppendingLinkage;
+ }
+ static bool isInternalLinkage(LinkageTypes Linkage) {
+ return Linkage == InternalLinkage;
+ }
+ static bool isPrivateLinkage(LinkageTypes Linkage) {
+ return Linkage == PrivateLinkage;
+ }
+ static bool isLinkerPrivateLinkage(LinkageTypes Linkage) {
+ return Linkage==LinkerPrivateLinkage;
+ }
+ static bool isLocalLinkage(LinkageTypes Linkage) {
+ return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage) ||
+ isLinkerPrivateLinkage(Linkage);
+ }
+ static bool isDLLImportLinkage(LinkageTypes Linkage) {
+ return Linkage == DLLImportLinkage;
+ }
+ static bool isDLLExportLinkage(LinkageTypes Linkage) {
+ return Linkage == DLLExportLinkage;
+ }
+ static bool isExternalWeakLinkage(LinkageTypes Linkage) {
+ return Linkage == ExternalWeakLinkage;
+ }
+ static bool isCommonLinkage(LinkageTypes Linkage) {
+ return Linkage == CommonLinkage;
}
- bool hasDLLImportLinkage() const { return Linkage == DLLImportLinkage; }
- bool hasDLLExportLinkage() const { return Linkage == DLLExportLinkage; }
- bool hasExternalWeakLinkage() const { return Linkage == ExternalWeakLinkage; }
- bool hasCommonLinkage() const { return Linkage == CommonLinkage; }
-
- void setLinkage(LinkageTypes LT) { Linkage = LT; }
- LinkageTypes getLinkage() const { return Linkage; }
/// mayBeOverridden - Whether the definition of this global may be replaced
/// by something non-equivalent at link time. For example, if a function has
/// weak linkage then the code defining it may be replaced by different code.
- bool mayBeOverridden() const {
+ static bool mayBeOverridden(LinkageTypes Linkage) {
return (Linkage == WeakAnyLinkage ||
Linkage == LinkOnceAnyLinkage ||
Linkage == CommonLinkage ||
@@ -148,7 +163,7 @@ public:
/// isWeakForLinker - Whether the definition of this global may be replaced at
/// link time.
- bool isWeakForLinker() const {
+ static bool isWeakForLinker(LinkageTypes Linkage) {
return (Linkage == AvailableExternallyLinkage ||
Linkage == WeakAnyLinkage ||
Linkage == WeakODRLinkage ||
@@ -158,6 +173,33 @@ public:
Linkage == ExternalWeakLinkage);
}
+ bool hasExternalLinkage() const { return isExternalLinkage(Linkage); }
+ bool hasAvailableExternallyLinkage() const {
+ return isAvailableExternallyLinkage(Linkage);
+ }
+ bool hasLinkOnceLinkage() const {
+ return isLinkOnceLinkage(Linkage);
+ }
+ bool hasWeakLinkage() const {
+ return isWeakLinkage(Linkage);
+ }
+ bool hasAppendingLinkage() const { return isAppendingLinkage(Linkage); }
+ bool hasInternalLinkage() const { return isInternalLinkage(Linkage); }
+ bool hasPrivateLinkage() const { return isPrivateLinkage(Linkage); }
+ bool hasLinkerPrivateLinkage() const { return isLinkerPrivateLinkage(Linkage); }
+ bool hasLocalLinkage() const { return isLocalLinkage(Linkage); }
+ bool hasDLLImportLinkage() const { return isDLLImportLinkage(Linkage); }
+ bool hasDLLExportLinkage() const { return isDLLExportLinkage(Linkage); }
+ bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
+ bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }
+
+ void setLinkage(LinkageTypes LT) { Linkage = LT; }
+ LinkageTypes getLinkage() const { return Linkage; }
+
+ bool mayBeOverridden() const { return mayBeOverridden(Linkage); }
+
+ bool isWeakForLinker() const { return isWeakForLinker(Linkage); }
+
/// copyAttributesFrom - copy all additional attributes (those not needed to
/// create a GlobalValue) from the GlobalValue Src to this one.
virtual void copyAttributesFrom(const GlobalValue *Src);
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h
index 1376e46..881a0fe 100644
--- a/include/llvm/Support/Compiler.h
+++ b/include/llvm/Support/Compiler.h
@@ -78,7 +78,9 @@
// ALWAYS_INLINE - On compilers where we have a directive to do so, mark a
// method "always inline" because it is performance sensitive.
-#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+// GCC 3.4 supported this but is buggy in various cases and produces
+// unimplemented errors, just use it in GCC 4.0 and later.
+#if __GNUC__ > 3
#define ALWAYS_INLINE __attribute__((always_inline))
#else
// TODO: No idea how to do this with MSVC.
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index c8aef9c..1f4e598 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -143,6 +143,10 @@ public:
return Type::getVoidTy(Context);
}
+ const Type *getInt8PtrTy() {
+ return Type::getInt8PtrTy(Context);
+ }
+
/// getCurrentFunctionReturnType - Get the return type of the current function
/// that we're emitting into.
const Type *getCurrentFunctionReturnType() const;
diff --git a/include/llvm/Transforms/Utils/BuildLibCalls.h b/include/llvm/Transforms/Utils/BuildLibCalls.h
new file mode 100644
index 0000000..03716a8
--- /dev/null
+++ b/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -0,0 +1,96 @@
+//===- BuildLibCalls.h - Utility builder for libcalls -----------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file exposes an interface to build some C language libcalls for
+// optimization passes that need to call the various functions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TRANSFORMS_UTILS_BUILDLIBCALLS_H
+#define TRANSFORMS_UTILS_BUILDLIBCALLS_H
+
+#include "llvm/Support/IRBuilder.h"
+
+namespace llvm {
+ class Value;
+ class TargetData;
+
+ /// CastToCStr - Return V if it is an i8*, otherwise cast it to i8*.
+ Value *CastToCStr(Value *V, IRBuilder<> &B);
+
+ /// EmitStrLen - Emit a call to the strlen function to the builder, for the
+ /// specified pointer. Ptr is required to be some pointer type, and the
+ /// return value has 'intptr_t' type.
+ Value *EmitStrLen(Value *Ptr, IRBuilder<> &B, const TargetData *TD);
+
+ /// EmitStrChr - Emit a call to the strchr function to the builder, for the
+ /// specified pointer and character. Ptr is required to be some pointer type,
+ /// and the return value has 'i8*' type.
+ Value *EmitStrChr(Value *Ptr, char C, IRBuilder<> &B, const TargetData *TD);
+
+ /// 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);
+
+ /// EmitMemCpy - Emit a call to the memcpy function to the builder. This
+ /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
+ Value *EmitMemCpy(Value *Dst, Value *Src, Value *Len,
+ unsigned Align, IRBuilder<> &B, const TargetData *TD);
+
+ /// EmitMemMove - Emit a call to the memmove function to the builder. This
+ /// always expects that the size has type 'intptr_t' and Dst/Src are pointers.
+ Value *EmitMemMove(Value *Dst, Value *Src, Value *Len,
+ unsigned Align, IRBuilder<> &B, const TargetData *TD);
+
+ /// EmitMemChr - Emit a call to the memchr function. This assumes that Ptr is
+ /// a pointer, Val is an i32 value, and Len is an 'intptr_t' value.
+ Value *EmitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B,
+ const TargetData *TD);
+
+ /// EmitMemCmp - Emit a call to the memcmp function.
+ Value *EmitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B,
+ const TargetData *TD);
+
+ /// EmitMemSet - Emit a call to the memset function
+ Value *EmitMemSet(Value *Dst, Value *Val, Value *Len, IRBuilder<> &B,
+ const TargetData *TD);
+
+ /// EmitUnaryFloatFnCall - Emit a call to the unary function named 'Name'
+ /// (e.g. 'floor'). This function is known to take a single of type matching
+ /// 'Op' and returns one value with the same type. If 'Op' is a long double,
+ /// 'l' is added as the suffix of name, if 'Op' is a float, we add a 'f'
+ /// suffix.
+ Value *EmitUnaryFloatFnCall(Value *Op, const char *Name, IRBuilder<> &B,
+ const AttrListPtr &Attrs);
+
+ /// EmitPutChar - Emit a call to the putchar function. This assumes that Char
+ /// is an integer.
+ Value *EmitPutChar(Value *Char, IRBuilder<> &B, const TargetData *TD);
+
+ /// EmitPutS - Emit a call to the puts function. This assumes that Str is
+ /// some pointer.
+ void EmitPutS(Value *Str, IRBuilder<> &B, const TargetData *TD);
+
+ /// EmitFPutC - Emit a call to the fputc function. This assumes that Char is
+ /// an i32, and File is a pointer to FILE.
+ void EmitFPutC(Value *Char, Value *File, IRBuilder<> &B,
+ const TargetData *TD);
+
+ /// EmitFPutS - Emit a call to the puts function. Str is required to be a
+ /// pointer and File is a pointer to FILE.
+ void EmitFPutS(Value *Str, Value *File, IRBuilder<> &B, const TargetData *TD);
+
+ /// EmitFWrite - Emit a call to the fwrite function. This assumes that Ptr is
+ /// 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);
+}
+
+#endif
OpenPOWER on IntegriCloud