llvm-mirror/test/TableGen/BigEncoder.td
Daniel Sanders 1c646a78c0 Fix compile-time regression caused by rL371928
Summary:
Also fixup rL371928 for cases that occur on our out-of-tree backend

There were still quite a few intermediate APInts and this caused the
compile time of MCCodeEmitter for our target to jump from 16s up to
~5m40s. This patch, brings it back down to ~17s by eliminating pretty
much all of them using two new APInt functions (extractBitsAsZExtValue(),
insertBits() but with a uint64_t). The exact conditions for eliminating
them is that the field extracted/inserted must be <=64-bit which is
almost always true.

Note: The two new APInt API's assume that APInt::WordSize is at least
64-bit because that means they touch at most 2 APInt words. They
statically assert that's true. It seems very unlikely that someone
is patching it to be smaller so this should be fine.

Reviewers: jmolloy

Reviewed By: jmolloy

Subscribers: hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67686

llvm-svn: 372243
2019-09-18 18:14:42 +00:00

58 lines
1.5 KiB
TableGen

// RUN: llvm-tblgen -gen-emitter -I %p/../../include %s | FileCheck %s
include "llvm/Target/Target.td"
def archInstrInfo : InstrInfo { }
def arch : Target {
let InstructionSet = archInstrInfo;
}
def Myi32 : Operand<i32> {
let DecoderMethod = "DecodeMyi32";
}
let OutOperandList = (outs), Size = 2 in {
def foo : Instruction {
let InOperandList = (ins i32imm:$factor);
field bits<65> Inst;
bits<32> factor;
let Inst{7-0} = 0xAA;
let Inst{14-8} = factor{6-0}; // no offset
let AsmString = "foo $factor";
field bits<16> SoftFail = 0;
}
def bar : Instruction {
let InOperandList = (ins i32imm:$factor);
field bits<65> Inst;
bits<32> factor;
let Inst{7-0} = 0xBB;
let Inst{15-8} = factor{10-3}; // offset by 3
let AsmString = "bar $factor";
field bits<16> SoftFail = 0;
}
def biz : Instruction {
let InOperandList = (ins i32imm:$factor);
field bits<65> Inst;
bits<32> factor;
let Inst{7-0} = 0xCC;
let Inst{11-8,15-12} = factor{10-3}; // offset by 3, multipart
let AsmString = "biz $factor";
field bits<16> SoftFail = 0;
}
}
// CHECK-LABEL: case ::biz: {
// CHECK: Value.insertBits(op.extractBitsAsZExtValue(4, 3), 12, 4);
// CHECK-NEXT: Value.insertBits(op.extractBitsAsZExtValue(4, 7), 8, 4);
// CHECK-LABEL: case ::foo: {
// CHECK: Value.insertBits(op.extractBitsAsZExtValue(7, 0), 8, 7);
// CHECK-LABEL: case ::bar: {
// CHECK: Value.insertBits(op.extractBitsAsZExtValue(8, 3), 8, 8);