diff options
author | Brian Gaeke <gaeke@uiuc.edu> | 2004-06-18 08:45:52 +0000 |
---|---|---|
committer | Brian Gaeke <gaeke@uiuc.edu> | 2004-06-18 08:45:52 +0000 |
commit | cfaf22445cb3293af4503df06fc2ce6ede284652 (patch) | |
tree | 92c146abc0f24970487cfce3f2a609a3360b1718 /lib | |
parent | 4f217fdd10df91b8beefb1c86591597b43b769f6 (diff) | |
download | external_llvm-cfaf22445cb3293af4503df06fc2ce6ede284652.zip external_llvm-cfaf22445cb3293af4503df06fc2ce6ede284652.tar.gz external_llvm-cfaf22445cb3293af4503df06fc2ce6ede284652.tar.bz2 |
Make visitAllocaInst() look more like its X86 counterpart.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/Sparc/InstSelectSimple.cpp | 14 | ||||
-rw-r--r-- | lib/Target/Sparc/SparcV8ISelSimple.cpp | 14 | ||||
-rw-r--r-- | lib/Target/SparcV8/InstSelectSimple.cpp | 14 | ||||
-rw-r--r-- | lib/Target/SparcV8/SparcV8ISelSimple.cpp | 14 |
4 files changed, 44 insertions, 12 deletions
diff --git a/lib/Target/Sparc/InstSelectSimple.cpp b/lib/Target/Sparc/InstSelectSimple.cpp index e86e25b9..1bfd4da 100644 --- a/lib/Target/Sparc/InstSelectSimple.cpp +++ b/lib/Target/Sparc/InstSelectSimple.cpp @@ -905,16 +905,24 @@ void V8ISel::visitAllocaInst(AllocaInst &I) { unsigned TmpReg1 = makeAnotherReg (Type::UIntTy); unsigned TmpReg2 = makeAnotherReg (Type::UIntTy); unsigned StackAdjReg = makeAnotherReg (Type::UIntTy); - unsigned DestReg = getReg (I); // StackAdjReg = (ArraySize * TySize) rounded up to nearest doubleword boundary BuildMI (BB, V8::UMULrr, 2, TmpReg1).addReg (ArraySizeReg).addReg (TySizeReg); + // Round up TmpReg1 to nearest doubleword boundary: BuildMI (BB, V8::ADDri, 2, TmpReg2).addReg (TmpReg1).addSImm (7); BuildMI (BB, V8::ANDri, 2, StackAdjReg).addReg (TmpReg2).addSImm (-8); - // Adjust stack, push pointer past trap frame space, put result in DestReg + + // Subtract size from stack pointer, thereby allocating some space. BuildMI (BB, V8::SUBrr, 2, V8::SP).addReg (V8::SP).addReg (StackAdjReg); - BuildMI (BB, V8::ADDri, 2, DestReg).addReg (V8::SP).addSImm (96); + + // Put a pointer to the space into the result register, by copying + // the stack pointer. + BuildMI (BB, V8::ADDri, 2, getReg(I)).addReg (V8::SP).addSImm (96); + + // Inform the Frame Information that we have just allocated a variable-sized + // object. + F->getFrameInfo()->CreateVariableSizedObject(); } /// LowerUnknownIntrinsicFunctionCalls - This performs a prepass over the diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp index e86e25b9..1bfd4da 100644 --- a/lib/Target/Sparc/SparcV8ISelSimple.cpp +++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp @@ -905,16 +905,24 @@ void V8ISel::visitAllocaInst(AllocaInst &I) { unsigned TmpReg1 = makeAnotherReg (Type::UIntTy); unsigned TmpReg2 = makeAnotherReg (Type::UIntTy); unsigned StackAdjReg = makeAnotherReg (Type::UIntTy); - unsigned DestReg = getReg (I); // StackAdjReg = (ArraySize * TySize) rounded up to nearest doubleword boundary BuildMI (BB, V8::UMULrr, 2, TmpReg1).addReg (ArraySizeReg).addReg (TySizeReg); + // Round up TmpReg1 to nearest doubleword boundary: BuildMI (BB, V8::ADDri, 2, TmpReg2).addReg (TmpReg1).addSImm (7); BuildMI (BB, V8::ANDri, 2, StackAdjReg).addReg (TmpReg2).addSImm (-8); - // Adjust stack, push pointer past trap frame space, put result in DestReg + + // Subtract size from stack pointer, thereby allocating some space. BuildMI (BB, V8::SUBrr, 2, V8::SP).addReg (V8::SP).addReg (StackAdjReg); - BuildMI (BB, V8::ADDri, 2, DestReg).addReg (V8::SP).addSImm (96); + + // Put a pointer to the space into the result register, by copying + // the stack pointer. + BuildMI (BB, V8::ADDri, 2, getReg(I)).addReg (V8::SP).addSImm (96); + + // Inform the Frame Information that we have just allocated a variable-sized + // object. + F->getFrameInfo()->CreateVariableSizedObject(); } /// LowerUnknownIntrinsicFunctionCalls - This performs a prepass over the diff --git a/lib/Target/SparcV8/InstSelectSimple.cpp b/lib/Target/SparcV8/InstSelectSimple.cpp index e86e25b9..1bfd4da 100644 --- a/lib/Target/SparcV8/InstSelectSimple.cpp +++ b/lib/Target/SparcV8/InstSelectSimple.cpp @@ -905,16 +905,24 @@ void V8ISel::visitAllocaInst(AllocaInst &I) { unsigned TmpReg1 = makeAnotherReg (Type::UIntTy); unsigned TmpReg2 = makeAnotherReg (Type::UIntTy); unsigned StackAdjReg = makeAnotherReg (Type::UIntTy); - unsigned DestReg = getReg (I); // StackAdjReg = (ArraySize * TySize) rounded up to nearest doubleword boundary BuildMI (BB, V8::UMULrr, 2, TmpReg1).addReg (ArraySizeReg).addReg (TySizeReg); + // Round up TmpReg1 to nearest doubleword boundary: BuildMI (BB, V8::ADDri, 2, TmpReg2).addReg (TmpReg1).addSImm (7); BuildMI (BB, V8::ANDri, 2, StackAdjReg).addReg (TmpReg2).addSImm (-8); - // Adjust stack, push pointer past trap frame space, put result in DestReg + + // Subtract size from stack pointer, thereby allocating some space. BuildMI (BB, V8::SUBrr, 2, V8::SP).addReg (V8::SP).addReg (StackAdjReg); - BuildMI (BB, V8::ADDri, 2, DestReg).addReg (V8::SP).addSImm (96); + + // Put a pointer to the space into the result register, by copying + // the stack pointer. + BuildMI (BB, V8::ADDri, 2, getReg(I)).addReg (V8::SP).addSImm (96); + + // Inform the Frame Information that we have just allocated a variable-sized + // object. + F->getFrameInfo()->CreateVariableSizedObject(); } /// LowerUnknownIntrinsicFunctionCalls - This performs a prepass over the diff --git a/lib/Target/SparcV8/SparcV8ISelSimple.cpp b/lib/Target/SparcV8/SparcV8ISelSimple.cpp index e86e25b9..1bfd4da 100644 --- a/lib/Target/SparcV8/SparcV8ISelSimple.cpp +++ b/lib/Target/SparcV8/SparcV8ISelSimple.cpp @@ -905,16 +905,24 @@ void V8ISel::visitAllocaInst(AllocaInst &I) { unsigned TmpReg1 = makeAnotherReg (Type::UIntTy); unsigned TmpReg2 = makeAnotherReg (Type::UIntTy); unsigned StackAdjReg = makeAnotherReg (Type::UIntTy); - unsigned DestReg = getReg (I); // StackAdjReg = (ArraySize * TySize) rounded up to nearest doubleword boundary BuildMI (BB, V8::UMULrr, 2, TmpReg1).addReg (ArraySizeReg).addReg (TySizeReg); + // Round up TmpReg1 to nearest doubleword boundary: BuildMI (BB, V8::ADDri, 2, TmpReg2).addReg (TmpReg1).addSImm (7); BuildMI (BB, V8::ANDri, 2, StackAdjReg).addReg (TmpReg2).addSImm (-8); - // Adjust stack, push pointer past trap frame space, put result in DestReg + + // Subtract size from stack pointer, thereby allocating some space. BuildMI (BB, V8::SUBrr, 2, V8::SP).addReg (V8::SP).addReg (StackAdjReg); - BuildMI (BB, V8::ADDri, 2, DestReg).addReg (V8::SP).addSImm (96); + + // Put a pointer to the space into the result register, by copying + // the stack pointer. + BuildMI (BB, V8::ADDri, 2, getReg(I)).addReg (V8::SP).addSImm (96); + + // Inform the Frame Information that we have just allocated a variable-sized + // object. + F->getFrameInfo()->CreateVariableSizedObject(); } /// LowerUnknownIntrinsicFunctionCalls - This performs a prepass over the |