[cfe-commits] r62041 - /cfe/trunk/lib/CodeGen/CGStmt.cpp
Anders Carlsson
andersca at mac.com
Sun Jan 11 11:32:54 PST 2009
Author: andersca
Date: Sun Jan 11 13:32:54 2009
New Revision: 62041
URL: http://llvm.org/viewvc/llvm-project?rev=62041&view=rev
Log:
Use a common function for emitting asm inputs and remove a FIXME
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=62041&r1=62040&r2=62041&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun Jan 11 13:32:54 2009
@@ -860,6 +860,29 @@
return Result;
}
+llvm::Value* CodeGenFunction::EmitAsmInput(const AsmStmt &S,
+ TargetInfo::ConstraintInfo Info,
+ const Expr *InputExpr,
+ std::string &ConstraintStr)
+{
+ llvm::Value *Arg;
+ if ((Info & TargetInfo::CI_AllowsRegister) ||
+ !(Info & TargetInfo::CI_AllowsMemory)) {
+ if (ConvertType(InputExpr->getType())->isSingleValueType()) {
+ Arg = EmitScalarExpr(InputExpr);
+ } else {
+ ErrorUnsupported(&S,
+ "asm statement passing multiple-value types as inputs");
+ }
+ } else {
+ LValue Dest = EmitLValue(InputExpr);
+ Arg = Dest.getAddress();
+ ConstraintStr += '*';
+ }
+
+ return Arg;
+}
+
void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) {
bool Failed;
std::string AsmString =
@@ -916,24 +939,10 @@
}
if (Info & TargetInfo::CI_ReadWrite) {
- // FIXME: This code should be shared with the code that handles inputs.
InOutConstraints += ',';
-
+
const Expr *InputExpr = S.getOutputExpr(i);
- llvm::Value *Arg;
- if ((Info & TargetInfo::CI_AllowsRegister) ||
- !(Info & TargetInfo::CI_AllowsMemory)) {
- if (ConvertType(InputExpr->getType())->isSingleValueType()) {
- Arg = EmitScalarExpr(InputExpr);
- } else {
- ErrorUnsupported(&S,
- "asm statement passing multiple-value types as inputs");
- }
- } else {
- LValue Dest = EmitLValue(InputExpr);
- Arg = Dest.getAddress();
- InOutConstraints += '*';
- }
+ llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, InOutConstraints);
InOutArgTypes.push_back(Arg->getType());
InOutArgs.push_back(Arg);
@@ -960,21 +969,7 @@
// Simplify the input constraint.
InputConstraint = SimplifyConstraint(InputConstraint.c_str(), Target);
- llvm::Value *Arg;
-
- if ((Info & TargetInfo::CI_AllowsRegister) ||
- !(Info & TargetInfo::CI_AllowsMemory)) {
- if (ConvertType(InputExpr->getType())->isSingleValueType()) {
- Arg = EmitScalarExpr(InputExpr);
- } else {
- ErrorUnsupported(&S,
- "asm statement passing multiple-value types as inputs");
- }
- } else {
- LValue Dest = EmitLValue(InputExpr);
- Arg = Dest.getAddress();
- Constraints += '*';
- }
+ llvm::Value *Arg = EmitAsmInput(S, Info, InputExpr, Constraints);
ArgTypes.push_back(Arg->getType());
Args.push_back(Arg);
More information about the cfe-commits
mailing list