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

Side by Side Diff: src/IceTargetLoweringX86BaseImpl.h

Issue 1206723003: Function Layout, Global Variable Layout and Pooled Constants Layout Reordering (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fixed some comments in patch set 1 Created 5 years, 5 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/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.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 // This file implements the TargetLoweringX86Base class, which 10 // This file implements the TargetLoweringX86Base class, which
(...skipping 3384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3395 Context.insert( 3395 Context.insert(
3396 InstFakeUse::create(Func, Context.getLastInserted()->getDest())); 3396 InstFakeUse::create(Func, Context.getLastInserted()->getDest()));
3397 return; 3397 return;
3398 } 3398 }
3399 case Intrinsics::AtomicRMW: 3399 case Intrinsics::AtomicRMW:
3400 if (!Intrinsics::isMemoryOrderValid( 3400 if (!Intrinsics::isMemoryOrderValid(
3401 ID, getConstantMemoryOrder(Instr->getArg(3)))) { 3401 ID, getConstantMemoryOrder(Instr->getArg(3)))) {
3402 Func->setError("Unexpected memory ordering for AtomicRMW"); 3402 Func->setError("Unexpected memory ordering for AtomicRMW");
3403 return; 3403 return;
3404 } 3404 }
3405 lowerAtomicRMW(Instr->getDest(), 3405 lowerAtomicRMW(
3406 static_cast<uint32_t>(llvm::cast<ConstantInteger32>( 3406 Instr->getDest(),
3407 Instr->getArg(0))->getValue()), 3407 static_cast<uint32_t>(
3408 Instr->getArg(1), Instr->getArg(2)); 3408 llvm::cast<ConstantInteger32>(Instr->getArg(0))->getValue()),
3409 Instr->getArg(1), Instr->getArg(2));
3409 return; 3410 return;
3410 case Intrinsics::AtomicStore: { 3411 case Intrinsics::AtomicStore: {
3411 if (!Intrinsics::isMemoryOrderValid( 3412 if (!Intrinsics::isMemoryOrderValid(
3412 ID, getConstantMemoryOrder(Instr->getArg(2)))) { 3413 ID, getConstantMemoryOrder(Instr->getArg(2)))) {
3413 Func->setError("Unexpected memory ordering for AtomicStore"); 3414 Func->setError("Unexpected memory ordering for AtomicStore");
3414 return; 3415 return;
3415 } 3416 }
3416 // We require the memory address to be naturally aligned. 3417 // We require the memory address to be naturally aligned.
3417 // Given that is the case, then normal stores are atomic. 3418 // Given that is the case, then normal stores are atomic.
3418 // Add a fence after the store to make it visible. 3419 // Add a fence after the store to make it visible.
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after
5403 // The offset of this mem operand should be blinded or pooled 5404 // The offset of this mem operand should be blinded or pooled
5404 Ctx->statsUpdateRPImms(); 5405 Ctx->statsUpdateRPImms();
5405 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == 5406 if (Ctx->getFlags().getRandomizeAndPoolImmediatesOption() ==
5406 RPI_Randomize) { 5407 RPI_Randomize) {
5407 // blind the constant offset 5408 // blind the constant offset
5408 // FROM: 5409 // FROM:
5409 // offset[base, index, shift] 5410 // offset[base, index, shift]
5410 // TO: 5411 // TO:
5411 // insert: lea offset+cookie[base], RegTemp 5412 // insert: lea offset+cookie[base], RegTemp
5412 // => -cookie[RegTemp, index, shift] 5413 // => -cookie[RegTemp, index, shift]
5413 uint32_t Value = llvm::dyn_cast<ConstantInteger32>( 5414 uint32_t Value =
5414 MemOperand->getOffset())->getValue(); 5415 llvm::dyn_cast<ConstantInteger32>(MemOperand->getOffset())
5416 ->getValue();
5415 uint32_t Cookie = Ctx->getRandomizationCookie(); 5417 uint32_t Cookie = Ctx->getRandomizationCookie();
5416 Constant *Mask1 = Ctx->getConstantInt( 5418 Constant *Mask1 = Ctx->getConstantInt(
5417 MemOperand->getOffset()->getType(), Cookie + Value); 5419 MemOperand->getOffset()->getType(), Cookie + Value);
5418 Constant *Mask2 = 5420 Constant *Mask2 =
5419 Ctx->getConstantInt(MemOperand->getOffset()->getType(), 0 - Cookie); 5421 Ctx->getConstantInt(MemOperand->getOffset()->getType(), 0 - Cookie);
5420 5422
5421 OperandX8632Mem *TempMemOperand = OperandX8632Mem::create( 5423 OperandX8632Mem *TempMemOperand = OperandX8632Mem::create(
5422 Func, MemOperand->getType(), MemOperand->getBase(), Mask1); 5424 Func, MemOperand->getType(), MemOperand->getBase(), Mask1);
5423 // If we have already assigned a physical register, we must come from 5425 // If we have already assigned a physical register, we must come from
5424 // advancedPhiLowering()=>lowerAssign(). In this case we should reuse 5426 // advancedPhiLowering()=>lowerAssign(). In this case we should reuse
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5494 } 5496 }
5495 // the offset is not eligible for blinding or pooling, return the original 5497 // the offset is not eligible for blinding or pooling, return the original
5496 // mem operand 5498 // mem operand
5497 return MemOperand; 5499 return MemOperand;
5498 } 5500 }
5499 5501
5500 } // end of namespace X86Internal 5502 } // end of namespace X86Internal
5501 } // end of namespace Ice 5503 } // end of namespace Ice
5502 5504
5503 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H 5505 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698