forked from OSchip/llvm-project
parent
36c6bc1bf4
commit
fd8c2265fa
|
@ -273,7 +273,7 @@ void V8Printer::emitGlobalConstant(const Constant *CV) {
|
||||||
} else if (isa<ConstantAggregateZero> (CV)) {
|
} else if (isa<ConstantAggregateZero> (CV)) {
|
||||||
unsigned size = TD.getTypeSize (CV->getType ());
|
unsigned size = TD.getTypeSize (CV->getType ());
|
||||||
for (unsigned i = 0; i < size; ++i)
|
for (unsigned i = 0; i < size; ++i)
|
||||||
O << "\t.byte 0\n";
|
O << "\t.byte 0\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +362,7 @@ bool V8Printer::runOnMachineFunction(MachineFunction &MF) {
|
||||||
<< "_" << I->getNumber () << ":\t! "
|
<< "_" << I->getNumber () << ":\t! "
|
||||||
<< I->getBasicBlock ()->getName () << "\n";
|
<< I->getBasicBlock ()->getName () << "\n";
|
||||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||||
II != E; ++II) {
|
II != E; ++II) {
|
||||||
// Print the assembly for the instruction.
|
// Print the assembly for the instruction.
|
||||||
O << "\t";
|
O << "\t";
|
||||||
printMachineInstruction(II);
|
printMachineInstruction(II);
|
||||||
|
|
|
@ -876,23 +876,27 @@ void V8ISel::visitCallInst(CallInst &I) {
|
||||||
if (getClassB (I.getOperand (i)->getType ()) < cLong) {
|
if (getClassB (I.getOperand (i)->getType ()) < cLong) {
|
||||||
// Schlep it over into the incoming arg register
|
// Schlep it over into the incoming arg register
|
||||||
if (ArgOffset < 92) {
|
if (ArgOffset < 92) {
|
||||||
assert (OAR != OAREnd && "About to dereference past end of OutgoingArgRegs");
|
assert (OAR != OAREnd &&
|
||||||
BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0).addReg (ArgReg);
|
"About to dereference past end of OutgoingArgRegs");
|
||||||
|
BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0).addReg (ArgReg);
|
||||||
} else {
|
} else {
|
||||||
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset).addReg (ArgReg);
|
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset)
|
||||||
|
.addReg (ArgReg);
|
||||||
}
|
}
|
||||||
ArgOffset += 4;
|
ArgOffset += 4;
|
||||||
} else if (getClassB (I.getOperand (i)->getType ()) == cFloat) {
|
} else if (getClassB (I.getOperand (i)->getType ()) == cFloat) {
|
||||||
if (ArgOffset < 92) {
|
if (ArgOffset < 92) {
|
||||||
// Single-fp args are passed in integer registers; go through
|
// Single-fp args are passed in integer registers; go through
|
||||||
// memory to get them out of FP registers. (Bleh!)
|
// memory to get them out of FP registers. (Bleh!)
|
||||||
unsigned FltAlign = TM.getTargetData().getFloatAlignment();
|
unsigned FltAlign = TM.getTargetData().getFloatAlignment();
|
||||||
int FI = F->getFrameInfo()->CreateStackObject(4, FltAlign);
|
int FI = F->getFrameInfo()->CreateStackObject(4, FltAlign);
|
||||||
BuildMI (BB, V8::STFri, 3).addFrameIndex (FI).addSImm (0).addReg (ArgReg);
|
BuildMI (BB, V8::STFri, 3).addFrameIndex(FI).addSImm(0).addReg(ArgReg);
|
||||||
assert (OAR != OAREnd && "About to dereference past end of OutgoingArgRegs");
|
assert (OAR != OAREnd &&
|
||||||
BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI).addSImm (0);
|
"About to dereference past end of OutgoingArgRegs");
|
||||||
|
BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI).addSImm (0);
|
||||||
} else {
|
} else {
|
||||||
BuildMI (BB, V8::STFri, 3).addReg (V8::SP).addSImm (ArgOffset).addReg (ArgReg);
|
BuildMI (BB, V8::STFri, 3).addReg (V8::SP).addSImm (ArgOffset)
|
||||||
|
.addReg (ArgReg);
|
||||||
}
|
}
|
||||||
ArgOffset += 4;
|
ArgOffset += 4;
|
||||||
} else if (getClassB (I.getOperand (i)->getType ()) == cDouble) {
|
} else if (getClassB (I.getOperand (i)->getType ()) == cDouble) {
|
||||||
|
@ -904,38 +908,46 @@ void V8ISel::visitCallInst(CallInst &I) {
|
||||||
int FI = F->getFrameInfo()->CreateStackObject(8, DblAlign);
|
int FI = F->getFrameInfo()->CreateStackObject(8, DblAlign);
|
||||||
BuildMI (BB, V8::STDFri, 3).addFrameIndex (FI).addSImm (0).addReg (ArgReg);
|
BuildMI (BB, V8::STDFri, 3).addFrameIndex (FI).addSImm (0).addReg (ArgReg);
|
||||||
if (ArgOffset < 92 && OAR != OAREnd) {
|
if (ArgOffset < 92 && OAR != OAREnd) {
|
||||||
assert (OAR != OAREnd && "About to dereference past end of OutgoingArgRegs");
|
assert (OAR != OAREnd &&
|
||||||
BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI).addSImm (0);
|
"About to dereference past end of OutgoingArgRegs");
|
||||||
|
BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI).addSImm (0);
|
||||||
} else {
|
} else {
|
||||||
unsigned TempReg = makeAnotherReg (Type::IntTy);
|
unsigned TempReg = makeAnotherReg (Type::IntTy);
|
||||||
BuildMI (BB, V8::LD, 2, TempReg).addFrameIndex (FI).addSImm (0);
|
BuildMI (BB, V8::LD, 2, TempReg).addFrameIndex (FI).addSImm (0);
|
||||||
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset).addReg (TempReg);
|
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset)
|
||||||
|
.addReg (TempReg);
|
||||||
}
|
}
|
||||||
ArgOffset += 4;
|
ArgOffset += 4;
|
||||||
if (ArgOffset < 92 && OAR != OAREnd) {
|
if (ArgOffset < 92 && OAR != OAREnd) {
|
||||||
assert (OAR != OAREnd && "About to dereference past end of OutgoingArgRegs");
|
assert (OAR != OAREnd &&
|
||||||
BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI).addSImm (4);
|
"About to dereference past end of OutgoingArgRegs");
|
||||||
|
BuildMI (BB, V8::LD, 2, *OAR++).addFrameIndex (FI).addSImm (4);
|
||||||
} else {
|
} else {
|
||||||
unsigned TempReg = makeAnotherReg (Type::IntTy);
|
unsigned TempReg = makeAnotherReg (Type::IntTy);
|
||||||
BuildMI (BB, V8::LD, 2, TempReg).addFrameIndex (FI).addSImm (4);
|
BuildMI (BB, V8::LD, 2, TempReg).addFrameIndex (FI).addSImm (4);
|
||||||
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset).addReg (TempReg);
|
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset)
|
||||||
|
.addReg (TempReg);
|
||||||
}
|
}
|
||||||
ArgOffset += 4;
|
ArgOffset += 4;
|
||||||
} else if (getClassB (I.getOperand (i)->getType ()) == cLong) {
|
} else if (getClassB (I.getOperand (i)->getType ()) == cLong) {
|
||||||
// do the first half...
|
// do the first half...
|
||||||
if (ArgOffset < 92) {
|
if (ArgOffset < 92) {
|
||||||
assert (OAR != OAREnd && "About to dereference past end of OutgoingArgRegs");
|
assert (OAR != OAREnd &&
|
||||||
BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0).addReg (ArgReg);
|
"About to dereference past end of OutgoingArgRegs");
|
||||||
|
BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0).addReg (ArgReg);
|
||||||
} else {
|
} else {
|
||||||
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset).addReg (ArgReg);
|
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset)
|
||||||
|
.addReg (ArgReg);
|
||||||
}
|
}
|
||||||
ArgOffset += 4;
|
ArgOffset += 4;
|
||||||
// ...then do the second half
|
// ...then do the second half
|
||||||
if (ArgOffset < 92) {
|
if (ArgOffset < 92) {
|
||||||
assert (OAR != OAREnd && "About to dereference past end of OutgoingArgRegs");
|
assert (OAR != OAREnd &&
|
||||||
BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0).addReg (ArgReg+1);
|
"About to dereference past end of OutgoingArgRegs");
|
||||||
|
BuildMI (BB, V8::ORrr, 2, *OAR++).addReg (V8::G0).addReg (ArgReg+1);
|
||||||
} else {
|
} else {
|
||||||
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset).addReg (ArgReg+1);
|
BuildMI (BB, V8::ST, 3).addReg (V8::SP).addSImm (ArgOffset)
|
||||||
|
.addReg (ArgReg+1);
|
||||||
}
|
}
|
||||||
ArgOffset += 4;
|
ArgOffset += 4;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1111,8 +1123,8 @@ void V8ISel::visitBranchInst(BranchInst &I) {
|
||||||
///
|
///
|
||||||
void V8ISel::emitGEPOperation (MachineBasicBlock *MBB,
|
void V8ISel::emitGEPOperation (MachineBasicBlock *MBB,
|
||||||
MachineBasicBlock::iterator IP,
|
MachineBasicBlock::iterator IP,
|
||||||
Value *Src, User::op_iterator IdxBegin,
|
Value *Src, User::op_iterator IdxBegin,
|
||||||
User::op_iterator IdxEnd, unsigned TargetReg) {
|
User::op_iterator IdxEnd, unsigned TargetReg) {
|
||||||
const TargetData &TD = TM.getTargetData ();
|
const TargetData &TD = TM.getTargetData ();
|
||||||
const Type *Ty = Src->getType ();
|
const Type *Ty = Src->getType ();
|
||||||
unsigned basePtrReg = getReg (Src, MBB, IP);
|
unsigned basePtrReg = getReg (Src, MBB, IP);
|
||||||
|
@ -1776,13 +1788,13 @@ void V8ISel::visitVAArgInst (VAArgInst &I) {
|
||||||
case Type::PointerTyID:
|
case Type::PointerTyID:
|
||||||
case Type::UIntTyID:
|
case Type::UIntTyID:
|
||||||
case Type::IntTyID:
|
case Type::IntTyID:
|
||||||
BuildMI (BB, V8::LD, 2, DestReg).addReg (VAList).addSImm (0);
|
BuildMI (BB, V8::LD, 2, DestReg).addReg (VAList).addSImm (0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Type::ULongTyID:
|
case Type::ULongTyID:
|
||||||
case Type::LongTyID:
|
case Type::LongTyID:
|
||||||
BuildMI (BB, V8::LD, 2, DestReg).addReg (VAList).addSImm (0);
|
BuildMI (BB, V8::LD, 2, DestReg).addReg (VAList).addSImm (0);
|
||||||
BuildMI (BB, V8::LD, 2, DestReg+1).addReg (VAList).addSImm (4);
|
BuildMI (BB, V8::LD, 2, DestReg+1).addReg (VAList).addSImm (4);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Type::DoubleTyID: {
|
case Type::DoubleTyID: {
|
||||||
|
|
|
@ -63,7 +63,7 @@ unsigned SparcV8TargetMachine::getModuleMatchQuality(const Module &M) {
|
||||||
/// to implement a static compiler for this target.
|
/// to implement a static compiler for this target.
|
||||||
///
|
///
|
||||||
bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM,
|
bool SparcV8TargetMachine::addPassesToEmitAssembly(PassManager &PM,
|
||||||
std::ostream &Out) {
|
std::ostream &Out) {
|
||||||
// FIXME: Implement efficient support for garbage collection intrinsics.
|
// FIXME: Implement efficient support for garbage collection intrinsics.
|
||||||
PM.add(createLowerGCPass());
|
PM.add(createLowerGCPass());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue