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

Side by Side Diff: src/IceTargetLoweringX86Base.h

Issue 1616673004: Merge x86 data and header lowering (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Small syntactic commonality. 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void emitSandboxedReturn() { 291 void emitSandboxedReturn() {
292 dispatchToConcrete(&Traits::ConcreteTarget::emitSandboxedReturn); 292 dispatchToConcrete(&Traits::ConcreteTarget::emitSandboxedReturn);
293 } 293 }
294 /// Emit just the call instruction (without argument or return variable 294 /// Emit just the call instruction (without argument or return variable
295 /// processing), sandboxing if needed. 295 /// processing), sandboxing if needed.
296 virtual Inst *emitCallToTarget(Operand *CallTarget, Variable *ReturnReg) = 0; 296 virtual Inst *emitCallToTarget(Operand *CallTarget, Variable *ReturnReg) = 0;
297 /// 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.
298 virtual Variable *moveReturnValueToRegister(Operand *Value, 298 virtual Variable *moveReturnValueToRegister(Operand *Value,
299 Type ReturnType) = 0; 299 Type ReturnType) = 0;
300 300
301 /// Emit a jump table to the constant pool.
302 void emitJumpTable(const Cfg *Func,
303 const InstJumpTable *JumpTable) const override;
304
301 /// Emit a fake use of esp to make sure esp stays alive for the entire 305 /// Emit a fake use of esp to make sure esp stays alive for the entire
302 /// function. Otherwise some esp adjustments get dead-code eliminated. 306 /// function. Otherwise some esp adjustments get dead-code eliminated.
303 void keepEspLiveAtExit() { 307 void keepEspLiveAtExit() {
304 Variable *esp = 308 Variable *esp =
305 Func->getTarget()->getPhysicalRegister(getStackReg(), Traits::WordType); 309 Func->getTarget()->getPhysicalRegister(getStackReg(), Traits::WordType);
306 Context.insert<InstFakeUse>(esp); 310 Context.insert<InstFakeUse>(esp);
307 } 311 }
308 312
309 /// Operand legalization helpers. To deal with address mode constraints, the 313 /// Operand legalization helpers. To deal with address mode constraints, the
310 /// helpers will create a new Operand and emit instructions that guarantee 314 /// helpers will create a new Operand and emit instructions that guarantee
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 /// x86lowerIcmp64 handles 64-bit icmp lowering. 1017 /// x86lowerIcmp64 handles 64-bit icmp lowering.
1014 template <typename T = Traits> 1018 template <typename T = Traits>
1015 typename std::enable_if<!T::Is64Bit, void>::type 1019 typename std::enable_if<!T::Is64Bit, void>::type
1016 lowerIcmp64(const InstIcmp *Icmp, const Inst *Consumer); 1020 lowerIcmp64(const InstIcmp *Icmp, const Inst *Consumer);
1017 1021
1018 BoolFolding<Traits> FoldingInfo; 1022 BoolFolding<Traits> FoldingInfo;
1019 1023
1020 static FixupKind PcRelFixup; 1024 static FixupKind PcRelFixup;
1021 static FixupKind AbsFixup; 1025 static FixupKind AbsFixup;
1022 }; 1026 };
1027
1028 template <typename TraitsType>
1029 class TargetDataX86 final : public TargetDataLowering {
1030 using Traits = TraitsType;
1031 TargetDataX86() = delete;
1032 TargetDataX86(const TargetDataX86 &) = delete;
1033 TargetDataX86 &operator=(const TargetDataX86 &) = delete;
1034
1035 public:
1036 ~TargetDataX86() override = default;
1037
1038 static std::unique_ptr<TargetDataLowering> create(GlobalContext *Ctx) {
1039 return makeUnique<TargetDataX86>(Ctx);
1040 }
1041
1042 void lowerGlobals(const VariableDeclarationList &Vars,
1043 const IceString &SectionSuffix) override;
1044 void lowerConstants() override;
1045 void lowerJumpTables() override;
1046
1047 private:
1048 ENABLE_MAKE_UNIQUE;
1049
1050 explicit TargetDataX86(GlobalContext *Ctx) : TargetDataLowering(Ctx){};
1051 template <typename T> static void emitConstantPool(GlobalContext *Ctx);
1052 };
1053
1054 class TargetHeaderX86 : public TargetHeaderLowering {
1055 TargetHeaderX86() = delete;
1056 TargetHeaderX86(const TargetHeaderX86 &) = delete;
1057 TargetHeaderX86 &operator=(const TargetHeaderX86 &) = delete;
1058
1059 public:
1060 ~TargetHeaderX86() = default;
1061
1062 static std::unique_ptr<TargetHeaderLowering> create(GlobalContext *Ctx) {
1063 return makeUnique<TargetHeaderX86>(Ctx);
1064 }
1065
1066 private:
1067 ENABLE_MAKE_UNIQUE;
1068
1069 explicit TargetHeaderX86(GlobalContext *Ctx) : TargetHeaderLowering(Ctx) {}
1070 };
1071
1023 } // end of namespace X86NAMESPACE 1072 } // end of namespace X86NAMESPACE
1024 } // end of namespace Ice 1073 } // end of namespace Ice
1025 1074
1026 #include "IceTargetLoweringX86BaseImpl.h" 1075 #include "IceTargetLoweringX86BaseImpl.h"
1027 1076
1028 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H 1077 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698