Interface.xcc

Benoit Dupont de Dinechin (Benoit.Dupont-de-Dinechinst.com). Francois de Ferriere (Francois.de-Ferrierest.com). Christophe Guillon (Christophe.Guillon@st.com).

Copyright 2002 - 2007 STMicroelectronics. Copyright 1995 - 1998 Commissariat a l'Energie Atomique.

This program is free software; you can redistribute it and/or modify it under the terms of either (at your option): the GNU General Public License (GPL) version 2; the GNU Lesser General Public License (LGPL) version 2.1; any later version of these licences as published by the Free Software Foundation.

InterfaceType -- Enumerate the Interface types in reverse mapping.

typedef enum {
  InterfaceType_CGIR,
  InterfaceType_Label,
  InterfaceType_Symbol,
  InterfaceType_Temporary,
  InterfaceType_Operation,
  InterfaceType_BasicBlock,
  InterfaceType_LoopScope,
  InterfaceType_CGIRImport,
  InterfaceType_CGIRValid,
  InterfaceType__
} InterfaceType;
typedef uint8_t short_InterfaceType;
InterfaceMapped— Mapped value in the LIR2CGIR HTables.
struct InterfaceMapped_ {
  //@args       void *cgir, InterfaceType type
  InterfaceCGIR CGIR;           // The CGIR object mapped to.
  short_InterfaceType TYPE;     // The LIR key object type.
};
Interface— Interface between the LAO LIR and a host compiler CGIR.

The purpose of the interface is to maintain mappings between LIR Labels, Symbols, Temporaries, Operations, BasicBlocks, LoopScopes, and the corresponding host compiler CGIR (Code Generator Intermediate Representation) objects.

There must not be more than one CGIR object mapped to the same LIR object to ensure that all CGIR objects are correctly updated. This constraint apply to all CGIR->LIR object tables. However there may be more than one LIR object mapped to the same CGIR object. So factorization of the objects in the CGIR side is allowed. These duplicated LIR objects however should not be mutable as in this case information from the LIR side may not be passed back to the CGIR side. So the LIR->CGIR reversed tables may have several keys pointing to the same CGIR object. In this case only one update is performed on the CGIR object.

struct Interface_;
Interface_getInstance— Returns the singleton Interface, for use by the LAO clients.
Interface
Interface_getInstance(void);
Interface_setMaxIssue— Set the processor max issue (override MDS information).
void
Interface_setMaxIssue(Interface this, Processor processor, int maxIssue);
Interface_setMinTaken— Set the processor min taken (override MDS information).
void
Interface_setMinTaken(Interface this, Processor processor, int minTaken);
Interface_setReserved— Set a register as reserved (override MDS information).
void
Interface_setReserved(Interface this, Convention convention, Register reserved);
Interface_setArgStage— Set the argument read stage (override MDS information).
bool
Interface_setArgStage(Interface this, Processor processor,
                      Operator operator, int index, int stage);
Interface_setResStage— Set the result write stage (override MDS information).
bool
Interface_setResStage(Interface this, Processor processor,
                      Operator operator, int index, int stage);
Interface_makeLabel— Make a Label.
Label
Interface_makeLabel(Interface this, CGIR_LAB cgir_lab, const char *name);
Interface_findLabel— Find a Label.
Label
Interface_findLabel(Interface this, CGIR_LAB cgir_lab);
Interface_makeSymbol— Make a Symbol.
Symbol
Interface_makeSymbol(Interface this, CGIR_SYM cgir_sym, const char *name);
Interface_Symbol_setClasses— Set the (class,store,export) for a Symbol.
void
Interface_Symbol_setClasses(Interface this, Symbol symbol, SymbolClass sclass, SymbolStore sstore, SymbolExport sexport);
Interface_findSymbol— Find a Symbol.
Symbol
Interface_findSymbol(Interface this, CGIR_SYM cgir_sym);
Interface_makeDedicatedTemporary— Make a Dedicated Temporary.
Temporary
Interface_makeDedicatedTemporary(Interface this, CGIR_TN cgir_tn, Register cgir_register);
Interface_makeAssignedTemporary— Make a Assigned Temporary.
Temporary
Interface_makeAssignedTemporary(Interface this, CGIR_TN cgir_tn, Register cgir_register);
Interface_makeVirtualTemporary— Make a Virtual Temporary.
Temporary
Interface_makeVirtualTemporary(Interface this, CGIR_TN cgir_tn, RegFile regFile);
Interface_makeAbsoluteTemporary— Make an Absolute Temporary.
Temporary
Interface_makeAbsoluteTemporary(Interface this, CGIR_TN cgir_tn, Immediate immediate, int64_t value);
Interface_makeSymbolTemporary— Make a Symbol Temporary.
Temporary
Interface_makeSymbolTemporary(Interface this, CGIR_TN cgir_tn, Immediate immediate, Symbol symbol, int64_t offset);
Interface_makeLabelTemporary— Make a Label Temporary.
Temporary
Interface_makeLabelTemporary(Interface this, CGIR_TN cgir_tn, Immediate immediate, Label label);
Interface_Temporary_setWidth— Set a Temporary bit-width.
void
Interface_Temporary_setWidth(Interface this, Temporary temporary, unsigned width);
Interface_Temporary_setRemater— Set an Temporary as remat.
void
Interface_Temporary_setRemater(Interface this, Temporary temporary, Temporary value);
Interface_Temporary_setHomeable— Set an Temporary as homeable to location.
void
Interface_Temporary_setHomeable(Interface this, Temporary temporary, Temporary location);
Interface_Temporary_setDedicated— Set an Temporary as dedicated.
void
Interface_Temporary_setDedicated(Interface this, Temporary temporary);
Interface_findTemporary— Find a Temporary.
Temporary
Interface_findTemporary(Interface this, CGIR_TN cgir_tn);

O64 Interface for queries on LAO Temporaries.

uint32_t
Interface_Temporary_identity(Temporary temporary);
int
Interface_Temporary_isAbsolute(Temporary temporary);
int64_t
Interface_Temporary_value(Temporary temporary);
int
Interface_Temporary_isSymbol(Temporary temporary);
Symbol
Interface_Temporary_symbol(Temporary temporary);
int64_t
Interface_Temporary_offset(Temporary temporary);
Immediate
Interface_Temporary_invariant(Temporary temporary);
int
Interface_Temporary_isVirtual(Temporary temporary);
int
Interface_Temporary_isDedicated(Temporary temporary);
int
Interface_Temporary_isAssigned(Temporary temporary);
Register
Interface_Temporary_register(Temporary temporary);
RegFile
Interface_Temporary_regFile(Temporary temporary);

O64Interface for queries on LAO Symbols.

uint32_t
Interface_Symbol_identity(Symbol symbol);
const char *
Interface_Symbol_name(Symbol symbol);
int
Interface_Symbol_isSpill(Symbol symbol);
NativeType
Interface_Symbol_nativeType(Symbol symbol);

O64 Interface for queries on LAO Operations.

uint32_t
Interface_Operation_identity(Operation operation);
Operator
Interface_Operation_operator(Operation operation);
int
Interface_Operation_iteration(Operation operation);
int
Interface_Operation_startDate(Operation operation);
int
Interface_Operation_isSpillCode(Operation operation);
int
Interface_Operation_isVolatile(Operation operation);
int
Interface_Operation_isHoisted(Operation operation);

O64 Interface for queries on LAO Labels.

uint32_t
Interface_Label_identity(Label label);
const char *
Interface_Label_name(Label label);

O64 Interface for queries on LAO BasicBlocks.

uint32_t
Interface_BasicBlock_identity(BasicBlock basicBlock);
int
Interface_BasicBlock_unrolled(BasicBlock basicBlock);
intptr_t
Interface_BasicBlock_traceId(BasicBlock basicBlock);

O64 Interface for queries on LAO LoopScopes.

uint32_t
Interface_LoopScope_identity(LoopScope loopScope);
int
Interface_LoopScope_unrolled(LoopScope loopScope);
Interface_makeOperation— Make an Operation.
Operation
Interface_makeOperation(Interface this, CGIR_OP cgir_op,
    Operator operator, int iteration, int argCount, Temporary arguments[],
    int resCount, Temporary results[], int regCount, int registers[]);
Interface_findOperation— Find a Operation.
Operation
Interface_findOperation(Interface this, CGIR_OP cgir_op);
Interface_Operation_setSafeAccess— Set an Operation as safe memory access.
void
Interface_Operation_setSafeAccess(Interface this, Operation operation);
Interface_Operation_setSafePerfs— Set an Operation as safe performance effects.
void
Interface_Operation_setSafePerfs(Interface this, Operation operation);
Interface_Operation_setHoisted— Set an Operation as volatile.
void
Interface_Operation_setHoisted(Interface this, Operation operation);
Interface_Operation_setVolatile— Set an Operation as volatile.
void
Interface_Operation_setVolatile(Interface this, Operation operation);
Interface_Operation_setPrefetch— Set an Operation as memory prefetch.
void
Interface_Operation_setPrefetch(Interface this, Operation operation);
Interface_Operation_setPreload— Set an Operation as memory preload.
void
Interface_Operation_setPreload(Interface this, Operation operation);
Interface_Operation_setBarrier— Set an Operation as a memory barrier.
void
Interface_Operation_setBarrier(Interface this, Operation operation);
Interface_Operation_setSpillCode— Set an Operation as spill code.
void
Interface_Operation_setSpillCode(Interface this, Operation operation, Symbol symbol);
Interface_makeBasicBlock— Make a BasicBlock.
BasicBlock
Interface_makeBasicBlock(Interface this, CGIR_BB cgir_bb, Processor processor,
                         int unrolled, int labelCount, Label labels[], int operationCount,
                         Operation operations[], intptr_t regionId, float frequency);
Interface_findBasicBlock— Find a BasicBlock.
BasicBlock
Interface_findBasicBlock(Interface this, CGIR_BB cgir_bb);
Interface_linkBasicBlocks— Link two BasicBlocks.
void
Interface_linkBasicBlocks(Interface this, BasicBlock tail_block,
                          BasicBlock head_block, float probability);
Interface_makeLoopScope— Make a LoopScope.
LoopScope
Interface_makeLoopScope(Interface this, CGIR_LD cgir_ld, BasicBlock basicBlock,
                        Temporary temporary, ConfigureItem item, ...);
Interface_findLoopScope— Find a LoopScope.
LoopScope
Interface_findLoopScope(Interface this, CGIR_LD cgir_ld);
Interface_LoopScope_setDependenceNode— Set Operation with a memory dependence node.
void
Interface_LoopScope_setDependenceNode(Interface this, LoopScope loopScope, Operation operation, DependenceNode node);
Interface_LoopScope_setDependenceArc— Set a memory dependence arc between two operations.
void
Interface_LoopScope_setDependenceArc(Interface this, LoopScope loopScope,
    Operation tail_operation, Operation head_operation, int latency, int omega, DependenceKind kind);
Interface_setBody— Set a BasicBlock as a body block.
//
void
Interface_setBody(Interface this, BasicBlock basicBlock);
Interface_setEntry— Set a BasicBlock as an entry block.
//
void
Interface_setEntry(Interface this, BasicBlock basicBlock);
Interface_setExit— Set a BasicBlock as an exit block.
//
void
Interface_setExit(Interface this, BasicBlock basicBlock);
Interface_setStart— Set a BasicBlock as trace start block.
//
void
Interface_setStart(Interface this, BasicBlock basicBlock);
Interface_updateCGIR— Update the CGIR from the LAO Interface.
void
Interface_updateCGIR(Interface this, CGIR_CallBack callback);
Interface_Initialize— Initialize the interface, must be called once per process.
void
Interface_Initialize(void);
Interface_open— Open this Interface.
void
Interface_open(Interface this, const char *name, ConfigureItem item, ...);
Interface_optimize— Apply the LAO optimizations through this Interface.
unsigned
Interface_optimize(Interface this, OptimizeItem item, ...);
Interface_close— Close this Interface.
void
Interface_close(Interface this);
Interface_Finalize— Finalize the interface, must be called once per process.
void
Interface_Finalize(void);