//
// The LLVM Compiler Infrastructure
//
-// This file was developed by Chris Lattner and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
#include <cctype>
using namespace llvm;
+// Implement the first virtual method in this class in this file so the
+// InlineAsm vtable is emitted here.
+InlineAsm::~InlineAsm() {
+}
+
+
// NOTE: when memoizing the function type, we have to be careful to handle the
// case when the type gets refined.
InlineAsm::InlineAsm(const FunctionType *Ty, const std::string &asmString,
const std::string &constraints, bool hasSideEffects)
- : Value(PointerType::get(Ty), Value::InlineAsmVal), AsmString(asmString),
+ : Value(PointerType::getUnqual(Ty),
+ Value::InlineAsmVal),
+ AsmString(asmString),
Constraints(constraints), HasSideEffects(hasSideEffects) {
// Do various checks on the constraint string and type.
break;
}
}
-
- if (NumOutputs > 1) return false; // Only one result allowed so far.
- if ((Ty->getReturnType() != Type::VoidTy) != NumOutputs)
- return false; // NumOutputs = 1 iff has a result type.
+ switch (NumOutputs) {
+ case 0:
+ if (Ty->getReturnType() != Type::VoidTy) return false;
+ break;
+ case 1:
+ if (isa<StructType>(Ty->getReturnType())) return false;
+ break;
+ default:
+ const StructType *STy = dyn_cast<StructType>(Ty->getReturnType());
+ if (STy == 0 || STy->getNumElements() != NumOutputs)
+ return false;
+ break;
+ }
if (Ty->getNumParams() != NumInputs) return false;
return true;
}
-DEFINING_FILE_FOR(InlineAsm)