[llvm-dev] what can cause a "CPU table is not sorted" assertion

Rail Shafigulin via llvm-dev llvm-dev at lists.llvm.org
Thu Oct 15 15:49:36 PDT 2015

I'm trying to create a simplified 2 slot VLIW from an OR1K. The codebase
I'm working with is here <https://github.com/openrisc/llvm-or1k>. I've
created an initial MyTargetSchedule.td

def MyTargetModel : SchedMachineModel {
  // HW can decode 2 instructions per cycle.
  let IssueWidth = 2;
  let LoadLatency = 4;
  let MispredictPenalty = 16;

  // This flag is set to allow the scheduler to assign a default model to
  // unrecognized opcodes.
  let CompleteModel = 0;

def WriteALU : SchedWrite;
def WriteBranch : SchedWrite;

let SchedModel = MyTargetModel in {
// SLOT0 can handles everything
def Slot0 : ProcResource<1>;
// SLOT1 can't handles branches
def Slot1 : ProcResource<1>;

// Many micro-ops are capable of issuing on multiple ports.
def SlotAny  : ProcResGroup<[Slot0, Slot1]>;

def : WriteRes<WriteALU, [SlotAny]> {
  let Latency = 1;
  let ResourceCycles =[1];

def : WriteRes<WriteBranch, [Slot0]> {
  let Latency = 1;
  let ResourceCycles =[1];

I've also changed OR1K.td to have

def : ProcessorModel<"generic", MyTargetModel, [FeatureDiv, FeatureMul]>;
def : ProcessorModel<"or1200",  MyTargetModel, [FeatureDiv, FeatureMul]>;

No issues compiling the code. But when I run the following command I get
and assertion:

llc -mcpu=mytarget hello_world.compiled.ll -debug-only=misched

the offending line.

I'd really appreciate if someone could point out the problem.


Rail Shafigulin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151015/841b9589/attachment.html>

More information about the llvm-dev mailing list