aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86CodeEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/X86/X86CodeEmitter.cpp')
-rw-r--r--lib/Target/X86/X86CodeEmitter.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index 3079dfa7cf..271384ab27 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "x86-emitter"
+#define DEBUG_TYPE "jit"
#include "X86InstrInfo.h"
#include "X86JITInfo.h"
#include "X86Subtarget.h"
@@ -35,6 +35,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Target/TargetOpcodes.h" // @LOCALMOD
using namespace llvm;
STATISTIC(NumEmitted, "Number of machine instructions emitted");
@@ -1114,6 +1115,28 @@ void Emitter<CodeEmitter>::emitInstruction(MachineInstr &MI,
unsigned Opcode = Desc->Opcode;
+ // @LOCALMOD-START
+ if (TM.getSubtargetImpl()->isTargetNaCl()) {
+ switch (Opcode) {
+ case TargetOpcode::BUNDLE_LOCK:
+ MCE.beginBundleLock();
+ return;
+ case TargetOpcode::BUNDLE_UNLOCK:
+ MCE.endBundleLock();
+ return;
+ case TargetOpcode::BUNDLE_ALIGN_START:
+ MCE.alignToBundleBeginning();
+ return;
+ case TargetOpcode::BUNDLE_ALIGN_END:
+ MCE.alignToBundleEnd();
+ return;
+ }
+ // In addition to groups of instructions, each instruction must itself be
+ // bundle-locked because they are emitted with multiple calls into MCE
+ MCE.beginBundleLock();
+ }
+ // @LOCALMOD-END
+
// If this is a two-address instruction, skip one of the register operands.
unsigned NumOps = Desc->getNumOperands();
unsigned CurOp = 0;
@@ -1470,5 +1493,11 @@ void Emitter<CodeEmitter>::emitInstruction(MachineInstr &MI,
llvm_unreachable(0);
}
+ // @LOCALMOD-START
+ if (TM.getSubtargetImpl()->isTargetNaCl()) {
+ MCE.endBundleLock();
+ }
+ // @LOCALMOD-END
+
MCE.processDebugLoc(MI.getDebugLoc(), false);
}