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

Unified Diff: src/IceInstX86Base.h

Issue 1559243002: Suzero. X8664. NaCl Sandboxing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fixes filetype=asm; addresses comments. Created 4 years, 11 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/IceInstX8664.def ('k') | src/IceInstX86BaseImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceInstX86Base.h
diff --git a/src/IceInstX86Base.h b/src/IceInstX86Base.h
index 2b7ac3f2fccb0267d19508e14d9261fc80083d16..d4dbe59149b949bc935bc8fbd493217af08c2037 100644
--- a/src/IceInstX86Base.h
+++ b/src/IceInstX86Base.h
@@ -337,11 +337,13 @@ template <typename TraitsType> struct InstImpl {
void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override;
void dump(const Cfg *Func) const override;
+ void setIsReturnLocation(bool Value) { IsReturnLocation = Value; }
private:
InstX86Label(Cfg *Func, TargetLowering *Target);
SizeT Number; // used for unique label generation.
+ bool IsReturnLocation = false;
};
/// Conditional and unconditional branch instruction.
@@ -528,8 +530,8 @@ template <typename TraitsType> struct InstImpl {
/// Emit a two-operand (GPR) instruction, where the dest operand is a Variable
/// that's guaranteed to be a register.
template <bool VarCanBeByte = true, bool SrcCanBeByte = true>
- static void emitIASRegOpTyGPR(const Cfg *Func, Type Ty, const Variable *Dst,
- const Operand *Src,
+ static void emitIASRegOpTyGPR(const Cfg *Func, bool IsLea, Type Ty,
+ const Variable *Dst, const Operand *Src,
const GPREmitterRegOp &Emitter);
/// Instructions of the form x := op(x).
@@ -613,7 +615,8 @@ template <typename TraitsType> struct InstImpl {
const Variable *Var = this->getDest();
Type Ty = Var->getType();
const Operand *Src = this->getSrc(0);
- emitIASRegOpTyGPR(Func, Ty, Var, Src, Emitter);
+ constexpr bool IsLea = K == InstX86Base::Lea;
+ emitIASRegOpTyGPR(Func, IsLea, Ty, Var, Src, Emitter);
}
void dump(const Cfg *Func) const override {
if (!BuildDefs::dump())
@@ -743,7 +746,10 @@ template <typename TraitsType> struct InstImpl {
void emitIAS(const Cfg *Func) const override {
Type Ty = this->getDest()->getType();
assert(this->getSrcSize() == 2);
- emitIASRegOpTyGPR(Func, Ty, this->getDest(), this->getSrc(1), Emitter);
+ constexpr bool ThisIsLEA = K == InstX86Base::Lea;
+ static_assert(!ThisIsLEA, "Lea should be a unaryop.");
+ emitIASRegOpTyGPR(Func, !ThisIsLEA, Ty, this->getDest(), this->getSrc(1),
+ Emitter);
}
void dump(const Cfg *Func) const override {
if (!BuildDefs::dump())
@@ -1177,9 +1183,15 @@ template <typename TraitsType> struct InstImpl {
void emitIAS(const Cfg *Func) const override;
+ void setMustKeep() { MustKeep = true; }
+
private:
+ bool MustKeep = false;
+
InstX86Movzx(Cfg *Func, Variable *Dest, Operand *Src)
: InstX86BaseUnaryopGPR<InstX86Base::Movzx>(Func, Dest, Src) {}
+
+ bool mayBeElided(const Variable *Dest, const Operand *Src) const;
};
class InstX86Movd : public InstX86BaseUnaryopXmm<InstX86Base::Movd> {
@@ -2638,7 +2650,10 @@ template <typename TraitsType> struct InstImpl {
InstX86Push &operator=(const InstX86Push &) = delete;
public:
- static InstX86Push *create(Cfg *Func, Variable *Source) {
+ static InstX86Push *create(Cfg *Func, InstX86Label *Label) {
+ return new (Func->allocate<InstX86Push>()) InstX86Push(Func, Label);
+ }
+ static InstX86Push *create(Cfg *Func, Operand *Source) {
return new (Func->allocate<InstX86Push>()) InstX86Push(Func, Source);
}
void emit(const Cfg *Func) const override;
@@ -2649,7 +2664,10 @@ template <typename TraitsType> struct InstImpl {
}
private:
- InstX86Push(Cfg *Func, Variable *Source);
+ InstX86Label *Label = nullptr;
+
+ InstX86Push(Cfg *Func, Operand *Source);
+ InstX86Push(Cfg *Func, InstX86Label *Label);
};
/// Ret instruction. Currently only supports the "ret" version that does not
« no previous file with comments | « src/IceInstX8664.def ('k') | src/IceInstX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698