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/Reader/BitcodeReader.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index d3c8678578..f31637e044 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2044,7 +2044,22 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { Opc == Instruction::AShr) { if (Record[OpNum] & (1 << bitc::PEO_EXACT)) cast(I)->setIsExact(true); + } else if (isa(I)) { + FastMathFlags FMF; + FMF.UnsafeAlgebra = + 0 != (Record[OpNum] & (1 << bitc::FMF_UNSAFE_ALGEBRA)); + FMF.NoNaNs + = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_NANS)); + FMF.NoInfs + = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_INFS)); + FMF.NoSignedZeros + = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_SIGNED_ZEROS)); + FMF.AllowReciprocal + = 0 != (Record[OpNum] & (1 << bitc::FMF_ALLOW_RECIPROCAL)); + if (FMF.any()) + I->setFastMathFlags(FMF); } + } break; } -- cgit v1.2.3-18-g5258 From eaac37ece1d72e6b0fa6a70000a60e31f635c918 Mon Sep 17 00:00:00 2001 From: Joe Abbey Date: Tue, 27 Nov 2012 01:20:22 +0000 Subject: Code pretification git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168661 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index f31637e044..944a3255cd 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2048,14 +2048,14 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { FastMathFlags FMF; FMF.UnsafeAlgebra = 0 != (Record[OpNum] & (1 << bitc::FMF_UNSAFE_ALGEBRA)); - FMF.NoNaNs - = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_NANS)); - FMF.NoInfs - = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_INFS)); - FMF.NoSignedZeros - = 0 != (Record[OpNum] & (1 << bitc::FMF_NO_SIGNED_ZEROS)); - FMF.AllowReciprocal - = 0 != (Record[OpNum] & (1 << bitc::FMF_ALLOW_RECIPROCAL)); + FMF.NoNaNs = + 0 != (Record[OpNum] & (1 << bitc::FMF_NO_NANS)); + FMF.NoInfs = + 0 != (Record[OpNum] & (1 << bitc::FMF_NO_INFS)); + FMF.NoSignedZeros = + 0 != (Record[OpNum] & (1 << bitc::FMF_NO_SIGNED_ZEROS)); + FMF.AllowReciprocal = + 0 != (Record[OpNum] & (1 << bitc::FMF_ALLOW_RECIPROCAL)); if (FMF.any()) I->setFastMathFlags(FMF); } -- 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/Reader/BitcodeReader.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 944a3255cd..dcbd68aee2 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1564,13 +1564,6 @@ bool BitcodeReader::ParseModule(bool Resume) { TheModule->setModuleInlineAsm(S); break; } - case bitc::MODULE_CODE_DEPLIB: { // DEPLIB: [strchr x N] - std::string S; - if (ConvertToString(Record, 0, S)) - return Error("Invalid MODULE_CODE_DEPLIB record"); - TheModule->addLibrary(S); - break; - } case bitc::MODULE_CODE_SECTIONNAME: { // SECTIONNAME: [strchr x N] std::string S; if (ConvertToString(Record, 0, S)) -- cgit v1.2.3-18-g5258 From 3defc0bfa600cc253f0cba0fe781aa49435d968a Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 28 Nov 2012 08:41:48 +0000 Subject: Add back support for reading and parsing 'deplibs'. This is for backwards compatibility for pre-3.x bc files. The code reads the code, but does nothing with it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168779 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index dcbd68aee2..29c603ff98 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1564,6 +1564,14 @@ bool BitcodeReader::ParseModule(bool Resume) { TheModule->setModuleInlineAsm(S); break; } + case bitc::MODULE_CODE_DEPLIB: { // DEPLIB: [strchr x N] + // FIXME: Remove in 4.0. + std::string S; + if (ConvertToString(Record, 0, S)) + return Error("Invalid MODULE_CODE_DEPLIB record"); + // Ignore value. + break; + } case bitc::MODULE_CODE_SECTIONNAME: { // SECTIONNAME: [strchr x N] std::string S; if (ConvertToString(Record, 0, S)) -- 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/Reader/BitcodeReader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 29c603ff98..95fc9ca620 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -13,19 +13,19 @@ #include "llvm/Bitcode/ReaderWriter.h" #include "BitcodeReader.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/AutoUpgrade.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" #include "llvm/IntrinsicInst.h" #include "llvm/Module.h" +#include "llvm/OperandTraits.h" #include "llvm/Operator.h" -#include "llvm/AutoUpgrade.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/SmallVector.h" #include "llvm/Support/DataStream.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/OperandTraits.h" using namespace llvm; enum { -- 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/Reader/BitcodeReader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 95fc9ca620..cb1a835185 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -47,7 +47,7 @@ void BitcodeReader::FreeState() { ValueList.clear(); MDValueList.clear(); - std::vector().swap(MAttributes); + std::vector().swap(MAttributes); std::vector().swap(FunctionBBs); std::vector().swap(FunctionsWithBodies); DeferredFunctionInfo.clear(); @@ -487,7 +487,7 @@ bool BitcodeReader::ParseAttributeBlock() { Attributes::get(Context, B))); } - MAttributes.push_back(AttrListPtr::get(Context, Attrs)); + MAttributes.push_back(AttributeSet::get(Context, Attrs)); Attrs.clear(); break; } @@ -2398,7 +2398,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { case bitc::FUNC_CODE_INST_INVOKE: { // INVOKE: [attrs, cc, normBB, unwindBB, fnty, op0,op1,op2, ...] if (Record.size() < 4) return Error("Invalid INVOKE record"); - AttrListPtr PAL = getAttributes(Record[0]); + AttributeSet PAL = getAttributes(Record[0]); unsigned CCInfo = Record[1]; BasicBlock *NormalBB = getBasicBlock(Record[2]); BasicBlock *UnwindBB = getBasicBlock(Record[3]); @@ -2663,7 +2663,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { if (Record.size() < 3) return Error("Invalid CALL record"); - AttrListPtr PAL = getAttributes(Record[0]); + AttributeSet PAL = getAttributes(Record[0]); unsigned CCInfo = Record[1]; unsigned OpNum = 2; -- 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/Reader/BitcodeReader.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index cb1a835185..131151f535 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2048,15 +2048,15 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { } else if (isa(I)) { FastMathFlags FMF; FMF.UnsafeAlgebra = - 0 != (Record[OpNum] & (1 << bitc::FMF_UNSAFE_ALGEBRA)); + 0 != (Record[OpNum] & FPMathOperator::UnsafeAlgebra); FMF.NoNaNs = - 0 != (Record[OpNum] & (1 << bitc::FMF_NO_NANS)); + 0 != (Record[OpNum] & FPMathOperator::NoNaNs); FMF.NoInfs = - 0 != (Record[OpNum] & (1 << bitc::FMF_NO_INFS)); + 0 != (Record[OpNum] & FPMathOperator::NoInfs); FMF.NoSignedZeros = - 0 != (Record[OpNum] & (1 << bitc::FMF_NO_SIGNED_ZEROS)); + 0 != (Record[OpNum] & FPMathOperator::NoSignedZeros); FMF.AllowReciprocal = - 0 != (Record[OpNum] & (1 << bitc::FMF_ALLOW_RECIPROCAL)); + 0 != (Record[OpNum] & FPMathOperator::AllowReciprocal); if (FMF.any()) I->setFastMathFlags(FMF); } -- 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/Reader/BitcodeReader.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 131151f535..1fdea799d0 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2047,16 +2047,16 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { cast(I)->setIsExact(true); } else if (isa(I)) { FastMathFlags FMF; - FMF.UnsafeAlgebra = - 0 != (Record[OpNum] & FPMathOperator::UnsafeAlgebra); - FMF.NoNaNs = - 0 != (Record[OpNum] & FPMathOperator::NoNaNs); - FMF.NoInfs = - 0 != (Record[OpNum] & FPMathOperator::NoInfs); - FMF.NoSignedZeros = - 0 != (Record[OpNum] & FPMathOperator::NoSignedZeros); - FMF.AllowReciprocal = - 0 != (Record[OpNum] & FPMathOperator::AllowReciprocal); + if (0 != (Record[OpNum] & FastMathFlags::UnsafeAlgebra)) + FMF.setUnsafeAlgebra(); + if (0 != (Record[OpNum] & FastMathFlags::NoNaNs)) + FMF.setNoNaNs(); + if (0 != (Record[OpNum] & FastMathFlags::NoInfs)) + FMF.setNoInfs(); + if (0 != (Record[OpNum] & FastMathFlags::NoSignedZeros)) + FMF.setNoSignedZeros(); + if (0 != (Record[OpNum] & FastMathFlags::AllowReciprocal)) + FMF.setAllowReciprocal(); if (FMF.any()) I->setFastMathFlags(FMF); } -- cgit v1.2.3-18-g5258