Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: lib/MC/MCParser/NaClAsmParser.cpp

Issue 1274223003: Auto-sandboxing: Switch to automatic scratch register invalidation (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: add flag to tests Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/MC/MCNaClExpander.cpp ('k') | lib/Target/ARM/MCTargetDesc/ARMMCNaClExpander.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/MC/MCParser/NaClAsmParser.cpp
diff --git a/lib/MC/MCParser/NaClAsmParser.cpp b/lib/MC/MCParser/NaClAsmParser.cpp
index fa06aa24676eed8214a0b67bcee2f2d373e0a7f8..ae2bcd61c489bff2591b85e3e740bbf0280ac6c8 100644
--- a/lib/MC/MCParser/NaClAsmParser.cpp
+++ b/lib/MC/MCParser/NaClAsmParser.cpp
@@ -32,7 +32,7 @@ class NaClAsmParser : public MCAsmParserExtension {
// Call the base implementation.
MCAsmParserExtension::Initialize(Parser);
addDirectiveHandler<&NaClAsmParser::ParseScratch>(".scratch");
- addDirectiveHandler<&NaClAsmParser::ParseUnscratch>(".unscratch");
+ addDirectiveHandler<&NaClAsmParser::ParseUnscratch>(".scratch_clear");
}
/// ::= {.scratch} reg
@@ -54,7 +54,8 @@ class NaClAsmParser : public MCAsmParserExtension {
}
Lex();
- Expander->pushScratchReg(RegNo);
+ if(Expander->addScratchReg(RegNo))
+ return Error(Loc, "Register can't be used as a scratch register");
return false;
}
@@ -62,12 +63,10 @@ class NaClAsmParser : public MCAsmParserExtension {
bool ParseUnscratch(StringRef Directive, SMLoc Loc) {
getParser().checkForValidSection();
if (getLexer().isNot(AsmToken::EndOfStatement))
- return TokError("unexpected token in '.unscratch' directive");
+ return TokError("unexpected token in '.scratch_clear' directive");
Lex();
- if (Expander->numScratchRegs() == 0)
- return Error(Loc, "No scratch registers specified");
- Expander->popScratchReg();
+ Expander->clearScratchRegs();
return false;
}
« no previous file with comments | « lib/MC/MCNaClExpander.cpp ('k') | lib/Target/ARM/MCTargetDesc/ARMMCNaClExpander.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698