2009-03-03 10:04:57 +00:00
|
|
|
//===- Hello.cpp - Example code from "Writing an LLVMC Plugin" ------------===//
|
2008-09-22 20:49:34 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2008-12-07 16:43:17 +00:00
|
|
|
// Test plugin for LLVMC. Shows how to write plugins without using TableGen.
|
2008-09-22 20:49:34 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2008-09-22 20:50:40 +00:00
|
|
|
#include "llvm/CompilerDriver/CompilationGraph.h"
|
|
|
|
#include "llvm/CompilerDriver/Plugin.h"
|
2008-09-22 20:49:34 +00: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-22 20:51:19 +00:00
|
|
|
static llvmc::RegisterPlugin<MyPlugin> RP("Hello", "Hello World plugin");
|
2008-09-22 20:49:34 +00:00
|
|
|
|
|
|
|
}
|