Implement Reactor breakpoints

For LLVM, uses the debugtrap intrinsic which is more debugging specific
than the trap intrinsic. The Subzero implementationuses a Trap
intrinsic. Both translate to 'int 3' on x86.

Bug: b/135997638
Change-Id: I6eca71e74752c4646baeade9a39b338e17053336
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33369
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp
index 343bf3c..d1c6eb2 100644
--- a/src/Reactor/LLVMReactor.cpp
+++ b/src/Reactor/LLVMReactor.cpp
@@ -3732,6 +3732,13 @@
 		for (auto arg : args) { arguments.push_back(V(arg)); }
 		return V(::builder->CreateCall(funcPtr, arguments));
 	}
+
+	void Breakpoint()
+	{
+		llvm::Function *debugtrap = llvm::Intrinsic::getDeclaration(::module, llvm::Intrinsic::debugtrap);
+
+		::builder->CreateCall(debugtrap);
+	}
 }
 
 namespace rr
@@ -4293,12 +4300,6 @@
 	}
 #endif // ENABLE_RR_PRINT
 
-	void Break()
-	{
-		auto trap = ::llvm::Intrinsic::getDeclaration(module, llvm::Intrinsic::trap);
-		builder->CreateCall(trap);
-	}
-
 	void Nop()
 	{
 		auto voidTy = ::llvm::Type::getVoidTy(*context);
diff --git a/src/Reactor/SubzeroReactor.cpp b/src/Reactor/SubzeroReactor.cpp
index 4878875..d655c93 100644
--- a/src/Reactor/SubzeroReactor.cpp
+++ b/src/Reactor/SubzeroReactor.cpp
@@ -3465,6 +3465,14 @@
 		return V(ret);
 	}
 
+	void Breakpoint()
+	{
+		const Ice::Intrinsics::IntrinsicInfo intrinsic = {Ice::Intrinsics::Trap, Ice::Intrinsics::SideEffects_F, Ice::Intrinsics::ReturnsTwice_F, Ice::Intrinsics::MemoryWrite_F};
+		auto target = ::context->getConstantUndef(Ice::IceType_i32);
+		auto trap = Ice::InstIntrinsicCall::create(::function, 0, nullptr, target, intrinsic);
+		::basicBlock->appendInst(trap);
+	}
+
 	// Below are functions currently unimplemented for the Subzero backend.
 	// They are stubbed to satisfy the linker.
 	void Nucleus::createFence(std::memory_order memoryOrder) { UNIMPLEMENTED("Subzero createFence()"); }