Ejemplo n.º 1
0
    /**
     * This method uses a SplitRecord as the criertion to partition the given EmitterSet into two
     * subsets.
     *
     * @param split the plit record dicatating how to split
     */
    private EmitterSet[] makeSplit(SplitRecord split) {
      int arg = split.argument;
      ArgumentType test = split.test;
      EmitterSet yes = new EmitterSet();
      EmitterSet no = new EmitterSet();
      Iterator<EmitterDescriptor> i = emitters.iterator();
      while (i.hasNext()) {
        EmitterDescriptor ed = (EmitterDescriptor) i.next();
        if (ed.argMatchesEncoding(arg, test)) {
          yes.add(ed);
        } else {
          no.add(ed);
        }
      }

      return new EmitterSet[] {yes, no};
    }
Ejemplo n.º 2
0
  /**
   * Computes the set of emit methods in the Assembler for a given IA32 opcode.
   *
   * @param emitters the set of all emit methods
   * @param opcode the opcode being examined
   */
  private static EmitterSet buildSetForOpcode(Method[] emitters, String opcode) {
    EmitterSet s = new EmitterSet();
    for (int i = 0; i < emitters.length; i++) {
      Method m = emitters[i];
      if (m.getName().startsWith("emit" + opcode + "_") || m.getName().equals("emit" + opcode)) {
        s.add(new EmitterDescriptor(m.getName(), m.getParameterTypes()));
      }
    }

    return s;
  }