Reverting previous beautification changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6464 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vikram S. Adve
2003-05-31 07:27:17 +00:00
parent f86d635e20
commit af9fd51da2
2 changed files with 410 additions and 386 deletions

View File

@@ -118,11 +118,13 @@ public:
if (isdigit(S[0]))
Result = "ll";
for (unsigned i = 0; i < S.size(); ++i) {
for (unsigned i = 0; i < S.size(); ++i)
{
char C = S[i];
if (C == '_' || C == '.' || C == '$' || isalpha(C) || isdigit(C))
Result += C;
else {
else
{
Result += '_';
Result += char('0' + ((unsigned char)C >> 4));
Result += char('0' + (C & 0xF));
@@ -188,8 +190,8 @@ public:
const TargetMachine& target) {
string S;
switch(CE->getOpcode()) {
case Instruction::GetElementPtr: {
// generate a symbolic expression for the byte address
case Instruction::GetElementPtr:
{ // generate a symbolic expression for the byte address
const Value* ptrVal = CE->getOperand(0);
std::vector<Value*> idxVec(CE->op_begin()+1, CE->op_end());
const TargetData &TD = target.getTargetData();
@@ -353,15 +355,20 @@ SparcFunctionAsmPrinter::printOperands(const MachineInstr *MI,
{
const MachineOperand& mop = MI->getOperand(opNum);
if (OpIsBranchTargetLabel(MI, opNum)) {
if (OpIsBranchTargetLabel(MI, opNum))
{
PrintOp1PlusOp2(mop, MI->getOperand(opNum+1), MI->getOpCode());
return 2;
} else if (OpIsMemoryAddressBase(MI, opNum)) {
}
else if (OpIsMemoryAddressBase(MI, opNum))
{
toAsm << "[";
PrintOp1PlusOp2(mop, MI->getOperand(opNum+1), MI->getOpCode());
toAsm << "]";
return 2;
} else {
}
else
{
printOneOperand(mop, MI->getOpCode());
return 1;
}
@@ -388,7 +395,8 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &mop,
{
case MachineOperand::MO_VirtualRegister:
case MachineOperand::MO_CCRegister:
case MachineOperand::MO_MachineRegister: {
case MachineOperand::MO_MachineRegister:
{
int regNum = (int)mop.getAllocatedRegNum();
if (regNum == Target.getRegInfo().getInvalidRegNum()) {
@@ -400,7 +408,8 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &mop,
break;
}
case MachineOperand::MO_PCRelativeDisp: {
case MachineOperand::MO_PCRelativeDisp:
{
const Value *Val = mop.getVRegValue();
assert(Val && "\tNULL Value in SparcFunctionAsmPrinter");
@@ -441,7 +450,7 @@ SparcFunctionAsmPrinter::emitMachineInst(const MachineInstr *MI)
unsigned Opcode = MI->getOpCode();
if (Target.getInstrInfo().isDummyPhiInstr(Opcode))
return; // Ignore Phi nodes
return; // IGNORE PHI NODES
toAsm << "\t" << Target.getInstrInfo().getName(Opcode) << "\t";
@@ -658,7 +667,8 @@ TypeToSize(const Type* type, const TargetMachine& target)
inline unsigned int
ConstantToSize(const Constant* CV, const TargetMachine& target)
{
if (const ConstantArray* CVA = dyn_cast<ConstantArray>(CV)) {
if (const ConstantArray* CVA = dyn_cast<ConstantArray>(CV))
{
const ArrayType *aty = cast<ArrayType>(CVA->getType());
if (ArrayTypeIsString(aty))
return 1 + CVA->getNumOperands();
@@ -717,7 +727,8 @@ SparcModuleAsmPrinter::printSingleConstantValue(const Constant* CV)
toAsm << "\t" << TypeToDataDirective(CV->getType()) << "\t";
if (CV->getType()->isPrimitiveType()) {
if (CV->getType()->isPrimitiveType())
{
if (CV->getType()->isFloatingPoint()) {
// FP Constants are printed as integer constants to avoid losing
// precision...
@@ -738,17 +749,22 @@ SparcModuleAsmPrinter::printSingleConstantValue(const Constant* CV)
} else {
WriteAsOperand(toAsm, CV, false, false) << "\n";
}
} else if (const ConstantPointerRef* CPR = dyn_cast<ConstantPointerRef>(CV)) {
// This is a constant address for a global variable or method.
}
else if (const ConstantPointerRef* CPR = dyn_cast<ConstantPointerRef>(CV))
{ // This is a constant address for a global variable or method.
// Use the name of the variable or method as the address value.
toAsm << getID(CPR->getValue()) << "\n";
} else if (isa<ConstantPointerNull>(CV)) {
// Null pointer value
}
else if (isa<ConstantPointerNull>(CV))
{ // Null pointer value
toAsm << "0\n";
} else if (const ConstantExpr* CE = dyn_cast<ConstantExpr>(CV)) {
// Constant expression built from operators, constants, and symbolic addrs
}
else if (const ConstantExpr* CE = dyn_cast<ConstantExpr>(CV))
{ // Constant expression built from operators, constants, and symbolic addrs
toAsm << ConstantExprToString(CE, Target) << "\n";
} else {
}
else
{
assert(0 && "Unknown elementary type for constant");
}
}
@@ -759,7 +775,8 @@ SparcModuleAsmPrinter::PrintZeroBytesToPad(int numBytes)
for ( ; numBytes >= 8; numBytes -= 8)
printSingleConstantValue(Constant::getNullValue(Type::ULongTy));
if (numBytes >= 4) {
if (numBytes >= 4)
{
printSingleConstantValue(Constant::getNullValue(Type::UIntTy));
numBytes -= 4;
}
@@ -776,21 +793,24 @@ SparcModuleAsmPrinter::printConstantValueOnly(const Constant* CV,
{
const ConstantArray *CVA = dyn_cast<ConstantArray>(CV);
if (CVA && isStringCompatible(CVA)) {
// print the string alone and return
if (CVA && isStringCompatible(CVA))
{ // print the string alone and return
toAsm << "\t" << ".ascii" << "\t" << getAsCString(CVA) << "\n";
} else if (CVA) {
// Not a string. Print the values in successive locations
}
else if (CVA)
{ // Not a string. Print the values in successive locations
const std::vector<Use> &constValues = CVA->getValues();
for (unsigned i=0; i < constValues.size(); i++)
printConstantValueOnly(cast<Constant>(constValues[i].get()));
} else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV)) {
// Print the fields in successive locations. Pad to align if needed!
}
else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV))
{ // Print the fields in successive locations. Pad to align if needed!
const StructLayout *cvsLayout =
Target.getTargetData().getStructLayout(CVS->getType());
const std::vector<Use>& constValues = CVS->getValues();
unsigned sizeSoFar = 0;
for (unsigned i=0, N = constValues.size(); i < N; i++) {
for (unsigned i=0, N = constValues.size(); i < N; i++)
{
const Constant* field = cast<Constant>(constValues[i].get());
// Check if padding is needed and insert one or more 0s.
@@ -806,7 +826,8 @@ SparcModuleAsmPrinter::printConstantValueOnly(const Constant* CV,
}
assert(sizeSoFar == cvsLayout->StructSize &&
"Layout of constant struct may be incorrect!");
} else
}
else
printSingleConstantValue(CV);
if (numPadBytesAfter)
@@ -826,8 +847,8 @@ SparcModuleAsmPrinter::printConstant(const Constant* CV, string valID)
// Print .size and .type only if it is not a string.
const ConstantArray *CVA = dyn_cast<ConstantArray>(CV);
if (CVA && isStringCompatible(CVA)) {
// print it as a string and return
if (CVA && isStringCompatible(CVA))
{ // print it as a string and return
toAsm << valID << ":\n";
toAsm << "\t" << ".ascii" << "\t" << getAsCString(CVA) << "\n";
return;

View File

@@ -1445,7 +1445,8 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
// Let's check for chain rules outside the switch so that we don't have
// to duplicate the list of chain rule production numbers here again
//
if (ThisIsAChainRule(ruleForNode)) {
if (ThisIsAChainRule(ruleForNode))
{
// Chain rules have a single nonterminal on the RHS.
// Get the rule that matches the RHS non-terminal and use that instead.
//
@@ -1454,7 +1455,9 @@ GetInstructionsByRule(InstructionNode* subtreeRoot,
nextRule = burm_rule(subtreeRoot->state, nts[0]);
nts = burm_nts[nextRule];
GetInstructionsByRule(subtreeRoot, nextRule, nts, target, mvec);
} else {
}
else
{
switch(ruleForNode) {
case 1: // stmt: Ret
case 2: // stmt: RetValue(reg)