When we want a constant, just use it, instead of calling through layers of

virtual methods and register name mapping functions


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15690 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-08-12 17:56:01 +00:00
parent 648bc14747
commit 6845dfe07e
3 changed files with 10 additions and 10 deletions

View File

@ -19,6 +19,8 @@
#include "SparcV9InstrForest.h" #include "SparcV9InstrForest.h"
#include "SparcV9Internals.h" #include "SparcV9Internals.h"
#include "SparcV9TmpInstr.h" #include "SparcV9TmpInstr.h"
#include "SparcV9FrameInfo.h"
#include "SparcV9RegisterInfo.h"
#include "llvm/CodeGen/IntrinsicLowering.h" #include "llvm/CodeGen/IntrinsicLowering.h"
#include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunction.h"
@ -2779,13 +2781,11 @@ static bool CodeGenIntrinsic(Intrinsic::ID iid, CallInst &callInstr,
assert(0 && "Unknown intrinsic function call should have been lowered!"); assert(0 && "Unknown intrinsic function call should have been lowered!");
case Intrinsic::vastart: { case Intrinsic::vastart: {
// Get the address of the first incoming vararg argument on the stack // Get the address of the first incoming vararg argument on the stack
bool ignore;
Function* func = cast<Function>(callInstr.getParent()->getParent()); Function* func = cast<Function>(callInstr.getParent()->getParent());
int numFixedArgs = func->getFunctionType()->getNumParams(); int numFixedArgs = func->getFunctionType()->getNumParams();
int fpReg = target.getFrameInfo()->getIncomingArgBaseRegNum(); int fpReg = SparcV9::i6;
int argSize = target.getFrameInfo()->getSizeOfEachArgOnStack(); int firstVarArgOff = numFixedArgs * 8 +
int firstVarArgOff = numFixedArgs * argSize + target.getFrameInfo()-> SparcV9FrameInfo::FirstIncomingArgOffsetFromFP;
getFirstIncomingArgOffset(MachineFunction::get(func), ignore);
mvec.push_back(BuildMI(V9::ADDi, 3).addMReg(fpReg).addSImm(firstVarArgOff). mvec.push_back(BuildMI(V9::ADDi, 3).addMReg(fpReg).addSImm(firstVarArgOff).
addRegDef(&callInstr)); addRegDef(&callInstr));
return true; return true;

View File

@ -112,7 +112,6 @@ public:
return growUp ? firstArg + relativeOffset : firstArg - relativeOffset; return growUp ? firstArg + relativeOffset : firstArg - relativeOffset;
} }
private:
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
This diagram shows the stack frame layout used by llc on SparcV9 V9. This diagram shows the stack frame layout used by llc on SparcV9 V9.
Note that only the location of automatic variables, spill area, Note that only the location of automatic variables, spill area,

View File

@ -18,6 +18,8 @@
#include "SparcV9Internals.h" #include "SparcV9Internals.h"
#include "SparcV9RegClassInfo.h" #include "SparcV9RegClassInfo.h"
#include "SparcV9RegisterInfo.h"
#include "SparcV9FrameInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineFunctionInfo.h" #include "llvm/CodeGen/MachineFunctionInfo.h"
#include "llvm/CodeGen/MachineCodeForInstruction.h" #include "llvm/CodeGen/MachineCodeForInstruction.h"
@ -123,13 +125,12 @@ void InsertPrologEpilogCode::InsertPrologCode(MachineFunction &MF)
int numArgRegs = TM.getRegInfo()->getNumOfIntArgRegs(); int numArgRegs = TM.getRegInfo()->getNumOfIntArgRegs();
if (numFixedArgs < numArgRegs) { if (numFixedArgs < numArgRegs) {
const TargetFrameInfo &FI = *TM.getFrameInfo(); const TargetFrameInfo &FI = *TM.getFrameInfo();
bool ignore;
int firstArgReg = TM.getRegInfo()->getUnifiedRegNum( int firstArgReg = TM.getRegInfo()->getUnifiedRegNum(
TM.getRegInfo()->getRegClassIDOfType(Type::IntTy), TM.getRegInfo()->getRegClassIDOfType(Type::IntTy),
SparcV9IntRegClass::i0); SparcV9IntRegClass::i0);
int fpReg = FI.getIncomingArgBaseRegNum(); int fpReg = SparcV9::i6;
int argSize = FI.getSizeOfEachArgOnStack(); int argSize = 8;
int firstArgOffset= FI.getFirstIncomingArgOffset(MF,ignore); int firstArgOffset= SparcV9FrameInfo::FirstIncomingArgOffsetFromFP;
int nextArgOffset = firstArgOffset + numFixedArgs * argSize; int nextArgOffset = firstArgOffset + numFixedArgs * argSize;
for (int i=numFixedArgs; i < numArgRegs; ++i) { for (int i=numFixedArgs; i < numArgRegs; ++i) {