[llvm-commits] CVS: llvm/lib/Target/Sparc/EmitAssembly.cpp
Vikram Adve
vadve at cs.uiuc.edu
Fri Aug 1 10:57:01 PDT 2003
Changes in directory llvm/lib/Target/Sparc:
EmitAssembly.cpp updated: 1.86 -> 1.87
---
Log message:
Add all arithmetic operators to ConstantExprToString().
Note that some generated operators (like &, | or ^) may
not be supported by the assembler -- but if they've got
this far, it's better to generate them and let the assembler decide.
---
Diffs of the changes:
Index: llvm/lib/Target/Sparc/EmitAssembly.cpp
diff -u llvm/lib/Target/Sparc/EmitAssembly.cpp:1.86 llvm/lib/Target/Sparc/EmitAssembly.cpp:1.87
--- llvm/lib/Target/Sparc/EmitAssembly.cpp:1.86 Wed Jul 30 07:54:47 2003
+++ llvm/lib/Target/Sparc/EmitAssembly.cpp Fri Aug 1 10:55:53 2003
@@ -213,6 +213,46 @@
+ valToExprString(CE->getOperand(1), target) + ")";
break;
+ case Instruction::Sub:
+ S += "(" + valToExprString(CE->getOperand(0), target) + ") - ("
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
+ case Instruction::Mul:
+ S += "(" + valToExprString(CE->getOperand(0), target) + ") * ("
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
+ case Instruction::Div:
+ S += "(" + valToExprString(CE->getOperand(0), target) + ") / ("
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
+ case Instruction::Rem:
+ S += "(" + valToExprString(CE->getOperand(0), target) + ") % ("
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
+ case Instruction::And:
+ // Logical && for booleans; bitwise & otherwise
+ S += "(" + valToExprString(CE->getOperand(0), target)
+ + ((CE->getType() == Type::BoolTy)? ") && (" : ") & (")
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
+ case Instruction::Or:
+ // Logical || for booleans; bitwise | otherwise
+ S += "(" + valToExprString(CE->getOperand(0), target)
+ + ((CE->getType() == Type::BoolTy)? ") || (" : ") | (")
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
+ case Instruction::Xor:
+ // Bitwise ^ for all types
+ S += "(" + valToExprString(CE->getOperand(0), target) + ") ^ ("
+ + valToExprString(CE->getOperand(1), target) + ")";
+ break;
+
default:
assert(0 && "Unsupported operator in ConstantExprToString()");
break;
More information about the llvm-commits
mailing list