mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-14 05:21:03 +00:00
RISCV relaxations (#408)
This PR enables RISC-V relaxations and changes to internal linkage for internal function and global symbols. See also: https://github.com/llvm/llvm-project/issues/167381#issuecomment-3513830043 Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -6,6 +6,9 @@ This is a development pre-release.
|
|||||||
|
|
||||||
Supported `polkadot-sdk` rev: `2509.0.0`
|
Supported `polkadot-sdk` rev: `2509.0.0`
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Instruct the LLVM backend and linker to `--relax` (may lead to smaller contract code size).
|
||||||
|
|
||||||
## v0.5.0
|
## v0.5.0
|
||||||
|
|
||||||
This is a development pre-release.
|
This is a development pre-release.
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"Baseline": 914,
|
"Baseline": 905,
|
||||||
"Computation": 2295,
|
"Computation": 2286,
|
||||||
"DivisionArithmetics": 14496,
|
"DivisionArithmetics": 14347,
|
||||||
"ERC20": 17482,
|
"ERC20": 16929,
|
||||||
"Events": 1674,
|
"Events": 1665,
|
||||||
"FibonacciIterative": 1490,
|
"FibonacciIterative": 1447,
|
||||||
"Flipper": 2086,
|
"Flipper": 2077,
|
||||||
"SHA1": 8158
|
"SHA1": 7721
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ SECTIONS {
|
|||||||
"--error-limit=0",
|
"--error-limit=0",
|
||||||
"--relocatable",
|
"--relocatable",
|
||||||
"--emit-relocs",
|
"--emit-relocs",
|
||||||
"--no-relax",
|
"--relax",
|
||||||
"--unique",
|
"--unique",
|
||||||
"--gc-sections",
|
"--gc-sections",
|
||||||
self.linker_script_path.to_str().expect("should be utf8"),
|
self.linker_script_path.to_str().expect("should be utf8"),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ impl<'ctx> Global<'ctx> {
|
|||||||
.add_global(r#type, Some(address_space.into()), name);
|
.add_global(r#type, Some(address_space.into()), name);
|
||||||
let global = Self { r#type, value };
|
let global = Self { r#type, value };
|
||||||
|
|
||||||
global.value.set_linkage(inkwell::module::Linkage::External);
|
global.value.set_linkage(inkwell::module::Linkage::Internal);
|
||||||
global
|
global
|
||||||
.value
|
.value
|
||||||
.set_visibility(inkwell::GlobalVisibility::Default);
|
.set_visibility(inkwell::GlobalVisibility::Default);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ impl<'ctx> Context<'ctx> {
|
|||||||
module
|
module
|
||||||
.get_function(import)
|
.get_function(import)
|
||||||
.unwrap_or_else(|| panic!("{import} import should be declared"))
|
.unwrap_or_else(|| panic!("{import} import should be declared"))
|
||||||
.set_linkage(inkwell::module::Linkage::External);
|
.set_linkage(inkwell::module::Linkage::Internal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl TargetMachine {
|
|||||||
|
|
||||||
/// LLVM target features.
|
/// LLVM target features.
|
||||||
pub const VM_FEATURES: &'static str =
|
pub const VM_FEATURES: &'static str =
|
||||||
"+e,+m,+a,+c,+zbb,+auipc-addi-fusion,+ld-add-fusion,+lui-addi-fusion,+xtheadcondmov";
|
"+e,+m,+a,+c,+zbb,+auipc-addi-fusion,+ld-add-fusion,+lui-addi-fusion,+xtheadcondmov,+relax";
|
||||||
|
|
||||||
/// A shortcut constructor.
|
/// A shortcut constructor.
|
||||||
/// A separate instance for every optimization level is created.
|
/// A separate instance for every optimization level is created.
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ impl PolkaVMWriteLLVM for FunctionDefinition {
|
|||||||
self.identifier.as_str(),
|
self.identifier.as_str(),
|
||||||
function_type,
|
function_type,
|
||||||
self.result.len(),
|
self.result.len(),
|
||||||
Some(inkwell::module::Linkage::External),
|
Some(inkwell::module::Linkage::Internal),
|
||||||
Some((self.location.line, self.location.column)),
|
Some((self.location.line, self.location.column)),
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user