mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 07:57:57 +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`
|
||||
|
||||
### Changed
|
||||
- Instruct the LLVM backend and linker to `--relax` (may lead to smaller contract code size).
|
||||
|
||||
## v0.5.0
|
||||
|
||||
This is a development pre-release.
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"Baseline": 914,
|
||||
"Computation": 2295,
|
||||
"DivisionArithmetics": 14496,
|
||||
"ERC20": 17482,
|
||||
"Events": 1674,
|
||||
"FibonacciIterative": 1490,
|
||||
"Flipper": 2086,
|
||||
"SHA1": 8158
|
||||
"Baseline": 905,
|
||||
"Computation": 2286,
|
||||
"DivisionArithmetics": 14347,
|
||||
"ERC20": 16929,
|
||||
"Events": 1665,
|
||||
"FibonacciIterative": 1447,
|
||||
"Flipper": 2077,
|
||||
"SHA1": 7721
|
||||
}
|
||||
@@ -78,7 +78,7 @@ SECTIONS {
|
||||
"--error-limit=0",
|
||||
"--relocatable",
|
||||
"--emit-relocs",
|
||||
"--no-relax",
|
||||
"--relax",
|
||||
"--unique",
|
||||
"--gc-sections",
|
||||
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);
|
||||
let global = Self { r#type, value };
|
||||
|
||||
global.value.set_linkage(inkwell::module::Linkage::External);
|
||||
global.value.set_linkage(inkwell::module::Linkage::Internal);
|
||||
global
|
||||
.value
|
||||
.set_visibility(inkwell::GlobalVisibility::Default);
|
||||
|
||||
@@ -134,7 +134,7 @@ impl<'ctx> Context<'ctx> {
|
||||
module
|
||||
.get_function(import)
|
||||
.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.
|
||||
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 separate instance for every optimization level is created.
|
||||
|
||||
@@ -215,7 +215,7 @@ impl PolkaVMWriteLLVM for FunctionDefinition {
|
||||
self.identifier.as_str(),
|
||||
function_type,
|
||||
self.result.len(),
|
||||
Some(inkwell::module::Linkage::External),
|
||||
Some(inkwell::module::Linkage::Internal),
|
||||
Some((self.location.line, self.location.column)),
|
||||
true,
|
||||
)?;
|
||||
|
||||
Reference in New Issue
Block a user