Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send-pop optimisation #2100

Open
wants to merge 20 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

allow accessing unified operands from attributes

Attributes of normal instructions can look at their operands.
This changeset enables the same thing for operand-unified
instructions.
  • Loading branch information...
shyouhei committed Aug 31, 2018
commit 42e09b96440f77e2aa093435918c1cffc8dab59d
@@ -15,12 +15,14 @@
class RubyVM::Attribute
include RubyVM::CEscape
attr_reader :insn, :key, :type, :expr
attr_accessor :preambles

def initialize opts = {}
@insn = opts[:insn]
@key = opts[:name]
@expr = RubyVM::CExpr.new location: opts[:location], expr: opts[:expr]
@type = opts[:type]
@preambles = []
end

def name
@@ -35,6 +35,9 @@ def initialize opts = {}
@konsts.each do |v|
@variables[v[:name]] ||= v
end
@attrs.each_value do |i|
inject_preambles i, parts[:attr_preamble]
end
end

def operand_shift_of var
@@ -91,6 +94,7 @@ def compose location, spec, template
name, template[:name], opes.size, argv.size)
else
src = []
src2 = []
mod = []
spec = []
vars = []
@@ -108,9 +112,14 @@ def compose location, spec, template
location: location,
expr: " const #{k[:decl]} = #{j};"
}
src2 << {
location: location,
expr: " MAYBE_UNUSED(#{k[:decl]}) = #{j};"
}
end
end
src.map! {|i| RubyVM::CExpr.new i }
src2.map! {|i| RubyVM::CExpr.new i }
return {
name: name,
signature: {
@@ -120,12 +129,17 @@ def compose location, spec, template
ret: template[:ret],
},
preamble: src,
attr_preamble: src2,
vars: vars,
spec: spec
}
end
end

def inject_preambles attr, spec
attr.preambles = spec
end

@instances = RubyVM::OptOperandDef.map do |h|
new h
end
@@ -24,6 +24,9 @@ PUREFUNC(MAYBE_UNUSED(static <%= a.declaration %>));
/* <%= a.pretty_name %> */
<%= a.definition %>
{
% a.preambles.each do |konst|
<%= render_c_expr konst -%>
% end
% str = render_c_expr a.expr
% case str when /\A#/ then
return
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.