From 495d10ad56d1113ba33e0589e7c4f96f3c16fa52 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Tue, 27 Nov 2012 00:43:38 +0000 Subject: Fast-math flags for the bitcode Added in bitcode enum for the serializing of fast-math flags. Added in the reading/writing of fast-math flags from the OptimizationFlags record for BinaryOps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168646 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index cf3c9fd74e..6206479b8d 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -553,6 +553,18 @@ static uint64_t GetOptimizationFlags(const Value *V) { dyn_cast(V)) { if (PEO->isExact()) Flags |= 1 << bitc::PEO_EXACT; + } else if (const FPMathOperator *FPMO = + dyn_cast(V)) { + if (FPMO->hasUnsafeAlgebra()) + Flags |= 1 << bitc::FMF_UNSAFE_ALGEBRA; + if (FPMO->hasNoNaNs()) + Flags |= 1 << bitc::FMF_NO_NANS; + if (FPMO->hasNoInfs()) + Flags |= 1 << bitc::FMF_NO_INFS; + if (FPMO->hasNoSignedZeros()) + Flags |= 1 << bitc::FMF_NO_SIGNED_ZEROS; + if (FPMO->hasAllowReciprocal()) + Flags |= 1 << bitc::FMF_ALLOW_RECIPROCAL; } return Flags; -- cgit v1.2.3-18-g5258 From efd08d413c077956478fbde90fd65aa6f179bb39 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Tue, 27 Nov 2012 09:55:56 +0000 Subject: Remove the dependent libraries feature. The dependent libraries feature was never used and has bit-rotted. Remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168694 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 6206479b8d..d9493afca7 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -392,10 +392,6 @@ static unsigned getEncodedThreadLocalMode(const GlobalVariable *GV) { // descriptors for global variables, and function prototype info. static void WriteModuleInfo(const Module *M, const ValueEnumerator &VE, BitstreamWriter &Stream) { - // Emit the list of dependent libraries for the Module. - for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I) - WriteStringRecord(bitc::MODULE_CODE_DEPLIB, *I, 0/*TODO*/, Stream); - // Emit various pieces of data attached to a module. if (!M->getTargetTriple().empty()) WriteStringRecord(bitc::MODULE_CODE_TRIPLE, M->getTargetTriple(), -- cgit v1.2.3-18-g5258 From d04a8d4b33ff316ca4cf961e06c9e312eff8e64f Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 3 Dec 2012 16:50:05 +0000 Subject: Use the new script to sort the includes of every file under lib. Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index d9493afca7..bbc9c834ec 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -12,22 +12,22 @@ //===----------------------------------------------------------------------===// #include "llvm/Bitcode/ReaderWriter.h" +#include "ValueEnumerator.h" +#include "llvm/ADT/Triple.h" #include "llvm/Bitcode/BitstreamWriter.h" #include "llvm/Bitcode/LLVMBitCodes.h" -#include "ValueEnumerator.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Operator.h" -#include "llvm/ValueSymbolTable.h" -#include "llvm/ADT/Triple.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/Program.h" +#include "llvm/Support/raw_ostream.h" +#include "llvm/ValueSymbolTable.h" #include #include using namespace llvm; -- cgit v1.2.3-18-g5258 From dbd7b95ed415a7d9fd5f53d9f811906c58912c60 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Mon, 3 Dec 2012 21:29:36 +0000 Subject: Since this SmallVector immediately grows on the next line, don't waste stack space. SmallVector is still needed due to existing APIs growing their arguments git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169157 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index bbc9c834ec..2ea9cbd6f4 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1939,7 +1939,7 @@ static void EmitDarwinBCHeaderAndTrailer(SmallVectorImpl &Buffer, /// WriteBitcodeToFile - Write the specified module to the specified output /// stream. void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out) { - SmallVector Buffer; + SmallVector Buffer; Buffer.reserve(256*1024); // If this is darwin or another generic macho target, reserve space for the -- cgit v1.2.3-18-g5258 From cb66b5dd7a19ac68e5ff56b484b3f5a9b877ecb3 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Mon, 3 Dec 2012 22:57:47 +0000 Subject: Minor tweaking to SmallVector static size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169176 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 2ea9cbd6f4..dec28f4ada 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -709,7 +709,7 @@ static void WriteModuleMetadataStore(const Module *M, BitstreamWriter &Stream) { // Write metadata kinds // METADATA_KIND - [n x [id, name]] - SmallVector Names; + SmallVector Names; M->getMDKindNames(Names); if (Names.empty()) return; -- cgit v1.2.3-18-g5258 From 99faa3b4ec6d03ac7808fe4ff3fbf3d04e375502 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 7 Dec 2012 23:16:57 +0000 Subject: s/AttrListPtr/AttributeSet/g to better label what this class is going to be in the near future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169651 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index dec28f4ada..d616eda9b9 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -164,14 +164,14 @@ static void WriteStringRecord(unsigned Code, StringRef Str, // Emit information about parameter attributes. static void WriteAttributeTable(const ValueEnumerator &VE, BitstreamWriter &Stream) { - const std::vector &Attrs = VE.getAttributes(); + const std::vector &Attrs = VE.getAttributes(); if (Attrs.empty()) return; Stream.EnterSubblock(bitc::PARAMATTR_BLOCK_ID, 3); SmallVector Record; for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { - const AttrListPtr &A = Attrs[i]; + const AttributeSet &A = Attrs[i]; for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) { const AttributeWithIndex &PAWI = A.getSlot(i); Record.push_back(PAWI.Index); -- cgit v1.2.3-18-g5258 From 855d0255d0bc388da7554d05f8cf184e26f5a00d Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Sun, 9 Dec 2012 20:23:16 +0000 Subject: Have the bitcode reader/writer just use FPMathOperator's fast math enum directly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169710 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index d616eda9b9..f2fe0aef68 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -552,15 +552,15 @@ static uint64_t GetOptimizationFlags(const Value *V) { } else if (const FPMathOperator *FPMO = dyn_cast(V)) { if (FPMO->hasUnsafeAlgebra()) - Flags |= 1 << bitc::FMF_UNSAFE_ALGEBRA; + Flags |= FPMathOperator::UnsafeAlgebra; if (FPMO->hasNoNaNs()) - Flags |= 1 << bitc::FMF_NO_NANS; + Flags |= FPMathOperator::NoNaNs; if (FPMO->hasNoInfs()) - Flags |= 1 << bitc::FMF_NO_INFS; + Flags |= FPMathOperator::NoInfs; if (FPMO->hasNoSignedZeros()) - Flags |= 1 << bitc::FMF_NO_SIGNED_ZEROS; + Flags |= FPMathOperator::NoSignedZeros; if (FPMO->hasAllowReciprocal()) - Flags |= 1 << bitc::FMF_ALLOW_RECIPROCAL; + Flags |= FPMathOperator::AllowReciprocal; } return Flags; -- cgit v1.2.3-18-g5258 From 1638b839090a35adcd5a4b4cc0a649352276e703 Mon Sep 17 00:00:00 2001 From: Michael Ilseman Date: Sun, 9 Dec 2012 21:12:04 +0000 Subject: Reorganize FastMathFlags to be a wrapper around unsigned, and streamline some interfaces. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169712 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Writer/BitcodeWriter.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index f2fe0aef68..ffe95d8f27 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -552,15 +552,15 @@ static uint64_t GetOptimizationFlags(const Value *V) { } else if (const FPMathOperator *FPMO = dyn_cast(V)) { if (FPMO->hasUnsafeAlgebra()) - Flags |= FPMathOperator::UnsafeAlgebra; + Flags |= FastMathFlags::UnsafeAlgebra; if (FPMO->hasNoNaNs()) - Flags |= FPMathOperator::NoNaNs; + Flags |= FastMathFlags::NoNaNs; if (FPMO->hasNoInfs()) - Flags |= FPMathOperator::NoInfs; + Flags |= FastMathFlags::NoInfs; if (FPMO->hasNoSignedZeros()) - Flags |= FPMathOperator::NoSignedZeros; + Flags |= FastMathFlags::NoSignedZeros; if (FPMO->hasAllowReciprocal()) - Flags |= FPMathOperator::AllowReciprocal; + Flags |= FastMathFlags::AllowReciprocal; } return Flags; -- cgit v1.2.3-18-g5258