From 04746270b3254776f5a716e87513964a06b2abbd Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 13 Apr 2018 09:11:14 -0700 Subject: [PATCH] Rename X86Abs4/X86Abs8 to Abs4/Abs8. These relocation codes are for simple absolute addresses and aren't architecture-specific. --- lib/cretonne/meta/isa/x86/recipes.py | 12 ++++++------ lib/cretonne/src/binemit/mod.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/cretonne/meta/isa/x86/recipes.py b/lib/cretonne/meta/isa/x86/recipes.py index af1cab5792..42ba7c3852 100644 --- a/lib/cretonne/meta/isa/x86/recipes.py +++ b/lib/cretonne/meta/isa/x86/recipes.py @@ -590,7 +590,7 @@ fnaddr4 = TailRecipe( 'fnaddr4', FuncAddr, size=4, ins=(), outs=GPR, emit=''' PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink); - sink.reloc_external(Reloc::X86Abs4, + sink.reloc_external(Reloc::Abs4, &func.dfg.ext_funcs[func_ref].name, 0); sink.put4(0); @@ -601,7 +601,7 @@ fnaddr8 = TailRecipe( 'fnaddr8', FuncAddr, size=8, ins=(), outs=GPR, emit=''' PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink); - sink.reloc_external(Reloc::X86Abs8, + sink.reloc_external(Reloc::Abs8, &func.dfg.ext_funcs[func_ref].name, 0); sink.put8(0); @@ -612,7 +612,7 @@ allones_fnaddr4 = TailRecipe( 'allones_fnaddr4', FuncAddr, size=4, ins=(), outs=GPR, emit=''' PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink); - sink.reloc_external(Reloc::X86Abs4, + sink.reloc_external(Reloc::Abs4, &func.dfg.ext_funcs[func_ref].name, 0); // Write the immediate as `!0` for the benefit of BaldrMonkey. @@ -624,7 +624,7 @@ allones_fnaddr8 = TailRecipe( 'allones_fnaddr8', FuncAddr, size=8, ins=(), outs=GPR, emit=''' PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink); - sink.reloc_external(Reloc::X86Abs8, + sink.reloc_external(Reloc::Abs8, &func.dfg.ext_funcs[func_ref].name, 0); // Write the immediate as `!0` for the benefit of BaldrMonkey. @@ -652,7 +652,7 @@ gvaddr4 = TailRecipe( 'gvaddr4', UnaryGlobalVar, size=4, ins=(), outs=GPR, emit=''' PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink); - sink.reloc_external(Reloc::X86Abs4, + sink.reloc_external(Reloc::Abs4, &func.global_vars[global_var].symbol_name(), 0); sink.put4(0); @@ -663,7 +663,7 @@ gvaddr8 = TailRecipe( 'gvaddr8', UnaryGlobalVar, size=8, ins=(), outs=GPR, emit=''' PUT_OP(bits | (out_reg0 & 7), rex1(out_reg0), sink); - sink.reloc_external(Reloc::X86Abs8, + sink.reloc_external(Reloc::Abs8, &func.global_vars[global_var].symbol_name(), 0); sink.put8(0); diff --git a/lib/cretonne/src/binemit/mod.rs b/lib/cretonne/src/binemit/mod.rs index 7caca7abab..9c78e4f784 100644 --- a/lib/cretonne/src/binemit/mod.rs +++ b/lib/cretonne/src/binemit/mod.rs @@ -25,12 +25,12 @@ pub type Addend = i64; /// Relocation kinds for every ISA #[derive(Debug)] pub enum Reloc { + /// absolute 4-byte + Abs4, + /// absolute 8-byte + Abs8, /// x86 PC-relative 4-byte X86PCRel4, - /// x86 absolute 4-byte - X86Abs4, - /// x86 absolute 8-byte - X86Abs8, /// x86 GOT PC-relative 4-byte X86GOTPCRel4, /// x86 PLT-relative 4-byte @@ -48,9 +48,9 @@ impl fmt::Display for Reloc { /// already unambigious, e.g. cton syntax with isa specified. In other contexts, use Debug. fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { + Reloc::Abs4 => write!(f, "{}", "Abs4"), + Reloc::Abs8 => write!(f, "{}", "Abs8"), Reloc::X86PCRel4 => write!(f, "{}", "PCRel4"), - Reloc::X86Abs4 => write!(f, "{}", "Abs4"), - Reloc::X86Abs8 => write!(f, "{}", "Abs8"), Reloc::X86GOTPCRel4 => write!(f, "{}", "GOTPCRel4"), Reloc::X86PLTRel4 => write!(f, "{}", "PLTRel4"), Reloc::Arm32Call | Reloc::Arm64Call | Reloc::RiscvCall => write!(f, "{}", "Call"),