示例#1
0
文件: LlvmVisitor.cs 项目: ionlang/ir
        public Construct VisitSection(Section node)
        {
            // Ensure function buffer is not null.
            if (this.function == null)
            {
                throw new Exception("Expected function buffer to be set");
            }

            // Create the block.
            LlvmBlock block = this.function.AppendBlock(node.Identifier);

            // Set builder.
            this.builder = block.Builder;

            // Process the section's instructions.
            foreach (Instruction inst in node.Instructions)
            {
                // Visit the instruction.
                this.Visit(inst);

                // Pop the resulting LLVM instruction off the stack.
                this.valueStack.Pop();
            }

            // Append the block onto the stack.
            this.blockStack.Push(block);

            // Return the node.
            return(node);
        }
示例#2
0
文件: LlvmVisitor.cs 项目: ionlang/ir
 public LlvmVisitor(LlvmModule module, LlvmBuilder builder)
 {
     this.module      = module;
     this.builder     = builder;
     this.symbolTable = new IrSymbolTable(this.module);
     this.valueStack  = new Stack <LlvmValue>();
     this.typeStack   = new Stack <LlvmType>();
     this.blockStack  = new Stack <LlvmBlock>();
     this.namedValues = new Dictionary <string, LlvmValue>();
 }
示例#3
0
文件: LlvmVisitor.cs 项目: ionlang/ir
 public LlvmVisitor(LlvmModule module) : this(module, LlvmBuilder.Create())
 {
     //
 }