[all-commits] [llvm/llvm-project] 01e756: [mlir] Add FileRange location type. (#80213)

Jacques Pienaar via All-commits all-commits at lists.llvm.org
Sat Nov 23 05:12:25 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 01e75646a5d4977a9e441e3db1042df0beccc4bb
      https://github.com/llvm/llvm-project/commit/01e75646a5d4977a9e441e3db1042df0beccc4bb
  Author: Jacques Pienaar <jpienaar at google.com>
  Date:   2024-11-23 (Sat, 23 Nov 2024)

  Changed paths:
    M mlir/include/mlir/IR/Builders.h
    M mlir/include/mlir/IR/BuiltinDialectBytecode.td
    M mlir/include/mlir/IR/BuiltinLocationAttributes.td
    M mlir/include/mlir/IR/Location.h
    M mlir/lib/AsmParser/LocationParser.cpp
    M mlir/lib/AsmParser/Parser.h
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/BuiltinDialectBytecode.cpp
    M mlir/lib/IR/Location.cpp
    M mlir/test/IR/locations.mlir

  Log Message:
  -----------
  [mlir] Add FileRange location type. (#80213)

This location type represents a contiguous range inside a file. It is
effectively a pair of FileLineCols. Add new type and make FileLineCol a
view for case where it matches existing previous one.

The location includes filename and optional start line & col, and end
line & col. Considered common cases are file:line, file:line:col,
file:line:start_col to file:line:end_col and general range within same
file. In memory its encoded as trailing objects. This keeps the memory
requirement the same as FileLineColLoc today (makes the rather common
File:Line cheaper) at the expense of extra work at decoding time. Kept the unsigned
type.

There was the option to always have file range be castable to
FileLineColLoc. This cast would just drop other fields. That may result
in some simpler staging. TBD.

This is a rather minimal change, it does not yet add bindings (C or
Python), lowering to LLVM debug locations etc. that supports end line:cols.

---------

Co-authored-by: River Riddle <riddleriver at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list