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

Unified Diff: src/IceInstX8632.cpp

Issue 633553003: emitIAS for push -- simplify push since it's not used for args passing anymore (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 6 years, 2 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/IceInstX8632.h ('k') | src/IceTargetLoweringX8632.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 8930a17a634df5632b8f8d914d0b0fef059c2356..cdc81aaf5e0b0492f1653ed8d79302d168d73985 100644
--- a/src/IceInstX8632.cpp
+++ b/src/IceInstX8632.cpp
@@ -303,10 +303,8 @@ InstX8632Fstp::InstX8632Fstp(Cfg *Func, Variable *Dest)
InstX8632Pop::InstX8632Pop(Cfg *Func, Variable *Dest)
: InstX8632(Func, InstX8632::Pop, 0, Dest) {}
-InstX8632Push::InstX8632Push(Cfg *Func, Operand *Source,
- bool SuppressStackAdjustment)
- : InstX8632(Func, InstX8632::Push, 1, NULL),
- SuppressStackAdjustment(SuppressStackAdjustment) {
+InstX8632Push::InstX8632Push(Cfg *Func, Variable *Source)
+ : InstX8632(Func, InstX8632::Push, 1, NULL) {
addSource(Source);
}
@@ -1868,34 +1866,24 @@ void InstX8632AdjustStack::dump(const Cfg *Func) const {
void InstX8632Push::emit(const Cfg *Func) const {
Ostream &Str = Func->getContext()->getStrEmit();
assert(getSrcSize() == 1);
- Type Ty = getSrc(0)->getType();
- Variable *Var = llvm::dyn_cast<Variable>(getSrc(0));
- if ((isVectorType(Ty) || isScalarFloatingType(Ty)) && Var && Var->hasReg()) {
- // The xmm registers can't be directly pushed, so we fake it by
- // decrementing esp and then storing to [esp].
- Str << "\tsub\tesp, " << typeWidthInBytes(Ty) << "\n";
- if (!SuppressStackAdjustment)
- Func->getTarget()->updateStackAdjustment(typeWidthInBytes(Ty));
- if (isVectorType(Ty)) {
- Str << "\tmovups\txmmword ptr [esp], ";
- } else {
- Str << "\tmov" << TypeX8632Attributes[Ty].SdSsString << "\t"
- << TypeX8632Attributes[Ty].WidthString << " [esp], ";
- }
- getSrc(0)->emit(Func);
- Str << "\n";
- } else if (Ty == IceType_f64 && (!Var || !Var->hasReg())) {
- // A double on the stack has to be pushed as two halves. Push the
- // upper half followed by the lower half for little-endian. TODO:
- // implement.
- llvm_unreachable("Missing support for pushing doubles from memory");
- } else {
- Str << "\tpush\t";
- getSrc(0)->emit(Func);
- Str << "\n";
- if (!SuppressStackAdjustment)
- Func->getTarget()->updateStackAdjustment(4);
- }
+ // Push is currently only used for saving GPRs.
+ Variable *Var = llvm::cast<Variable>(getSrc(0));
+ assert(Var->hasReg());
+ Str << "\tpush\t";
+ Var->emit(Func);
+ Str << "\n";
+}
+
+void InstX8632Push::emitIAS(const Cfg *Func) const {
+ Ostream &Str = Func->getContext()->getStrEmit();
+ assert(getSrcSize() == 1);
+ // Push is currently only used for saving GPRs.
+ Variable *Var = llvm::cast<Variable>(getSrc(0));
+ assert(Var->hasReg());
+ x86::AssemblerX86 *Asm = Func->getAssembler<x86::AssemblerX86>();
+ intptr_t StartPosition = Asm->GetPosition();
+ Asm->pushl(RegX8632::getEncodedGPR(Var->getRegNum()));
+ emitIASBytes(Str, Asm, StartPosition);
}
void InstX8632Push::dump(const Cfg *Func) const {
« no previous file with comments | « src/IceInstX8632.h ('k') | src/IceTargetLoweringX8632.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698