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