summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Sparc/EmitAssembly.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-05-19 15:25:51 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-05-19 15:25:51 +0000
commite9327f0082410c2f2256f85d3204c6d77302e21d (patch)
treefd1c7afbfa5161f3c0507d4a020ca5d247c526e2 /llvm/lib/Target/Sparc/EmitAssembly.cpp
parent5b3057bb82da0023f82316ca9e116d09952c11f1 (diff)
downloadbcm5719-llvm-e9327f0082410c2f2256f85d3204c6d77302e21d.tar.gz
bcm5719-llvm-e9327f0082410c2f2256f85d3204c6d77302e21d.zip
Numerous bug fixes:
-- correct sign extensions for integer casts and for shift-by-constant instructions generated for integer multiply -- passing FP arguments to functions with more than 6 arguments -- passing FP arguments to varargs functions -- passing FP arguments to functions with no prototypes -- incorrect stack frame size when padding a section -- folding getelementptr operations with mixed array and struct indexes -- use uint64_t instead of uint for constant offsets in mem operands -- incorrect coloring for CC registers (both int and FP): interferences were being completely ignored for int CC and were considered but no spills were marked for fp CC! Also some code improvements: -- better interface to generating machine instr for common cases (many places still need to be updated to use this interface) -- annotations on MachineInstr to communicate information from one codegen phase to another (now used to pass information about CALL/JMPLCALL operands from selection to register allocation) -- all sizes and offests in class TargetData are uint64_t instead of uint llvm-svn: 2640
Diffstat (limited to 'llvm/lib/Target/Sparc/EmitAssembly.cpp')
-rw-r--r--llvm/lib/Target/Sparc/EmitAssembly.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/llvm/lib/Target/Sparc/EmitAssembly.cpp b/llvm/lib/Target/Sparc/EmitAssembly.cpp
index 868f8710d89..74b7f73da36 100644
--- a/llvm/lib/Target/Sparc/EmitAssembly.cpp
+++ b/llvm/lib/Target/Sparc/EmitAssembly.cpp
@@ -312,9 +312,9 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &op)
case MachineOperand::MO_PCRelativeDisp:
{
const Value *Val = op.getVRegValue();
- if (!Val)
- toAsm << "\t<*NULL Value*>";
- else if (const BasicBlock *BB = dyn_cast<BasicBlock>(Val))
+ assert(Val && "\tNULL Value in SparcFunctionAsmPrinter");
+
+ if (const BasicBlock *BB = dyn_cast<const BasicBlock>(Val))
toAsm << getID(BB);
else if (const Function *M = dyn_cast<Function>(Val))
toAsm << getID(M);
@@ -323,13 +323,16 @@ SparcFunctionAsmPrinter::printOneOperand(const MachineOperand &op)
else if (const Constant *CV = dyn_cast<Constant>(Val))
toAsm << getID(CV);
else
- toAsm << "<unknown value=" << Val << ">";
+ assert(0 && "Unrecognized value in SparcFunctionAsmPrinter");
break;
}
case MachineOperand::MO_SignExtendedImmed:
+ toAsm << op.getImmedValue();
+ break;
+
case MachineOperand::MO_UnextendedImmed:
- toAsm << (long)op.getImmedValue();
+ toAsm << (uint64_t) op.getImmedValue();
break;
default:
@@ -486,7 +489,9 @@ static string getAsCString(ConstantArray *CPA) {
(unsigned char)cast<ConstantSInt>(CPA->getOperand(i))->getValue() :
(unsigned char)cast<ConstantUInt>(CPA->getOperand(i))->getValue();
- if (isprint(C)) {
+ if (C == '"') {
+ Result += "\\\"";
+ } else if (isprint(C)) {
Result += C;
} else {
switch(C) {
@@ -666,13 +671,13 @@ SparcModuleAsmPrinter::printConstantValueOnly(const Constant* CV)
else if (CPA)
{ // Not a string. Print the values in successive locations
const std::vector<Use> &constValues = CPA->getValues();
- for (unsigned i=1; i < constValues.size(); i++)
+ for (unsigned i=0; i < constValues.size(); i++)
this->printConstantValueOnly(cast<Constant>(constValues[i].get()));
}
else if (ConstantStruct *CPS = dyn_cast<ConstantStruct>(CV))
{ // Print the fields in successive locations
const std::vector<Use>& constValues = CPS->getValues();
- for (unsigned i=1; i < constValues.size(); i++)
+ for (unsigned i=0; i < constValues.size(); i++)
this->printConstantValueOnly(cast<Constant>(constValues[i].get()));
}
else
OpenPOWER on IntegriCloud