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

Unified Diff: lib/Target/X86/MCTargetDesc/X86MCNaClExpander.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/Target/X86/MCTargetDesc/X86MCNaClExpander.h ('k') | test/MC/ARM/nacl-autosandbox/scratch-invalid.s » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Target/X86/MCTargetDesc/X86MCNaClExpander.cpp
diff --git a/lib/Target/X86/MCTargetDesc/X86MCNaClExpander.cpp b/lib/Target/X86/MCTargetDesc/X86MCNaClExpander.cpp
index 3979974ae8281bf2ee6dc7bba93053dbac2f35cb..30665f79096a38de3e35fd6a714044260212bde5 100644
--- a/lib/Target/X86/MCTargetDesc/X86MCNaClExpander.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86MCNaClExpander.cpp
@@ -39,6 +39,14 @@ static bool isAbsoluteReg(unsigned Reg) {
Reg == X86::RIP);
}
+bool X86::X86MCNaClExpander::isValidScratchRegister(unsigned Reg) const {
+ // TODO(dschuff): Check the register class.
+ if (isAbsoluteReg(Reg))
+ return false;
+ return true;
+}
+
+
static void PushReturnAddress(const llvm::MCSubtargetInfo &STI,
MCContext &Context, MCStreamer &Out,
MCSymbol *RetTarget) {
@@ -565,10 +573,12 @@ void X86::X86MCNaClExpander::emitInstruction(const MCInst &Inst,
Out.EmitInstruction(Inst, STI);
}
+
void X86::X86MCNaClExpander::doExpandInst(const MCInst &Inst, MCStreamer &Out,
const MCSubtargetInfo &STI,
bool EmitPrefixes) {
+
// Explicitly IGNORE all pseudo instructions, these will be handled in the
// older customExpandInst code
switch (Inst.getOpcode()) {
@@ -635,6 +645,7 @@ bool X86::X86MCNaClExpander::expandInst(const MCInst &Inst, MCStreamer &Out,
Guard = true;
doExpandInst(Inst, Out, STI, true);
+ invalidateScratchRegs(Inst);
Guard = false;
return true;
« no previous file with comments | « lib/Target/X86/MCTargetDesc/X86MCNaClExpander.h ('k') | test/MC/ARM/nacl-autosandbox/scratch-invalid.s » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698