================
@@ -117,6 +117,67 @@ collectInOutConstraintInfos(const CIRGenFunction &cgf,
const AsmStmt &s,
}
}
+std::pair<mlir::Value, mlir::Type> CIRGenFunction::emitAsmInputLValue(
+ const TargetInfo::ConstraintInfo &info, LValue inputValue,
+ QualType inputType, std::string &constraintString, SourceLocation loc) {
+
+ if (info.allowsRegister() || !info.allowsMemory()) {
+ if (hasScalarEvaluationKind(inputType))
+ return {emitLoadOfLValue(inputValue, loc).getValue(), mlir::Type()};
+
+ mlir::Type ty = convertType(inputType);
+ uint64_t size = cgm.getDataLayout().getTypeSizeInBits(ty);
+ if ((size <= 64 && llvm::isPowerOf2_64(size)) ||
+ getTargetHooks().isScalarizableAsmOperand(*this, ty)) {
+ ty = cir::IntType::get(&getMLIRContext(), size, false);
+
+ return {builder.createLoad(
+ getLoc(loc),
+ inputValue.getAddress().withElementType(builder, ty)),
+ mlir::Type()};
+ }
+ }
+
+ Address addr = inputValue.getAddress();
+ constraintString += '*';
+ return {addr.getPointer(), addr.getElementType()};
+}
+
+std::pair<mlir::Value, mlir::Type>
+CIRGenFunction::emitAsmInput(const TargetInfo::ConstraintInfo &info,
+ const Expr *inputExpr,
+ std::string &constraintString) {
+ auto loc = getLoc(inputExpr->getExprLoc());
----------------
andykaylor wrote:
```suggestion
mlir::Location loc = getLoc(inputExpr->getExprLoc());
```
https://github.com/llvm/llvm-project/pull/176239
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits