Index: src/IceTargetLoweringX8664.h |
diff --git a/src/IceTargetLoweringX8664.h b/src/IceTargetLoweringX8664.h |
index 791343ac482a442d6b206513d52e1f35d25ae066..718f1c5952adfc70a7055b90cb6f3c37650ead25 100644 |
--- a/src/IceTargetLoweringX8664.h |
+++ b/src/IceTargetLoweringX8664.h |
@@ -16,22 +16,48 @@ |
#ifndef SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
#define SUBZERO_SRC_ICETARGETLOWERINGX8664_H |
+#include "IceAssemblerX8664.h" |
#include "IceCfg.h" |
#include "IceGlobalContext.h" |
+#include "IceInstX8664.h" |
#include "IceTargetLowering.h" |
+#include "IceTargetLoweringX8664Traits.h" |
+#include "IceTargetLoweringX86Base.h" |
namespace Ice { |
-class TargetX8664 : public TargetLowering { |
+class TargetX8664 final : public ::Ice::X86Internal::TargetX86Base<TargetX8664> { |
TargetX8664() = delete; |
TargetX8664(const TargetX8664 &) = delete; |
TargetX8664 &operator=(const TargetX8664 &) = delete; |
public: |
- static TargetX8664 *create(Cfg *Func); |
+ static TargetX8664 *create(Cfg *Func) { return new TargetX8664(Func); } |
private: |
- explicit TargetX8664(Cfg *Func) : TargetLowering(Func) {} |
+ friend class ::Ice::X86Internal::TargetX86Base<TargetX8664>; |
+ |
+ explicit TargetX8664(Cfg *Func) : ::Ice::X86Internal::TargetX86Base<TargetX8664>(Func) {} |
+ |
+ Operand *createNaClReadTPSrcOperand() { |
+ Variable *TDB = callNaClReadTp(); |
+ Variable *RZP = materializeRZP(); |
+ Constant *TPOffset = Ctx->getConstantInt8(0x20); |
+ return Traits::X86OperandMem::create(Func, IceType_i32, RZP, TPOffset, TDB); |
+ } |
+ |
+ Variable *callNaClReadTp() { |
+ Variable *TDB = makeReg(IceType_i32); |
+ InstCall *Call = makeHelperCall(H_call_read_tp, TDB, 0); |
+ lowerCall(Call); |
+ return TDB; |
+ } |
+ |
+ Variable *materializeRZP() { |
+ Variable *RZP = makeReg(IceType_i32, Traits::RegisterSet::Reg_r15d); |
+ Context.insert(InstFakeDef::create(Func, RZP)); |
+ return RZP; |
+ } |
}; |
class TargetDataX8664 : public TargetDataLowering { |
@@ -55,6 +81,7 @@ private: |
ENABLE_MAKE_UNIQUE; |
explicit TargetDataX8664(GlobalContext *Ctx) : TargetDataLowering(Ctx) {} |
+ template <typename T> static void emitConstantPool(GlobalContext *Ctx); |
}; |
class TargetHeaderX8664 : public TargetHeaderLowering { |