Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/backends/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { SyntaxNode } from '../ast';
import { Proc, Prog, CompilerIR, Variant } from '../compile/ir';
import { assign } from '../util';
import { LLVMEmitter } from './llvm'

/**
* A structure specifying a code-generation backend and its state.
Expand Down Expand Up @@ -59,7 +60,7 @@ export function emit_main(emitter: Emitter) {
* Get the current specialized version of a program, according to the
* emitter's current variant.
*/
export function specialized_prog(emitter: Emitter, progid: number) {
export function specialized_prog(emitter: Emitter|LLVMEmitter, progid: number) {
let variant = emitter.variant;
if (!variant) {
return emitter.ir.progs[progid];
Expand All @@ -70,7 +71,7 @@ export function specialized_prog(emitter: Emitter, progid: number) {
/**
* Get the current specialized version of a function.
*/
export function specialized_proc(emitter: Emitter, procid: number) {
export function specialized_proc(emitter: Emitter|LLVMEmitter, procid: number) {
let variant = emitter.variant;
if (!variant) {
return emitter.ir.procs[procid];
Expand Down
3 changes: 2 additions & 1 deletion src/backends/gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { CompilerIR, Prog, nearest_quote } from '../compile/ir';
import { varsym } from './emitutil';
import { Emitter, specialized_prog } from './emitter';
import { FUNC_ANNOTATION } from './js';
import { LLVMEmitter } from './llvm'

// General OpenGL-related backend components.

Expand Down Expand Up @@ -470,6 +471,6 @@ function get_glue(ir: CompilerIR, prog: Prog): Glue[] {
* Eventually, it would be nice to pre-compute or memoize this. At the moment,
* we may be re-computing this many times.
*/
export function emit_glue(emitter: Emitter, progid: number) {
export function emit_glue(emitter: Emitter|LLVMEmitter, progid: number) {
return get_glue(emitter.ir, specialized_prog(emitter, progid));
}
3 changes: 2 additions & 1 deletion src/backends/glsl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Emitter, emit, specialized_prog } from './emitter';
import { varsym, indent, emit_seq, emit_assign, emit_lookup, emit_if,
emit_while, emit_body, paren, splicesym } from './emitutil';
import { CompilerIR, nearest_quote, Variant } from '../compile/ir';
import { LLVMEmitter } from './llvm'

// Type checking for uniforms, which are automatically demoted from arrays to
// individual values when they persist.
Expand Down Expand Up @@ -241,7 +242,7 @@ let compile_rules: ASTVisit<Emitter, string> = {

// Emitting the surrounding machinery for communicating between stages.

export function compile_prog(parent_emitter: Emitter, progid: number): string
export function compile_prog(parent_emitter: Emitter|LLVMEmitter, progid: number): string
{
let ir = parent_emitter.ir;
let emitter: Emitter = {
Expand Down
Loading