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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1616483003: Merged addProlog and addEpilog on x86. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX86Base.h - x86 lowering ----*- C++ -*-===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 template <typename T = Traits> 171 template <typename T = Traits>
172 typename std::enable_if<!T::Is64Bit, Operand>::type * 172 typename std::enable_if<!T::Is64Bit, Operand>::type *
173 hiOperand(Operand *Operand); 173 hiOperand(Operand *Operand);
174 template <typename T = Traits> 174 template <typename T = Traits>
175 typename std::enable_if<T::Is64Bit, Operand>::type *hiOperand(Operand *) { 175 typename std::enable_if<T::Is64Bit, Operand>::type *hiOperand(Operand *) {
176 llvm::report_fatal_error( 176 llvm::report_fatal_error(
177 "Hey, yo! This is x86-64. Watcha doin'? (hiOperand)"); 177 "Hey, yo! This is x86-64. Watcha doin'? (hiOperand)");
178 } 178 }
179 179
180 void addProlog(CfgNode *Node) override;
180 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, 181 void finishArgumentLowering(Variable *Arg, Variable *FramePtr,
181 size_t BasicFrameOffset, size_t StackAdjBytes, 182 size_t BasicFrameOffset, size_t StackAdjBytes,
182 size_t &InArgsSizeBytes); 183 size_t &InArgsSizeBytes);
184 void addEpilog(CfgNode *Node) override;
183 X86Address stackVarToAsmOperand(const Variable *Var) const; 185 X86Address stackVarToAsmOperand(const Variable *Var) const;
184 186
185 InstructionSetEnum getInstructionSet() const { return InstructionSet; } 187 InstructionSetEnum getInstructionSet() const { return InstructionSet; }
186 Operand *legalizeUndef(Operand *From, int32_t RegNum = Variable::NoRegister); 188 Operand *legalizeUndef(Operand *From, int32_t RegNum = Variable::NoRegister);
187 189
188 protected: 190 protected:
189 const bool NeedSandboxing; 191 const bool NeedSandboxing;
190 192
191 explicit TargetX86Base(Cfg *Func); 193 explicit TargetX86Base(Cfg *Func);
192 194
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 277
276 using LowerBinOp = void (TargetX86Base::*)(Variable *, Operand *); 278 using LowerBinOp = void (TargetX86Base::*)(Variable *, Operand *);
277 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, 279 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi,
278 Variable *Dest, Operand *Ptr, Operand *Val); 280 Variable *Dest, Operand *Ptr, Operand *Val);
279 281
280 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); 282 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult);
281 283
282 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, 284 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest,
283 Operand *Src0, Operand *Src1); 285 Operand *Src0, Operand *Src1);
284 286
287 void emitGetIP(CfgNode *Node) {
288 dispatchToConcrete(&Traits::ConcreteTarget::emitGetIP, std::move(Node));
289 }
290 /// Emit a sandboxed return sequence rather than a return.
291 virtual void emitSandboxedReturn() {
John 2016/01/21 15:04:52 is virtual needed here?
sehr 2016/01/21 16:02:10 Removed.
292 dispatchToConcrete(&Traits::ConcreteTarget::emitSandboxedReturn);
293 }
285 /// Emit just the call instruction (without argument or return variable 294 /// Emit just the call instruction (without argument or return variable
286 /// processing), sandboxing if needed. 295 /// processing), sandboxing if needed.
287 virtual Inst *emitCallToTarget(Operand *CallTarget, Variable *ReturnReg) = 0; 296 virtual Inst *emitCallToTarget(Operand *CallTarget, Variable *ReturnReg) = 0;
288 /// Materialize the moves needed to return a value of the specified type. 297 /// Materialize the moves needed to return a value of the specified type.
289 virtual Variable *moveReturnValueToRegister(Operand *Value, 298 virtual Variable *moveReturnValueToRegister(Operand *Value,
290 Type ReturnType) = 0; 299 Type ReturnType) = 0;
291 300
292 /// Emit a fake use of esp to make sure esp stays alive for the entire 301 /// Emit a fake use of esp to make sure esp stays alive for the entire
293 /// function. Otherwise some esp adjustments get dead-code eliminated. 302 /// function. Otherwise some esp adjustments get dead-code eliminated.
294 void keepEspLiveAtExit() { 303 void keepEspLiveAtExit() {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 AutoMemorySandboxer<> _(this, &Dest, &Src0, &Src1); 590 AutoMemorySandboxer<> _(this, &Dest, &Src0, &Src1);
582 Context.insert<typename Traits::Insts::Insertps>(Dest, Src0, Src1); 591 Context.insert<typename Traits::Insts::Insertps>(Dest, Src0, Src1);
583 } 592 }
584 void _jmp(Operand *Target) { 593 void _jmp(Operand *Target) {
585 AutoMemorySandboxer<> _(this, &Target); 594 AutoMemorySandboxer<> _(this, &Target);
586 Context.insert<typename Traits::Insts::Jmp>(Target); 595 Context.insert<typename Traits::Insts::Jmp>(Target);
587 } 596 }
588 void _lea(Variable *Dest, Operand *Src0) { 597 void _lea(Variable *Dest, Operand *Src0) {
589 Context.insert<typename Traits::Insts::Lea>(Dest, Src0); 598 Context.insert<typename Traits::Insts::Lea>(Dest, Src0);
590 } 599 }
600 void _link_bp() { dispatchToConcrete(&Traits::ConcreteTarget::_link_bp); }
601 void _push_reg(Variable *Reg) {
602 dispatchToConcrete(&Traits::ConcreteTarget::_push_reg, std::move(Reg));
603 }
591 void _mfence() { Context.insert<typename Traits::Insts::Mfence>(); } 604 void _mfence() { Context.insert<typename Traits::Insts::Mfence>(); }
592 /// Moves can be used to redefine registers, creating "partial kills" for 605 /// Moves can be used to redefine registers, creating "partial kills" for
593 /// liveness. Mark where moves are used in this way. 606 /// liveness. Mark where moves are used in this way.
594 void _redefined(Inst *MovInst, bool IsRedefinition = true) { 607 void _redefined(Inst *MovInst, bool IsRedefinition = true) {
595 if (IsRedefinition) 608 if (IsRedefinition)
596 MovInst->setDestRedefined(); 609 MovInst->setDestRedefined();
597 } 610 }
598 /// If Dest=nullptr is passed in, then a new variable is created, marked as 611 /// If Dest=nullptr is passed in, then a new variable is created, marked as
599 /// infinite register allocation weight, and returned through the in/out Dest 612 /// infinite register allocation weight, and returned through the in/out Dest
600 /// argument. 613 /// argument.
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 } 842 }
830 void _test(Operand *Src0, Operand *Src1) { 843 void _test(Operand *Src0, Operand *Src1) {
831 AutoMemorySandboxer<> _(this, &Src0, &Src1); 844 AutoMemorySandboxer<> _(this, &Src0, &Src1);
832 Context.insert<typename Traits::Insts::Test>(Src0, Src1); 845 Context.insert<typename Traits::Insts::Test>(Src0, Src1);
833 } 846 }
834 void _ucomiss(Operand *Src0, Operand *Src1) { 847 void _ucomiss(Operand *Src0, Operand *Src1) {
835 AutoMemorySandboxer<> _(this, &Src0, &Src1); 848 AutoMemorySandboxer<> _(this, &Src0, &Src1);
836 Context.insert<typename Traits::Insts::Ucomiss>(Src0, Src1); 849 Context.insert<typename Traits::Insts::Ucomiss>(Src0, Src1);
837 } 850 }
838 void _ud2() { Context.insert<typename Traits::Insts::UD2>(); } 851 void _ud2() { Context.insert<typename Traits::Insts::UD2>(); }
852 void _unlink_bp() { dispatchToConcrete(&Traits::ConcreteTarget::_unlink_bp); }
839 void _xadd(Operand *Dest, Variable *Src, bool Locked) { 853 void _xadd(Operand *Dest, Variable *Src, bool Locked) {
840 AutoMemorySandboxer<> _(this, &Dest, &Src); 854 AutoMemorySandboxer<> _(this, &Dest, &Src);
841 Context.insert<typename Traits::Insts::Xadd>(Dest, Src, Locked); 855 Context.insert<typename Traits::Insts::Xadd>(Dest, Src, Locked);
842 // The xadd exchanges Dest and Src (modifying Src). Model that update with 856 // The xadd exchanges Dest and Src (modifying Src). Model that update with
843 // a FakeDef followed by a FakeUse. 857 // a FakeDef followed by a FakeUse.
844 Context.insert<InstFakeDef>(Src, llvm::dyn_cast<Variable>(Dest)); 858 Context.insert<InstFakeDef>(Src, llvm::dyn_cast<Variable>(Dest));
845 _set_dest_redefined(); 859 _set_dest_redefined();
846 Context.insert<InstFakeUse>(Src); 860 Context.insert<InstFakeUse>(Src);
847 } 861 }
848 void _xchg(Operand *Dest, Variable *Src) { 862 void _xchg(Operand *Dest, Variable *Src) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 1019
1006 static FixupKind PcRelFixup; 1020 static FixupKind PcRelFixup;
1007 static FixupKind AbsFixup; 1021 static FixupKind AbsFixup;
1008 }; 1022 };
1009 } // end of namespace X86NAMESPACE 1023 } // end of namespace X86NAMESPACE
1010 } // end of namespace Ice 1024 } // end of namespace Ice
1011 1025
1012 #include "IceTargetLoweringX86BaseImpl.h" 1026 #include "IceTargetLoweringX86BaseImpl.h"
1013 1027
1014 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 1028 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698