Commit Graph

32 Commits

Author SHA1 Message Date
Alessandro Di Federico a5b380b201 Model: rework how we name things
This commit improves the formalization of how we handle names.

The main changes are:

* Now `_` is a reserved prefix and all the generated names start with
  `_`.
* The model verification routine now checks that `CustomName`s in the
  global scope do not collide with any local namespace (e.g., fields of
  a `StructType`).
* We changed the prefix `prefix_` to `unreserved_` to better convey the
  fact that the prefix has been introduce to use an non-reserved name.
2023-08-23 16:14:04 +02:00
Ivan Krysak 7d235f4fd0 Enforce licence header consistency
Also do some basic cleanup: capitalize first letters, add `.`
at the end of the sentences, and so on.
2023-07-03 15:23:10 +00:00
Ivan Krysak 9f1d9fd5d0 Use Container::contains() where appropriate 2023-07-02 15:06:11 +00:00
Ivan Krysak bc98e0079f Formatting: change PenaltyReturnTypeOnItsOwnLine
The new value is 21.
2023-07-02 13:20:49 +02:00
Alessandro Di Federico ae871f5062 Adopt setOnlyReadsMemory 2023-04-08 08:42:24 +02:00
Alessandro Di Federico e131817334 Drop usage of Type::getPointerElementType 2023-04-08 08:42:24 +02:00
Alessandro Di Federico d2caa1fad0 Make CreateLoad usages opaque pointers-compatible 2023-04-08 08:42:24 +02:00
Alessandro Di Federico 927f5b38be PromoteCSVs/EnforceABI: handle declarations
PromoteCSVs and EnforceABI were not handling declarated functions
properly, leading to issues downstream.
2023-03-13 22:53:44 +01:00
Alessandro Di Federico bd61df1ddd PromoteCSVs::getUsedCSVs: fix non-helpers 2023-03-13 22:53:44 +01:00
Alessandro Di Federico 9efe5e1366 PromoteCSVs: rename metadata to revng.abi_register 2023-02-23 14:51:10 +01:00
Alessandro Di Federico d3f6d43ffe PromoteCSV: tag init_ functions with register
This enables downstream passes to selectively purge calls to `init_`
functions.
2023-02-23 08:30:22 +01:00
Massimo Fioravanti d55aa9b9e6 Pipeline: remove * from targets
Now * is just a pipeline frontend shorthand.
2022-10-20 14:20:12 +02:00
Alessandro Di Federico 9dd0b139c0 PromoteCSVs: helpers no longer return structs
PromteCSVs creates wrappers around helpers. These helpers used to return
a struct in case the helper was changing a CSV.

In order to simplify the downstream pipeline, we now use out arguments
instead of returning a struct.
2022-09-29 10:53:47 +02:00
Massimo Fioravanti 633f49c1ef Introduce dedicated namespace for kinds and ranks 2022-08-29 14:44:53 +02:00
Pietro Fezzardi a4dc1e52fd EnforceABI: add FunctionTags::ABIEnforced tag 2022-04-12 14:15:01 +02:00
Pietro Fezzardi 69d65956bf PromoteCSV: add FunctionTag::CSVsPromoted tag 2022-04-12 14:14:19 +02:00
Alessandro Di Federico 1a2a729e92 Rework FunctionTags::Tag 2022-03-31 12:51:24 +02:00
Alessandro Di Federico 00ce580362 Introduce EnforceABI and PromoteCSV pipes 2022-03-17 14:10:50 +01:00
Alessandro Di Federico fa3206b26d Rename Lifted tag to Isolated 2022-03-17 14:10:50 +01:00
Alessandro Di Federico ee0b8f44c1 Introduce BinaryImporter
This is a big step to split revng-lift in two parts: one that only
writes the model and one that actually lifts to LLVM IR.

* Introduce `revng import binary`
* Split off `BinaryFile.h`
* Drop `revng.h`
* `GeneratedCodeBasicInfo`: use model
* Reduce role of `GeneratedCodeBasicInfo` in favor of
  `model::Architecture` and `model::Register` methods
* `CodeGenerator`: adopt `RawBinaryView` and model
* `JumpTargetManager`: adopt `RawBinaryView` and model
* `ExternalJumpsHandler`: adopt model
* `InstructionTranslator`: discard `Architecture` in favor of
  `EndianessMismatch`
* Many other changes
2022-03-08 15:15:24 +01:00
Alvise de Faveri 7593d4da23 PromoteCSVs: promote PC CSVs 2022-02-12 12:04:14 +01:00
Alessandro Di Federico 7c050ee377 mv include/revng/{TypeShrinking,MFP}/SetLattices.h 2021-12-17 18:51:06 +01:00
Alessandro Di Federico 3e1e69e08f Introduce eraseFromParent 2021-12-17 18:50:08 +01:00
Alessandro Di Federico 4b6a557a19 Fix key issues in -promote-csv
The following bugs have been fixed:

* PromoteCSV no longer mixes `alloca` with other instructions, which is
  a convention in LLVM IR that some passes rely upon.
* Before this commit, we were detecting if *calls to CSV initializers*
  where already present in order to reuse them, but this was not right,
  we need to reuse the *alloca* instructions they are associated
  with. This commit does exaclty that.
2021-12-17 18:49:51 +01:00
Antonio Frighetto cbd81e57d9 Improve MFP 2021-12-15 18:03:30 +01:00
Antonio Frighetto b5f87748eb PromoteCSVs: no wrapper for Marker and Exceptional 2021-12-15 18:03:30 +01:00
Alvise de Faveri 267410ac43 Add Attribute::WillReturn to ReadOnly funcs
Without this attribute, newer versions of llvm are not able to
remove calls to `ReadOnly` functions whose return value is unused.

This is instead the expected behavior for the functions that are
generated by `revng` with the `ReadOnly` attribute.
2021-11-19 10:17:02 +01:00
Alessandro Di Federico 3a3eea0cf5 Introduce support for dynamic functions 2021-10-21 15:01:19 +02:00
Alessandro Di Federico 06043b92c6 PromoteCSV: do not promote the stack pointer 2021-10-18 20:44:58 +02:00
Pietro Fezzardi f0a6184ac0 Propagate DebugLoc on CallInst and InvokeInst
With llvm-12 thera are more stringent requirement on the propagation of
DebugLoc on CallInst and InvokeInst.
Various CallInst and InvokeInst created during lifting did not fulfill
these requirements, causing the Module to not verify() with llvm-12.

This commit fixes the problem, properly propagating the debug locations.
2021-06-14 23:04:02 +02:00
Pietro Fezzardi b6327b0526 PromoteCSVs: fix CSV list initialization 2021-04-30 14:52:25 +02:00
Alessandro Di Federico 53f6328507 Introduce PromoteCSVs
This commit takes out of EnforceABI the part taking care of creating
wrappers for calls to helpers and promoting CSV to local variables.
This decoupling, enables to run -promote-csvs multiple times, for
instance after inlining.
2021-04-22 18:07:24 +02:00