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

Side by Side Diff: src/IceTargetLoweringX8632.h

Issue 460233002: Subzero: Randomize immediates by constant blinding or pooling. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Comments round 1 Created 6 years, 4 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
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 lowering ---*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringX8632.h - x86-32 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 // This file declares the TargetLoweringX8632 class, which 10 // This file declares the TargetLoweringX8632 class, which
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi, 121 void expandAtomicRMWAsCmpxchg(LowerBinOp op_lo, LowerBinOp op_hi,
122 Variable *Dest, Operand *Ptr, Operand *Val); 122 Variable *Dest, Operand *Ptr, Operand *Val);
123 123
124 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult); 124 void eliminateNextVectorSextInstruction(Variable *SignExtendedResult);
125 125
126 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, 126 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest,
127 Operand *Src0, Operand *Src1); 127 Operand *Src0, Operand *Src1);
128 128
129 void sortByAlignment(VarList &Dest, const VarList &Source) const; 129 void sortByAlignment(VarList &Dest, const VarList &Source) const;
130 130
131 Variable *randomizeImmediate(Constant *Immediate);
132
131 // Operand legalization helpers. To deal with address mode 133 // Operand legalization helpers. To deal with address mode
132 // constraints, the helpers will create a new Operand and emit 134 // constraints, the helpers will create a new Operand and emit
133 // instructions that guarantee that the Operand kind is one of those 135 // instructions that guarantee that the Operand kind is one of those
134 // indicated by the LegalMask (a bitmask of allowed kinds). If the 136 // indicated by the LegalMask (a bitmask of allowed kinds). If the
135 // input Operand is known to already meet the constraints, it may be 137 // input Operand is known to already meet the constraints, it may be
136 // simply returned as the result, without creating any new 138 // simply returned as the result, without creating any new
137 // instructions or operands. 139 // instructions or operands.
138 enum OperandLegalization { 140 enum OperandLegalization {
139 Legal_None = 0, 141 Legal_None = 0,
140 Legal_Reg = 1 << 0, // physical register, not stack location 142 Legal_Reg = 1 << 0, // physical register, not stack location
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 bool IsEbpBasedFrame; 466 bool IsEbpBasedFrame;
465 bool NeedsStackAlignment; 467 bool NeedsStackAlignment;
466 size_t FrameSizeLocals; 468 size_t FrameSizeLocals;
467 size_t SpillAreaSizeBytes; 469 size_t SpillAreaSizeBytes;
468 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; 470 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM];
469 llvm::SmallBitVector ScratchRegs; 471 llvm::SmallBitVector ScratchRegs;
470 llvm::SmallBitVector RegsUsed; 472 llvm::SmallBitVector RegsUsed;
471 SizeT NextLabelNumber; 473 SizeT NextLabelNumber;
472 bool ComputedLiveRanges; 474 bool ComputedLiveRanges;
473 VarList PhysicalRegisters; 475 VarList PhysicalRegisters;
476 bool ConstantBlindingCookieInitialized;
477 uint32_t ConstantBlindingCookie;
474 static IceString RegNames[]; 478 static IceString RegNames[];
475 479
476 private: 480 private:
477 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION; 481 TargetX8632(const TargetX8632 &) LLVM_DELETED_FUNCTION;
478 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION; 482 TargetX8632 &operator=(const TargetX8632 &) LLVM_DELETED_FUNCTION;
479 virtual ~TargetX8632() {} 483 virtual ~TargetX8632() {}
480 template <typename T> void emitConstantPool() const; 484 template <typename T> void emitConstantPool() const;
485 void emitPooledImmediates() const;
481 }; 486 };
482 487
483 class TargetGlobalInitX8632 : public TargetGlobalInitLowering { 488 class TargetGlobalInitX8632 : public TargetGlobalInitLowering {
484 public: 489 public:
485 static TargetGlobalInitLowering *create(GlobalContext *Ctx) { 490 static TargetGlobalInitLowering *create(GlobalContext *Ctx) {
486 return new TargetGlobalInitX8632(Ctx); 491 return new TargetGlobalInitX8632(Ctx);
487 } 492 }
488 virtual void lower(const IceString &Name, SizeT Align, bool IsInternal, 493 virtual void lower(const IceString &Name, SizeT Align, bool IsInternal,
489 bool IsConst, bool IsZeroInitializer, SizeT Size, 494 bool IsConst, bool IsZeroInitializer, SizeT Size,
490 const char *Data, bool DisableTranslation); 495 const char *Data, bool DisableTranslation);
491 496
492 protected: 497 protected:
493 TargetGlobalInitX8632(GlobalContext *Ctx); 498 TargetGlobalInitX8632(GlobalContext *Ctx);
494 499
495 private: 500 private:
496 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; 501 TargetGlobalInitX8632(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
497 TargetGlobalInitX8632 & 502 TargetGlobalInitX8632 &
498 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION; 503 operator=(const TargetGlobalInitX8632 &) LLVM_DELETED_FUNCTION;
499 virtual ~TargetGlobalInitX8632() {} 504 virtual ~TargetGlobalInitX8632() {}
500 }; 505 };
501 506
502 template <> void ConstantInteger::emit(GlobalContext *Ctx) const; 507 template <> void ConstantInteger::emit(GlobalContext *Ctx) const;
503 template <> void ConstantFloat::emit(GlobalContext *Ctx) const; 508 template <> void ConstantFloat::emit(GlobalContext *Ctx) const;
504 template <> void ConstantDouble::emit(GlobalContext *Ctx) const; 509 template <> void ConstantDouble::emit(GlobalContext *Ctx) const;
505 510
506 } // end of namespace Ice 511 } // end of namespace Ice
507 512
508 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H 513 #endif // SUBZERO_SRC_ICETARGETLOWERINGX8632_H
OLDNEW
« no previous file with comments | « src/IceGlobalContext.cpp ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698