diff options
| author | Nate Begeman <natebegeman@mac.com> | 2004-11-24 21:53:14 +0000 | 
|---|---|---|
| committer | Nate Begeman <natebegeman@mac.com> | 2004-11-24 21:53:14 +0000 | 
| commit | e49936af54f3124cf7247b247096255aab6d235d (patch) | |
| tree | 341996ac224cf89a19d3a560f289a657cde625d2 /llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | |
| parent | 078b6f2b6224fbe9cc316f50edca63bf1781b89e (diff) | |
| download | bcm5719-llvm-e49936af54f3124cf7247b247096255aab6d235d.tar.gz bcm5719-llvm-e49936af54f3124cf7247b247096255aab6d235d.zip | |
Add the same optimization that we do loading from fixed alloca slots to
storing to fixed alloca slots.
llvm-svn: 18221
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp')
| -rw-r--r-- | llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp index 9d23173777f..465f560266a 100644 --- a/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp +++ b/llvm/lib/Target/PowerPC/PPC32ISelSimple.cpp @@ -2989,6 +2989,8 @@ void PPC32ISel::visitLoadInst(LoadInst &I) {    if (Class == cShort && I.getType()->isSigned()) ImmOpcode = PPC::LHA;    if (Class == cShort && I.getType()->isSigned()) IdxOpcode = PPC::LHAX; +  // If this is a fixed size alloca, emit a load directly from the stack slot +  // corresponding to it.    if (AllocaInst *AI = dyn_castFixedAlloca(SourceAddr)) {      unsigned FI = getFixedSizedAllocaFI(AI);      if (Class == cLong) { @@ -3071,6 +3073,16 @@ void PPC32ISel::visitStoreInst(StoreInst &I) {    unsigned IdxOpcode = IdxOpcodes[Class];    unsigned ValReg    = getReg(I.getOperand(0)); +  // If this is a fixed size alloca, emit a store directly to the stack slot +  // corresponding to it. +  if (AllocaInst *AI = dyn_castFixedAlloca(SourceAddr)) { +    unsigned FI = getFixedSizedAllocaFI(AI); +    addFrameReference(BuildMI(BB, ImmOpcode, 3).addReg(ValReg), FI); +    if (Class == cLong) +      addFrameReference(BuildMI(BB, ImmOpcode, 3).addReg(ValReg+1), FI, 4); +    return; +  } +      // If the offset fits in 16 bits, we can emit a reg+imm store, otherwise, we    // use the index from the FoldedGEP struct and use reg+reg addressing.    if (GetElementPtrInst *GEPI = canFoldGEPIntoLoadOrStore(SourceAddr)) { | 

