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

Unified Diff: lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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/X86MCAsmInfo.cpp ('k') | lib/Target/X86/MCTargetDesc/X86MCNaCl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
diff --git a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
index 31b8e2da8e4e635646fb9c71f6e82ab5be0eea32..3ed7953d1d9501fce721f22978363708114e0ae1 100644
--- a/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
+++ b/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
@@ -590,6 +590,8 @@ void X86MCCodeEmitter::EmitVEXOpcodePrefix(uint64_t TSFlags, unsigned &CurByte,
int MemOperand, const MCInst &MI,
const MCInstrDesc &Desc,
raw_ostream &OS) const {
+ assert(!(TSFlags & X86II::LOCK)); // Can't have LOCK VEX. @LOCALMOD
+
uint64_t Encoding = TSFlags & X86II::EncodingMask;
bool HasEVEX_K = TSFlags & X86II::EVEX_K;
bool HasVEX_4V = TSFlags & X86II::VEX_4V;
@@ -1109,6 +1111,12 @@ void X86MCCodeEmitter::EmitOpcodePrefix(uint64_t TSFlags, unsigned &CurByte,
: X86II::OpSize16))
EmitByte(0x66, CurByte, OS);
+ // @LOCALMOD-START
+ // Emit the LOCK opcode prefix.
+ if (TSFlags & X86II::LOCK)
+ EmitByte(0xF0, CurByte, OS);
+ // @LOCALMOD-END
+
switch (TSFlags & X86II::OpPrefixMask) {
case X86II::PD: // 66
EmitByte(0x66, CurByte, OS);
@@ -1182,9 +1190,7 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
int MemoryOperand = X86II::getMemoryOperandNo(TSFlags, Opcode);
if (MemoryOperand != -1) MemoryOperand += CurOp;
- // Emit the lock opcode prefix as needed.
- if (TSFlags & X86II::LOCK)
- EmitByte(0xF0, CurByte, OS);
+ // @LOCALMOD Moved LOCK prefix generation to EmitOpcodePrefix.
// Emit segment override opcode prefix as needed.
if (MemoryOperand >= 0)
@@ -1239,6 +1245,10 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS,
switch (TSFlags & X86II::FormMask) {
default: errs() << "FORM: " << (TSFlags & X86II::FormMask) << "\n";
llvm_unreachable("Unknown FormMask value in X86MCCodeEmitter!");
+ // @LOCALMOD-BEGIN
+ case X86II::CustomFrm:
+ llvm_unreachable("CustomFrm instruction shouldn't be emitted");
+ // @LOCALMOD-END
case X86II::Pseudo:
llvm_unreachable("Pseudo instruction shouldn't be emitted");
case X86II::RawFrmDstSrc: {
« no previous file with comments | « lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp ('k') | lib/Target/X86/MCTargetDesc/X86MCNaCl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698