Index: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h =================================================================== --- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h +++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h @@ -15,12 +15,21 @@ #ifndef LLVM_BITCODE_BITSTREAMREADER_H #define LLVM_BITCODE_BITSTREAMREADER_H +#include "llvm/ADT/IntrusiveRefCntPtr.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Bitcode/BitCodes.h" #include "llvm/Support/Endian.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/StreamingMemoryObject.h" +#include +#include #include +#include +#include +#include #include +#include #include namespace llvm { @@ -37,9 +46,9 @@ unsigned BlockID; std::vector> Abbrevs; std::string Name; - std::vector > RecordNames; }; + private: std::unique_ptr BitcodeBytes; @@ -51,6 +60,7 @@ BitstreamReader(const BitstreamReader&) = delete; void operator=(const BitstreamReader&) = delete; + public: BitstreamReader() : IgnoreBlockInfoNames(true) { } @@ -139,12 +149,12 @@ // The size of the bicode. 0 if we don't know it yet. size_t Size = 0; +public: /// This is the current data we have pulled from the stream but have not /// returned to the client. This is specifically and intentionally defined to /// follow the word size of the host machine for efficiency. We use word_t in /// places that are aware of this to make it perfectly explicit what is going /// on. -public: typedef size_t word_t; private: @@ -306,7 +316,7 @@ uint32_t Result = 0; unsigned NextBit = 0; - while (1) { + while (true) { Result |= (Piece & ((1U << (NumBits-1))-1)) << NextBit; if ((Piece & (1U << (NumBits-1))) == 0) @@ -326,7 +336,7 @@ uint64_t Result = 0; unsigned NextBit = 0; - while (1) { + while (true) { Result |= uint64_t(Piece & ((1U << (NumBits-1))-1)) << NextBit; if ((Piece & (1U << (NumBits-1))) == 0) @@ -394,12 +404,15 @@ static BitstreamEntry getError() { BitstreamEntry E; E.Kind = Error; return E; } + static BitstreamEntry getEndBlock() { BitstreamEntry E; E.Kind = EndBlock; return E; } + static BitstreamEntry getSubBlock(unsigned ID) { BitstreamEntry E; E.Kind = SubBlock; E.ID = ID; return E; } + static BitstreamEntry getRecord(unsigned AbbrevID) { BitstreamEntry E; E.Kind = Record; E.ID = AbbrevID; return E; } @@ -421,13 +434,13 @@ struct Block { unsigned PrevCodeSize; std::vector> PrevAbbrevs; + explicit Block(unsigned PCS) : PrevCodeSize(PCS) {} }; /// This tracks the codesize of parent blocks. SmallVector BlockScope; - public: static const size_t MaxChunkSize = sizeof(word_t) * 8; @@ -471,7 +484,7 @@ /// Advance the current bitstream, returning the next entry in the stream. BitstreamEntry advance(unsigned Flags = 0) { - while (1) { + while (true) { unsigned Code = ReadCode(); if (Code == bitc::END_BLOCK) { // Pop the end of the block unless Flags tells us not to. @@ -498,7 +511,7 @@ /// This is a convenience function for clients that don't expect any /// subblocks. This just skips over them automatically. BitstreamEntry advanceSkippingSubblocks(unsigned Flags = 0) { - while (1) { + while (true) { // If we found a normal entry, return it. BitstreamEntry Entry = advance(Flags); if (Entry.Kind != BitstreamEntry::SubBlock) @@ -514,7 +527,6 @@ return Read(CurCodeSize); } - // Block header: // [ENTER_SUBBLOCK, blockid, newcodelen, , blocklen] @@ -558,7 +570,6 @@ } private: - void popBlockScope() { CurCodeSize = BlockScope.back().PrevCodeSize; @@ -593,6 +604,6 @@ bool ReadBlockInfoBlock(); }; -} // End llvm namespace +} // end llvm namespace -#endif +#endif // LLVM_BITCODE_BITSTREAMREADER_H Index: llvm/trunk/include/llvm/MC/MCInstPrinter.h =================================================================== --- llvm/trunk/include/llvm/MC/MCInstPrinter.h +++ llvm/trunk/include/llvm/MC/MCInstPrinter.h @@ -10,10 +10,11 @@ #ifndef LLVM_MC_MCINSTPRINTER_H #define LLVM_MC_MCINSTPRINTER_H -#include "llvm/Support/DataTypes.h" #include "llvm/Support/Format.h" +#include namespace llvm { + template class ArrayRef; class MCInst; class raw_ostream; @@ -27,11 +28,13 @@ void dumpBytes(ArrayRef Bytes, raw_ostream &OS); namespace HexStyle { + enum Style { C, ///< 0xff Asm ///< 0ffh }; -} + +} // end namespace HexStyle /// \brief This is an instance of a target assembly language printer that /// converts an MCInst to valid target assembly syntax. @@ -60,8 +63,8 @@ public: MCInstPrinter(const MCAsmInfo &mai, const MCInstrInfo &mii, const MCRegisterInfo &mri) - : CommentStream(nullptr), MAI(mai), MII(mii), MRI(mri), UseMarkup(0), - PrintImmHex(0), PrintHexStyle(HexStyle::C) {} + : CommentStream(nullptr), MAI(mai), MII(mii), MRI(mri), UseMarkup(false), + PrintImmHex(false), PrintHexStyle(HexStyle::C) {} virtual ~MCInstPrinter(); @@ -103,6 +106,6 @@ format_object formatHex(uint64_t Value) const; }; -} // namespace llvm +} // end namespace llvm -#endif +#endif // LLVM_MC_MCINSTPRINTER_H Index: llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h =================================================================== --- llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h +++ llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h @@ -17,8 +17,11 @@ // FIXME: Move to this file: BasicBlock::removePredecessor, BB::splitBasicBlock +#include "llvm/ADT/ArrayRef.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" +#include "llvm/IR/InstrTypes.h" +#include namespace llvm { @@ -29,7 +32,6 @@ class MDNode; class ReturnInst; class TargetLibraryInfo; -class TerminatorInst; /// Delete the specified block, which must have no predecessors. void DeleteDeadBlock(BasicBlock *BB); @@ -154,7 +156,7 @@ CriticalEdgeSplittingOptions()) { TerminatorInst *TI = Src->getTerminator(); unsigned i = 0; - while (1) { + while (true) { assert(i != TI->getNumSuccessors() && "Edge doesn't exist!"); if (TI->getSuccessor(i) == Dst) return SplitCriticalEdge(TI, i, Options); @@ -282,6 +284,7 @@ /// instructions in them. Value *GetIfCondition(BasicBlock *BB, BasicBlock *&IfTrue, BasicBlock *&IfFalse); -} // End llvm namespace -#endif +} // end namespace llvm + +#endif // LLVM_TRANSFORMS_UTILS_BASICBLOCKUTILS_H Index: llvm/trunk/lib/AsmParser/LLLexer.cpp =================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp +++ llvm/trunk/lib/AsmParser/LLLexer.cpp @@ -12,21 +12,18 @@ //===----------------------------------------------------------------------===// #include "LLLexer.h" +#include "llvm/ADT/APInt.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/Twine.h" -#include "llvm/AsmParser/Parser.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/Instruction.h" -#include "llvm/IR/LLVMContext.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/MathExtras.h" -#include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/SourceMgr.h" -#include "llvm/Support/raw_ostream.h" +#include #include #include -#include -#include + using namespace llvm; bool LLLexer::Error(LocTy ErrorLoc, const Twine &Msg) const { @@ -147,18 +144,15 @@ C == '.' || C == '_'; } - /// isLabelTail - Return true if this pointer points to a valid end of a label. static const char *isLabelTail(const char *CurPtr) { - while (1) { + while (true) { if (CurPtr[0] == ':') return CurPtr+1; if (!isLabelChar(CurPtr[0])) return nullptr; ++CurPtr; } } - - //===----------------------------------------------------------------------===// // Lexer definition. //===----------------------------------------------------------------------===// @@ -185,7 +179,6 @@ } } - lltok::Kind LLLexer::LexToken() { TokStart = CurPtr; @@ -246,7 +239,7 @@ } void LLLexer::SkipLineComment() { - while (1) { + while (true) { if (CurPtr[0] == '\n' || CurPtr[0] == '\r' || getNextChar() == EOF) return; } @@ -271,7 +264,7 @@ if (CurPtr[0] == '"') { ++CurPtr; - while (1) { + while (true) { int CurChar = getNextChar(); if (CurChar == EOF) { @@ -300,7 +293,7 @@ /// ReadString - Read a string until the closing quote. lltok::Kind LLLexer::ReadString(lltok::Kind kind) { const char *Start = CurPtr; - while (1) { + while (true) { int CurChar = getNextChar(); if (CurChar == EOF) { @@ -338,7 +331,7 @@ if (CurPtr[0] == '"') { ++CurPtr; - while (1) { + while (true) { int CurChar = getNextChar(); if (CurChar == EOF) { @@ -488,11 +481,12 @@ CurPtr = KeywordEnd; --StartChar; StringRef Keyword(StartChar, CurPtr - StartChar); + #define KEYWORD(STR) \ do { \ if (Keyword == #STR) \ return lltok::kw_##STR; \ - } while (0) + } while (false) KEYWORD(true); KEYWORD(false); KEYWORD(declare); KEYWORD(define); @@ -697,6 +691,7 @@ KEYWORD(cleanup); KEYWORD(catch); KEYWORD(filter); + #undef KEYWORD // Keywords for types. @@ -707,6 +702,7 @@ return lltok::Type; \ } \ } while (false) + TYPEKEYWORD("void", Type::getVoidTy(Context)); TYPEKEYWORD("half", Type::getHalfTy(Context)); TYPEKEYWORD("float", Type::getFloatTy(Context)); @@ -718,6 +714,7 @@ TYPEKEYWORD("metadata", Type::getMetadataTy(Context)); TYPEKEYWORD("x86_mmx", Type::getX86_MMXTy(Context)); TYPEKEYWORD("token", Type::getTokenTy(Context)); + #undef TYPEKEYWORD // Keywords for instructions. @@ -782,6 +779,7 @@ INSTKEYWORD(catchswitch, CatchSwitch); INSTKEYWORD(catchpad, CatchPad); INSTKEYWORD(cleanuppad, CleanupPad); + #undef INSTKEYWORD #define DWKEYWORD(TYPE, TOKEN) \ @@ -791,6 +789,7 @@ return lltok::TOKEN; \ } \ } while (false) + DWKEYWORD(TAG, DwarfTag); DWKEYWORD(ATE, DwarfAttEncoding); DWKEYWORD(VIRTUALITY, DwarfVirtuality); @@ -798,7 +797,9 @@ DWKEYWORD(CC, DwarfCC); DWKEYWORD(OP, DwarfOp); DWKEYWORD(MACINFO, DwarfMacinfo); + #undef DWKEYWORD + if (Keyword.startswith("DIFlag")) { StrVal.assign(Keyword.begin(), Keyword.end()); return lltok::DIFlag; Index: llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp =================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp +++ llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp @@ -8,6 +8,9 @@ //===----------------------------------------------------------------------===// #include "llvm/Bitcode/BitstreamReader.h" +#include "llvm/ADT/StringRef.h" +#include +#include using namespace llvm; @@ -95,8 +98,6 @@ } } - - /// skipRecord - Read the current record and discard it. void BitstreamCursor::skipRecord(unsigned AbbrevID) { // Skip unabbreviated records by reading past their entries. @@ -279,7 +280,6 @@ return Code; } - void BitstreamCursor::ReadAbbrevRecord() { BitCodeAbbrev *Abbv = new BitCodeAbbrev(); unsigned NumOpInfo = ReadVBR(5); @@ -329,7 +329,7 @@ BitstreamReader::BlockInfo *CurBlockInfo = nullptr; // Read all the records for this module. - while (1) { + while (true) { BitstreamEntry Entry = advanceSkippingSubblocks(AF_DontAutoprocessAbbrevs); switch (Entry.Kind) { @@ -388,4 +388,3 @@ } } } - Index: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp =================================================================== --- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -12,21 +12,26 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" #include "llvm/Support/Casting.h" -#include "llvm/Support/DataTypes.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/DataExtractor.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include #include -#include #include using namespace llvm; using namespace dwarf; - /// \brief Abstract frame entry defining the common interface concrete /// entries implement. class llvm::FrameEntry { @@ -95,7 +100,6 @@ } }; - // See DWARF standard v3, section 7.23 const uint8_t DWARF_CFI_PRIMARY_OPCODE_MASK = 0xc0; const uint8_t DWARF_CFI_PRIMARY_OPERAND_MASK = 0x3f; @@ -194,6 +198,7 @@ } namespace { + /// \brief DWARF Common Information Entry (CIE) class CIE : public FrameEntry { public: @@ -220,9 +225,11 @@ StringRef getAugmentationString() const { return Augmentation; } uint64_t getCodeAlignmentFactor() const { return CodeAlignmentFactor; } int64_t getDataAlignmentFactor() const { return DataAlignmentFactor; } + uint32_t getFDEPointerEncoding() const { return FDEPointerEncoding; } + uint32_t getLSDAPointerEncoding() const { return LSDAPointerEncoding; } @@ -274,7 +281,6 @@ uint32_t LSDAPointerEncoding; }; - /// \brief DWARF Frame Description Entry (FDE) class FDE : public FrameEntry { public: @@ -336,7 +342,7 @@ do { \ OpTypes[OP][0] = OPTYPE0; \ OpTypes[OP][1] = OPTYPE1; \ - } while (0) + } while (false) #define DECLARE_OP1(OP, OPTYPE0) DECLARE_OP2(OP, OPTYPE0, OT_None) #define DECLARE_OP0(OP) DECLARE_OP1(OP, OT_None) @@ -373,6 +379,7 @@ #undef DECLARE_OP0 #undef DECLARE_OP1 #undef DECLARE_OP2 + return ArrayRef(&OpTypes[0], DW_CFA_restore+1); } @@ -668,7 +675,6 @@ } } - void DWARFDebugFrame::dump(raw_ostream &OS) const { OS << "\n"; for (const auto &Entry : Entries) { @@ -677,4 +683,3 @@ OS << "\n"; } } - Index: llvm/trunk/lib/Target/X86/X86InstrBuilder.h =================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h @@ -24,9 +24,15 @@ #ifndef LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H #define LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H +#include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineMemOperand.h" +#include "llvm/CodeGen/MachineOperand.h" +#include "llvm/MC/MCInstrDesc.h" +#include namespace llvm { @@ -57,12 +63,11 @@ Base.Reg = 0; } - void getFullAddress(SmallVectorImpl &MO) { assert(Scale == 1 || Scale == 2 || Scale == 4 || Scale == 8); if (BaseType == X86AddressMode::RegBase) - MO.push_back(MachineOperand::CreateReg(Base.Reg, false, false, + MO.push_back(MachineOperand::CreateReg(Base.Reg, false, false, false, false, false, false, 0, false)); else { assert(BaseType == X86AddressMode::FrameIndexBase); @@ -70,16 +75,16 @@ } MO.push_back(MachineOperand::CreateImm(Scale)); - MO.push_back(MachineOperand::CreateReg(IndexReg, false, false, - false, false, false, 0, false)); + MO.push_back(MachineOperand::CreateReg(IndexReg, false, false, false, false, + false, false, 0, false)); if (GV) MO.push_back(MachineOperand::CreateGA(GV, Disp, GVOpFlags)); else MO.push_back(MachineOperand::CreateImm(Disp)); - MO.push_back(MachineOperand::CreateReg(0, false, false, - false, false, false, 0, false)); + MO.push_back(MachineOperand::CreateReg(0, false, false, false, false, false, + false, 0, false)); } }; @@ -206,6 +211,6 @@ .addConstantPoolIndex(CPI, 0, OpFlags).addReg(0); } -} // End llvm namespace +} // end namespace llvm -#endif +#endif // LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H