2009-03-03 18:04:57 +08:00
|
|
|
//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===//
|
2008-09-23 04:49:34 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-12-08 00:43:17 +08:00
|
|
|
// Test plugin for LLVMC. Shows how to write plugins without using TableGen.
|
2008-09-23 04:49:34 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-09-23 04:50:40 +08:00
|
|
|
#include "llvm/CompilerDriver/CompilationGraph.h"
|
|
|
|
#include "llvm/CompilerDriver/Plugin.h"
|
2008-09-23 04:49:34 +08:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
struct MyPlugin : public llvmc::BasePlugin {
|
|
|
|
void PopulateLanguageMap(llvmc::LanguageMap&) const
|
|
|
|
{ std::cout << "Hello!\n"; }
|
|
|
|
|
|
|
|
void PopulateCompilationGraph(llvmc::CompilationGraph&) const
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2008-09-23 04:51:19 +08:00
|
|
|
static llvmc::RegisterPlugin<MyPlugin> RP("Hello", "Hello World plugin");
|
2008-09-23 04:49:34 +08:00
|
|
|
|
|
|
|
}
|