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

Unified Diff: src/IceInstX8632.cpp

Issue 1129263005: Convert Constant->emit() definitions to allow multiple targets to define them. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: report fatal Created 5 years, 7 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 | « no previous file | 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 b2532783c9a0e67f8e34ff8d63001fd59a674b6d..2ac95db35f5ee2854d75397549986c669dc81be6 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -526,8 +526,12 @@ 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<Constant>(getCallTarget())) {
- CallTarget->emitWithoutDollar(Func->getContext());
+ if (const auto CI = llvm::dyn_cast<ConstantInteger32>(getCallTarget())) {
+ // Emit without a leading '$'.
+ Str << CI->getValue();
+ } else if (const auto CallTarget =
+ llvm::dyn_cast<ConstantRelocatable>(getCallTarget())) {
+ CallTarget->emitWithoutPrefix(Func->getTarget());
} else {
Str << "*";
getCallTarget()->emit(Func);
@@ -2848,7 +2852,7 @@ void OperandX8632Mem::emit(const Cfg *Func) const {
// Emit a non-zero offset without a leading '$'.
Str << CI->getValue();
} else if (const auto CR = llvm::dyn_cast<ConstantRelocatable>(Offset)) {
- CR->emitWithoutDollar(Func->getContext());
+ CR->emitWithoutPrefix(Func->getTarget());
} else {
llvm_unreachable("Invalid offset type for x86 mem operand");
}
« no previous file with comments | « no previous file | src/IceOperand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698