diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/PrologEpilogInserter.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContext.cpp | 41 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 9 | ||||
-rw-r--r-- | llvm/lib/Support/CMakeLists.txt | 2 | ||||
-rw-r--r-- | llvm/lib/Support/DiagnosticInfo.cpp | 54 | ||||
-rw-r--r-- | llvm/lib/Support/DiagnosticPrinter.cpp | 101 |
7 files changed, 7 insertions, 213 deletions
diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp index 556d92f0ddb..0107a9cb442 100644 --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -30,11 +30,9 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/RegisterScavenging.h" #include "llvm/IR/InlineAsm.h" -#include "llvm/IR/LLVMContext.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" -#include "llvm/Support/DiagnosticInfo.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetFrameLowering.h" #include "llvm/Target/TargetInstrInfo.h" @@ -162,11 +160,10 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) { // Warn on stack size when we exceeds the given limit. MachineFrameInfo *MFI = Fn.getFrameInfo(); - uint64_t StackSize = MFI->getStackSize(); - if (WarnStackSize.getNumOccurrences() > 0 && WarnStackSize < StackSize) { - DiagnosticInfoStackSize DiagStackSize(*F, StackSize); - F->getContext().diagnose(DiagStackSize); - } + if (WarnStackSize.getNumOccurrences() > 0 && + WarnStackSize < MFI->getStackSize()) + errs() << "warning: Stack size limit exceeded (" << MFI->getStackSize() + << ") in " << Fn.getName() << ".\n"; delete RS; ReturnBlocks.clear(); diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 26541d81684..883bb9878fa 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -17,8 +17,6 @@ #include "llvm/IR/Constants.h" #include "llvm/IR/Instruction.h" #include "llvm/IR/Metadata.h" -#include "llvm/Support/DiagnosticInfo.h" -#include "llvm/Support/DiagnosticPrinter.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/SourceMgr.h" #include <cctype> @@ -100,20 +98,6 @@ void *LLVMContext::getInlineAsmDiagnosticContext() const { return pImpl->InlineAsmDiagContext; } -void LLVMContext::setDiagnosticHandler(DiagnosticHandlerTy DiagnosticHandler, - void *DiagnosticContext) { - pImpl->DiagnosticHandler = DiagnosticHandler; - pImpl->DiagnosticContext = DiagnosticContext; -} - -LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const { - return pImpl->DiagnosticHandler; -} - -void *LLVMContext::getDiagnosticContext() const { - return pImpl->DiagnosticContext; -} - void LLVMContext::emitError(const Twine &ErrorStr) { emitError(0U, ErrorStr); } @@ -128,31 +112,6 @@ void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) { return emitError(LocCookie, ErrorStr); } -void LLVMContext::diagnose(const DiagnosticInfo &DI) { - // If there is a report handler, use it. - if (pImpl->DiagnosticHandler != 0) { - pImpl->DiagnosticHandler(DI, pImpl->DiagnosticContext); - return; - } - // Otherwise, print the message with a prefix based on the severity. - std::string MsgStorage; - raw_string_ostream Stream(MsgStorage); - DiagnosticPrinterRawOStream DP(Stream); - DI.print(DP); - Stream.flush(); - switch (DI.getSeverity()) { - case DS_Error: - errs() << "error: " << MsgStorage << "\n"; - exit(1); - case DS_Warning: - errs() << "warning: " << MsgStorage << "\n"; - break; - case DS_Note: - errs() << "note: " << MsgStorage << "\n"; - break; - } -} - void LLVMContext::emitError(unsigned LocCookie, const Twine &ErrorStr) { // If there is no error handler installed, just print the error and exit. if (pImpl->InlineAsmDiagHandler == 0) { diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index ebff9d3a51f..6a6a4d6801f 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -37,8 +37,6 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C) Int64Ty(C, 64) { InlineAsmDiagHandler = 0; InlineAsmDiagContext = 0; - DiagnosticHandler = 0; - DiagnosticContext = 0; NamedStructTypesUniqueID = 0; } diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 39e5d778ed6..407b9856892 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -238,12 +238,9 @@ public: LLVMContext::InlineAsmDiagHandlerTy InlineAsmDiagHandler; void *InlineAsmDiagContext; - - LLVMContext::DiagnosticHandlerTy DiagnosticHandler; - void *DiagnosticContext; - - typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt *, - DenseMapAPIntKeyInfo> IntMapTy; + + typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*, + DenseMapAPIntKeyInfo> IntMapTy; IntMapTy IntConstants; typedef DenseMap<DenseMapAPFloatKeyInfo::KeyTy, ConstantFP*, diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt index 50aab382ca8..3aecf3ffa4e 100644 --- a/llvm/lib/Support/CMakeLists.txt +++ b/llvm/lib/Support/CMakeLists.txt @@ -17,8 +17,6 @@ add_llvm_library(LLVMSupport Debug.cpp DeltaAlgorithm.cpp DAGDeltaAlgorithm.cpp - DiagnosticInfo.cpp - DiagnosticPrinter.cpp Dwarf.cpp ErrorHandling.cpp FileUtilities.cpp diff --git a/llvm/lib/Support/DiagnosticInfo.cpp b/llvm/lib/Support/DiagnosticInfo.cpp deleted file mode 100644 index 0ce0d90a42f..00000000000 --- a/llvm/lib/Support/DiagnosticInfo.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the different classes involved in low level diagnostics. -// -// Diagnostics reporting is still done as part of the LLVMContext. -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/Twine.h" -#include "llvm/IR/Constants.h" -#include "llvm/IR/Function.h" -#include "llvm/IR/Instruction.h" -#include "llvm/IR/Metadata.h" -#include "llvm/Support/Atomic.h" -#include "llvm/Support/DiagnosticInfo.h" -#include "llvm/Support/DiagnosticPrinter.h" - -#include <string> - -using namespace llvm; - -int getNextAvailablePluginDiagnosticKind() { - static sys::cas_flag PluginKindID = DK_FirstPluginKind; - return (int)sys::AtomicIncrement(&PluginKindID); -} - -DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(const Instruction &I, - const Twine &MsgStr, - DiagnosticSeverity Severity) - : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr), - Instr(&I) { - if (const MDNode *SrcLoc = I.getMetadata("srcloc")) { - if (SrcLoc->getNumOperands() != 0) - if (const ConstantInt *CI = dyn_cast<ConstantInt>(SrcLoc->getOperand(0))) - LocCookie = CI->getZExtValue(); - } -} - -void DiagnosticInfoInlineAsm::print(DiagnosticPrinter &DP) const { - DP << getMsgStr(); - if (getLocCookie()) - DP << " at line " << getLocCookie(); -} - -void DiagnosticInfoStackSize::print(DiagnosticPrinter &DP) const { - DP << "stack size limit exceeded (" << getStackSize() << ") in " - << getFunction(); -} diff --git a/llvm/lib/Support/DiagnosticPrinter.cpp b/llvm/lib/Support/DiagnosticPrinter.cpp deleted file mode 100644 index 00b80693f90..00000000000 --- a/llvm/lib/Support/DiagnosticPrinter.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===- llvm/Support/DiagnosticInfo.cpp - Diagnostic Definitions -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines the a diagnostic printer relying on raw_ostream. -// -//===----------------------------------------------------------------------===// - -#include "llvm/ADT/Twine.h" -#include "llvm/IR/Value.h" -#include "llvm/Support/DiagnosticPrinter.h" -#include "llvm/Support/raw_ostream.h" - -using namespace llvm; - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(char C) { - Stream << C; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned char C) { - Stream << C; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(signed char C) { - Stream << C; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(StringRef Str) { - Stream << Str; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const char *Str) { - Stream << Str; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<( - const std::string &Str) { - Stream << Str; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned long N) { - Stream << N; - return *this; -} -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long N) { - Stream << N; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<( - unsigned long long N) { - Stream << N; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(long long N) { - Stream << N; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const void *P) { - Stream << P; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(unsigned int N) { - Stream << N; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(int N) { - Stream << N; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(double N) { - Stream << N; - return *this; -} - -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Twine &Str) { - Stream << Str.getSingleStringRef(); - return *this; -} - -// IR related types. -DiagnosticPrinter &DiagnosticPrinterRawOStream::operator<<(const Value &V) { - Stream << V.getName(); - return *this; -} |