llvm.org GIT mirror llvm / ccbe603
Ban rematerializable instructions with side effects. TableGen infers unmodeled side effects on instructions without a pattern. Fix some instruction definitions where that was overlooked. Also raise an error if a rematerializable instruction has unmodeled side effects. That doen't make any sense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141929 91177308-0d34-0410-b5e6-96231b3b80d8 Jakob Stoklund Olesen 8 years ago
5 changed file(s) with 22 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
311311 // ADD , sp, #
312312 // This is rematerializable, which is particularly useful for taking the
313313 // address of locals.
314 let isReMaterializable = 1 in
314 let isReMaterializable = 1, neverHasSideEffects = 1 in
315315 def tADDrSPi : T1pI<(outs tGPR:$dst), (ins GPRsp:$sp, t_imm0_1020s4:$imm),
316316 IIC_iALUi, "add", "\t$dst, $sp, $imm", []>,
317317 T1Encoding<{1,0,1,0,1,?}> {
441441 //===----------------------------------------------------------------------===//
442442
443443 let canFoldAsLoad = 1, isReMaterializable = 1 in {
444 def LBU : LoadM<0x30, 0x000, "lbu ">;
445 def LBUR : LoadM<0x30, 0x200, "lbur ">;
446
447 def LHU : LoadM<0x31, 0x000, "lhu ">;
448 def LHUR : LoadM<0x31, 0x200, "lhur ">;
449
450 def LW : LoadM<0x32, 0x000, "lw ">;
451 def LWR : LoadM<0x32, 0x200, "lwr ">;
452
453 let Defs = [CARRY] in {
454 def LWX : LoadM<0x32, 0x400, "lwx ">;
444 let neverHasSideEffects = 1 in {
445 def LBU : LoadM<0x30, 0x000, "lbu ">;
446 def LBUR : LoadM<0x30, 0x200, "lbur ">;
447
448 def LHU : LoadM<0x31, 0x000, "lhu ">;
449 def LHUR : LoadM<0x31, 0x200, "lhur ">;
450
451 def LW : LoadM<0x32, 0x000, "lw ">;
452 def LWR : LoadM<0x32, 0x200, "lwr ">;
453
454 let Defs = [CARRY] in {
455 def LWX : LoadM<0x32, 0x400, "lwx ">;
456 }
455457 }
456458
457459 def LBUI : LoadMI<0x38, "lbui ", zextloadi8>;
477477 "lmg\t{$from, $to, $dst}",
478478 []>;
479479
480 let isReMaterializable = 1, isAsCheapAsAMove = 1,
480 let isReMaterializable = 1, neverHasSideEffects = 1, isAsCheapAsAMove = 1,
481481 Constraints = "$src = $dst" in {
482482 def MOV64Pr0_even : Pseudo<(outs GR64P:$dst), (ins GR64P:$src),
483483 "lhi\t${dst:subreg_even}, 0",
966966 def MOV8mr_NOREX : I<0x88, MRMDestMem,
967967 (outs), (ins i8mem_NOREX:$dst, GR8_NOREX:$src),
968968 "mov{b}\t{$src, $dst|$dst, $src} # NOREX", []>;
969 let mayLoad = 1,
969 let mayLoad = 1, neverHasSideEffects = 1,
970970 canFoldAsLoad = 1, isReMaterializable = 1 in
971971 def MOV8rm_NOREX : I<0x8A, MRMSrcMem,
972972 (outs GR8_NOREX:$dst), (ins i8mem_NOREX:$src),
28282828 InstInfo.isBitcast = IsBitcast;
28292829 InstInfo.hasSideEffects = HasSideEffects;
28302830 InstInfo.Operands.isVariadic = IsVariadic;
2831
2832 // Sanity checks.
2833 if (InstInfo.isReMaterializable && InstInfo.hasSideEffects)
2834 throw TGError(InstInfo.TheDef->getLoc(), "The instruction " +
2835 InstInfo.TheDef->getName() +
2836 " is rematerializable AND has unmodeled side effects?");
28312837 }
28322838 }
28332839