aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/APSInt.h4
-rw-r--r--include/llvm/ADT/PostOrderIterator.h2
-rw-r--r--include/llvm/ADT/SmallBitVector.h12
-rw-r--r--include/llvm/ADT/StringSet.h26
-rw-r--r--include/llvm/Analysis/AliasSetTracker.h1
-rw-r--r--include/llvm/Analysis/BlockFrequencyImpl.h2
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h3
-rw-r--r--include/llvm/CodeGen/LiveRangeEdit.h2
-rw-r--r--include/llvm/CodeGen/LiveVariables.h4
-rw-r--r--include/llvm/CodeGen/MachineBranchProbabilityInfo.h1
-rw-r--r--include/llvm/CodeGen/MachineFrameInfo.h3
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h2
-rw-r--r--include/llvm/DIBuilder.h17
-rw-r--r--include/llvm/DebugInfo.h146
-rw-r--r--include/llvm/ExecutionEngine/GenericValue.h6
-rw-r--r--include/llvm/IR/Attributes.h10
-rw-r--r--include/llvm/IR/DataLayout.h49
-rw-r--r--include/llvm/IR/Function.h8
-rw-r--r--include/llvm/IR/Instructions.h3
-rw-r--r--include/llvm/Linker.h42
-rw-r--r--include/llvm/MC/MCAtom.h4
-rw-r--r--include/llvm/MC/MCContext.h9
-rw-r--r--include/llvm/MC/MCParser/MCParsedAsmOperand.h11
-rw-r--r--include/llvm/Support/CallSite.h1
-rw-r--r--include/llvm/Support/Compiler.h10
-rw-r--r--include/llvm/Support/DebugLoc.h26
-rw-r--r--include/llvm/Support/ELF.h2
-rw-r--r--include/llvm/Support/FileSystem.h6
-rw-r--r--include/llvm/TableGen/Error.h1
-rw-r--r--include/llvm/TableGen/Record.h5
-rw-r--r--include/llvm/Target/Target.td3
-rw-r--r--include/llvm/Target/TargetFrameLowering.h3
-rw-r--r--include/llvm/Target/TargetLowering.h7
-rw-r--r--include/llvm/Target/TargetMachine.h5
-rw-r--r--include/llvm/Target/TargetSchedule.td5
-rw-r--r--include/llvm/Transforms/Instrumentation.h37
-rw-r--r--include/llvm/Transforms/Scalar.h2
37 files changed, 260 insertions, 220 deletions
diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h
index 42e123930d..11be4c513e 100644
--- a/include/llvm/ADT/APSInt.h
+++ b/include/llvm/ADT/APSInt.h
@@ -161,11 +161,11 @@ public:
}
APSInt& operator++() {
- static_cast<APInt&>(*this)++;
+ ++(static_cast<APInt&>(*this));
return *this;
}
APSInt& operator--() {
- static_cast<APInt&>(*this)--;
+ --(static_cast<APInt&>(*this));
return *this;
}
APSInt operator++(int) {
diff --git a/include/llvm/ADT/PostOrderIterator.h b/include/llvm/ADT/PostOrderIterator.h
index 7f6350e444..59fa3f39c9 100644
--- a/include/llvm/ADT/PostOrderIterator.h
+++ b/include/llvm/ADT/PostOrderIterator.h
@@ -260,7 +260,7 @@ class ReversePostOrderTraversal {
typedef typename GT::NodeType NodeType;
std::vector<NodeType*> Blocks; // Block list in normal PO order
inline void Initialize(NodeType *BB) {
- copy(po_begin(BB), po_end(BB), back_inserter(Blocks));
+ std::copy(po_begin(BB), po_end(BB), std::back_inserter(Blocks));
}
public:
typedef typename std::vector<NodeType*>::reverse_iterator rpo_iterator;
diff --git a/include/llvm/ADT/SmallBitVector.h b/include/llvm/ADT/SmallBitVector.h
index 62620fa267..652492a153 100644
--- a/include/llvm/ADT/SmallBitVector.h
+++ b/include/llvm/ADT/SmallBitVector.h
@@ -178,9 +178,9 @@ public:
unsigned count() const {
if (isSmall()) {
uintptr_t Bits = getSmallBits();
- if (sizeof(uintptr_t) * CHAR_BIT == 32)
+ if (NumBaseBits == 32)
return CountPopulation_32(Bits);
- if (sizeof(uintptr_t) * CHAR_BIT == 64)
+ if (NumBaseBits == 64)
return CountPopulation_64(Bits);
llvm_unreachable("Unsupported!");
}
@@ -215,9 +215,9 @@ public:
uintptr_t Bits = getSmallBits();
if (Bits == 0)
return -1;
- if (sizeof(uintptr_t) * CHAR_BIT == 32)
+ if (NumBaseBits == 32)
return CountTrailingZeros_32(Bits);
- if (sizeof(uintptr_t) * CHAR_BIT == 64)
+ if (NumBaseBits == 64)
return CountTrailingZeros_64(Bits);
llvm_unreachable("Unsupported!");
}
@@ -233,9 +233,9 @@ public:
Bits &= ~uintptr_t(0) << (Prev + 1);
if (Bits == 0 || Prev + 1 >= getSmallSize())
return -1;
- if (sizeof(uintptr_t) * CHAR_BIT == 32)
+ if (NumBaseBits == 32)
return CountTrailingZeros_32(Bits);
- if (sizeof(uintptr_t) * CHAR_BIT == 64)
+ if (NumBaseBits == 64)
return CountTrailingZeros_64(Bits);
llvm_unreachable("Unsupported!");
}
diff --git a/include/llvm/ADT/StringSet.h b/include/llvm/ADT/StringSet.h
index b69a964a23..7bea577f34 100644
--- a/include/llvm/ADT/StringSet.h
+++ b/include/llvm/ADT/StringSet.h
@@ -18,23 +18,25 @@
namespace llvm {
- /// StringSet - A wrapper for StringMap that provides set-like
- /// functionality. Only insert() and count() methods are used by my
- /// code.
+ /// StringSet - A wrapper for StringMap that provides set-like functionality.
template <class AllocatorTy = llvm::MallocAllocator>
class StringSet : public llvm::StringMap<char, AllocatorTy> {
typedef llvm::StringMap<char, AllocatorTy> base;
public:
- bool insert(StringRef InLang) {
- assert(!InLang.empty());
- const char *KeyStart = InLang.data();
- const char *KeyEnd = KeyStart + InLang.size();
- llvm::StringMapEntry<char> *Entry = llvm::StringMapEntry<char>::
- Create(KeyStart, KeyEnd, base::getAllocator(), '+');
- if (!base::insert(Entry)) {
- Entry->Destroy(base::getAllocator());
+
+ /// insert - Insert the specified key into the set. If the key already
+ /// exists in the set, return false and ignore the request, otherwise insert
+ /// it and return true.
+ bool insert(StringRef Key) {
+ // Get or create the map entry for the key; if it doesn't exist the value
+ // type will be default constructed which we use to detect insert.
+ //
+ // We use '+' as the sentinel value in the map.
+ assert(!Key.empty());
+ StringMapEntry<char> &Entry = this->GetOrCreateValue(Key);
+ if (Entry.getValue() == '+')
return false;
- }
+ Entry.setValue('+');
return true;
}
};
diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h
index 163331c262..da007072e5 100644
--- a/include/llvm/Analysis/AliasSetTracker.h
+++ b/include/llvm/Analysis/AliasSetTracker.h
@@ -20,7 +20,6 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
-#include "llvm/Support/CallSite.h"
#include "llvm/Support/ValueHandle.h"
#include <vector>
diff --git a/include/llvm/Analysis/BlockFrequencyImpl.h b/include/llvm/Analysis/BlockFrequencyImpl.h
index f220c58244..b3e2d18eb2 100644
--- a/include/llvm/Analysis/BlockFrequencyImpl.h
+++ b/include/llvm/Analysis/BlockFrequencyImpl.h
@@ -271,7 +271,7 @@ class BlockFrequencyImpl {
BlockT *EntryBlock = fn->begin();
- copy(po_begin(EntryBlock), po_end(EntryBlock), back_inserter(POT));
+ std::copy(po_begin(EntryBlock), po_end(EntryBlock), std::back_inserter(POT));
unsigned RPOidx = 0;
for (rpot_iterator I = rpot_begin(), E = rpot_end(); I != E; ++I) {
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 4632368157..7d72f37255 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -20,9 +20,7 @@
#ifndef LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
#define LLVM_CODEGEN_LIVEINTERVAL_ANALYSIS_H
-#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/IndexedMap.h"
-#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
@@ -36,6 +34,7 @@
namespace llvm {
class AliasAnalysis;
+ class BitVector;
class LiveRangeCalc;
class LiveVariables;
class MachineDominatorTree;
diff --git a/include/llvm/CodeGen/LiveRangeEdit.h b/include/llvm/CodeGen/LiveRangeEdit.h
index def7b00ce7..8a32a3c11a 100644
--- a/include/llvm/CodeGen/LiveRangeEdit.h
+++ b/include/llvm/CodeGen/LiveRangeEdit.h
@@ -83,7 +83,7 @@ private:
/// allUsesAvailableAt - Return true if all registers used by OrigMI at
/// OrigIdx are also available with the same value at UseIdx.
bool allUsesAvailableAt(const MachineInstr *OrigMI, SlotIndex OrigIdx,
- SlotIndex UseIdx);
+ SlotIndex UseIdx) const;
/// foldAsLoad - If LI has a single use and a single def that can be folded as
/// a load, eliminate the register by folding the def into the use.
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index 3c5ed9297e..6628fd278e 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -29,21 +29,19 @@
#ifndef LLVM_CODEGEN_LIVEVARIABLES_H
#define LLVM_CODEGEN_LIVEVARIABLES_H
-#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IndexedMap.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/SparseBitVector.h"
-#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetRegisterInfo.h"
namespace llvm {
+class MachineBasicBlock;
class MachineRegisterInfo;
-class TargetRegisterInfo;
class LiveVariables : public MachineFunctionPass {
public:
diff --git a/include/llvm/CodeGen/MachineBranchProbabilityInfo.h b/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
index 1c9bdd954c..98dd03b45c 100644
--- a/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
+++ b/include/llvm/CodeGen/MachineBranchProbabilityInfo.h
@@ -1,4 +1,3 @@
-
//==- MachineBranchProbabilityInfo.h - Machine Branch Probability Analysis -==//
//
// The LLVM Compiler Infrastructure
diff --git a/include/llvm/CodeGen/MachineFrameInfo.h b/include/llvm/CodeGen/MachineFrameInfo.h
index 93d77287d7..cdec7e6637 100644
--- a/include/llvm/CodeGen/MachineFrameInfo.h
+++ b/include/llvm/CodeGen/MachineFrameInfo.h
@@ -419,6 +419,9 @@ public:
///
void setStackSize(uint64_t Size) { StackSize = Size; }
+ /// Estimate and return the size of the stack frame.
+ unsigned estimateStackSize(const MachineFunction &MF) const;
+
/// getOffsetAdjustment - Return the correction for frame offsets.
///
int getOffsetAdjustment() const { return OffsetAdjustment; }
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index 1db6252ef4..a3acec8095 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -295,7 +295,7 @@ public:
/// isUsedFunction - Return true if the functions in the llvm.used list. This
/// does not return true for things in llvm.compiler.used unless they are also
/// in llvm.used.
- bool isUsedFunction(const Function *F) {
+ bool isUsedFunction(const Function *F) const {
return UsedFunctions.count(F);
}
diff --git a/include/llvm/DIBuilder.h b/include/llvm/DIBuilder.h
index d59847558a..de6c38f0e0 100644
--- a/include/llvm/DIBuilder.h
+++ b/include/llvm/DIBuilder.h
@@ -375,10 +375,6 @@ namespace llvm {
/// flag set.
DIType createObjectPointerType(DIType Ty);
- /// createTemporaryType - Create a temporary forward-declared type.
- DIType createTemporaryType();
- DIType createTemporaryType(DIFile F);
-
/// createForwardDecl - Create a temporary forward-declared type.
DIType createForwardDecl(unsigned Tag, StringRef Name, DIDescriptor Scope,
DIFile F, unsigned Line, unsigned RuntimeLang = 0,
@@ -411,6 +407,19 @@ namespace llvm {
createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
DIType Ty, bool isLocalToUnit, llvm::Value *Val);
+ /// \brief Create a new descriptor for the specified global.
+ /// @param Name Name of the variable.
+ /// @param LinkageName Mangled variable name.
+ /// @param File File where this variable is defined.
+ /// @param LineNo Line number.
+ /// @param Ty Variable Type.
+ /// @param isLocalToUnit Boolean flag indicate whether this variable is
+ /// externally visible or not.
+ /// @param Val llvm::Value of the variable.
+ DIGlobalVariable
+ createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
+ unsigned LineNo, DIType Ty, bool isLocalToUnit,
+ llvm::Value *Val);
/// createStaticVariable - Create a new descriptor for the specified
/// variable.
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h
index 42d94f4777..f6ac869a5f 100644
--- a/include/llvm/DebugInfo.h
+++ b/include/llvm/DebugInfo.h
@@ -169,6 +169,18 @@ namespace llvm {
StringRef getDirectory() const;
};
+ /// DIFile - This is a wrapper for a file.
+ class DIFile : public DIScope {
+ friend class DIDescriptor;
+ public:
+ explicit DIFile(const MDNode *N = 0) : DIScope(N) {
+ if (DbgNode && !isFile())
+ DbgNode = 0;
+ }
+ MDNode *getFileNode() const;
+ bool Verify() const;
+ };
+
/// DICompileUnit - A wrapper for a compile unit.
class DICompileUnit : public DIScope {
friend class DIDescriptor;
@@ -176,50 +188,24 @@ namespace llvm {
public:
explicit DICompileUnit(const MDNode *N = 0) : DIScope(N) {}
- unsigned getLanguage() const { return getUnsignedField(2); }
- StringRef getFilename() const { return getStringField(3); }
- StringRef getDirectory() const { return getStringField(4); }
- StringRef getProducer() const { return getStringField(5); }
-
- /// isMain - Each input file is encoded as a separate compile unit in LLVM
- /// debugging information output. However, many target specific tool chains
- /// prefer to encode only one compile unit in an object file. In this
- /// situation, the LLVM code generator will include debugging information
- /// entities in the compile unit that is marked as main compile unit. The
- /// code generator accepts maximum one main compile unit per module. If a
- /// module does not contain any main compile unit then the code generator
- /// will emit multiple compile units in the output object file.
- // TODO: This can be removed when we remove the legacy debug information.
- bool isMain() const { return getUnsignedField(6) != 0; }
- bool isOptimized() const { return getUnsignedField(7) != 0; }
- StringRef getFlags() const { return getStringField(8); }
- unsigned getRunTimeVersion() const { return getUnsignedField(9); }
+ unsigned getLanguage() const { return getUnsignedField(2); }
+ StringRef getProducer() const { return getStringField(3); }
+
+ bool isOptimized() const { return getUnsignedField(4) != 0; }
+ StringRef getFlags() const { return getStringField(5); }
+ unsigned getRunTimeVersion() const { return getUnsignedField(6); }
DIArray getEnumTypes() const;
DIArray getRetainedTypes() const;
DIArray getSubprograms() const;
DIArray getGlobalVariables() const;
- StringRef getSplitDebugFilename() const { return getStringField(14); }
+ StringRef getSplitDebugFilename() const { return getStringField(11); }
/// Verify - Verify that a compile unit is well formed.
bool Verify() const;
};
- /// DIFile - This is a wrapper for a file.
- class DIFile : public DIScope {
- friend class DIDescriptor;
- void printInternal(raw_ostream &OS) const {} // FIXME: Output something?
- public:
- explicit DIFile(const MDNode *N = 0) : DIScope(N) {
- if (DbgNode && !isFile())
- DbgNode = 0;
- }
- StringRef getFilename() const { return getStringField(1); }
- StringRef getDirectory() const { return getStringField(2); }
- bool Verify() const;
- };
-
/// DIEnumerator - A wrapper for an enumerator (e.g. X and Y in 'enum {X,Y}').
/// FIXME: it seems strange that this doesn't have either a reference to the
/// type/precision or a file/line pair for location info.
@@ -250,9 +236,8 @@ namespace llvm {
explicit DIType(const MDNode *N);
explicit DIType() {}
- DIScope getContext() const { return getFieldAs<DIScope>(1); }
- StringRef getName() const { return getStringField(2); }
- DIFile getFile() const { return getFieldAs<DIFile>(3); }
+ DIScope getContext() const { return getFieldAs<DIScope>(2); }
+ StringRef getName() const { return getStringField(3); }
unsigned getLineNumber() const { return getUnsignedField(4); }
uint64_t getSizeInBits() const { return getUInt64Field(5); }
uint64_t getAlignInBits() const { return getUInt64Field(6); }
@@ -297,12 +282,6 @@ namespace llvm {
bool isValid() const {
return DbgNode && (isBasicType() || isDerivedType() || isCompositeType());
}
- StringRef getDirectory() const {
- return getFieldAs<DIFile>(3).getDirectory();
- }
- StringRef getFilename() const {
- return getFieldAs<DIFile>(3).getFilename();
- }
/// isUnsignedDIType - Return true if type encoding is unsigned.
bool isUnsignedDIType();
@@ -435,78 +414,66 @@ namespace llvm {
StringRef getName() const { return getStringField(3); }
StringRef getDisplayName() const { return getStringField(4); }
StringRef getLinkageName() const { return getStringField(5); }
- unsigned getLineNumber() const { return getUnsignedField(7); }
- DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
+ unsigned getLineNumber() const { return getUnsignedField(6); }
+ DICompositeType getType() const { return getFieldAs<DICompositeType>(7); }
/// getReturnTypeName - Subprogram return types are encoded either as
/// DIType or as DICompositeType.
StringRef getReturnTypeName() const {
- DICompositeType DCT(getFieldAs<DICompositeType>(8));
+ DICompositeType DCT(getFieldAs<DICompositeType>(7));
if (DCT.Verify()) {
DIArray A = DCT.getTypeArray();
DIType T(A.getElement(0));
return T.getName();
}
- DIType T(getFieldAs<DIType>(8));
+ DIType T(getFieldAs<DIType>(7));
return T.getName();
}
/// isLocalToUnit - Return true if this subprogram is local to the current
/// compile unit, like 'static' in C.
- unsigned isLocalToUnit() const { return getUnsignedField(9); }
- unsigned isDefinition() const { return getUnsignedField(10); }
+ unsigned isLocalToUnit() const { return getUnsignedField(8); }
+ unsigned isDefinition() const { return getUnsignedField(9); }
- unsigned getVirtuality() const { return getUnsignedField(11); }
- unsigned getVirtualIndex() const { return getUnsignedField(12); }
+ unsigned getVirtuality() const { return getUnsignedField(10); }
+ unsigned getVirtualIndex() const { return getUnsignedField(11); }
DICompositeType getContainingType() const {
- return getFieldAs<DICompositeType>(13);
+ return getFieldAs<DICompositeType>(12);
}
unsigned getFlags() const {
- return getUnsignedField(14);
+ return getUnsignedField(13);
}
unsigned isArtificial() const {
- return (getUnsignedField(14) & FlagArtificial) != 0;
+ return (getUnsignedField(13) & FlagArtificial) != 0;
}
/// isPrivate - Return true if this subprogram has "private"
/// access specifier.
bool isPrivate() const {
- return (getUnsignedField(14) & FlagPrivate) != 0;
+ return (getUnsignedField(13) & FlagPrivate) != 0;
}
/// isProtected - Return true if this subprogram has "protected"
/// access specifier.
bool isProtected() const {
- return (getUnsignedField(14) & FlagProtected) != 0;
+ return (getUnsignedField(13) & FlagProtected) != 0;
}
/// isExplicit - Return true if this subprogram is marked as explicit.
bool isExplicit() const {
- return (getUnsignedField(14) & FlagExplicit) != 0;
+ return (getUnsignedField(13) & FlagExplicit) != 0;
}
/// isPrototyped - Return true if this subprogram is prototyped.
bool isPrototyped() const {
- return (getUnsignedField(14) & FlagPrototyped) != 0;
+ return (getUnsignedField(13) & FlagPrototyped) != 0;
}
unsigned isOptimized() const;
- StringRef getFilename() const {
- return getFieldAs<DIFile>(6).getFilename();
- }
-
- StringRef getDirectory() const {
- return getFieldAs<DIFile>(6).getDirectory();
- }
-
- DIFile getFile() const {
- return getFieldAs<DIFile>(6);
- }
-
/// getScopeLineNumber - Get the beginning of the scope of the
/// function, not necessarily where the name of the program
/// starts.
- unsigned getScopeLineNumber() const { return getUnsignedField(20); }
+ unsigned getScopeLineNumber() const { return getUnsignedField(19); }
/// Verify - Verify that a subprogram descriptor is well formed.
bool Verify() const;
@@ -515,11 +482,11 @@ namespace llvm {
/// information for the function F.
bool describes(const Function *F);
- Function *getFunction() const { return getFunctionField(16); }
- void replaceFunction(Function *F) { replaceFunctionField(16, F); }
- DIArray getTemplateParams() const { return getFieldAs<DIArray>(17); }
+ Function *getFunction() const { return getFunctionField(15); }
+ void replaceFunction(Function *F) { replaceFunctionField(15, F); }
+ DIArray getTemplateParams() const { return getFieldAs<DIArray>(16); }
DISubprogram getFunctionDeclaration() const {
- return getFieldAs<DISubprogram>(18);
+ return getFieldAs<DISubprogram>(17);
}
MDNode *getVariablesNodes() const;
DIArray getVariables() const;
@@ -623,16 +590,14 @@ namespace llvm {
class DILexicalBlock : public DIScope {
public:
explicit DILexicalBlock(const MDNode *N = 0) : DIScope(N) {}
- DIScope getContext() const { return getFieldAs<DIScope>(1); }
- unsigned getLineNumber() const { return getUnsignedField(2); }
- unsigned getColumnNumber() const { return getUnsignedField(3); }
+ DIScope getContext() const { return getFieldAs<DIScope>(2); }
+ unsigned getLineNumber() const { return getUnsignedField(3); }
+ unsigned getColumnNumber() const { return getUnsignedField(4); }
StringRef getDirectory() const {
- StringRef dir = getFieldAs<DIFile>(4).getDirectory();
- return !dir.empty() ? dir : getContext().getDirectory();
+ return getFieldAs<DIFile>(1).getDirectory();
}
StringRef getFilename() const {
- StringRef filename = getFieldAs<DIFile>(4).getFilename();
- return !filename.empty() ? filename : getContext().getFilename();
+ return getFieldAs<DIFile>(1).getFilename();
}
bool Verify() const;
};
@@ -646,13 +611,10 @@ namespace llvm {
unsigned getLineNumber() const { return getScope().getLineNumber(); }
unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
StringRef getDirectory() const {
- StringRef dir = getFieldAs<DIFile>(2).getDirectory();
- return !dir.empty() ? dir : getContext().getDirectory();
+ return getFieldAs<DIFile>(2).getDirectory();
}
StringRef getFilename() const {
- StringRef filename = getFieldAs<DIFile>(2).getFilename();
- assert(!filename.empty() && "Why'd you create this then?");
- return filename;
+ return getFieldAs<DIFile>(2).getFilename();
}
DILexicalBlock getScope() const { return getFieldAs<DILexicalBlock>(1); }
bool Verify() const;
@@ -660,16 +622,12 @@ namespace llvm {
/// DINameSpace - A wrapper for a C++ style name space.
class DINameSpace : public DIScope {
+ friend class DIDescriptor;
+ void printInternal(raw_ostream &OS) const;
public:
explicit DINameSpace(const MDNode *N = 0) : DIScope(N) {}
- DIScope getContext() const { return getFieldAs<DIScope>(1); }
- StringRef getName() const { return getStringField(2); }
- StringRef getDirectory() const {
- return getFieldAs<DIFile>(3).getDirectory();
- }
- StringRef getFilename() const {
- return getFieldAs<DIFile>(3).getFilename();
- }
+ DIScope getContext() const { return getFieldAs<DIScope>(2); }
+ StringRef getName() const { return getStringField(3); }
unsigned getLineNumber() const { return getUnsignedField(4); }
bool Verify() const;
};
diff --git a/include/llvm/ExecutionEngine/GenericValue.h b/include/llvm/ExecutionEngine/GenericValue.h
index e160e3aafd..21b99421b3 100644
--- a/include/llvm/ExecutionEngine/GenericValue.h
+++ b/include/llvm/ExecutionEngine/GenericValue.h
@@ -24,11 +24,15 @@ typedef void* PointerTy;
class APInt;
struct GenericValue {
+ struct IntPair {
+ unsigned int first;
+ unsigned int second;
+ };
union {
double DoubleVal;
float FloatVal;
PointerTy PointerVal;
- struct { unsigned int first; unsigned int second; } UIntPairVal;
+ struct IntPair UIntPairVal;
unsigned char Untyped[8];
};
APInt IntVal; // also used for long doubles
diff --git a/include/llvm/IR/Attributes.h b/include/llvm/IR/Attributes.h
index 30c0965337..074b38779a 100644
--- a/include/llvm/IR/Attributes.h
+++ b/include/llvm/IR/Attributes.h
@@ -226,11 +226,6 @@ private:
explicit AttributeSet(AttributeSetImpl *LI) : pImpl(LI) {}
public:
AttributeSet() : pImpl(0) {}
- AttributeSet(const AttributeSet &P) : pImpl(P.pImpl) {}
- const AttributeSet &operator=(const AttributeSet &RHS) {
- pImpl = RHS.pImpl;
- return *this;
- }
//===--------------------------------------------------------------------===//
// AttributeSet Construction and Mutation
@@ -247,6 +242,11 @@ public:
AttributeSet addAttribute(LLVMContext &C, unsigned Idx,
Attribute::AttrKind Attr) const;
+ /// \brief Add an attribute to the attribute set at the given index. Since
+ /// attribute sets are immutable, this returns a new set.
+ AttributeSet addAttribute(LLVMContext &C, unsigned Idx,
+ StringRef Kind) const;
+
/// \brief Add attributes to the attribute set at the given index. Since
/// attribute sets are immutable, this returns a new set.
AttributeSet addAttributes(LLVMContext &C, unsigned Idx,
diff --git a/include/llvm/IR/DataLayout.h b/include/llvm/IR/DataLayout.h
index 5eb186d531..72b4eedabd 100644
--- a/include/llvm/IR/DataLayout.h
+++ b/include/llvm/IR/DataLayout.h
@@ -22,6 +22,8 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/IR/Type.h"
#include "llvm/Pass.h"
#include "llvm/Support/DataTypes.h"
@@ -181,6 +183,10 @@ public:
~DataLayout(); // Not virtual, do not subclass this class
+ /// DataLayout is an immutable pass, but holds state. This allows the pass
+ /// manager to clear its mutable state.
+ bool doFinalization(Module &M);
+
/// Parse a data layout string (with fallback to default values). Ensure that
/// the data layout pass is registered.
void init(StringRef LayoutDescription);
@@ -419,6 +425,49 @@ private:
StructLayout(StructType *ST, const DataLayout &TD);
};
+
+// The implementation of this method is provided inline as it is particularly
+// well suited to constant folding when called on a specific Type subclass.
+inline uint64_t DataLayout::getTypeSizeInBits(Type *Ty) const {
+ assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");
+ switch (Ty->getTypeID()) {
+ case Type::LabelTyID:
+ return getPointerSizeInBits(0);
+ case Type::PointerTyID:
+ return getPointerSizeInBits(cast<PointerType>(Ty)->getAddressSpace());
+ case Type::ArrayTyID: {
+ ArrayType *ATy = cast<ArrayType>(Ty);
+ return ATy->getNumElements() *
+ getTypeAllocSizeInBits(ATy->getElementType());
+ }
+ case Type::StructTyID:
+ // Get the layout annotation... which is lazily created on demand.
+ return getStructLayout(cast<StructType>(Ty))->getSizeInBits();
+ case Type::IntegerTyID:
+ return cast<IntegerType>(Ty)->getBitWidth();
+ case Type::HalfTyID:
+ return 16;
+ case Type::FloatTyID:
+ return 32;
+ case Type::DoubleTyID:
+ case Type::X86_MMXTyID:
+ return 64;
+ case Type::PPC_FP128TyID:
+ case Type::FP128TyID:
+ return 128;
+ // In memory objects this is always aligned to a higher boundary, but
+ // only 80 bits contain information.
+ case Type::X86_FP80TyID:
+ return 80;
+ case Type::VectorTyID: {
+ VectorType *VTy = cast<VectorType>(Ty);
+ return VTy->getNumElements() * getTypeSizeInBits(VTy->getElementType());
+ }
+ default:
+ llvm_unreachable("DataLayout::getTypeSizeInBits(): Unsupported type");
+ }
+}
+
} // End llvm name