Skip to content

insertIndirectBranch not implemented but SizeRelaxationPass uses it (LLVM-55) #8

Closed
@bjoernQ

Description

@bjoernQ

I'm using a Rust port (https://github.com/MabezDev/rust-xtensa) that uses this LLVM backend. It works on my OSX system but not on my Windows system - but it used to work on Windows using some quite early commits of this LLVM backend. For me actually it crashes during compilation on Windows.

I investigated a bit and was able to track it down to insertIndirectBranch isn't implemented

Then I realized that insertIndirectBranch is called via BranchRelaxation which is enabled by https://github.com/espressif/llvm-xtensa/blob/757e18f722dbdcd98b8479e25041b1eee1128ce9/lib/Target/Xtensa/XtensaTargetMachine.cpp#L137

Probably it used to work for me before since previously XtensaTargetMachine configured the passes like this

  addPass(createXtensaBranchSelectionPass());
  addPass(createXtensaSizeReductionPass());

So it wasn't using BranchRelaxation before.

I don't understand why it's working on OSX and apparently Linux and it's only me who runs into this problem (and only on Windows) - however given the code it shouldn't be platform dependent.

I guess implementing insertIndirectBranch would be a good solution.

Locally I just commented out addPass(&BranchRelaxationPassID); from XtensaPassConfig::addPreEmitPass() and I'm now able to compile and run code.
Unfortunately implementing a proper solution (i.e. insertIndirectBranch) myself is way over my head.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions