mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Eliminate the silly namedContext member of printType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9666 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ac50030f86
commit
7635ea4230
@ -72,7 +72,7 @@ namespace {
|
|||||||
|
|
||||||
std::ostream &printType(std::ostream &Out, const Type *Ty,
|
std::ostream &printType(std::ostream &Out, const Type *Ty,
|
||||||
const std::string &VariableName = "",
|
const std::string &VariableName = "",
|
||||||
bool IgnoreName = false, bool namedContext = true);
|
bool IgnoreName = false);
|
||||||
|
|
||||||
void writeOperand(Value *Operand);
|
void writeOperand(Value *Operand);
|
||||||
void writeOperandInternal(Value *Operand);
|
void writeOperandInternal(Value *Operand);
|
||||||
@ -173,7 +173,7 @@ inline bool ptrTypeNameNeedsParens(const std::string &NameSoFar) {
|
|||||||
//
|
//
|
||||||
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
||||||
const std::string &NameSoFar,
|
const std::string &NameSoFar,
|
||||||
bool IgnoreName, bool namedContext) {
|
bool IgnoreName) {
|
||||||
if (Ty->isPrimitiveType())
|
if (Ty->isPrimitiveType())
|
||||||
switch (Ty->getPrimitiveID()) {
|
switch (Ty->getPrimitiveID()) {
|
||||||
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
||||||
@ -243,7 +243,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
|||||||
// Do not need parens around "* NameSoFar" if NameSoFar consists only
|
// Do not need parens around "* NameSoFar" if NameSoFar consists only
|
||||||
// of zero or more '*' chars *and* this is not an unnamed pointer type
|
// of zero or more '*' chars *and* this is not an unnamed pointer type
|
||||||
// such as the result type in a cast statement. Otherwise, enclose in ( ).
|
// such as the result type in a cast statement. Otherwise, enclose in ( ).
|
||||||
if (ptrTypeNameNeedsParens(NameSoFar) || !namedContext ||
|
if (ptrTypeNameNeedsParens(NameSoFar) ||
|
||||||
PTy->getElementType()->getPrimitiveID() == Type::ArrayTyID)
|
PTy->getElementType()->getPrimitiveID() == Type::ArrayTyID)
|
||||||
ptrName = "(" + ptrName + ")"; //
|
ptrName = "(" + ptrName + ")"; //
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ void CWriter::visitBinaryOperator(Instruction &I) {
|
|||||||
|| (I.getType() == Type::FloatTy)) {
|
|| (I.getType() == Type::FloatTy)) {
|
||||||
needsCast = true;
|
needsCast = true;
|
||||||
Out << "((";
|
Out << "((";
|
||||||
printType(Out, I.getType(), "", false, false);
|
printType(Out, I.getType());
|
||||||
Out << ")(";
|
Out << ")(";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,7 +1180,7 @@ void CWriter::visitCastInst(CastInst &I) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Out << "(";
|
Out << "(";
|
||||||
printType(Out, I.getType(), "", /*ignoreName*/false, /*namedContext*/false);
|
printType(Out, I.getType());
|
||||||
Out << ")";
|
Out << ")";
|
||||||
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
|
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
|
||||||
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
|
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
|
||||||
@ -1371,8 +1371,7 @@ void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) {
|
|||||||
void CWriter::visitVANextInst(VANextInst &I) {
|
void CWriter::visitVANextInst(VANextInst &I) {
|
||||||
Out << Mang->getValueName(I.getOperand(0));
|
Out << Mang->getValueName(I.getOperand(0));
|
||||||
Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", ";
|
Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", ";
|
||||||
printType(Out, I.getArgType(), "", /*ignoreName*/false,
|
printType(Out, I.getArgType());
|
||||||
/*namedContext*/false);
|
|
||||||
Out << ")";
|
Out << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1381,7 +1380,7 @@ void CWriter::visitVAArgInst(VAArgInst &I) {
|
|||||||
Out << "{ va_list Tmp; va_copy(Tmp, *(va_list*)&";
|
Out << "{ va_list Tmp; va_copy(Tmp, *(va_list*)&";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
Out << ");\n " << Mang->getValueName(&I) << " = va_arg(Tmp, ";
|
Out << ");\n " << Mang->getValueName(&I) << " = va_arg(Tmp, ";
|
||||||
printType(Out, I.getType(), "", /*ignoreName*/false, /*namedContext*/false);
|
printType(Out, I.getType());
|
||||||
Out << ");\n va_end(Tmp); }";
|
Out << ");\n va_end(Tmp); }";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ namespace {
|
|||||||
|
|
||||||
std::ostream &printType(std::ostream &Out, const Type *Ty,
|
std::ostream &printType(std::ostream &Out, const Type *Ty,
|
||||||
const std::string &VariableName = "",
|
const std::string &VariableName = "",
|
||||||
bool IgnoreName = false, bool namedContext = true);
|
bool IgnoreName = false);
|
||||||
|
|
||||||
void writeOperand(Value *Operand);
|
void writeOperand(Value *Operand);
|
||||||
void writeOperandInternal(Value *Operand);
|
void writeOperandInternal(Value *Operand);
|
||||||
@ -173,7 +173,7 @@ inline bool ptrTypeNameNeedsParens(const std::string &NameSoFar) {
|
|||||||
//
|
//
|
||||||
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
||||||
const std::string &NameSoFar,
|
const std::string &NameSoFar,
|
||||||
bool IgnoreName, bool namedContext) {
|
bool IgnoreName) {
|
||||||
if (Ty->isPrimitiveType())
|
if (Ty->isPrimitiveType())
|
||||||
switch (Ty->getPrimitiveID()) {
|
switch (Ty->getPrimitiveID()) {
|
||||||
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
case Type::VoidTyID: return Out << "void " << NameSoFar;
|
||||||
@ -243,7 +243,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
|
|||||||
// Do not need parens around "* NameSoFar" if NameSoFar consists only
|
// Do not need parens around "* NameSoFar" if NameSoFar consists only
|
||||||
// of zero or more '*' chars *and* this is not an unnamed pointer type
|
// of zero or more '*' chars *and* this is not an unnamed pointer type
|
||||||
// such as the result type in a cast statement. Otherwise, enclose in ( ).
|
// such as the result type in a cast statement. Otherwise, enclose in ( ).
|
||||||
if (ptrTypeNameNeedsParens(NameSoFar) || !namedContext ||
|
if (ptrTypeNameNeedsParens(NameSoFar) ||
|
||||||
PTy->getElementType()->getPrimitiveID() == Type::ArrayTyID)
|
PTy->getElementType()->getPrimitiveID() == Type::ArrayTyID)
|
||||||
ptrName = "(" + ptrName + ")"; //
|
ptrName = "(" + ptrName + ")"; //
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ void CWriter::visitBinaryOperator(Instruction &I) {
|
|||||||
|| (I.getType() == Type::FloatTy)) {
|
|| (I.getType() == Type::FloatTy)) {
|
||||||
needsCast = true;
|
needsCast = true;
|
||||||
Out << "((";
|
Out << "((";
|
||||||
printType(Out, I.getType(), "", false, false);
|
printType(Out, I.getType());
|
||||||
Out << ")(";
|
Out << ")(";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1180,7 +1180,7 @@ void CWriter::visitCastInst(CastInst &I) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Out << "(";
|
Out << "(";
|
||||||
printType(Out, I.getType(), "", /*ignoreName*/false, /*namedContext*/false);
|
printType(Out, I.getType());
|
||||||
Out << ")";
|
Out << ")";
|
||||||
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
|
if (isa<PointerType>(I.getType())&&I.getOperand(0)->getType()->isIntegral() ||
|
||||||
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
|
isa<PointerType>(I.getOperand(0)->getType())&&I.getType()->isIntegral()) {
|
||||||
@ -1371,8 +1371,7 @@ void CWriter::visitGetElementPtrInst(GetElementPtrInst &I) {
|
|||||||
void CWriter::visitVANextInst(VANextInst &I) {
|
void CWriter::visitVANextInst(VANextInst &I) {
|
||||||
Out << Mang->getValueName(I.getOperand(0));
|
Out << Mang->getValueName(I.getOperand(0));
|
||||||
Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", ";
|
Out << "; va_arg(*(va_list*)&" << Mang->getValueName(&I) << ", ";
|
||||||
printType(Out, I.getArgType(), "", /*ignoreName*/false,
|
printType(Out, I.getArgType());
|
||||||
/*namedContext*/false);
|
|
||||||
Out << ")";
|
Out << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1381,7 +1380,7 @@ void CWriter::visitVAArgInst(VAArgInst &I) {
|
|||||||
Out << "{ va_list Tmp; va_copy(Tmp, *(va_list*)&";
|
Out << "{ va_list Tmp; va_copy(Tmp, *(va_list*)&";
|
||||||
writeOperand(I.getOperand(0));
|
writeOperand(I.getOperand(0));
|
||||||
Out << ");\n " << Mang->getValueName(&I) << " = va_arg(Tmp, ";
|
Out << ");\n " << Mang->getValueName(&I) << " = va_arg(Tmp, ";
|
||||||
printType(Out, I.getType(), "", /*ignoreName*/false, /*namedContext*/false);
|
printType(Out, I.getType());
|
||||||
Out << ");\n va_end(Tmp); }";
|
Out << ");\n va_end(Tmp); }";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user