summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLLexer.cpp35
-rw-r--r--llvm/lib/Bitcode/Reader/BitstreamReader.cpp9
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp21
-rw-r--r--llvm/lib/Target/X86/X86InstrBuilder.h21
4 files changed, 48 insertions, 38 deletions
diff --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index 9cd21e75a7b..58fe13e0249 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/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 <cassert>
#include <cctype>
#include <cstdio>
-#include <cstdlib>
-#include <cstring>
+
using namespace llvm;
bool LLLexer::Error(LocTy ErrorLoc, const Twine &Msg) const {
@@ -147,18 +144,15 @@ static bool isLabelChar(char C) {
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 @@ int LLLexer::getNextChar() {
}
}
-
lltok::Kind LLLexer::LexToken() {
TokStart = CurPtr;
@@ -246,7 +239,7 @@ lltok::Kind LLLexer::LexToken() {
}
void LLLexer::SkipLineComment() {
- while (1) {
+ while (true) {
if (CurPtr[0] == '\n' || CurPtr[0] == '\r' || getNextChar() == EOF)
return;
}
@@ -271,7 +264,7 @@ lltok::Kind LLLexer::LexDollar() {
if (CurPtr[0] == '"') {
++CurPtr;
- while (1) {
+ while (true) {
int CurChar = getNextChar();
if (CurChar == EOF) {
@@ -300,7 +293,7 @@ lltok::Kind LLLexer::LexDollar() {
/// 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 @@ lltok::Kind LLLexer::LexVar(lltok::Kind Var, lltok::Kind VarID) {
if (CurPtr[0] == '"') {
++CurPtr;
- while (1) {
+ while (true) {
int CurChar = getNextChar();
if (CurChar == EOF) {
@@ -488,11 +481,12 @@ lltok::Kind LLLexer::LexIdentifier() {
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 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(cleanup);
KEYWORD(catch);
KEYWORD(filter);
+
#undef KEYWORD
// Keywords for types.
@@ -707,6 +702,7 @@ lltok::Kind LLLexer::LexIdentifier() {
return lltok::Type; \
} \
} while (false)
+
TYPEKEYWORD("void", Type::getVoidTy(Context));
TYPEKEYWORD("half", Type::getHalfTy(Context));
TYPEKEYWORD("float", Type::getFloatTy(Context));
@@ -718,6 +714,7 @@ lltok::Kind LLLexer::LexIdentifier() {
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 @@ lltok::Kind LLLexer::LexIdentifier() {
INSTKEYWORD(catchswitch, CatchSwitch);
INSTKEYWORD(catchpad, CatchPad);
INSTKEYWORD(cleanuppad, CleanupPad);
+
#undef INSTKEYWORD
#define DWKEYWORD(TYPE, TOKEN) \
@@ -791,6 +789,7 @@ lltok::Kind LLLexer::LexIdentifier() {
return lltok::TOKEN; \
} \
} while (false)
+
DWKEYWORD(TAG, DwarfTag);
DWKEYWORD(ATE, DwarfAttEncoding);
DWKEYWORD(VIRTUALITY, DwarfVirtuality);
@@ -798,7 +797,9 @@ lltok::Kind LLLexer::LexIdentifier() {
DWKEYWORD(CC, DwarfCC);
DWKEYWORD(OP, DwarfOp);
DWKEYWORD(MACINFO, DwarfMacinfo);
+
#undef DWKEYWORD
+
if (Keyword.startswith("DIFlag")) {
StrVal.assign(Keyword.begin(), Keyword.end());
return lltok::DIFlag;
diff --git a/llvm/lib/Bitcode/Reader/BitstreamReader.cpp b/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
index 60360d2ef78..330bc045cc6 100644
--- a/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
@@ -8,6 +8,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/Bitcode/BitstreamReader.h"
+#include "llvm/ADT/StringRef.h"
+#include <cassert>
+#include <string>
using namespace llvm;
@@ -95,8 +98,6 @@ static void skipAbbreviatedField(BitstreamCursor &Cursor,
}
}
-
-
/// 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 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
return Code;
}
-
void BitstreamCursor::ReadAbbrevRecord() {
BitCodeAbbrev *Abbv = new BitCodeAbbrev();
unsigned NumOpInfo = ReadVBR(5);
@@ -329,7 +329,7 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
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 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
}
}
}
-
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
index 9b6a9a78823..4253401cf22 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ b/llvm/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 <algorithm>
+#include <cassert>
+#include <cinttypes>
+#include <cstdint>
#include <string>
-#include <utility>
#include <vector>
using namespace llvm;
using namespace dwarf;
-
/// \brief Abstract frame entry defining the common interface concrete
/// entries implement.
class llvm::FrameEntry {
@@ -95,7 +100,6 @@ protected:
}
};
-
// 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 @@ void FrameEntry::parseInstructions(DataExtractor Data, uint32_t *Offset,
}
namespace {
+
/// \brief DWARF Common Information Entry (CIE)
class CIE : public FrameEntry {
public:
@@ -220,9 +225,11 @@ public:
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 @@ private:
uint32_t LSDAPointerEncoding;
};
-
/// \brief DWARF Frame Description Entry (FDE)
class FDE : public FrameEntry {
public:
@@ -336,7 +342,7 @@ static ArrayRef<OperandType[2]> getOperandTypes() {
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 @@ static ArrayRef<OperandType[2]> getOperandTypes() {
#undef DECLARE_OP0
#undef DECLARE_OP1
#undef DECLARE_OP2
+
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 {
OS << "\n";
for (const auto &Entry : Entries) {
@@ -677,4 +683,3 @@ void DWARFDebugFrame::dump(raw_ostream &OS) const {
OS << "\n";
}
}
-
diff --git a/llvm/lib/Target/X86/X86InstrBuilder.h b/llvm/lib/Target/X86/X86InstrBuilder.h
index 9c9e8d2b889..f07f68256a1 100644
--- a/llvm/lib/Target/X86/X86InstrBuilder.h
+++ b/llvm/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 <cassert>
namespace llvm {
@@ -57,12 +63,11 @@ struct X86AddressMode {
Base.Reg = 0;
}
-
void getFullAddress(SmallVectorImpl<MachineOperand> &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 @@ struct X86AddressMode {
}
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 @@ addConstantPoolReference(const MachineInstrBuilder &MIB, unsigned CPI,
.addConstantPoolIndex(CPI, 0, OpFlags).addReg(0);
}
-} // End llvm namespace
+} // end namespace llvm
-#endif
+#endif // LLVM_LIB_TARGET_X86_X86INSTRBUILDER_H
OpenPOWER on IntegriCloud