summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-01-15 15:37:28 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-01-15 15:37:28 +0000
commit3fba7d16b41dfbefe3b1be6bc0ab94c017728f79 (patch)
treebe5a687969f682edded4aa6f13594ffd9aa9030e /tools
parenta16c51cee9225a354c999dd1076d5dba2aa79807 (diff)
downloadFreeBSD-src-3fba7d16b41dfbefe3b1be6bc0ab94c017728f79.zip
FreeBSD-src-3fba7d16b41dfbefe3b1be6bc0ab94c017728f79.tar.gz
Update LLVM to 93512.
Diffstat (limited to 'tools')
-rw-r--r--tools/llc/llc.cpp5
-rw-r--r--tools/llvm-mc/AsmLexer.cpp2
-rw-r--r--tools/llvm-mc/AsmParser.cpp28
-rw-r--r--tools/llvmc/plugins/Base/Base.td.in3
-rw-r--r--tools/lto/LTOCodeGenerator.cpp6
-rw-r--r--tools/opt/opt.cpp4
6 files changed, 41 insertions, 7 deletions
diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp
index 84e6867..930de26 100644
--- a/tools/llc/llc.cpp
+++ b/tools/llc/llc.cpp
@@ -28,6 +28,7 @@
#include "llvm/Config/config.h"
#include "llvm/LinkAllVMCore.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/ManagedStatic.h"
@@ -210,6 +211,10 @@ static formatted_raw_ostream *GetOutputStream(const char *TargetName,
int main(int argc, char **argv) {
sys::PrintStackTraceOnErrorSignal();
PrettyStackTraceProgram X(argc, argv);
+
+ // Enable debug stream buffering.
+ EnableDebugBuffering = true;
+
LLVMContext &Context = getGlobalContext();
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
diff --git a/tools/llvm-mc/AsmLexer.cpp b/tools/llvm-mc/AsmLexer.cpp
index 99055c6..ba0d247 100644
--- a/tools/llvm-mc/AsmLexer.cpp
+++ b/tools/llvm-mc/AsmLexer.cpp
@@ -44,7 +44,7 @@ void AsmLexer::PrintMessage(SMLoc Loc, const std::string &Msg,
/// ReturnError - Set the error to the specified string at the specified
/// location. This is defined to always return AsmToken::Error.
AsmToken AsmLexer::ReturnError(const char *Loc, const std::string &Msg) {
- SrcMgr.PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error");
+ PrintMessage(SMLoc::getFromPointer(Loc), Msg, "error");
return AsmToken(AsmToken::Error, StringRef(Loc, 0));
}
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 1204a00..2eb75a7 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -18,6 +18,7 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCParsedAsmOperand.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
@@ -28,6 +29,11 @@
#include "llvm/Target/TargetAsmParser.h"
using namespace llvm;
+/// getStartLoc - Get the location of the first token of this operand.
+SMLoc MCParsedAsmOperand::getStartLoc() const { return SMLoc(); }
+SMLoc MCParsedAsmOperand::getEndLoc() const { return SMLoc(); }
+
+
// Mach-O section uniquing.
//
// FIXME: Figure out where this should live, it should be shared by
@@ -710,16 +716,34 @@ bool AsmParser::ParseStatement() {
return false;
}
- MCInst Inst;
- if (getTargetParser().ParseInstruction(IDVal, Inst))
+
+ SmallVector<MCParsedAsmOperand*, 8> ParsedOperands;
+ if (getTargetParser().ParseInstruction(IDVal, IDLoc, ParsedOperands))
+ // FIXME: Leaking ParsedOperands on failure.
return true;
if (Lexer.isNot(AsmToken::EndOfStatement))
+ // FIXME: Leaking ParsedOperands on failure.
return TokError("unexpected token in argument list");
// Eat the end of statement marker.
Lexer.Lex();
+
+ MCInst Inst;
+
+ bool MatchFail = getTargetParser().MatchInstruction(ParsedOperands, Inst);
+
+ // Free any parsed operands.
+ for (unsigned i = 0, e = ParsedOperands.size(); i != e; ++i)
+ delete ParsedOperands[i];
+
+ if (MatchFail) {
+ // FIXME: We should give nicer diagnostics about the exact failure.
+ Error(IDLoc, "unrecognized instruction");
+ return true;
+ }
+
// Instruction is good, process it.
Out.EmitInstruction(Inst);
diff --git a/tools/llvmc/plugins/Base/Base.td.in b/tools/llvmc/plugins/Base/Base.td.in
index c7ba3be..cf0ff68 100644
--- a/tools/llvmc/plugins/Base/Base.td.in
+++ b/tools/llvmc/plugins/Base/Base.td.in
@@ -56,7 +56,7 @@ def OptList : OptionList<[
(help "A deprecated synonym for -mtune"), (hidden)),
(parameter_option "MF",
(help "Specify a file to write dependencies to"), (hidden)),
- (parameter_option "MT",
+ (parameter_list_option "MT",
(help "Change the name of the rule emitted by dependency generation"),
(hidden)),
(parameter_list_option "include",
@@ -139,6 +139,7 @@ class llvm_gcc_based <string cmd_prefix, string in_lang, string E_ext> : Tool<
(not_empty "m"), (forward "m"),
(switch_on "m32"), (forward "m32"),
(switch_on "m64"), (forward "m64"),
+ (switch_on "O0"), (forward "O0"),
(switch_on "O1"), (forward "O1"),
(switch_on "O2"), (forward "O2"),
(switch_on "O3"), (forward "O3"),
diff --git a/tools/lto/LTOCodeGenerator.cpp b/tools/lto/LTOCodeGenerator.cpp
index 060fc4f..93eb0a5 100644
--- a/tools/lto/LTOCodeGenerator.cpp
+++ b/tools/lto/LTOCodeGenerator.cpp
@@ -443,12 +443,12 @@ bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
/// Optimize merged modules using various IPO passes
void LTOCodeGenerator::setCodeGenDebugOptions(const char* options)
{
- std::string ops(options);
- for (std::string o = getToken(ops); !o.empty(); o = getToken(ops)) {
+ for (std::pair<StringRef, StringRef> o = getToken(options);
+ !o.first.empty(); o = getToken(o.second)) {
// ParseCommandLineOptions() expects argv[0] to be program name.
// Lazily add that.
if ( _codegenOptions.empty() )
_codegenOptions.push_back("libLTO");
- _codegenOptions.push_back(strdup(o.c_str()));
+ _codegenOptions.push_back(strdup(o.first.str().c_str()));
}
}
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index 50a2e39..a636bd9 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -26,6 +26,7 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/PassNameParser.h"
#include "llvm/System/Signals.h"
+#include "llvm/Support/Debug.h"
#include "llvm/Support/IRReader.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
@@ -344,6 +345,9 @@ int main(int argc, char **argv) {
sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram X(argc, argv);
+ // Enable debug stream buffering.
+ EnableDebugBuffering = true;
+
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
LLVMContext &Context = getGlobalContext();
OpenPOWER on IntegriCloud