Parameter attributes do have to be specially handled in the CBE. Implement
their handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32976
91177308-0d34-0410-b5e6-
96231b3b80d8
- std::ostream &printType(std::ostream &Out, const Type *Ty,
+ std::ostream &printType(std::ostream &Out, const Type *Ty,
+ bool isSigned = true,
const std::string &VariableName = "",
bool IgnoreName = false);
std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty,
const std::string &VariableName = "",
bool IgnoreName = false);
std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty,
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
for (++I; I != E; ++I) {
if (PrintedType)
FunctionInnards << ", ";
for (++I; I != E; ++I) {
if (PrintedType)
FunctionInnards << ", ";
- printType(FunctionInnards, *I, "");
+ printType(FunctionInnards, *I,
+ /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), "");
PrintedType = true;
}
if (FTy->isVarArg()) {
PrintedType = true;
}
if (FTy->isVarArg()) {
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
- printType(Out, RetTy, tstr);
+ printType(Out, RetTy,
+ /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr);
// declaration.
//
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
// declaration.
//
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
- const std::string &NameSoFar,
+ bool isSigned, const std::string &NameSoFar,
bool IgnoreName) {
if (Ty->isPrimitiveType()) {
// FIXME:Signedness. When integer types are signless, this should just
// always pass "false" for the sign of the primitive type. The instructions
// will figure out how the value is to be interpreted.
bool IgnoreName) {
if (Ty->isPrimitiveType()) {
// FIXME:Signedness. When integer types are signless, this should just
// always pass "false" for the sign of the primitive type. The instructions
// will figure out how the value is to be interpreted.
- printPrimitiveType(Out, Ty, true, NameSoFar);
+ printPrimitiveType(Out, Ty, isSigned, NameSoFar);
const FunctionType *FTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
const FunctionType *FTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
FunctionInnards << ", ";
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
FunctionInnards << ", ";
- printType(FunctionInnards, *I, "");
+ printType(FunctionInnards, *I,
+ /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), "");
+ ++Idx;
}
if (FTy->isVarArg()) {
if (FTy->getNumParams())
}
if (FTy->isVarArg()) {
if (FTy->getNumParams())
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
- printType(Out, FTy->getReturnType(), tstr);
+ printType(Out, FTy->getReturnType(),
+ /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr);
return Out;
}
case Type::StructTyID: {
return Out;
}
case Type::StructTyID: {
for (StructType::element_iterator I = STy->element_begin(),
E = STy->element_end(); I != E; ++I) {
Out << " ";
for (StructType::element_iterator I = STy->element_begin(),
E = STy->element_end(); I != E; ++I) {
Out << " ";
- printType(Out, *I, "field" + utostr(Idx++));
+ printType(Out, *I, true, "field" + utostr(Idx++));
Out << ";\n";
}
return Out << '}';
Out << ";\n";
}
return Out << '}';
isa<PackedType>(PTy->getElementType()))
ptrName = "(" + ptrName + ")";
isa<PackedType>(PTy->getElementType()))
ptrName = "(" + ptrName + ")";
- return printType(Out, PTy->getElementType(), ptrName);
+ return printType(Out, PTy->getElementType(), true, ptrName);
}
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
}
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
- return printType(Out, ATy->getElementType(),
+ return printType(Out, ATy->getElementType(), true,
NameSoFar + "[" + utostr(NumElements) + "]");
}
NameSoFar + "[" + utostr(NumElements) + "]");
}
const PackedType *PTy = cast<PackedType>(Ty);
unsigned NumElements = PTy->getNumElements();
if (NumElements == 0) NumElements = 1;
const PackedType *PTy = cast<PackedType>(Ty);
unsigned NumElements = PTy->getNumElements();
if (NumElements == 0) NumElements = 1;
- return printType(Out, PTy->getElementType(),
+ return printType(Out, PTy->getElementType(), true,
NameSoFar + "[" + utostr(NumElements) + "]");
}
NameSoFar + "[" + utostr(NumElements) + "]");
}
I != E; ++I) {
if (I->hasExternalLinkage()) {
Out << "extern ";
I != E; ++I) {
if (I->hasExternalLinkage()) {
Out << "extern ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
Out << ";\n";
} else if (I->hasDLLImportLinkage()) {
Out << "__declspec(dllimport) ";
Out << ";\n";
} else if (I->hasDLLImportLinkage()) {
Out << "__declspec(dllimport) ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
Out << ";\n";
} else if (I->hasExternalWeakLinkage()) {
Out << "extern ";
Out << ";\n";
} else if (I->hasExternalWeakLinkage()) {
Out << "extern ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
Out << " __EXTERNAL_WEAK__ ;\n";
}
}
Out << " __EXTERNAL_WEAK__ ;\n";
}
}
Out << "static ";
else
Out << "extern ";
Out << "static ";
else
Out << "extern ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
else if (I->hasDLLExportLinkage())
Out << "__declspec(dllexport) ";
else if (I->hasDLLExportLinkage())
Out << "__declspec(dllexport) ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
else if (I->hasWeakLinkage())
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
else if (I->hasWeakLinkage())
const Type *Ty = cast<Type>(I->second);
std::string Name = "l_" + Mang->makeNameProper(I->first);
Out << "typedef ";
const Type *Ty = cast<Type>(I->second);
std::string Name = "l_" + Mang->makeNameProper(I->first);
Out << "typedef ";
- printType(Out, Ty, Name);
+ printType(Out, Ty, true, Name);
if (StructPrinted.insert(STy).second) {
// Print structure type out.
std::string Name = TypeNames[STy];
if (StructPrinted.insert(STy).second) {
// Print structure type out.
std::string Name = TypeNames[STy];
- printType(Out, STy, Name, true);
+ printType(Out, STy, true, Name, true);
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
if (I->hasName() || !Prototype)
ArgName = Mang->getValueName(I);
else
ArgName = "";
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
if (I->hasName() || !Prototype)
ArgName = Mang->getValueName(I);
else
ArgName = "";
- printType(FunctionInnards, I->getType(), ArgName);
+ printType(FunctionInnards, I->getType(),
+ /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute),
+ ArgName);
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
- printType(FunctionInnards, *I);
+ printType(FunctionInnards, *I,
+ /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute));
}
// Print out the return type and the signature built above.
}
// Print out the return type and the signature built above.
- printType(Out, RetTy, FunctionInnards.str());
+ printType(Out, RetTy, FT->paramHasAttr(0, FunctionType::SExtAttribute),
+ FunctionInnards.str());
}
static inline bool isFPIntBitCast(const Instruction &I) {
}
static inline bool isFPIntBitCast(const Instruction &I) {
const Type *StructTy =
cast<PointerType>(F.arg_begin()->getType())->getElementType();
Out << " ";
const Type *StructTy =
cast<PointerType>(F.arg_begin()->getType())->getElementType();
Out << " ";
- printType(Out, StructTy, "StructReturn");
+ printType(Out, StructTy, true, "StructReturn");
Out << "; /* Struct return temporary */\n";
Out << " ";
Out << "; /* Struct return temporary */\n";
Out << " ";
- printType(Out, F.arg_begin()->getType(), Mang->getValueName(F.arg_begin()));
+ printType(Out, F.arg_begin()->getType(), true,
+ Mang->getValueName(F.arg_begin()));
Out << " = &StructReturn;\n";
}
Out << " = &StructReturn;\n";
}
for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
if (const AllocaInst *AI = isDirectAlloca(&*I)) {
Out << " ";
for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
if (const AllocaInst *AI = isDirectAlloca(&*I)) {
Out << " ";
- printType(Out, AI->getAllocatedType(), Mang->getValueName(AI));
+ printType(Out, AI->getAllocatedType(), true, Mang->getValueName(AI));
Out << "; /* Address-exposed local */\n";
PrintedVar = true;
} else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) {
Out << " ";
Out << "; /* Address-exposed local */\n";
PrintedVar = true;
} else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) {
Out << " ";
- printType(Out, I->getType(), Mang->getValueName(&*I));
+ printType(Out, I->getType(), true, Mang->getValueName(&*I));
Out << ";\n";
if (isa<PHINode>(*I)) { // Print out PHI node temporaries as well...
Out << " ";
Out << ";\n";
if (isa<PHINode>(*I)) { // Print out PHI node temporaries as well...
Out << " ";
- printType(Out, I->getType(),
+ printType(Out, I->getType(), true,
Mang->getValueName(&*I)+"__PHI_TEMPORARY");
Out << ";\n";
}
Mang->getValueName(&*I)+"__PHI_TEMPORARY");
Out << ";\n";
}
}
bool PrintedArg = false;
}
bool PrintedArg = false;
- for (; AI != AE; ++AI, ++ArgNo) {
+ unsigned Idx = 1;
+ for (; AI != AE; ++AI, ++ArgNo, ++Idx) {
if (PrintedArg) Out << ", ";
if (ArgNo < NumDeclaredParams &&
(*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << '(';
if (PrintedArg) Out << ", ";
if (ArgNo < NumDeclaredParams &&
(*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << '(';
- printType(Out, FTy->getParamType(ArgNo));
+ printType(Out, FTy->getParamType(ArgNo),
+ /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute));
Out << ')';
}
writeOperand(*AI);
Out << ')';
}
writeOperand(*AI);
Out << '*';
if (I.isVolatile()) {
Out << "((";
Out << '*';
if (I.isVolatile()) {
Out << "((";
- printType(Out, I.getType(), "volatile*");
+ printType(Out, I.getType(), true, "volatile*");
Out << '*';
if (I.isVolatile()) {
Out << "((";
Out << '*';
if (I.isVolatile()) {
Out << "((";
- printType(Out, I.getOperand(0)->getType(), " volatile*");
+ printType(Out, I.getOperand(0)->getType(), true, " volatile*");
Out << ")";
}
writeOperand(I.getPointerOperand());
Out << ")";
}
writeOperand(I.getPointerOperand());
- std::ostream &printType(std::ostream &Out, const Type *Ty,
+ std::ostream &printType(std::ostream &Out, const Type *Ty,
+ bool isSigned = true,
const std::string &VariableName = "",
bool IgnoreName = false);
std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty,
const std::string &VariableName = "",
bool IgnoreName = false);
std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty,
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
for (++I; I != E; ++I) {
if (PrintedType)
FunctionInnards << ", ";
for (++I; I != E; ++I) {
if (PrintedType)
FunctionInnards << ", ";
- printType(FunctionInnards, *I, "");
+ printType(FunctionInnards, *I,
+ /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), "");
PrintedType = true;
}
if (FTy->isVarArg()) {
PrintedType = true;
}
if (FTy->isVarArg()) {
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
- printType(Out, RetTy, tstr);
+ printType(Out, RetTy,
+ /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr);
// declaration.
//
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
// declaration.
//
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
- const std::string &NameSoFar,
+ bool isSigned, const std::string &NameSoFar,
bool IgnoreName) {
if (Ty->isPrimitiveType()) {
// FIXME:Signedness. When integer types are signless, this should just
// always pass "false" for the sign of the primitive type. The instructions
// will figure out how the value is to be interpreted.
bool IgnoreName) {
if (Ty->isPrimitiveType()) {
// FIXME:Signedness. When integer types are signless, this should just
// always pass "false" for the sign of the primitive type. The instructions
// will figure out how the value is to be interpreted.
- printPrimitiveType(Out, Ty, true, NameSoFar);
+ printPrimitiveType(Out, Ty, isSigned, NameSoFar);
const FunctionType *FTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
const FunctionType *FTy = cast<FunctionType>(Ty);
std::stringstream FunctionInnards;
FunctionInnards << " (" << NameSoFar << ") (";
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
FunctionInnards << ", ";
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
if (I != FTy->param_begin())
FunctionInnards << ", ";
- printType(FunctionInnards, *I, "");
+ printType(FunctionInnards, *I,
+ /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute), "");
+ ++Idx;
}
if (FTy->isVarArg()) {
if (FTy->getNumParams())
}
if (FTy->isVarArg()) {
if (FTy->getNumParams())
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
}
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
- printType(Out, FTy->getReturnType(), tstr);
+ printType(Out, FTy->getReturnType(),
+ /*isSigned=*/FTy->paramHasAttr(0, FunctionType::SExtAttribute), tstr);
return Out;
}
case Type::StructTyID: {
return Out;
}
case Type::StructTyID: {
for (StructType::element_iterator I = STy->element_begin(),
E = STy->element_end(); I != E; ++I) {
Out << " ";
for (StructType::element_iterator I = STy->element_begin(),
E = STy->element_end(); I != E; ++I) {
Out << " ";
- printType(Out, *I, "field" + utostr(Idx++));
+ printType(Out, *I, true, "field" + utostr(Idx++));
Out << ";\n";
}
return Out << '}';
Out << ";\n";
}
return Out << '}';
isa<PackedType>(PTy->getElementType()))
ptrName = "(" + ptrName + ")";
isa<PackedType>(PTy->getElementType()))
ptrName = "(" + ptrName + ")";
- return printType(Out, PTy->getElementType(), ptrName);
+ return printType(Out, PTy->getElementType(), true, ptrName);
}
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
}
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
unsigned NumElements = ATy->getNumElements();
if (NumElements == 0) NumElements = 1;
- return printType(Out, ATy->getElementType(),
+ return printType(Out, ATy->getElementType(), true,
NameSoFar + "[" + utostr(NumElements) + "]");
}
NameSoFar + "[" + utostr(NumElements) + "]");
}
const PackedType *PTy = cast<PackedType>(Ty);
unsigned NumElements = PTy->getNumElements();
if (NumElements == 0) NumElements = 1;
const PackedType *PTy = cast<PackedType>(Ty);
unsigned NumElements = PTy->getNumElements();
if (NumElements == 0) NumElements = 1;
- return printType(Out, PTy->getElementType(),
+ return printType(Out, PTy->getElementType(), true,
NameSoFar + "[" + utostr(NumElements) + "]");
}
NameSoFar + "[" + utostr(NumElements) + "]");
}
I != E; ++I) {
if (I->hasExternalLinkage()) {
Out << "extern ";
I != E; ++I) {
if (I->hasExternalLinkage()) {
Out << "extern ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
Out << ";\n";
} else if (I->hasDLLImportLinkage()) {
Out << "__declspec(dllimport) ";
Out << ";\n";
} else if (I->hasDLLImportLinkage()) {
Out << "__declspec(dllimport) ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
Out << ";\n";
} else if (I->hasExternalWeakLinkage()) {
Out << "extern ";
Out << ";\n";
} else if (I->hasExternalWeakLinkage()) {
Out << "extern ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
Out << " __EXTERNAL_WEAK__ ;\n";
}
}
Out << " __EXTERNAL_WEAK__ ;\n";
}
}
Out << "static ";
else
Out << "extern ";
Out << "static ";
else
Out << "extern ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
else if (I->hasDLLExportLinkage())
Out << "__declspec(dllexport) ";
else if (I->hasDLLExportLinkage())
Out << "__declspec(dllexport) ";
- printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
+ printType(Out, I->getType()->getElementType(), true,
+ Mang->getValueName(I));
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
else if (I->hasWeakLinkage())
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
else if (I->hasWeakLinkage())
const Type *Ty = cast<Type>(I->second);
std::string Name = "l_" + Mang->makeNameProper(I->first);
Out << "typedef ";
const Type *Ty = cast<Type>(I->second);
std::string Name = "l_" + Mang->makeNameProper(I->first);
Out << "typedef ";
- printType(Out, Ty, Name);
+ printType(Out, Ty, true, Name);
if (StructPrinted.insert(STy).second) {
// Print structure type out.
std::string Name = TypeNames[STy];
if (StructPrinted.insert(STy).second) {
// Print structure type out.
std::string Name = TypeNames[STy];
- printType(Out, STy, Name, true);
+ printType(Out, STy, true, Name, true);
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
if (I->hasName() || !Prototype)
ArgName = Mang->getValueName(I);
else
ArgName = "";
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
if (I->hasName() || !Prototype)
ArgName = Mang->getValueName(I);
else
ArgName = "";
- printType(FunctionInnards, I->getType(), ArgName);
+ printType(FunctionInnards, I->getType(),
+ /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute),
+ ArgName);
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
- printType(FunctionInnards, *I);
+ printType(FunctionInnards, *I,
+ /*isSigned=*/FT->paramHasAttr(Idx, FunctionType::SExtAttribute));
}
// Print out the return type and the signature built above.
}
// Print out the return type and the signature built above.
- printType(Out, RetTy, FunctionInnards.str());
+ printType(Out, RetTy, FT->paramHasAttr(0, FunctionType::SExtAttribute),
+ FunctionInnards.str());
}
static inline bool isFPIntBitCast(const Instruction &I) {
}
static inline bool isFPIntBitCast(const Instruction &I) {
const Type *StructTy =
cast<PointerType>(F.arg_begin()->getType())->getElementType();
Out << " ";
const Type *StructTy =
cast<PointerType>(F.arg_begin()->getType())->getElementType();
Out << " ";
- printType(Out, StructTy, "StructReturn");
+ printType(Out, StructTy, true, "StructReturn");
Out << "; /* Struct return temporary */\n";
Out << " ";
Out << "; /* Struct return temporary */\n";
Out << " ";
- printType(Out, F.arg_begin()->getType(), Mang->getValueName(F.arg_begin()));
+ printType(Out, F.arg_begin()->getType(), true,
+ Mang->getValueName(F.arg_begin()));
Out << " = &StructReturn;\n";
}
Out << " = &StructReturn;\n";
}
for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
if (const AllocaInst *AI = isDirectAlloca(&*I)) {
Out << " ";
for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) {
if (const AllocaInst *AI = isDirectAlloca(&*I)) {
Out << " ";
- printType(Out, AI->getAllocatedType(), Mang->getValueName(AI));
+ printType(Out, AI->getAllocatedType(), true, Mang->getValueName(AI));
Out << "; /* Address-exposed local */\n";
PrintedVar = true;
} else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) {
Out << " ";
Out << "; /* Address-exposed local */\n";
PrintedVar = true;
} else if (I->getType() != Type::VoidTy && !isInlinableInst(*I)) {
Out << " ";
- printType(Out, I->getType(), Mang->getValueName(&*I));
+ printType(Out, I->getType(), true, Mang->getValueName(&*I));
Out << ";\n";
if (isa<PHINode>(*I)) { // Print out PHI node temporaries as well...
Out << " ";
Out << ";\n";
if (isa<PHINode>(*I)) { // Print out PHI node temporaries as well...
Out << " ";
- printType(Out, I->getType(),
+ printType(Out, I->getType(), true,
Mang->getValueName(&*I)+"__PHI_TEMPORARY");
Out << ";\n";
}
Mang->getValueName(&*I)+"__PHI_TEMPORARY");
Out << ";\n";
}
}
bool PrintedArg = false;
}
bool PrintedArg = false;
- for (; AI != AE; ++AI, ++ArgNo) {
+ unsigned Idx = 1;
+ for (; AI != AE; ++AI, ++ArgNo, ++Idx) {
if (PrintedArg) Out << ", ";
if (ArgNo < NumDeclaredParams &&
(*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << '(';
if (PrintedArg) Out << ", ";
if (ArgNo < NumDeclaredParams &&
(*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << '(';
- printType(Out, FTy->getParamType(ArgNo));
+ printType(Out, FTy->getParamType(ArgNo),
+ /*isSigned=*/FTy->paramHasAttr(Idx, FunctionType::SExtAttribute));
Out << ')';
}
writeOperand(*AI);
Out << ')';
}
writeOperand(*AI);
Out << '*';
if (I.isVolatile()) {
Out << "((";
Out << '*';
if (I.isVolatile()) {
Out << "((";
- printType(Out, I.getType(), "volatile*");
+ printType(Out, I.getType(), true, "volatile*");
Out << '*';
if (I.isVolatile()) {
Out << "((";
Out << '*';
if (I.isVolatile()) {
Out << "((";
- printType(Out, I.getOperand(0)->getType(), " volatile*");
+ printType(Out, I.getOperand(0)->getType(), true, " volatile*");
Out << ")";
}
writeOperand(I.getPointerOperand());
Out << ")";
}
writeOperand(I.getPointerOperand());