16
16
#include " llvm/CodeGen/MachineOperand.h"
17
17
#include " llvm/CodeGen/MachineRegisterInfo.h"
18
18
#include " llvm/CodeGen/TargetLowering.h"
19
- #include " llvm/IR/DiagnosticInfo.h"
20
19
#include " llvm/IR/Module.h"
21
20
22
21
#define DEBUG_TYPE " inline-asm-lowering"
@@ -232,15 +231,6 @@ bool InlineAsmLowering::lowerInlineAsm(
232
231
TargetLowering::AsmOperandInfoVector TargetConstraints =
233
232
TLI->ParseConstraints (DL, TRI, Call);
234
233
235
- const auto ConstraintError = [&](const GISelAsmOperandInfo &Info, Twine Msg) {
236
- LLVMContext &Ctx = MIRBuilder.getContext ();
237
- Ctx.diagnose (DiagnosticInfoInlineAsm (
238
- Call, " invalid constraint '" + Info.ConstraintCode + " ': " + Msg));
239
- // TODO: Recover if fallback isn't used. Otherwise let the fallback to DAG
240
- // kick in.
241
- return false ;
242
- };
243
-
244
234
ExtraFlags ExtraInfo (Call);
245
235
unsigned ArgNo = 0 ; // ArgNo - The argument of the CallInst.
246
236
unsigned ResNo = 0 ; // ResNo - The result number of the next output.
@@ -253,8 +243,8 @@ bool InlineAsmLowering::lowerInlineAsm(
253
243
OpInfo.CallOperandVal = const_cast <Value *>(Call.getArgOperand (ArgNo));
254
244
255
245
if (isa<BasicBlock>(OpInfo.CallOperandVal )) {
256
- return ConstraintError (OpInfo,
257
- " basic block input operands not supported yet " ) ;
246
+ LLVM_DEBUG ( dbgs () << " Basic block input operands not supported yet \n " );
247
+ return false ;
258
248
}
259
249
260
250
Type *OpTy = OpInfo.CallOperandVal ->getType ();
@@ -268,8 +258,9 @@ bool InlineAsmLowering::lowerInlineAsm(
268
258
269
259
// FIXME: Support aggregate input operands
270
260
if (!OpTy->isSingleValueType ()) {
271
- return ConstraintError (OpInfo,
272
- " aggregate input operands not supported yet" );
261
+ LLVM_DEBUG (
262
+ dbgs () << " Aggregate input operands are not supported yet\n " );
263
+ return false ;
273
264
}
274
265
275
266
OpInfo.ConstraintVT =
@@ -353,8 +344,9 @@ bool InlineAsmLowering::lowerInlineAsm(
353
344
354
345
// Find a register that we can use.
355
346
if (OpInfo.Regs .empty ()) {
356
- return ConstraintError (
357
- OpInfo, " could not allocate output register for constraint" );
347
+ LLVM_DEBUG (dbgs ()
348
+ << " Couldn't allocate output register for constraint\n " );
349
+ return false ;
358
350
}
359
351
360
352
// Add information to the INLINEASM instruction to know that this
@@ -397,13 +389,13 @@ bool InlineAsmLowering::lowerInlineAsm(
397
389
398
390
const InlineAsm::Flag MatchedOperandFlag (Inst->getOperand (InstFlagIdx).getImm ());
399
391
if (MatchedOperandFlag.isMemKind ()) {
400
- return ConstraintError (
401
- OpInfo,
402
- " matching input constraint to mem operand not supported; this "
403
- " should be target specific" );
392
+ LLVM_DEBUG (dbgs () << " Matching input constraint to mem operand not "
393
+ " supported. This should be target specific.\n " );
394
+ return false ;
404
395
}
405
396
if (!MatchedOperandFlag.isRegDefKind () && !MatchedOperandFlag.isRegDefEarlyClobberKind ()) {
406
- return ConstraintError (OpInfo, " unknown matching constraint" );
397
+ LLVM_DEBUG (dbgs () << " Unknown matching constraint\n " );
398
+ return false ;
407
399
}
408
400
409
401
// We want to tie input to register in next operand.
@@ -433,10 +425,9 @@ bool InlineAsmLowering::lowerInlineAsm(
433
425
434
426
if (OpInfo.ConstraintType == TargetLowering::C_Other &&
435
427
OpInfo.isIndirect ) {
436
- return ConstraintError (
437
- OpInfo,
438
- " indirect input operands with unknown constraint not supported "
439
- " yet" );
428
+ LLVM_DEBUG (dbgs () << " Indirect input operands with unknown constraint "
429
+ " not supported yet\n " );
430
+ return false ;
440
431
}
441
432
442
433
if (OpInfo.ConstraintType == TargetLowering::C_Immediate ||
@@ -446,7 +437,9 @@ bool InlineAsmLowering::lowerInlineAsm(
446
437
if (!lowerAsmOperandForConstraint (OpInfo.CallOperandVal ,
447
438
OpInfo.ConstraintCode , Ops,
448
439
MIRBuilder)) {
449
- return ConstraintError (OpInfo, " unsupported constraint" );
440
+ LLVM_DEBUG (dbgs () << " Don't support constraint: "
441
+ << OpInfo.ConstraintCode << " yet\n " );
442
+ return false ;
450
443
}
451
444
452
445
assert (Ops.size () > 0 &&
@@ -463,8 +456,9 @@ bool InlineAsmLowering::lowerInlineAsm(
463
456
if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
464
457
465
458
if (!OpInfo.isIndirect ) {
466
- return ConstraintError (
467
- OpInfo, " indirect memory input operands are not supported yet" );
459
+ LLVM_DEBUG (dbgs ()
460
+ << " Cannot indirectify memory input operands yet\n " );
461
+ return false ;
468
462
}
469
463
470
464
assert (OpInfo.isIndirect && " Operand must be indirect to be a mem!" );
@@ -488,15 +482,18 @@ bool InlineAsmLowering::lowerInlineAsm(
488
482
" Unknown constraint type!" );
489
483
490
484
if (OpInfo.isIndirect ) {
491
- return ConstraintError (
492
- OpInfo, " indirect register inputs are not supported yet" );
485
+ LLVM_DEBUG (dbgs () << " Can't handle indirect register inputs yet "
486
+ " for constraint '"
487
+ << OpInfo.ConstraintCode << " '\n " );
488
+ return false ;
493
489
}
494
490
495
491
// Copy the input into the appropriate registers.
496
492
if (OpInfo.Regs .empty ()) {
497
- return ConstraintError (
498
- OpInfo,
499
- " could not allocate input register for register constraint" );
493
+ LLVM_DEBUG (
494
+ dbgs ()
495
+ << " Couldn't allocate input register for register constraint\n " );
496
+ return false ;
500
497
}
501
498
502
499
unsigned NumRegs = OpInfo.Regs .size ();
@@ -506,10 +503,9 @@ bool InlineAsmLowering::lowerInlineAsm(
506
503
" source registers" );
507
504
508
505
if (NumRegs > 1 ) {
509
- return ConstraintError (
510
- OpInfo,
511
- " input operands with multiple input registers are not supported "
512
- " yet" );
506
+ LLVM_DEBUG (dbgs () << " Input operands with multiple input registers are "
507
+ " not supported yet\n " );
508
+ return false ;
513
509
}
514
510
515
511
InlineAsm::Flag Flag (InlineAsm::Kind::RegUse, NumRegs);
0 commit comments