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

Unified Diff: src/IceInstX8632.cpp

Issue 1017373002: Subzero: Assemble calls to constant addresses. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: move test back Created 5 years, 9 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 | « src/IceFixups.cpp ('k') | src/IceOperand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX8632.cpp
diff --git a/src/IceInstX8632.cpp b/src/IceInstX8632.cpp
index 776a8708b8a31ccf89ec250629bac6fd42f30f44..24645671b5d953014d5e64f47236182e17dc1563 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -489,11 +489,10 @@ void InstX8632Jmp::emitIAS(const Cfg *Func) const {
} else if (const auto Imm = llvm::dyn_cast<ConstantInteger32>(Target)) {
// NaCl trampoline calls refer to an address within the sandbox directly.
// This is usually only needed for non-IRT builds and otherwise not
- // very portable or stable. For this, we would use the 0xE8 opcode
- // (relative version of call) and there should be a PC32 reloc too.
- // The PC32 reloc will have symbol index 0, and the absolute address
- // would be encoded as an offset relative to the next instruction.
- // TODO(jvoung): Do we need to support this?
+ // very portable or stable. Usually this is only done for "calls"
+ // and not jumps.
+ // TODO(jvoung): Support this when there is a lowering that
+ // actually triggers this case.
(void)Imm;
llvm::report_fatal_error("Unexpected jmp to absolute address");
} else {
@@ -515,10 +514,7 @@ void InstX8632Call::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
Str << "\tcall\t";
- if (const auto CallTarget =
- llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) {
- // TODO(stichnot): All constant targets should suppress the '$',
- // not just relocatables.
+ if (const auto CallTarget = llvm::dyn_cast<Constant>(getCallTarget())) {
CallTarget->emitWithoutDollar(Func->getContext());
} else {
Str << "*";
@@ -544,15 +540,7 @@ void InstX8632Call::emitIAS(const Cfg *Func) const {
assert(CR->getOffset() == 0 && "We only support calling a function");
Asm->call(CR);
} else if (const auto Imm = llvm::dyn_cast<ConstantInteger32>(Target)) {
- // NaCl trampoline calls refer to an address within the sandbox directly.
- // This is usually only needed for non-IRT builds and otherwise not
- // very portable or stable. For this, we would use the 0xE8 opcode
- // (relative version of call) and there should be a PC32 reloc too.
- // The PC32 reloc will have symbol index 0, and the absolute address
- // would be encoded as an offset relative to the next instruction.
- // TODO(jvoung): Do we need to support this?
- (void)Imm;
- llvm_unreachable("Unexpected call to absolute address");
+ Asm->call(x86::Immediate(Imm->getValue()));
} else {
llvm_unreachable("Unexpected operand type");
}
« no previous file with comments | « src/IceFixups.cpp ('k') | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698