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,19 +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
- // Use warnings in combination with a "return false" to trigger the fallback
237
- // path. If fallback isn't enabled, then another error will be emitted later
238
- // and the warnings will provide context as to why the error occured.
239
- LLVMContext &Ctx = MIRBuilder.getContext ();
240
- Ctx.diagnose (DiagnosticInfoInlineAsm (
241
- Call, " invalid constraint '" + Info.ConstraintCode + " ': " + Msg,
242
- DS_Warning));
243
- // TODO: If we could detect that the fallback isn't enabled, we could
244
- // recover here by defining all result registers as G_IMPLICIT_DEF.
245
- return false ;
246
- };
247
-
248
234
ExtraFlags ExtraInfo (Call);
249
235
unsigned ArgNo = 0 ; // ArgNo - The argument of the CallInst.
250
236
unsigned ResNo = 0 ; // ResNo - The result number of the next output.
@@ -257,8 +243,8 @@ bool InlineAsmLowering::lowerInlineAsm(
257
243
OpInfo.CallOperandVal = const_cast <Value *>(Call.getArgOperand (ArgNo));
258
244
259
245
if (isa<BasicBlock>(OpInfo.CallOperandVal )) {
260
- return ConstraintError (OpInfo,
261
- " basic block input operands not supported yet " ) ;
246
+ LLVM_DEBUG ( dbgs () << " Basic block input operands not supported yet \n " );
247
+ return false ;
262
248
}
263
249
264
250
Type *OpTy = OpInfo.CallOperandVal ->getType ();
@@ -272,8 +258,9 @@ bool InlineAsmLowering::lowerInlineAsm(
272
258
273
259
// FIXME: Support aggregate input operands
274
260
if (!OpTy->isSingleValueType ()) {
275
- return ConstraintError (OpInfo,
276
- " aggregate input operands not supported yet" );
261
+ LLVM_DEBUG (
262
+ dbgs () << " Aggregate input operands are not supported yet\n " );
263
+ return false ;
277
264
}
278
265
279
266
OpInfo.ConstraintVT =
@@ -357,8 +344,9 @@ bool InlineAsmLowering::lowerInlineAsm(
357
344
358
345
// Find a register that we can use.
359
346
if (OpInfo.Regs .empty ()) {
360
- return ConstraintError (
361
- OpInfo, " could not allocate output register for constraint" );
347
+ LLVM_DEBUG (dbgs ()
348
+ << " Couldn't allocate output register for constraint\n " );
349
+ return false ;
362
350
}
363
351
364
352
// Add information to the INLINEASM instruction to know that this
@@ -401,13 +389,13 @@ bool InlineAsmLowering::lowerInlineAsm(
401
389
402
390
const InlineAsm::Flag MatchedOperandFlag (Inst->getOperand (InstFlagIdx).getImm ());
403
391
if (MatchedOperandFlag.isMemKind ()) {
404
- return ConstraintError (
405
- OpInfo,
406
- " matching input constraint to mem operand not supported; this "
407
- " 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 ;
408
395
}
409
396
if (!MatchedOperandFlag.isRegDefKind () && !MatchedOperandFlag.isRegDefEarlyClobberKind ()) {
410
- return ConstraintError (OpInfo, " unknown matching constraint" );
397
+ LLVM_DEBUG (dbgs () << " Unknown matching constraint\n " );
398
+ return false ;
411
399
}
412
400
413
401
// We want to tie input to register in next operand.
@@ -437,10 +425,9 @@ bool InlineAsmLowering::lowerInlineAsm(
437
425
438
426
if (OpInfo.ConstraintType == TargetLowering::C_Other &&
439
427
OpInfo.isIndirect ) {
440
- return ConstraintError (
441
- OpInfo,
442
- " indirect input operands with unknown constraint not supported "
443
- " yet" );
428
+ LLVM_DEBUG (dbgs () << " Indirect input operands with unknown constraint "
429
+ " not supported yet\n " );
430
+ return false ;
444
431
}
445
432
446
433
if (OpInfo.ConstraintType == TargetLowering::C_Immediate ||
@@ -450,7 +437,9 @@ bool InlineAsmLowering::lowerInlineAsm(
450
437
if (!lowerAsmOperandForConstraint (OpInfo.CallOperandVal ,
451
438
OpInfo.ConstraintCode , Ops,
452
439
MIRBuilder)) {
453
- return ConstraintError (OpInfo, " unsupported constraint" );
440
+ LLVM_DEBUG (dbgs () << " Don't support constraint: "
441
+ << OpInfo.ConstraintCode << " yet\n " );
442
+ return false ;
454
443
}
455
444
456
445
assert (Ops.size () > 0 &&
@@ -467,8 +456,9 @@ bool InlineAsmLowering::lowerInlineAsm(
467
456
if (OpInfo.ConstraintType == TargetLowering::C_Memory) {
468
457
469
458
if (!OpInfo.isIndirect ) {
470
- return ConstraintError (
471
- OpInfo, " indirect memory input operands are not supported yet" );
459
+ LLVM_DEBUG (dbgs ()
460
+ << " Cannot indirectify memory input operands yet\n " );
461
+ return false ;
472
462
}
473
463
474
464
assert (OpInfo.isIndirect && " Operand must be indirect to be a mem!" );
@@ -492,15 +482,18 @@ bool InlineAsmLowering::lowerInlineAsm(
492
482
" Unknown constraint type!" );
493
483
494
484
if (OpInfo.isIndirect ) {
495
- return ConstraintError (
496
- 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 ;
497
489
}
498
490
499
491
// Copy the input into the appropriate registers.
500
492
if (OpInfo.Regs .empty ()) {
501
- return ConstraintError (
502
- OpInfo,
503
- " 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 ;
504
497
}
505
498
506
499
unsigned NumRegs = OpInfo.Regs .size ();
@@ -510,10 +503,9 @@ bool InlineAsmLowering::lowerInlineAsm(
510
503
" source registers" );
511
504
512
505
if (NumRegs > 1 ) {
513
- return ConstraintError (
514
- OpInfo,
515
- " input operands with multiple input registers are not supported "
516
- " yet" );
506
+ LLVM_DEBUG (dbgs () << " Input operands with multiple input registers are "
507
+ " not supported yet\n " );
508
+ return false ;
517
509
}
518
510
519
511
InlineAsm::Flag Flag (InlineAsm::Kind::RegUse, NumRegs);
0 commit comments